diff --git a/README.md b/README.md index ef4b10e..4666c8a 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,15 @@ yextend was written for the sake of augmenting yara. yara by itself is great but Notes: -- (01/19/2016) yextend version 1.4 - output enhancement - output now includes the offset and string definition identifier for every hit reported by Yara. +- (03/18/2016) yextend version 1.4 - output enhancements and runtime helper prog + + - output now includes the offset and string definition identifier for every hit reported by Yara. + - output now includes the name of the Yara ruleset file at hand + - initial release of run_yextend prog - (10/24/2015) yextend version 1.3 will only work with yara 3.4. - if your rules have data in the 'meta' section they will now show up in the output, take a look at 'RULEWITHMETA' below and you will see an example of such output + - if your rules have data in the 'meta' section they will now show up in the output, take a look at 'RULEWITHMETA' below and you will see an example of such output - (05/28/2015) yextend version 1.2 will only work with yara 3.3 and above @@ -63,7 +67,22 @@ Instructions: 5 - Run: - - prefix the run statement by telling LD_LIBRARY_PATH where the yara shared object lib (or its symlink) is. If you changed nothing during the yara install then that value is '/usr/local/lib' + - 2 options to run: + + A. use executable run_yextend - it wraps the native yextend executable. To run: + + - the program 'run_yextend' takes in 2 arguments: + + 1. A yara ruleset file or directory of ruleset files + 2. A file name or a directory of target files + + usage: + + - ./run_yextend rule_entity target_file_entity + + ***** make sure the executable bit is set on the file system for run_yextend ***** + + B. run yextend executable - prefix the run statement by telling LD_LIBRARY_PATH where the yara shared object lib (or its symlink) is. If you changed nothing during the yara install then that value is '/usr/local/lib' - the program 'yextend' takes in 2 arguments: @@ -89,7 +108,8 @@ Instructions: 6 - Analyze output. The output will be structured as such (number of result stanzas will obviously vary based on the content at hand): ===============================ALPHA=================================== - Filename: x + Ruleset File Name: w + File Name: x File Size: y File Signature (MD5): z @@ -144,7 +164,8 @@ Instructions: A. example output from one of the test files: ===============================ALPHA=================================== - Filename: test_files/rands_tarball.tar.gz + Ruleset File Name: test_rules/ruleset_blah + File Name: test_files/rands_tarball.tar.gz File Size: 271386 File Signature (MD5): 74edc10648f6d65e90cd859120eaa31b @@ -182,7 +203,8 @@ Instructions: ===============================ALPHA=================================== - Filename: test_files/step1-zips.tar.gz + Ruleset File Name: test_rules/ruleset_blah + File Name: test_files/step1-zips.tar.gz File Size: 2400255 File Signature (MD5): 98178b84fd9280fa1ed469c6512cd0ee diff --git a/filedata.cpp b/filedata.cpp index 530808c..fd08d39 100644 --- a/filedata.cpp +++ b/filedata.cpp @@ -32,6 +32,7 @@ class __InitFileData_t { public: __InitFileData_t(); + ~__InitFileData_t(); }; __InitFileData_t __InitFileData; @@ -60,6 +61,10 @@ __InitFileData_t::__InitFileData_t() * we could not detect the file type yet still want to inspect content. * So it is used for an unclassified binary file type * + * Index 65534 is special in that I had to push the zip file pattern + * down in the stack such that zip derivatives are detected before + * a pure vanilla zip file is identified + * * The value in FileDataPatternOffset will be used in FileDissect and will * tell that process where (the offset) to start looking for a match * on the data pattern @@ -85,7 +90,7 @@ __InitFileData_t::__InitFileData_t() FileDataPatternMap[1] = "Adobe PDF"; FileDataPatternOffset[1] = 0; - FileDataPatterns["255044462d312e3"] = 2; + FileDataPatterns["255044462d312e"] = 2; FileDataPatternMap[2] = "Adobe PDF"; FileDataPatternOffset[2] = 0; @@ -97,638 +102,638 @@ __InitFileData_t::__InitFileData_t() FileDataPatternMap[4] = "Microsoft Office document (DOC PPT XLS)"; FileDataPatternOffset[4] = 0; - FileDataPatterns["d0cf11e0a1b11ae1000000000000000000000000000000003"] = 5; + FileDataPatterns["d0cf11e0a1b11ae100000000000000000000000000000000"] = 5; FileDataPatternMap[5] = "Microsoft Office document (DOC PPT XLS)"; FileDataPatternOffset[5] = 0; - FileDataPatterns["52457e5e"] = 6; - FileDataPatternMap[6] = "RAR Archive"; - FileDataPatternOffset[6] = 0; + FileDataPatterns["52457e5e"] = 6; + FileDataPatternMap[6] = "RAR Archive"; + FileDataPatternOffset[6] = 0; - FileDataPatterns["526172211a0700cf"] = 7; - FileDataPatternMap[7] = "RAR Archive"; - FileDataPatternOffset[7] = 0; + FileDataPatterns["526172211a0700cf"] = 7; + FileDataPatternMap[7] = "RAR Archive"; + FileDataPatternOffset[7] = 0; - FileDataPatterns["526172211a0700ffffffcf"] = 8; - FileDataPatternMap[8] = "RAR Archive"; - FileDataPatternOffset[8] = 0; + FileDataPatterns["526172211a0700ffffffcf"] = 8; + FileDataPatternMap[8] = "RAR Archive"; + FileDataPatternOffset[8] = 0; - FileDataPatterns["526172211a07005a"] = 9; - FileDataPatternMap[9] = "RAR Archive (Part 1 of Multiple Files)"; - FileDataPatternOffset[9] = 0; + FileDataPatterns["526172211a07005a"] = 9; + FileDataPatternMap[9] = "RAR Archive (Part 1 of Multiple Files)"; + FileDataPatternOffset[9] = 0; - FileDataPatterns["526172211a070019"] = 10; - FileDataPatternMap[10] = "RAR Archive (Subsequent Part of Multiple Files)"; - FileDataPatternOffset[10] = 0; + FileDataPatterns["526172211a070019"] = 10; + FileDataPatternMap[10] = "RAR Archive (Subsequent Part of Multiple Files)"; + FileDataPatternOffset[10] = 0; - FileDataPatterns["526172211a0700ce"] = 11; - FileDataPatternMap[11] = "Encrypted RAR Archive"; - FileDataPatternOffset[11] = 0; + FileDataPatterns["526172211a0700ce"] = 11; + FileDataPatternMap[11] = "Encrypted RAR Archive"; + FileDataPatternOffset[11] = 0; - FileDataPatterns["526172211a0700ffffffce"] = 12; - FileDataPatternMap[12] = "Encrypted RAR Archive"; - FileDataPatternOffset[12] = 0; + FileDataPatterns["526172211a0700ffffffce"] = 12; + FileDataPatternMap[12] = "Encrypted RAR Archive"; + FileDataPatternOffset[12] = 0; - FileDataPatterns["526172211a07005b"] = 13; - FileDataPatternMap[13] = "Encrypted RAR Archive (Part 1 of Multiple Files)"; - FileDataPatternOffset[13] = 0; + FileDataPatterns["526172211a07005b"] = 13; + FileDataPatternMap[13] = "Encrypted RAR Archive (Part 1 of Multiple Files)"; + FileDataPatternOffset[13] = 0; - FileDataPatterns["526172211a070018"] = 14; - FileDataPatternMap[14] = "Encrypted RAR Archive (Subsequent Part of Multiple Files)"; - FileDataPatternOffset[14] = 0; + FileDataPatterns["526172211a070018"] = 14; + FileDataPatternMap[14] = "Encrypted RAR Archive (Subsequent Part of Multiple Files)"; + FileDataPatternOffset[14] = 0; - /* + /* FileDataPatterns["504b0304"] = 15; FileDataPatternMap[15] = "Zip or Jar Archive"; FileDataPatternOffset[15] = 0; - */ - - FileDataPatterns["5f27a889"] = 16; - FileDataPatternMap[16] = "Jar Archive"; - FileDataPatternOffset[16] = 0; - - FileDataPatterns["1fffffff8b08"] = 17; - FileDataPatternMap[17] = "GZIP Archive"; - FileDataPatternOffset[17] = 0; - - FileDataPatterns["1f8b08"] = 18; - FileDataPatternMap[18] = "GZIP Archive"; - FileDataPatternOffset[18] = 0; - - FileDataPatterns["1f9d90"] = 19; - FileDataPatternMap[19] = "Compressed Tape Archive (TAR.Z)"; - FileDataPatternOffset[19] = 0; - - FileDataPatterns["1fa0"] = 20; - FileDataPatternMap[20] = "Compressed Tape Archive (TAR.Z)"; - FileDataPatternOffset[20] = 0; - - FileDataPatterns["377abcaf271c"] = 21; - FileDataPatternMap[21] = "7-Zip compressed file"; - FileDataPatternOffset[21] = 0; - - //