forked from daknob/mwhois
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-ip-wind
executable file
·57 lines (50 loc) · 1.96 KB
/
add-ip-wind
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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 + "abuse-mailbox: " + abuse + n
body = body + n
nodeid = raw_input("WiND/Database Node ID: ")
body = body + "% Information related to '" + str(ntwrk.network) + "/" + str(ntwrk.prefixlen) + "ID" + nodeid + "'" + 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 + "origin: " + nodeid + 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!")