Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import ftplib
- import os
- username = "ftp"
- password = "me@me.com"
- ftp_server_path = "/"
- def serverList(ftp_servers_file):
- fdesc = open(ftp_servers_file,"r")
- for line in fdesc.readlines():
- ftp_server = line.strip()
- suckFTP(ftp_server)
- def suckFTP(ftp_server):
- global username
- global password
- global ftp_server_path
- getFTP = ftplib.FTP(ftp_server, username, password)
- print "Getting listing from: %s" % ftp_server
- print "Using path: %s" % ftp_server_path
- getFTP.dir(ftp_server_path)
- print "End of listing from: %s\n" % ftp_server
- getFTP.close()
- if __name__ == '__main__':
- ftp_servers_file = "./ftpServers"
- serverList(ftp_servers_file)
- ------------------------------------------------------------------
- phantasm@patina:~/exploit-central/py/module3/m3s02$ cat ftpServers
- ftp.mozilla.org
- ftp.debian.org
- openbsd.org.ar
- ftp5.eu.openbsd.org
- ftp.crans.org
- ------------------------------------------------------------------
- phantasm@patina:~/exploit-central/py/module3/m3s02$ python getFTP.py
- Getting listing from: ftp.mozilla.org
- Using path: /
- -rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README
- -rw-r--r-- 1 ftp ftp 560 Sep 28 2007 index.html
- drwxr-xr-x 40 ftp ftp 4096 May 23 11:00 pub
- End of listing from: ftp.mozilla.org
- Getting listing from: ftp.debian.org
- Using path: /
- drwxr-xr-x 8 1176 1176 4096 May 23 21:05 debian
- End of listing from: ftp.debian.org
- Getting listing from: openbsd.org.ar
- Using path: /
- total 20
- drwxr-xr-x 2 1005 1005 512 Mar 20 2009 etc
- -rw-r--r-- 1 1005 1005 101 Apr 24 2009 index.html
- dr-xr-xr-x 3 1005 1005 512 Dec 3 2009 pub
- drwxr-xr-x 31 1005 1005 512 Aug 10 2011 pub2
- End of listing from: openbsd.org.ar
- Getting listing from: ftp5.eu.openbsd.org
- Using path: /
- total 4
- drwxr-xr-x 3 0 1 512 Aug 10 2007 pub
- End of listing from: ftp5.eu.openbsd.org
- Getting listing from: ftp.crans.org
- Using path: /
- End of listing from: ftp.crans.org
Add Comment
Please, Sign In to add comment