import re
import socket
import sys
def Check(ip,port):
try:
s = socket.socket()
s.settimeout(0.3)
s.connect((ip,port))
return s.recv(512)
except:
pass
def Scan():
start = sys.argv[1]
end = sys.argv[2]
endip = end.partition('.')
currentip = start.split('.')
while not (currentip == endip):
targetip = currentip[0]+"."+currentip[1]+"."+currentip[2]+"."+currentip[3]
print("Checking: "+targetip+"\n")
result = Check(targetip,21)
if result:
if re.search("FTP",result.decode('utf-8')):
retard = open('ftps.txt','a')
retard.write(targetip+"\n")
retard.close()
if (int(currentip[3]) < 255) and (int(currentip[0]) != int(endip[0])) and (int(currentip[1]) != int(endip[1])) and (int(currentip[2]) != int(endip[2])) and (int(currentip[3]) != int(endip[3])+1):
int(currentip[3]) += 1
elif (int(currentip[3]) == 255) and (int(currentip[0]) != int(endip[0])) and (int(currentip[1]) != int(endip[1])) and (int(currentip[2]) != int(endip[2])) and (int(currentip[3]) != int(endip[3])+1):
if (int(currentip[2]) < 255):
int(currentip[2]) += 1
int(currentip[3]) = 0
elif (int(currentip[2]) == 255):
if (int(currentip[1]) < 255):
int(currentip[1]) += 1
int(currentip[2]) = 0
int(currentip[3]) = 0
elif (int(currentip[0]) < int(endip[0])) and (int(currentip[0]) != 255) and (int(currentip[1]) == 255):
int(currentip[0]) += 1
int(currentip[1]) = 0
int(currentip[2]) = 0
int(currentip[3]) = 0
Scan()
int(currentip[0]) += 1
会导致错误,而转换其他与转换方式完全相同的项则不会触发任何错误
File "ftpscan.py", line 46
int(currentip[0]) += 1
^
SyntaxError: cannot assign to function call
这就是它的工作方式,谢谢你试着帮助我,我自己就知道了
基本上,
i += 1
与i = i + 1
相同就你而言
int(currentip[0]) += 1
,与int(currentip[0]) = int(currentip[0]) + 1
相同因此,从技术上讲,您不能分配给函数调用。 相反,这应该是可行的
您正试图增加数字(返回的内容),而不是变量的内容
相关问题 更多 >
编程相关推荐