From fc5845f88a3af093f9c256c998469df820fed5b6 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 28 Dec 2022 23:31:24 -0500 Subject: [PATCH] Created --- analyze.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 analyze.py diff --git a/analyze.py b/analyze.py new file mode 100644 index 0000000..ad9a656 --- /dev/null +++ b/analyze.py @@ -0,0 +1,51 @@ +import sys +import time + +def main(filename: str): + validwords = { + 'wp-login.php', + '.env', + 'plugins/system/debug/debug.xml', + 'administrator/language/en-GB/en-GB.xml', + 'administrator/help/en-GB/toc.json', + '.git/config', + 'vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php', + 'xmlrpc.php', + 'wp1/wp-includes/wlwmanifest.xml', + 'wp/wp-includes/wlwmanifest.xml', + 'wordpress/wp-includes/wlwmanifest.xml', + 'web/wp-includes/wlwmanifest.xml', + 'test/wp-includes/wlwmanifest.xml', + 'site/wp-includes/wlwmanifest.xml', + 'shop/wp-includes/wlwmanifest.xml', + 'cms/wp-includes/wlwmanifest.xml', + 'blog/wp-includes/wlwmanifest.xml', + '2019/wp-includes/wlwmanifest.xml', + 'wp-load.php', + 'public/_ignition/health-check', + '_ignition/health-check', + 'admin/.env', + 'protected/.env', + 'wp-includes/wp-class.php', + 'wp-commentin.php', + 'wp-signin.php' + } + for ip, date, time, timezone, status, method, filename in filterwords(filename, validwords): + print(f'{ip = }, {date = }, {time = }, {timezone = }, {status = }, {method = }, {filename = }') + +def filterwords(filename: str, validnames: set): + with open(filename, 'r') as f: + for line in f: + ip, timethings, status, method, filename = line.split(',') + filename = '/'.join(filename.split('/')[4:]).strip() + if ( + status != '200' + or method != 'GET' + or filename not in validnames + ): continue + # IP,YYMMDD hhmmss TIMEZONE,STATUS,METHOD,FILE + date, time, timezone = timethings.split(' ') + yield ip, date, time, timezone, status, method, filename + +if __name__ == '__main__': + main(sys.argv[1]) \ No newline at end of file