用Python构建匿名FTP扫描器
·
#!/usr/bin/python
#coding=utf-8
#Python中默认安装的ftplib模块定义了FTP类,其中函数有限,可用来实现简单的ftp客户端,用于上传或下载文件
import ftplib
def anonLogin(hostname):
try:
#设置变量
ftp = ftplib.FTP(hostname)
#ftp.login("user","password") 连接的用户名,密码
ftp.login('anonymous', 'what')
print '\n[*] ' + str(hostname) + ' FTP Anonymous Logon Succeeded.'
#退出ftp
ftp.quit()
return True
except Exception,e:
print '\n[-] ' + str(hostname) + ' FTP Anonymous Logon Failed.'
def main():
while True:
hostname = raw_input("Please enter the hostname: ")
anonLogin(hostname)
print
if __name__ == '__main__':
main()更多推荐



所有评论(0)