-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDNSscan.py
55 lines (37 loc) · 1.1 KB
/
DDNSscan.py
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
import socket
from multiprocessing import Pool
import time
import argparse
def hosttoIP(arg):
target = arg
return (socket.gethostbyname(arg))
def scan(arg):
target_ip, port = arg
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2)
try:
sock.connect((target_ip, port))
sock.close()
return port, True
except (socket.timeout, socket.error):
return port, False
def showtest(arg):
target_ip, port = arg
time.sleep(port)
return port, True
def main():
parser = argparse.ArgumentParser(description='script port scan dynamic DNS servers given a list of hostnames')
parser.add_argument('-v', '--verbose',
action="store_true",
help="verbose output" )
parser.add_argument('-f',
type=argparse.FileType('r'),
help="file containing hostnames")
args = parser.parse_args()
if args.f is not None:
with args.f as hostfile:
for line in hostfile:
print(line)
print(hosttoIP("yellow24.ddns.net"))
if __name__ == '__main__':
main()