-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle.py
More file actions
30 lines (26 loc) · 846 Bytes
/
google.py
File metadata and controls
30 lines (26 loc) · 846 Bytes
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
import socket
import argparse
def con(tgthost,tgtport):
try:
socket.setdefaulttimeout(2)
s=socket.socket()
try:
g=socket.gethostbyname(tgthost)
except Exception as e:
print(str(e))
exit(0)
s.connect((g,tgtport))
print("connection succesful ")
except Exception as e:
print(str(e))
def main():
parser=argparse.ArgumentParser()
parser.add_argument('-H','--host',dest='host',action='store',help='specify target host ip or name')
parser.add_argument('-p','--port',dest='port',action='store',help='specify target port')
args=parser.parse_args()
tgthost=args.host
tgtports=str(args.port).split(',')
for tgtport in tgtports :
con(tgthost,tgtport)
if __name__=='__main__':
main()