import socket
def retBanner(ip,port):
try:
socket.setdefaulttimeout(0.04)
s=socket.socket()
s.connect((ip,port))
ans = s.recv(1024)
return ans
except:
return
def checkVulns(ans):
if("FreeFloat FTP Server (Version 1.00)"in ans):
print("[+] FreeFloat FTP Server,Vulnerable")
elif("3Com 3CDaemon FTP Server (Version 2.00)"in ans):
print("[+] 3Com 3CDaemon FTP Server,Vulnerable")
elif("Ability Server 2.34"in ans):
print("[+] Ability Server,Vulnerable")
elif("Sami FTP Server 2.0.2"in ans):
print("[+] 3Com 3CDaemon FTP Server,Vulnerable")
else:
print("[+] Server is not Vulnerable | "+ans)
return
def main():
portList=[21,22,25,80,110,443]
for x in range(1,225):
ip='192.168.95.'+str(x)
for port in portList:
ans = retBanner(ip,port)
if ans:
print('[+]'+ip+':'+ans)
checkVulns(ans)
if __name__=='__main__':
main()
except里不要什么都不写,写个print,证明连接出错了
最好这样:
except Exception as e:
print(e)
这样你才能知道到底报了什么错误
说明你上面所有的ip,端口号,使用socket都没连上