master
Nicholas Hope 2022-12-28 23:31:24 -05:00
parent 866bb3fd8f
commit fc5845f88a
1 changed files with 51 additions and 0 deletions

51
analyze.py Normal file
View File

@ -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])