Last active
February 12, 2018 05:17
-
-
Save garyconstable/be2a2636e273f9c95f88 to your computer and use it in GitHub Desktop.
Python Anonymous FTP Scanner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Anonymous FTP Scanner - with GUI | |
''' | |
try: | |
from Tkinter import * | |
except ImportError: | |
from tkinter import * | |
import ftplib | |
import optparse | |
''' | |
Root frame | |
''' | |
root = Tk() | |
root.title("FTP Scanner") | |
root.resizable(width=FALSE, height=FALSE) | |
root.geometry(str(320)+'x'+str(140)) | |
root.attributes('-alpha', 0.9) | |
''' | |
l2 string var | |
''' | |
var = StringVar() | |
''' | |
Anon login | |
''' | |
def anonLogin(hostname): | |
global var | |
try: | |
ftp = ftplib.FTP(hostname) | |
ftp.login('anonymous', '[email protected]') | |
msg = ('\n[*] ' + str(hostname) + ' FTP Anonymous Login Succeeded.') | |
var.set(msg) | |
print(msg) | |
ftp.quit() | |
return True | |
except Exception as e: | |
msg = ('\n[*] ' + str(hostname) + ' FTP Anonymous Login Failed.') | |
var.set(msg) | |
print(msg) | |
return False | |
''' | |
label | |
''' | |
l1 = Label(root, text="Enter hostname or IP") | |
l1.pack(); | |
''' | |
Entry | |
''' | |
hostname = StringVar() | |
e1 = Entry(root, bd=5, textvariable=hostname) | |
e1.pack(); | |
''' | |
button | |
''' | |
b = Button(root, text="Click me...", command= lambda: anonLogin( e1.get() ) ) | |
b.pack(); | |
''' | |
label | |
''' | |
l2 = Message( root, textvariable=var, width=300 ) | |
l2.pack(); | |
''' | |
frame loop | |
''' | |
root.mainloop() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Anonymous FTP Scanner | |
''' | |
import ftplib | |
import optparse | |
def anonLogin(hostname): | |
try: | |
ftp = ftplib.FTP(hostname) | |
ftp.login('anonymous', '[email protected]') | |
print('\n[*] ' + str(hostname) + ' FTP Anonymous Login Succeeded.') | |
ftp.quit() | |
return True | |
except Exception as e: | |
print('\n[*] ' + str(hostname) + ' FTP Anonymous Login Failed.') | |
return False | |
def main(): | |
parser = optparse.OptionParser('python ftp-scanner.py -H <target host>') | |
parser.add_option('-H', dest="tgtHost", type="string", help='Specify target host') | |
(options, args) = parser.parse_args() | |
host = options.tgtHost | |
if host == None: | |
print(parser.usage) | |
exit(0) | |
anonLogin(host) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anonymous FTP Scanner