Compare commits

...

2 Commits

2 changed files with 55 additions and 6 deletions

View File

@ -1,6 +1,12 @@
import sys
import requests
def sorted_dict(d: dict, reverse=True) -> dict:
return {
key: d[key]
for key in sorted(d, key=d.get, reverse=reverse)
}
def main(filename: str):
validnames = {
'wp-login.php',
@ -32,7 +38,7 @@ def main(filename: str):
}
hitfiles = {}.fromkeys(validnames, 0)
requesters = {}
ips = {}
locations = {}
for ip, date, time, timezone, status, method, file in filterwords(filename, validnames):
hitfiles[file] += 1
@ -42,14 +48,13 @@ def main(filename: str):
requesters[ip] = 1
latlon = get_ip_latlon(ip)
if latlon is not None:
ips[ip] = latlon
locations[ip] = latlon
hitfiles = sorted_dict(hitfiles)
print(f'{hitfiles = }')
requesters = sorted_dict(requesters)
print(f'{requesters = }')
print(f'{ips = }')
req_list = list(requesters)
req_list.sort(key=req_list.count)
print(f'{req_list = }')
print(f'{locations = }')
def get_ip_latlon(ip: str) -> (int, int):
# make a reqest to ip-api.com to associate an ip to a

44
make-requests.py Normal file
View File

@ -0,0 +1,44 @@
import requests
import random
import asyncio as aio
async def hitvm(filename: str):
requests.get(f'http://172.30.0.156/{filename}')
async def main():
filenames = [
"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"
]
await aio.gather(*[
hitvm(filename)
for filename in random.choices(
filenames, k=len(filenames)//2
)
])
aio.run(main())