mirror of
https://git.photon.obnh.io/AXSY/whois.git
synced 2025-12-11 04:39:15 +00:00
Based on mwhois by Antonios A. Chariton Modifications for SCION AS support by Olaf Baumert, Axpo Systems AG
55 lines
1.8 KiB
Python
Executable File
55 lines
1.8 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
# Use this file to get a wizard in order to enter a database
|
|
# entry about an IP Address Block. It assumes the input is
|
|
# trusted and generates a more or less accurate whois record
|
|
|
|
import netaddr
|
|
|
|
ip = raw_input("Enter Network CIDR Block: ")
|
|
body = ""
|
|
n = "\r\n"
|
|
ip = ip.replace("-", "/")
|
|
ntwrk = netaddr.IPNetwork(ip)
|
|
|
|
fullnet = str(ntwrk.network) + " - " + str(ntwrk.broadcast)
|
|
abuse = raw_input("Enter Abuse E-Mail: ")
|
|
body = body + "% Abuse contact for '" + fullnet + "' is '" + abuse + "'" + n + n
|
|
body = body + "inetnum: " + fullnet + n
|
|
netname = raw_input("Net Name: ")
|
|
body = body + "netname: " + netname + n
|
|
descr = raw_input("Description of network: ")
|
|
body = body + "descr: " + descr + n
|
|
country = raw_input("Two-Digit Country Code: ")
|
|
body = body + "country: " + country + n
|
|
admin = raw_input("Administrator: ")
|
|
body = body + "admin-c: " + admin + n
|
|
print("Enter all Tech Admins, enter @ to stop.")
|
|
f = raw_input("Tech Admin: ")
|
|
while(f!="@"):
|
|
body = body + "tech-c: " + f + n
|
|
f = raw_input("Tech Admin: ")
|
|
status = raw_input("Status (ASSIGNED/ALLOCATED): ")
|
|
body = body + "status: " + status + n
|
|
print("Enter all Managers, enter @ to stop.")
|
|
mntby = raw_input("Managed by: ")
|
|
while(mntby!="@"):
|
|
body = body + "mnt-by: " + mntby + n
|
|
mntby = raw_input("Managed by: ")
|
|
|
|
body = body + n
|
|
body = body + "% Information related to '" + str(ntwrk.network) + "/" + str(ntwrk.prefixlen) + "'" + n
|
|
body = body + n
|
|
body = body + "route: " + str(ntwrk.network) + "/" + str(ntwrk.prefixlen) + n
|
|
descr = raw_input("Short Network Description: ")
|
|
body = body + "descr: " + descr + n
|
|
body = body + "mnt-by: " + admin + n
|
|
|
|
|
|
# Save to file
|
|
filename = ip.replace("/", "-")
|
|
d = open("db/ipv4/" + filename, "w+")
|
|
d.write(body)
|
|
d.close()
|
|
print("Done!")
|