mirror of
https://github.com/e-m-b-a/emba.git
synced 2026-10-11 22:09:54 +00:00
Merge pull request #2151 from m-1-k-3/testdata/version-identifier-extraction
Version identifier binary testdata
This commit is contained in:
@@ -14,3 +14,5 @@ config/ai_config.env
|
||||
config/dependencytrack.env
|
||||
*config/cve-database.db
|
||||
tests/bats-core/
|
||||
tests/bin_version_testdata/corpus_generator.log
|
||||
tests/bin_version_testdata/logfile.txt
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+?.*\\ Built-in\\ shell",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+?.*\\ multi-call\\ binary",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+?\\ ",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+?\\ \\([0-9]+-.*\\)"
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+.*\\ Built-in\\ shell",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+.*\\ multi-call\\ binary",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+\\ ",
|
||||
"BusyBox\\ v[0-9](\\.[0-9]+)+\\ \\([0-9]+-.*\\)"
|
||||
],
|
||||
"vendor_names": [
|
||||
"busybox"
|
||||
@@ -29,8 +29,8 @@
|
||||
"NA"
|
||||
],
|
||||
"live_grep_commands": [
|
||||
"^BusyBox\\ http\\ [0-9](\\.[0-9]+)+?",
|
||||
"^BusyBox\\ telnetd\\ [0-9](\\.[0-9]+)+?"
|
||||
"^BusyBox\\ http\\ [0-9](\\.[0-9]+)+",
|
||||
"^BusyBox\\ telnetd\\ [0-9](\\.[0-9]+)+"
|
||||
],
|
||||
"strict_grep_commands": [],
|
||||
"zgrep_grep_commands": [],
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^ccrypt$\"AND\"^\\%s\\ \\%s\\.\\ Secure\\ encryption\\ and\\ decryption\\ of\\ files\\ and\\ streams\\.$\"AND\"[0-9](\\.[0-9]+)+?\"",
|
||||
"ccrypt\\ [0-9](\\.[0-9]+)+?\\.\\ Secure\\ encryption\\ and\\ decryption\\ of\\ files\\ and\\ streams\\."
|
||||
"'\"^ccrypt$\"AND\"^\\%s\\ \\%s\\.\\ Secure\\ encryption\\ and\\ decryption\\ of\\ files\\ and\\ streams\\.$\"AND\"[0-9](\\.[0-9]+)+\"",
|
||||
"ccrypt\\ [0-9](\\.[0-9]+)+\\.\\ Secure\\ encryption\\ and\\ decryption\\ of\\ files\\ and\\ streams\\."
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"curl"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^curl\\ [0-9](\\.[0-9]+)+?"
|
||||
"^curl\\ [0-9](\\.[0-9]+)+"
|
||||
],
|
||||
"vendor_names": [
|
||||
"curl",
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"grep_commands": [
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+?-[0-9]\\ ",
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+?-rc[0-9]\\ ",
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+?\\ "
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+-[0-9]\\ ",
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+-rc[0-9]\\ ",
|
||||
"ebtables\\ v[0-9](\\.[0-9]+)+\\ "
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"[0-9](\\.[0-9]+)+?\\ -\\ $Id:\\ ez-ipupdate.c,v\\ [0-9]\\.[0-9]+",
|
||||
"[0-9](\\.[0-9]+)+?\\ -\\ \\$Id:\\ ez-ipupdate.c,v\\ [0-9]\\.[0-9]+",
|
||||
"ez-ipupdate:\\ -\\ [0-9](\\.[0-9]+)+?"
|
||||
],
|
||||
"vendor_names": [
|
||||
@@ -17,7 +17,7 @@
|
||||
"ez-ipupdate"
|
||||
],
|
||||
"version_extraction": [
|
||||
"sed -r 's/([0-9](\\.[0-9]+)+?)\\ -\\ $Id:\\ ez-ipupdate.c,v\\ [0-9]\\.[0-9]+/::ez-ipupdate:\\1/'",
|
||||
"sed -r 's/([0-9](\\.[0-9]+)+?)\\ -\\ \\$Id:\\ ez-ipupdate.c,v\\ [0-9]\\.[0-9]+/::ez-ipupdate:\\1/'",
|
||||
"sed -r 's/ez-ipupdate:\\ -\\ ([0-9](\\.[0-9]+)+?)/::ez-ipupdate:\\1/'"
|
||||
],
|
||||
"affected_paths": [
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
],
|
||||
"grep_commands": [
|
||||
"flash_erase\\ version\\ [0-9]+(\\.[0-9]+)+?",
|
||||
"flash_eraseall\\ \\$Revision:\\ [0-9]+(\\.[0-9]+)+?\\ \\$"
|
||||
"^flash_eraseall\\ \\$Revision:\\ [0-9]+(\\.[0-9]+)+\\ \\$$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"flash_eraseall\\ \\$Revision:\\ [0-9](\\.[0-9]+)+?\\ \\$"
|
||||
"^flash_eraseall\\ \\$Revision:\\ [0-9](\\.[0-9]+)+\\ \\$$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"gSOAP\\/[0-9](.[0-9]+)+?"
|
||||
"gSOAP\\/[0-9](\\.[0-9]+)+"
|
||||
],
|
||||
"vendor_names": [
|
||||
"genivia"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^hostapd\\ v[0-9](\\.[0-9]+)+?(-devel)?$",
|
||||
"hostapd\\ v[0-9](\\.[0-9]+)+?$",
|
||||
"hostapd\\ v[0-9](\\.[0-9]+)+?\\.x$"
|
||||
"^hostapd\\ v[0-9](\\.[0-9]+)+(-devel)?$",
|
||||
"hostapd\\ v[0-9](\\.[0-9]+)+$",
|
||||
"hostapd\\ v[0-9](\\.[0-9]+)+\\.x$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"w1.fi"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"hostapd_cli\\ v[0-9](\\.[0-9]+)+?\\.x$"
|
||||
"hostapd_cli\\ v[0-9](\\.[0-9]+)+\\.x$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"w1.fi"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^igmpproxy\\ [0-9]+(\\.[0-9]+)+?$",
|
||||
"igmpproxy,\\ Version\\ [0-9](\\.[0-9]+)+?",
|
||||
"igmpproxy\\ versoin\\ [0-9](\\.[0-9])+?(\\ beta)?"
|
||||
"^igmpproxy\\ [0-9]+(\\.[0-9]+)+$",
|
||||
"igmpproxy,\\ Version\\ [0-9](\\.[0-9]+)+",
|
||||
"igmpproxy\\ versoin\\ [0-9](\\.[0-9])+(\\ beta)?"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^can't initialize iptables table .\\%s': \\%s$\"AND\"^[1-9](\\.[0-9]+)?+$\"'",
|
||||
"iptables\\ v[1-9](\\.[0-9]+)+?([a-z])?",
|
||||
"iptables\\ v[1-9](\\.[0-9]+)+?([a-z])?$"
|
||||
"'\"^can't\\ initialize\\ iptables\\ table\\ .\\%s':\\ \\%s$\"AND\"^[1-9](\\.[0-9]+)+$\"'",
|
||||
"iptables\\ v[1-9](\\.[0-9]+)+([a-z])?",
|
||||
"iptables\\ v[1-9](\\.[0-9]+)+([a-z])?$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"netfilter"
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"curl"
|
||||
],
|
||||
"grep_commands": [
|
||||
"CLIENT\\ libcurl\\ [0-9](\\.[0-9]+)+?",
|
||||
"^libcurl\\/[0-9](\\.[0-9]+)+?$"
|
||||
"CLIENT\\ libcurl\\ [0-9](\\.[0-9]+)+",
|
||||
"^libcurl\\/[0-9](\\.[0-9]+)+$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^libdev$\"AND\"libev:\\ loop\\ to\\ be\\ embedded\\ is\\ not\\ embeddable\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^libdev$\"AND\"libev:\\ loop\\ to\\ be\\ embedded\\ is\\ not\\ embeddable\"AND\"^[0-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"LGPL-2.1-or-later"
|
||||
],
|
||||
"grep_commands": [
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+?$",
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+?(-[a-z]+)?$",
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+?\\ ",
|
||||
"^This\\ is\\ Libgcrypt\\ [0-9]\\.([0-9]+)+?\\ -\\ The\\ GNU\\ Crypto\\ Library$"
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+$",
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+(-[a-z]+)?$",
|
||||
"[Ll]ibgcrypt\\ [0-9](\\.[0-9]+)+\\ ",
|
||||
"^This\\ is\\ Libgcrypt\\ [0-9]\\.([0-9]+)+\\ -\\ The\\ GNU\\ Crypto\\ Library$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"gnupg"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"LGPL-3.0-only OR GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^GNU MP assertion failed: %s$\"AND\"^[2-9](\\.[0-9])?+$\"'"
|
||||
"'\"^GNU MP assertion failed: %s$\"AND\"^[2-9](\\.[0-9])+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"gmplib"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^IDN2_UNKNOWN$\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^IDN2_UNKNOWN$\"AND\"^[0-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"gnu"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPL-3.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^libiec61850\"AND\"^[1-2]+\\.[0-7]+(\\.[0-9]+)?$\"'"
|
||||
"'\"^libiec61850\"AND\"^[1-2]+\\.[0-7]+(\\.[0-9]{1,2}){0,2}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"mz-automation"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^INTERNAL ERROR: _json_c_visit\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^INTERNAL ERROR: _json_c_visit\"AND\"^[0-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"json-c"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^LZ4_freeStreamHC$\"AND\"^liblz4.so.1$\"AND\"^[0-9](\\.[0-9]+)+?$\"'"
|
||||
"'\"^LZ4_freeStreamHC$\"AND\"^liblz4.so.1$\"AND\"^[0-9](\\.[0-9]{1,2}){1,3}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"public-domain"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^g\\[TNIEB\\?=:864310\\.\\-\\,\\+\\*\\)\\('&\\%\\\\$\\#\\\"\\\"\\!\"AND\"^lzma_index_stream_padding$\"AND\"^[0-9](\\.[0-9]+)?+$\"'",
|
||||
"liblzma\\ [0-9](\\.[0-9]+)+?$"
|
||||
"'\"^g\\[TNIEB\\?=:864310\\.\\-\\,\\+\\*\\)\\('&\\%\\\\$\\#\\\"\\\"\\!\"AND\"^lzma_index_stream_padding$\"AND\"^[0-9](\\.[0-9]+)+$\"'",
|
||||
"liblzma\\ [0-9](\\.[0-9]+)+$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^stream->state == NGHTTP2_STREAM_IDLE$\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^stream->state == NGHTTP2_STREAM_IDLE$\"AND\"^[0-2](\\.[0-9]{1,2}){2}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"nghttp2"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"nss_DumpCertificateCacheInfo\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"nss_DumpCertificateCacheInfo\"AND\"^[0-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^libpcap\\ version\\ [0-9](\\.[0-9]+)+?$",
|
||||
"^libpcap\\ version\\ [0-9](\\.[0-9]+)+$",
|
||||
"^libpcap\\ version\\ [0-9](\\.[0-9]+)+\\ \\(with.*\\)?$"
|
||||
],
|
||||
"vendor_names": [
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"Libpng"
|
||||
],
|
||||
"grep_commands": [
|
||||
"libpng\\ version\\ [0-9](\\.[0-9]+)+?\\ "
|
||||
"libpng\\ version\\ [0-9](\\.[0-9]+)+\\ "
|
||||
],
|
||||
"vendor_names": [
|
||||
"greg_roelofs",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"LIBTASN1 ERROR:\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"LIBTASN1 ERROR:\"AND\"^[0-9](\\.[0-9]{1,2}){1,2}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"free_software_foundation_inc.",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"LGPL-3.0-only OR GPL-2.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^lua_cjson\\.c$\"AND\"^Memory\\ allocation\\ error\\ in\\ CJSON\\ protected\\ call$\"AND\"^[0-9]\\.[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^lua_cjson\\.c$\"AND\"^Memory\\ allocation\\ error\\ in\\ CJSON\\ protected\\ call$\"AND\"^[0-9]\\.[0-9](\\.[0-9]){0,1}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"lua"
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"MiniDLNA is already running. EXITING.\"AND\"^[0-9](\\.[0-9]+)?+$\"'",
|
||||
"^Starting\\ MiniDLNA\\ version\\ [0-9](\\.[0-9]+)+?"
|
||||
"'\"MiniDLNA\\ is\\ already\\ running\\.\\ EXITING\\.\"AND\"^[0-9](\\.[0-9]+)+$\"'",
|
||||
"^Starting\\ MiniDLNA\\ version\\ [0-9](\\.[0-9]+)+"
|
||||
],
|
||||
"live_grep_commands": [
|
||||
"^MiniDLNA\\ [0-9](\\.[0-9]+)+?\\ "
|
||||
"^MiniDLNA\\ [0-9](\\.[0-9]+)+\\ "
|
||||
],
|
||||
"vendor_names": [
|
||||
"minidlna_project"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPLv2"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"nftables\"AND\"nft_run_cmd_from_filename\"AND\"^[0-9](\\.[0-9]+)+?$\"'"
|
||||
"'\"nftables\"AND\"nft_run_cmd_from_filename\"AND\"^[0-9](\\.[0-9]{1,2}){1,3}$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"netfilter"
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
"OpenSSL OR Apache-2.0"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+?(-[a-z]+)$",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+?(-[a-z]+)\\ ",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+?([a-z]+)?-",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+?([a-z]+)?\\ ",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+?\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+?(-[a-z]+)$",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+?(-[a-z]+)\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+?([a-z]+)?-",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+?([a-z]+)?\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+?\\ "
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+(-[a-z]+)$",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+(-[a-z]+)\\ ",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+([a-z]+)?-",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+([a-z]+)?\\ ",
|
||||
"^OpenSSL\\ [0-9](\\.[0-9]+)+\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+(-[a-z]+)$",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+(-[a-z]+)\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+([a-z]+)?-",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+([a-z]+)?\\ ",
|
||||
"part of OpenSSL\\ [0-9](\\.[0-9]+)+\\ "
|
||||
],
|
||||
"vendor_names": [
|
||||
"openssl"
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"pppd\\ %s\\ started\\ by\\ %s,\\ uid\\ %d\"AND\"^[1-3](\\.[0-9]+)+?([a-c][0-9])?$\"'",
|
||||
"pppd\\ version\\ [1-3](\\.[0-9]+)+?([a-c][0-9])?$",
|
||||
"pppd\\ version\\ [1-3](\\.[0-9]+)+?([a-c][0-9])?\\ ",
|
||||
"pppd\\.so\\.[1-3](\\.[0-9]+)+?([a-c][0-9])?$"
|
||||
"'\"pppd\\ %s\\ started\\ by\\ %s,\\ uid\\ %d\"AND\"^[1-3](\\.[0-9]+)+([a-c][0-9])?$\"'",
|
||||
"pppd\\ version\\ [1-3](\\.[0-9]+)+([a-c][0-9])?$",
|
||||
"pppd\\ version\\ [1-3](\\.[0-9]+)+([a-c][0-9])?\\ ",
|
||||
"pppd\\.so\\.[1-3](\\.[0-9]+)+([a-c][0-9])?$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"point-to-point_protocol_project"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^pyexpat$\"AND\"^Python\\ wrapper\\ for\\ Expat\\ parser\\.$\"AND\"^sqlite3_bind_parameter_index$\"AND\"^[0-9](\\.[0-9]+)?+$\"'"
|
||||
"'\"^pyexpat$\"AND\"^Python\\ wrapper\\ for\\ Expat\\ parser\\.$\"AND\"^sqlite3_bind_parameter_index$\"AND\"^[0-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"User-Agent: Siemens Canada Limited - ROX2 - [0-9](\\.[0-9]+)?+$"
|
||||
"User-Agent: Siemens Canada Limited - ROX2 - [0-9](\\.[0-9]+)+$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"siemens"
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"GPL-3.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"GNU\\ sed\\ version\\ [0-9](\\.[0-9]+)+?$",
|
||||
"\\(GNU\\ sed\\)\\ [0-9](\\.[0-9]+)+?$"
|
||||
"GNU\\ sed\\ version\\ [0-9](\\.[0-9]+)+$",
|
||||
"\\(GNU\\ sed\\)\\ [0-9](\\.[0-9]+)+$"
|
||||
],
|
||||
"vendor_names": [
|
||||
"gnu"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"This\\ is\\ SMTPclient\\ Version\\ [0-9](\\.[0-9]+)+?\\ "
|
||||
"This\\ is\\ SMTPclient\\ Version\\ [0-9](\\.[0-9]+)+\\ "
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"public-domain"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^sqlite3_version$\"AND\"^sqlite3_bind_parameter_index$\"AND\"^3(\\.[0-9]+)?+$\"'",
|
||||
"SQLite\\ version\\ 3(\\.[0-9]+)+?"
|
||||
"'\"^sqlite3_version$\"AND\"^sqlite3_bind_parameter_index$\"AND\"^3(\\.[0-9]+)+$\"'",
|
||||
"SQLite\\ version\\ 3(\\.[0-9]+)+"
|
||||
],
|
||||
"vendor_names": [
|
||||
"sqlite"
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
"tcpdump"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^dump\"AND\"^\\[\\ -T\\ type\\ \\]\\ \\[\\ --version\\ \\]\\ \\[\\ -V\\ file\\ \\]$\"AND\"^[2-9](\\.[0-9]+)+?$\"'",
|
||||
"^tcpdump\\ version\\ [2-9](\\.[0-9]+)+?$",
|
||||
"tcpdump\\.[2-9](\\.[0-9]+)+?\\ version",
|
||||
"'\"^dump_packet_and_trunc$\"AND\"^%s\\ version\\ [2-9](\\.[0-9]+)+?$\"'"
|
||||
"'\"^dump\"AND\"^\\[\\ -T\\ type\\ \\]\\ \\[\\ --version\\ \\]\\ \\[\\ -V\\ file\\ \\]$\"AND\"^[2-9](\\.[0-9]+)+$\"'",
|
||||
"^tcpdump\\ version\\ [2-9](\\.[0-9]+)+$",
|
||||
"tcpdump\\.[2-9](\\.[0-9]+)+\\ version",
|
||||
"'\"^dump_packet_and_trunc$\"AND\"^%s\\ version\\ [2-9](\\.[0-9]+)+$\"'"
|
||||
],
|
||||
"live_grep_commands": [],
|
||||
"zgrep_grep_commands": [],
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^udev-[0-9]\\.[0-9](\\.[0-9]+)+?$",
|
||||
"^udev-[0-9]\\.[0-9](\\.[0-9]+)+$",
|
||||
"^udevinfo,\\ version\\ [0-9]+$"
|
||||
],
|
||||
"vendor_names": [
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"unknown"
|
||||
],
|
||||
"grep_commands": [
|
||||
"info,\\ udhcp\\ client\\ \\(v[0-9](\\.[0-9]+)+?\\)\\ started",
|
||||
"udhcp\\ [0-9](\\.[0-9]+)+?$",
|
||||
"udhcpc\\ \\(v[0-9](\\.[0-9]+)+?(-pre)?\\)\\ started$",
|
||||
"udhcpcd,\\ version\\ [0-9](\\.[0-9]+)+?"
|
||||
"info,\\ udhcp\\ client\\ \\(v[0-9](\\.[0-9]+)+\\)\\ started",
|
||||
"udhcp\\ [0-9](\\.[0-9]+)+$",
|
||||
"udhcpc\\ \\(v[0-9](\\.[0-9]+)+(-pre)?\\)\\ started$",
|
||||
"udhcpcd,\\ version\\ [0-9](\\.[0-9]+)+"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"GPL-3.0-only"
|
||||
],
|
||||
"grep_commands": [
|
||||
"'\"^xargs$\"AND\"^environment\\ is\\ too\\ large\\ for\\ exec$\"AND\"[0-9](\\.[0-9]+)+?\"'"
|
||||
"'\"^xargs$\"AND\"^environment\\ is\\ too\\ large\\ for\\ exec$\"AND\"[0-9](\\.[0-9]+)+\"'"
|
||||
],
|
||||
"vendor_names": [
|
||||
"NA"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
"Zlib"
|
||||
],
|
||||
"grep_commands": [
|
||||
"^\\ unzip\\ [0-9]\\.([0-9]+)\\ Copyright 1998-20[0-9][0-9] Gilles Vollant.*$",
|
||||
"deflate\\ [0-9](\\.[0-9]+)+?\\ Copyright.*Mark\\ Adler",
|
||||
"inflate\\ [0-9](\\.[0-9]+)+?\\ Copyright.*Mark Adler"
|
||||
"^\\ unzip\\ [0-9](\\.[0-9]+)+\\ Copyright 1998-20[0-9][0-9] Gilles Vollant.*$",
|
||||
"deflate\\ [0-9](\\.[0-9]+)+\\ Copyright.*Mark\\ Adler",
|
||||
"inflate\\ [0-9](\\.[0-9]+)+\\ Copyright.*Mark Adler"
|
||||
],
|
||||
"vendor_names": [
|
||||
"zlib"
|
||||
|
||||
@@ -120,6 +120,7 @@ set_defaults() {
|
||||
export EXT_DIR="${INVOCATION_PATH}/external"
|
||||
export HELP_DIR="${INVOCATION_PATH}/helpers"
|
||||
export MOD_DIR="${INVOCATION_PATH}/modules"
|
||||
export TESTS_DIR="${INVOCATION_PATH}/tests"
|
||||
export MOD_DIR_LOCAL="${INVOCATION_PATH}/EMBA-Non-free/modules_local"
|
||||
export PID_LOGGING=0
|
||||
# this will be in TMP_DIR/pid_notes.log
|
||||
@@ -160,6 +161,10 @@ set_defaults() {
|
||||
# usually no memory limit is needed, but some modules/tools are wild and we need to protect our system
|
||||
export TOTAL_MEMORY=0
|
||||
TOTAL_MEMORY="$(grep MemTotal /proc/meminfo | awk '{print $2}' || true)"
|
||||
|
||||
# BINARY_CORPUS_GENERATION enables the building of small binary artifacts of all detected
|
||||
# components for later analysis or for testcase generation emba_logs/s09_firmware_base_version_check/binary_corpus_tmp/
|
||||
export BINARY_CORPUS_GENERATION=1
|
||||
export Q_MOD_PID=""
|
||||
export UEFI_VERIFIED=0
|
||||
export MAIN_CONTAINER=""
|
||||
|
||||
@@ -21,6 +21,7 @@ IP00_extractors() {
|
||||
if [[ "${LIST_DEP}" -eq 1 ]] || [[ "${IN_DOCKER}" -eq 1 ]] || [[ "${DOCKER_SETUP}" -eq 0 ]] || [[ "${FULL}" -eq 1 ]]; then
|
||||
|
||||
print_tool_info "python3-pip" 1
|
||||
print_tool_info "python3-dev" 1
|
||||
print_tool_info "patool" 1
|
||||
print_pip_info "bsdiff4"
|
||||
print_git_info "payload_dumper" "EMBA-support-repos/payload_dumper" "Android OTA payload.bin extractor"
|
||||
|
||||
@@ -224,13 +224,15 @@ S09_identifier_threadings() {
|
||||
mapfile -t lVENDOR_NAME_ARR < <(jq -r .vendor_names[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
# shellcheck disable=SC2034
|
||||
mapfile -t lCSV_REGEX_ARR < <(jq -r .version_extraction[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
|
||||
# we extract: ID/key\tGREP_COMMAND
|
||||
if [[ "${lPARSING_MODE_ARR[*]}" == *"strict"* ]]; then
|
||||
mapfile -t lSTRICT_VERSION_IDENTIFIER_ARR < <(jq -r .strict_grep_commands[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
mapfile -t lSTRICT_VERSION_IDENTIFIER_ARR < <(jq -r '.strict_grep_commands | to_entries[] | "\(.key)\t\(.value)"' "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
fi
|
||||
if [[ "${lPARSING_MODE_ARR[*]}" == *"zgrep"* ]]; then
|
||||
mapfile -t lZGREP_VERSION_IDENTIFIER_ARR < <(jq -r .zgrep_grep_commands[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
mapfile -t lZGREP_VERSION_IDENTIFIER_ARR < <(jq -r '.zgrep_grep_commands | to_entries[] | "\(.key)\t\(.value)"' "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
fi
|
||||
mapfile -t lVERSION_IDENTIFIER_ARR < <(jq -r .grep_commands[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
mapfile -t lVERSION_IDENTIFIER_ARR < <(jq -r '.grep_commands | to_entries[] | "\(.key)\t\(.value)"' "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
mapfile -t lAFFECTED_PATHS_ARR < <(jq -r .affected_paths[] "${lVERSION_JSON_CFG}" 2>/dev/null || true)
|
||||
# echo "Testing ${lRULE_IDENTIFIER} ..."
|
||||
# echo "lPARSING_MODE_ARR: ${lPARSING_MODE_ARR[*]}"
|
||||
@@ -287,8 +289,10 @@ S09_identifier_threadings() {
|
||||
for lAPP_NAME in "${lAFFECTED_PATHS_ARR[@]}"; do
|
||||
local lSTRICT_BINS_ARR_TMP=()
|
||||
mapfile -t lSTRICT_BINS_ARR_TMP < <(awk -F';' -v pat="${lAPP_NAME#/}" 'index($2, pat) > 0' "${P99_CSV_LOG}" | sort -u || true)
|
||||
lSTRICT_BINS_ARR+=("${lSTRICT_BINS_ARR_TMP[@]}")
|
||||
print_output "[*] Add ${lSTRICT_BINS_ARR_TMP[*]} to strict bin binary testing area for ${lRULE_IDENTIFIER}" "no_log"
|
||||
if [[ "${#lSTRICT_BINS_ARR_TMP[@]}" -gt 0 ]]; then
|
||||
lSTRICT_BINS_ARR+=("${lSTRICT_BINS_ARR_TMP[@]}")
|
||||
# print_output "[*] Add ${lSTRICT_BINS_ARR_TMP[*]} to strict bin binary testing area for ${lRULE_IDENTIFIER}" "no_log"
|
||||
fi
|
||||
done
|
||||
|
||||
# before moving on we need to ensure our strings files are generated:
|
||||
@@ -308,11 +312,15 @@ S09_identifier_threadings() {
|
||||
continue
|
||||
fi
|
||||
for lVERSION_IDENTIFIER in "${lSTRICT_VERSION_IDENTIFIER_ARR[@]}"; do
|
||||
local lIDENTIFIER_ID=$(("${lVERSION_IDENTIFIER%%$'\t'*}" + 1))
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER#*$'\t'}"
|
||||
|
||||
# print_output "[*] Testing STRICT identifier ${lVERSION_IDENTIFIER}" "no_log"
|
||||
lVERSION_IDENTIFIED=$(grep -a -E "${lVERSION_IDENTIFIER}" "${lSTRINGS_OUTPUT}" | sort -u || true)
|
||||
if [[ -n ${lVERSION_IDENTIFIED} ]]; then
|
||||
print_ln "no_log"
|
||||
print_output "[+] Version information found ${RED}${lAPP_NAME} ${lVERSION_IDENTIFIED}${NC}${GREEN} in binary ${ORANGE}$(print_path "${lBINARY_PATH}")${GREEN} (license: ${ORANGE}${lLICENSES_ARR[*]}${GREEN}) (${ORANGE}static - strict${GREEN})."
|
||||
# create_minimal_binary_corpus "${lRULE_IDENTIFIER}" "${lIDENTIFIER_ID}" "${lBINARY_PATH}" "${lVERSION_IDENTIFIER}"
|
||||
if version_parsing_logging "${S09_CSV_LOG}" "S09_firmware_base_version_check" "${lVERSION_IDENTIFIED}" "${lBINARY_ENTRY}" "${lRULE_IDENTIFIER}" "lVENDOR_NAME_ARR" "lPRODUCT_NAME_ARR" "lLICENSES_ARR" "lCSV_REGEX_ARR"; then
|
||||
# print_output "[*] back from logging for ${lVERSION_IDENTIFIED} -> continue to next binary"
|
||||
continue 2
|
||||
@@ -342,6 +350,9 @@ S09_identifier_threadings() {
|
||||
continue
|
||||
fi
|
||||
for lVERSION_IDENTIFIER in "${lZGREP_VERSION_IDENTIFIER_ARR[@]}"; do
|
||||
local lIDENTIFIER_ID=$(("${lVERSION_IDENTIFIER%%$'\t'*}" + 1))
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER#*$'\t'}"
|
||||
|
||||
# print_output "[*] Testing zgrep identifier ${ORANGE}${lVERSION_IDENTIFIER}${NC} on binary ${ORANGE}${lBINARY_PATH}${NC}"
|
||||
lVERSION_IDENTIFIED=$(zgrep -h "${lVERSION_IDENTIFIER}" "${lBINARY_PATH}" | sort -u || true)
|
||||
lVERSION_IDENTIFIED="${lVERSION_IDENTIFIED//[![:print:]]/}"
|
||||
@@ -377,6 +388,9 @@ S09_identifier_threadings() {
|
||||
# if no strings available ... go ahead and test all the bins against our identifiers
|
||||
if [[ -f "${lSTRINGS_OUTPUT}" ]]; then
|
||||
for lVERSION_IDENTIFIER in "${lVERSION_IDENTIFIER_ARR[@]}"; do
|
||||
local lIDENTIFIER_ID=$(("${lVERSION_IDENTIFIER%%$'\t'*}" + 1))
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER#*$'\t'}"
|
||||
|
||||
# print_output "[*] Testing identifier ${lVERSION_IDENTIFIER} for RTOS firmware" "no_log"
|
||||
lVERSION_IDENTIFIED=$(grep -a -E "${lVERSION_IDENTIFIER}" "${lSTRINGS_OUTPUT}" | sort -u || true)
|
||||
if [[ -n ${lVERSION_IDENTIFIED} ]]; then
|
||||
@@ -401,8 +415,11 @@ S09_identifier_threadings() {
|
||||
# TODO: change to local vars via parameters - this is ugly as hell!
|
||||
local lVERSION_IDENTIFIER=""
|
||||
for lVERSION_IDENTIFIER in "${lVERSION_IDENTIFIER_ARR[@]}"; do
|
||||
local lIDENTIFIER_ID=$(("${lVERSION_IDENTIFIER%%$'\t'*}" + 1))
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER#*$'\t'}"
|
||||
|
||||
# print_output "[*] Calling with ${lVERSION_IDENTIFIER}" "no_log"
|
||||
bin_string_checker "${lVERSION_IDENTIFIER}" "${lRULE_IDENTIFIER}" "lVENDOR_NAME_ARR" "lPRODUCT_NAME_ARR" "lLICENSES_ARR" "lCSV_REGEX_ARR" "lPARSING_MODE_ARR" &
|
||||
bin_string_checker "${lVERSION_IDENTIFIER}" "${lIDENTIFIER_ID}" "${lRULE_IDENTIFIER}" "lVENDOR_NAME_ARR" "lPRODUCT_NAME_ARR" "lLICENSES_ARR" "lCSV_REGEX_ARR" "lPARSING_MODE_ARR" &
|
||||
local lTMP_PID="$!"
|
||||
WAIT_PIDS_S09+=("${lTMP_PID}")
|
||||
# echo "WAIT_PIDS_S09: ${#WAIT_PIDS_S09[@]} / max: ${MAX_MOD_THREADS})"
|
||||
@@ -745,25 +762,26 @@ generate_strings() {
|
||||
|
||||
# bin_string_checker "${lVERSION_IDENTIFIER}" "${lRULE_IDENTIFIER}" "lVENDOR_NAME_ARR" "lPRODUCT_NAME_ARR" "lLICENSES_ARR" "lCSV_REGEX_ARR" "lPARSING_MODE_ARR" &
|
||||
bin_string_checker() {
|
||||
local lVERSION_IDENTIFIER="${1:-}"
|
||||
local lRULE_IDENTIFIER="${2:-}"
|
||||
local lVERSION_IDENTIFIER_ORIG="${1:-}"
|
||||
local lIDENTIFIER_ID="${2:-}"
|
||||
local lRULE_IDENTIFIER="${3:-}"
|
||||
# shellcheck disable=SC2034
|
||||
local -n lrVENDOR_NAME_ARR="${3:-}"
|
||||
local -n lrVENDOR_NAME_ARR="${4:-}"
|
||||
# shellcheck disable=SC2034
|
||||
local -n lrPRODUCT_NAME_ARR="${4:-}"
|
||||
local -n lrPRODUCT_NAME_ARR="${5:-}"
|
||||
# shellcheck disable=SC2034
|
||||
local -n lrLICENSES_ARR="${5:-}"
|
||||
local -n lrLICENSES_ARR="${6:-}"
|
||||
# shellcheck disable=SC2034
|
||||
local -n lrCSV_REGEX_ARR="${6:-}"
|
||||
local -n lrPARSING_MODE_ARR="${7:-}"
|
||||
local -n lrCSV_REGEX_ARR="${7:-}"
|
||||
local -n lrPARSING_MODE_ARR="${8:-}"
|
||||
|
||||
# load lVERSION_IDENTIFIER string into array for multi_grep handling
|
||||
# load lVERSION_IDENTIFIER_FULL string into array for multi_grep handling
|
||||
local lVERSION_IDENTIFIERS_ARR=()
|
||||
# remove the ' from the multi_grep identifiers:
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER%\'}"
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER#\'}"
|
||||
lVERSION_IDENTIFIER_FULL="${lVERSION_IDENTIFIER_ORIG%\'}"
|
||||
lVERSION_IDENTIFIER_FULL="${lVERSION_IDENTIFIER_FULL#\'}"
|
||||
# replace the AND marker with \n to create an array with all the identifiers
|
||||
mapfile -t lVERSION_IDENTIFIERS_ARR < <(echo "${lVERSION_IDENTIFIER//AND/$'\n'}")
|
||||
mapfile -t lVERSION_IDENTIFIERS_ARR < <(echo "${lVERSION_IDENTIFIER_FULL//AND/$'\n'}")
|
||||
|
||||
local lPURL_IDENTIFIER="NA"
|
||||
local lOS_IDENTIFIED=""
|
||||
@@ -794,7 +812,7 @@ bin_string_checker() {
|
||||
done
|
||||
fi
|
||||
if [[ "${#lFILE_DATA_ARR[@]}" -eq 0 ]]; then
|
||||
# print_output "[-] No file array created for ${lVERSION_IDENTIFIER}" "no_log"
|
||||
# print_output "[-] No file array created for ${lVERSION_IDENTIFIER_FULL}" "no_log"
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -850,6 +868,7 @@ bin_string_checker() {
|
||||
fi
|
||||
print_ln "no_log"
|
||||
print_output "[+] Version information found ${RED}${lVERSION_IDENTIFIED}${NC}${GREEN} in binary ${ORANGE}$(print_path "${lBINARY_PATH}")${GREEN} (license: ${ORANGE}${lLICENSES_ARR[*]}${GREEN}) (${ORANGE}static${GREEN})."
|
||||
create_minimal_binary_corpus "${lRULE_IDENTIFIER}" "${lIDENTIFIER_ID}" "${lBINARY_PATH}" "${lVERSION_IDENTIFIER_ORIG}"
|
||||
|
||||
if version_parsing_logging "${S09_CSV_LOG}" "S09_firmware_base_version_check" "${lVERSION_IDENTIFIED}" "${lBINARY_DATA}" "${lRULE_IDENTIFIER}" "lrVENDOR_NAME_ARR" "lrPRODUCT_NAME_ARR" "lrLICENSES_ARR" "lrCSV_REGEX_ARR"; then
|
||||
# print_output "[*] back from logging for ${lVERSION_IDENTIFIED} -> continue to next binary"
|
||||
@@ -904,3 +923,81 @@ bin_string_checker() {
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# enable/disable with BINARY_CORPUS_GENERATION in defaults or in scanning profile
|
||||
# This mechanism automatically generates EMBA binary testing corpus files.
|
||||
# It automatically checks if the testing file is already available and checks it only if
|
||||
# it is missing. A PR on missing testing files should be very easy with this mechanisms.
|
||||
# Additionally, this mechanism will help in building and submitting new identifiers in
|
||||
# config/bin_version_identifiers. Just build the new identifier and the testfile will be
|
||||
# generated automatically in the s09 module directory -> just copy it to tests/bin_version_testdata
|
||||
# and submit a PR
|
||||
create_minimal_binary_corpus() {
|
||||
[[ "${BINARY_CORPUS_GENERATION}" -ne 1 ]] && return
|
||||
local lRULE_IDENTIFIER="${1:-}"
|
||||
local lIDENTIFIER_ID="${2:-}"
|
||||
local lBINARY_PATH="${3:-}"
|
||||
local lVERSION_IDENTIFIER_ORIG="${4:-}"
|
||||
|
||||
local lCORPUS_PATH="${S09_LOG_DIR}/binary_corpus_tmp"
|
||||
local lCORPUS_log="${lCORPUS_PATH}/logfile.txt"
|
||||
[[ ! -d "${lCORPUS_PATH}" ]] && mkdir -p "${lCORPUS_PATH}"
|
||||
touch "${lCORPUS_log}" 2>/dev/null || true
|
||||
local lCORPUS_FILE="${lCORPUS_PATH}/${lRULE_IDENTIFIER}_${lIDENTIFIER_ID//$'\n'/_}"
|
||||
local lORIG_CORPUS_FILE="${TESTS_DIR}/bin_version_testdata/${lRULE_IDENTIFIER}_${lIDENTIFIER_ID//$'\n'/_}.bin"
|
||||
local lCORPUS_FILE_tmp="${lCORPUS_FILE}_${RANDOM}.bin"
|
||||
local lCORPUS_FILE="${lCORPUS_FILE}.bin"
|
||||
[[ -f "${lCORPUS_FILE}" ]] && return
|
||||
[[ -f "${lORIG_CORPUS_FILE}" ]] && return
|
||||
|
||||
# replace the AND marker with \n to create an array with all the identifiers
|
||||
local lVERSION_IDENTIFIERS_ARR=()
|
||||
# remove the ' from the multi_grep identifiers:
|
||||
lVERSION_IDENTIFIER_FULL="${lVERSION_IDENTIFIER_ORIG%\'}"
|
||||
lVERSION_IDENTIFIER_FULL="${lVERSION_IDENTIFIER_FULL#\'}"
|
||||
mapfile -t lVERSION_IDENTIFIERS_ARR < <(echo "${lVERSION_IDENTIFIER_FULL//AND/$'\n'}")
|
||||
|
||||
write_log "[*] Testing ${lRULE_IDENTIFIER}.json for identifier ${lVERSION_IDENTIFIER_FULL}" "${lCORPUS_log}"
|
||||
|
||||
write_log "[*] Extracted id for rule ${lRULE_IDENTIFIER} - ${lVERSION_IDENTIFIER_ORIG}: ${lIDENTIFIER_ID}" "${lCORPUS_log}"
|
||||
write_log "[*] Generate corpus for rule ${lRULE_IDENTIFIER}" "${lCORPUS_log}"
|
||||
write_log "[*] Generate corpus for version identifier ${lVERSION_IDENTIFIER_ORIG} - rule ${lRULE_IDENTIFIER}" "${lCORPUS_log}"
|
||||
write_log "[*] Generate corpus for binary ${lBINARY_PATH} - rule ${lRULE_IDENTIFIER}" "${lCORPUS_log}"
|
||||
|
||||
if [[ ! -f "${lBINARY_PATH}" ]]; then
|
||||
write_log "[-] WARNING: no binary file for ${lBINARY_PATH} found" "${lCORPUS_log}"
|
||||
return
|
||||
fi
|
||||
|
||||
for ((j = 0; j < ${#lVERSION_IDENTIFIERS_ARR[@]}; j++)); do
|
||||
local lVERSION_IDENTIFIER="${lVERSION_IDENTIFIERS_ARR["${j}"]}"
|
||||
# print_output "[*] Testing ${lBINARY_PATH} with version identifier ${lVERSION_IDENTIFIER}" "no_log"
|
||||
local lVERSION_IDENTIFIED=""
|
||||
[[ -z "${lVERSION_IDENTIFIER}" ]] && continue
|
||||
# this is a workaround to handle the new multi_grep
|
||||
if [[ "${lVERSION_IDENTIFIER: -1}" == '"' ]]; then
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER/\"/}"
|
||||
lVERSION_IDENTIFIER="${lVERSION_IDENTIFIER%\"}"
|
||||
fi
|
||||
|
||||
lVERSION_IDENTIFIER=${lVERSION_IDENTIFIER%$}
|
||||
lVERSION_IDENTIFIER=${lVERSION_IDENTIFIER#^}
|
||||
|
||||
grep -o -a -E ".{0,300}${lVERSION_IDENTIFIER}.{0,300}" "${lBINARY_PATH}" >>"${lCORPUS_FILE_tmp}" || true
|
||||
|
||||
lCORP_SIZE=$(wc -c <"${lCORPUS_FILE_tmp}")
|
||||
write_log "[*] Generated corpus for binary ${lBINARY_PATH} with size ${lCORP_SIZE} - rule ${lRULE_IDENTIFIER}/${lVERSION_IDENTIFIER}" "${lCORPUS_log}"
|
||||
done
|
||||
if [[ ! -f "${lCORPUS_FILE}" ]]; then
|
||||
if [[ -s "${lCORPUS_FILE_tmp}" ]]; then
|
||||
# mv -n does not overwrite existing files
|
||||
if mv -n "${lCORPUS_FILE_tmp}" "${lCORPUS_FILE}"; then
|
||||
lCORP_SIZE=$(wc -c <"${lCORPUS_FILE}")
|
||||
write_log "[*] Generated final corpus for binary ${lBINARY_PATH} with size ${lCORP_SIZE} - rule ${lRULE_IDENTIFIER}/${lVERSION_IDENTIFIER_ORIG}" "${lCORPUS_log}"
|
||||
else
|
||||
# lCORPUS_FILE already available -> we can remove our tmp file
|
||||
rm -f "${lCORPUS_FILE_tmp}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
7-Zip 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06
|
||||
@@ -0,0 +1 @@
|
||||
D0----Welcome to Realtek Camera Tool. Version 1.11.1
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
apstats v0.1: Display Access Point Statistics.
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
bc 0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user