Compare commits
2 Commits
c54d5e308e
...
719c4157e8
Author | SHA1 | Date |
---|---|---|
Nicholas Hope | 719c4157e8 | |
Nicholas Hope | 934425c073 |
17
analyze.py
17
analyze.py
|
@ -1,6 +1,12 @@
|
||||||
import sys
|
import sys
|
||||||
import requests
|
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):
|
def main(filename: str):
|
||||||
validnames = {
|
validnames = {
|
||||||
'wp-login.php',
|
'wp-login.php',
|
||||||
|
@ -32,7 +38,7 @@ def main(filename: str):
|
||||||
}
|
}
|
||||||
hitfiles = {}.fromkeys(validnames, 0)
|
hitfiles = {}.fromkeys(validnames, 0)
|
||||||
requesters = {}
|
requesters = {}
|
||||||
ips = {}
|
locations = {}
|
||||||
for ip, date, time, timezone, status, method, file in filterwords(filename, validnames):
|
for ip, date, time, timezone, status, method, file in filterwords(filename, validnames):
|
||||||
hitfiles[file] += 1
|
hitfiles[file] += 1
|
||||||
|
|
||||||
|
@ -42,14 +48,13 @@ def main(filename: str):
|
||||||
requesters[ip] = 1
|
requesters[ip] = 1
|
||||||
latlon = get_ip_latlon(ip)
|
latlon = get_ip_latlon(ip)
|
||||||
if latlon is not None:
|
if latlon is not None:
|
||||||
ips[ip] = latlon
|
locations[ip] = latlon
|
||||||
|
|
||||||
|
hitfiles = sorted_dict(hitfiles)
|
||||||
print(f'{hitfiles = }')
|
print(f'{hitfiles = }')
|
||||||
|
requesters = sorted_dict(requesters)
|
||||||
print(f'{requesters = }')
|
print(f'{requesters = }')
|
||||||
print(f'{ips = }')
|
print(f'{locations = }')
|
||||||
req_list = list(requesters)
|
|
||||||
req_list.sort(key=req_list.count)
|
|
||||||
print(f'{req_list = }')
|
|
||||||
|
|
||||||
def get_ip_latlon(ip: str) -> (int, int):
|
def get_ip_latlon(ip: str) -> (int, int):
|
||||||
# make a reqest to ip-api.com to associate an ip to a
|
# make a reqest to ip-api.com to associate an ip to a
|
||||||
|
|
|
@ -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())
|
Loading…
Reference in New Issue