我想在一行中手动写出 itertools 的功能,以便我可以尝试使用多个字符串更快地完成该功能。现在这个功能有效,我只需要大幅加速它。我什至不确定写出 itertools 行是否能让我使用多个线程。
def list ():
charLength = sys.argv[2]
charSet = 'abcdefghijklmnopqrstuvwxyz0123456789'
combo = itertools.combinations_with_replacement(charSet, int(charLength))
for floatingcombo in combo:
floatingcombo = ''.join(floatingcombo)
floatingcombo += "." + sys.argv[3]
try:
floatingIP = socket.gethostbyname(floatingcombo)
msvcrt.printf("%s resolved to --> %s\n", floatingcombo, floatingIP)
except socket.gaierror:
msvcrt.printf("%s does not exist\n", floatingcombo)
return