-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan.py
More file actions
31 lines (29 loc) · 1.01 KB
/
scan.py
File metadata and controls
31 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import subprocess
import ipaddress
def findranges():
asn = input("ASN: ")
asnmap = ["asnmap", "-a", f"{asn}"]
result = subprocess.run(asnmap, capture_output=True, text=True, check=True)
out = result.stdout.strip().split('\n')
return out
def findips(file):
range = findranges()
for _ in range:
with open(f"{file}", "a") as f:
try:
n = ipaddress.ip_network(_)
for ips in n:
f.write(f"{ips}\n")
except ValueError as e:
print("bad ip range?")
break
def attack():
findips("ips.txt")
with open("ips.txt", "r") as f:
for line in f:
nuclei = ["nuclei", "-u", f"{line}", "-silent", "-j", "-or", "-ot", "-nm", "-es", "info","low"]
result = subprocess.run(nuclei, capture_output=True, text=True, check=True)
print(result.stdout)
with open("result.txt", "a") as res:
res.write(f"TARGET {line}\n{result.stdout}\n")
attack()