tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

scan_md5.cpp
Go to the documentation of this file.
1 /**
2  *
3  * scan_md5:
4  * plug-in demonstration that shows how to write a simple plug-in scanner that calculates
5  * the MD5 of each file..
6  */
7 
8 #include "config.h"
9 #include "bulk_extractor_i.h"
10 #include "dfxml/src/hash_t.h"
11 
12 #include <iostream>
13 #include <sys/types.h>
14 
15 
16 extern "C"
17 void scan_md5(const class scanner_params &sp,const recursion_control_block &rcb)
18 {
19 
21  std::cerr << "scan_md5 requires sp version " << scanner_params::CURRENT_SP_VERSION << "; "
22  << "got version " << sp.sp_version << "\n";
23  exit(1);
24  }
25 
27  sp.info->name = "md5";
29  return; /* No feature files created */
30  }
31 
32 #ifdef HAVE_EVP_GET_DIGESTBYNAME
34  static const std::string hash0("<hashdigest type='MD5'>");
35  static const std::string hash1("</hashdigest>");
36  if(sp.sxml){
37  (*sp.sxml) << hash0 << md5_generator::hash_buf(sp.sbuf.buf,sp.sbuf.bufsize).hexdigest() << hash1;
38  }
39  return;
40  }
41 #endif
42 }
static hash__< md, SIZE > hash_buf(const uint8_t *buf, size_t bufsize)
Definition: hash_t.h:264
size_t bufsize
Definition: sbuf.h:248
const uint8_t * buf
Definition: sbuf.h:246
std::string name
static const int CURRENT_SP_VERSION
std::stringstream * sxml
scanner_info * info
static const int SCANNER_DISABLED
const int sp_version
const phase_t phase
const sbuf_t & sbuf
void scan_md5(const class scanner_params &sp, const recursion_control_block &rcb)
Definition: scan_md5.cpp:17