I'm trying to bulid an Anonymous FTP scanner , but i got an error about calling function X , i defined X to recieve ony 1 arguement which is the ip address , the same code works if i don't use the loop and send the IPs one by one .
The error is : X() takes exactly 1 argument (8 given)
from ftplib import FTP
import ipcalc
from threading import Thread
def X (ip):
try:
ftp = FTP(ip)
x = ftp.login()
if 'ogged' in str(x):
print '[+] Bingo ! we got a Anonymous FTP server IP: ' +ip
except:
return
def main ():
global ip
for ip in ipcalc.Network('10.0.2.0/24'):
ip = str(ip)
t = Thread (target = X, args = ip)
t.start()
main ()
When constructing Thread
objects, args
should be a sequence of arguments, but you are passing in a string. This causes Python to iterate over the string and treat each character as an argument.
You can use a tuple containing one element:
t = Thread (target = X, args = (ip,))
or a list:
t = Thread (target = X, args = [ip])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With