Answer the question
In order to leave comments, you need to log in
How to properly work with sockets in Python3?
Hello.
I have several ip's of different sites. Everyone has port 443 open.
45.60.40.164
185.71.67.88
185.71.67.56
212.5.66.66
178.248.232.33
185.203.72.185
185.62.200.245
217.73.62.241
212.193.152.179
104.16.199.133
178.248.232.221
178.248.232.181
95.101.172.6
nmap -p 443 -iL result_ips.txt
import time
import socket
start_time = time.time()
def scan_port(ip,port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.01)
try:
connect = sock.connect((ip,port))
print(ip + port + ' open.')
connect.close()
except:
pass
ports = ['443']
for port in ports:
file_result_ips = open('result_ips.txt', 'r')
for ip in file_result_ips:
scan_port(ip,port)
file_result_ips.close()
print('')
print('%s seconds' % (time.time() - start_time))
0.0005757808685302734 seconds
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question