before analyzing
This commit is contained in:
BIN
analyzing_mascan_results/GeoLite2-ASN.mmdb
Normal file
BIN
analyzing_mascan_results/GeoLite2-ASN.mmdb
Normal file
Binary file not shown.
44
analyzing_mascan_results/analyze.py
Normal file
44
analyzing_mascan_results/analyze.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import geoip2.database
|
||||
import geoip2.errors
|
||||
import csv
|
||||
|
||||
# File names
|
||||
INPUT_FILE = 'mascan_results.txt' # Your list of IPs, one per line
|
||||
OUTPUT_FILE = 'results.csv' # The CSV file that will be created
|
||||
DB_FILE = 'GeoLite2-ASN.mmdb' # The MaxMind database file
|
||||
|
||||
# We use 'with' statements to ensure files and databases close automatically
|
||||
with geoip2.database.Reader(DB_FILE) as reader, \
|
||||
open(INPUT_FILE, 'r') as infile, \
|
||||
open(OUTPUT_FILE, 'w', newline='') as outfile:
|
||||
|
||||
# Initialize the CSV writer
|
||||
writer = csv.writer(outfile)
|
||||
|
||||
# Write the column headers to the CSV
|
||||
writer.writerow(['IP Address', 'ISP / Provider', 'Subnet', 'ASN'])
|
||||
|
||||
# Loop through each line in your input text file
|
||||
for line in infile:
|
||||
ip = line.strip() # Remove spaces and line breaks
|
||||
|
||||
if not ip:
|
||||
continue # Skip blank lines
|
||||
|
||||
try:
|
||||
# Query the Radix Tree database
|
||||
response = reader.asn(ip)
|
||||
provider = response.autonomous_system_organization
|
||||
subnet = str(response.network) # Convert subnet object to string
|
||||
asn = response.autonomous_system_number
|
||||
|
||||
# Write the successful result to the CSV
|
||||
writer.writerow([ip, provider, subnet, asn])
|
||||
|
||||
except geoip2.errors.AddressNotFoundError:
|
||||
# IP isn't in the database
|
||||
writer.writerow([ip, 'Not Found', 'Not Found', 'Not Found'])
|
||||
|
||||
except ValueError:
|
||||
# The text on this line wasn't a valid IP address format
|
||||
writer.writerow([ip, 'Invalid IP format', 'N/A', 'N/A'])
|
||||
44
analyzing_mascan_results/mascan_results.txt
Normal file
44
analyzing_mascan_results/mascan_results.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
213.87.45.151
|
||||
51.250.32.53
|
||||
185.138.255.120
|
||||
91.142.135.249
|
||||
185.138.254.19
|
||||
194.35.48.89
|
||||
195.3.183.35
|
||||
51.250.36.135
|
||||
84.201.149.9
|
||||
213.59.197.148
|
||||
176.112.172.163
|
||||
45.136.21.184
|
||||
51.250.68.84
|
||||
79.174.93.218
|
||||
151.236.108.136
|
||||
94.181.203.49
|
||||
87.250.251.94
|
||||
158.160.60.16
|
||||
84.201.130.113
|
||||
84.201.162.116
|
||||
178.248.232.99
|
||||
51.250.125.50
|
||||
46.42.185.125
|
||||
95.163.251.181
|
||||
158.160.54.141
|
||||
185.141.224.76
|
||||
151.236.75.97
|
||||
51.250.104.104
|
||||
158.160.225.118
|
||||
158.160.176.92
|
||||
5.188.113.209
|
||||
51.250.15.30
|
||||
151.236.117.31
|
||||
176.109.76.103
|
||||
185.51.158.56
|
||||
46.254.18.103
|
||||
155.212.204.157
|
||||
158.160.167.138
|
||||
185.65.149.243
|
||||
178.250.242.63
|
||||
185.32.249.55
|
||||
158.160.90.8
|
||||
51.250.77.135
|
||||
109.238.88.226
|
||||
45
analyzing_mascan_results/results.csv
Normal file
45
analyzing_mascan_results/results.csv
Normal file
@@ -0,0 +1,45 @@
|
||||
IP Address,ISP / Provider,Subnet,ASN
|
||||
213.87.45.151,MTS PJSC,213.87.44.0/22,13174
|
||||
51.250.32.53,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
185.138.255.120,LLC Wildberries,185.138.252.0/22,57073
|
||||
91.142.135.249,PJSC NK Rosneft,91.142.135.0/24,41706
|
||||
185.138.254.19,LLC Wildberries,185.138.252.0/22,57073
|
||||
194.35.48.89,Lime HD LLC,194.35.48.0/23,47481
|
||||
195.3.183.35,GKU TO CIT,195.3.183.0/24,39562
|
||||
51.250.36.135,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
84.201.149.9,Yandex.Cloud LLC,84.201.128.0/18,200350
|
||||
213.59.197.148,Rostelecom,213.59.192.0/18,12389
|
||||
176.112.172.163,LLC VK,176.112.168.0/21,47764
|
||||
45.136.21.184,LLC VK,45.136.20.0/22,47764
|
||||
51.250.68.84,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
79.174.93.218,"Domain names registrar REG.RU, Ltd",79.174.80.0/20,197695
|
||||
151.236.108.136,Global Cloud Network LLC,151.236.108.0/24,204720
|
||||
94.181.203.49,JSC ER-Telecom Holding,94.181.192.0/18,41727
|
||||
87.250.251.94,YANDEX LLC,87.250.248.0/21,13238
|
||||
158.160.60.16,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
84.201.130.113,Yandex.Cloud LLC,84.201.128.0/18,200350
|
||||
84.201.162.116,Yandex.Cloud LLC,84.201.128.0/18,200350
|
||||
178.248.232.99,HLL LLC,178.248.232.0/21,51115
|
||||
51.250.125.50,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
46.42.185.125,CDNvideo LLC,46.42.185.0/24,57363
|
||||
95.163.251.181,LLC VK,95.163.248.0/21,47764
|
||||
158.160.54.141,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
185.141.224.76,Global Cloud Network LLC,185.141.224.0/24,204720
|
||||
151.236.75.97,CDNvideo LLC,151.236.72.0/22,57363
|
||||
51.250.104.104,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
158.160.225.118,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
158.160.176.92,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
5.188.113.209,JSC Selectel,5.188.113.0/24,49505
|
||||
51.250.15.30,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
151.236.117.31,Global Cloud Network LLC,151.236.116.0/22,204720
|
||||
176.109.76.103,MTS PJSC,176.109.72.0/21,60490
|
||||
185.51.158.56,LLC IMT,185.51.156.0/22,60162
|
||||
46.254.18.103,EuroByte LLC,46.254.16.0/21,210079
|
||||
155.212.204.157,LLC VK,155.212.192.0/20,47764
|
||||
158.160.167.138,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
185.65.149.243,HLL LLC,185.65.148.0/22,51115
|
||||
178.250.242.63,Hosting Ltd,178.250.240.0/21,43362
|
||||
185.32.249.55,LLC VK,185.32.249.0/24,28709
|
||||
158.160.90.8,Yandex.Cloud LLC,158.160.0.0/16,200350
|
||||
51.250.77.135,Yandex.Cloud LLC,51.250.0.0/17,200350
|
||||
109.238.88.226,Servicepipe LLC,109.238.88.0/24,201706
|
||||
|
Reference in New Issue
Block a user