if data.find('!scan') != -1:
nick = data.split('!')开发者_JAVA百科[ 0 ].replace(':','')
targetip = socket.gethostbyname(str(arg))
sck.send('PRIVMSG ' + chan + " :" ' scanning host' + targetip + '\r\n')
for i in range(20, 1025):
s = socket(AF_INET, SOCK_STREAM)
result = s.connect_ex((targetip, i))
if (result == 0) :
s.send('PRIVMSG ' + chan + " :" 'port %d: OPEN' % (i,) + '\r\n')
s.close()
I get this error:
targetip = socket.gethostbyname(str(arg))
socket.gaierror: [Errno 11003] getaddrinfo failed
On Windows, socket.gethostbyname()
invokes the getaddrinfo()
Winsock API call, and errno 11003 - WSANO_RECOVERY may be caused by the SYSTEMROOT environment variable not being set.
Check if os.environ contains SYSTEMROOT before calling socket.gethostbyname, ex:
import os
assert 'SYSTEMROOT' in os.environ
精彩评论