示例#1
0
    /**
     * Open a DFXML file and import its hash elements.
     */
    hashdb_exporter_t (const std::string& _dfxml_outfilename) 
                    : dfxml_outfilename(_dfxml_outfilename),
                      x(_dfxml_outfilename, false) {

      // start with dfxml tag
      x.push("dfxml");

      // add creator information
      x.add_DFXML_creator(PACKAGE_NAME, PACKAGE_VERSION, "svn not tracked", command_line);
    }
示例#2
0
    void report_status(dfxml_writer& x) const {
//      x.push("hashdb_status");
      x.xmlout("hashdb_path", hashdb_dir);
      x.xmlout("file_mode", file_mode_type_to_string(file_mode_type));
      hash_store->report_status(x);
      hash_duplicates_store->report_status(x);
      bloom1->report_status(x, 1);
      bloom2->report_status(x, 2);
//      x.pop();
    }
示例#3
0
 void report_remove_changes(dfxml_writer& x) const {
   x.push("hashdb_changes");
   x.xmlout("hashes_removed", hashes_removed);
   x.xmlout("hashes_not_removed_invalid_file_offset", hashes_not_removed_invalid_file_offset);
   x.xmlout("hashes_not_removed_wrong_hash_block_size", hashes_not_removed_wrong_hash_block_size);
   x.xmlout("hashes_not_removed_wrong_hashdigest_type", hashes_not_removed_wrong_hashdigest_type);
   x.xmlout("hashes_not_removed_no_hash", hashes_not_removed_no_hash);
   x.xmlout("hashes_not_removed_different_source", hashes_not_removed_different_source);
   x.pop();
 }
示例#4
0
 // generate reports to dfxml
 void report_insert_changes(dfxml_writer& x) const {
   x.push("hashdb_changes");
   x.xmlout("hashes_inserted", hashes_inserted);
   x.xmlout("hashes_not_inserted_invalid_file_offset", hashes_not_inserted_invalid_file_offset);
   x.xmlout("hashes_not_inserted_wrong_hash_block_size", hashes_not_inserted_wrong_hash_block_size);
   x.xmlout("hashes_not_inserted_wrong_hashdigest_type", hashes_not_inserted_wrong_hashdigest_type);
   x.xmlout("hashes_not_inserted_exceeds_max_duplicates", hashes_not_inserted_exceeds_max_duplicates);
   x.xmlout("hashes_not_inserted_duplicate_source", hashes_not_inserted_duplicate_source);
   x.pop();
 }
示例#5
0
    void do_export(const hashdb_db_manager_t& hashdb_in) {
      const size_t hash_block_size = hashdb_in.hashdb_settings.hash_block_size;

      hashdb_db_manager_t::hashdb_iterator_t it = hashdb_in.begin();
      hashdb_db_manager_t::hashdb_iterator_t end = hashdb_in.end();
      while (it != end) {

        // get the hashdb element associated with the iterator
        hashdb_element_t hashdb_element = *it;

        // get md5 from first
        md5_t md5 = hashdb_element.first;

        // get offset, repository_name, and filename from second
        uint64_t file_offset = hashdb_element.second.file_offset;
        std::string repository_name = hashdb_element.second.repository_name;
        std::string filename = hashdb_element.second.filename;

        // start the fileobject tag
        x.push("fileobject");

        // write the repository name tag
        x.xmlout("repository_name", repository_name);

        // write the filename tag
        x.xmlout("filename", std::string(filename));

        // start the byte_run tag with its file_offset attribute
        std::stringstream ss;
        ss << "file_offset='" << file_offset << "' len='" << hash_block_size << "'";
        x.push("byte_run", ss.str());

        // write the hashdigest
        std::string hashdigest = md5.hexdigest();
        x.xmlout("hashdigest", hashdigest, "type='MD5'", false);

        // close the byte_run tag
        x.pop();

        // close the fileobject tag
        x.pop();

        // move to next iterator
        ++it;
      }
    }
示例#6
0
 ~hashdb_exporter_t() {
   // close dfxml_writer
   x.add_rusage();
   x.pop();
   x.close();
 }
示例#7
0
static void dfxml_create(dfxml_writer &xreport,const std::string &command_line,const BulkExtractor_Phase1::Config &cfg)
{
    xreport.push("dfxml","xmloutputversion='1.0'");
    xreport.push("metadata",
		 "\n  xmlns='http://afflib.org/bulk_extractor/' "
		 "\n  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
		 "\n  xmlns:dc='http://purl.org/dc/elements/1.1/'" );
    xreport.xmlout("dc:type","Feature Extraction","",false);
    xreport.pop();
    xreport.add_DFXML_creator(PACKAGE_NAME,PACKAGE_VERSION,svn_revision_clean(),command_line);
    xreport.push("configuration");
    xreport.xmlout("threads",cfg.num_threads);
    xreport.xmlout("pagesize",cfg.opt_pagesize);
    xreport.xmlout("marginsize",cfg.opt_marginsize);
    xreport.push("scanners");

    /* Generate a list of the scanners in use */
    std::vector<std::string> ev;
    be13::plugin::get_enabled_scanners(ev);
    for(std::vector<std::string>::const_iterator it=ev.begin();it!=ev.end();it++){
        xreport.xmlout("scanner",(*it));
    }
    xreport.pop();			// scanners
    xreport.pop();			// configuration
}