可匿名登录FTP服务器扫描文件列表python程序
2016-09-26 09:15
537 查看
最近在Freebuf上看到有个人扫描了全球的ip地址,扫描出近80万可匿名登录的FTP服务器,下载下来后用python写了一个扫描文件列表的程序,不过效率比较慢,只当学习一下,没准会找到比较有意思的东西呢。
代码如下:
刚考试扫描的时候经常会出现卡死的情况,所以加了个socket连接默认时长socket.setdefaulttimeout(4),默认4秒没反应就跳过。
代码如下:
import ftplib import threading import time import socket def anonyLogin(ftpUrl,FileDest): dirList = [] hostnames = open(ftpUrl, 'r') OutPut = open(FileDest,'w+') socket.setdefaulttimeout(4) for line in hostnames: hostname = line.strip('\n').strip('\r') try: ftp = ftplib.FTP(hostname) ftp.login('anonymous') print 'Succeed:'+str(hostname) except Exception,e:continue try: dirList = ftp.nlst() ftp.quit() except Exception,e: dirList = [] print str(e) continue if dirList != []: print str(dirList) OutPut.write(hostname + ':\n' + str(dirList) + '\n') OutPut.close() hostnames.close() return th = threading.Thread(target=anonyLogin,args=('openftp2.txt','openftp_file2.txt')) th.start()
刚考试扫描的时候经常会出现卡死的情况,所以加了个socket连接默认时长socket.setdefaulttimeout(4),默认4秒没反应就跳过。
相关文章推荐
- linux下ftp服务器vsftpd-允许匿名用户上传文件
- php实现从ftp服务器上下载文件树到本地电脑的程序
- 从ftp服务器上下载文件树到本地电脑的php程序
- python文件操作(1)--扫描某目录下的文件列表信息存入日志文件
- 登录多个ftp服务器下载文件
- VC程序下载FTP服务器上的文件
- 使用Apache 的 FTP Client获取FTP服务器上的文件列表FTP response 421 received.Server closed connection问题的解决
- 获取ftp文件列表的perl程序
- FTPClient.cs (采用定时器上传ftp服务器文件的时候出现问题,程序间断性崩溃,求帮助!!)
- python 匿名ftp扫描
- 用python通过ftp将文件上传到服务器
- linux64位系统ftp服务器匿名用户登录问题
- 获取ftp服务器文件和目录列表
- python 从远程服务器下载日志文件的程序
- python实现从ftp服务器下载文件的方法
- python实现从ftp服务器下载文件的方法
- python通过ftplib登录到ftp服务器的方法
- python通过ftplib登录到ftp服务器的方法
- 使用Apache 的 FTP Client获取FTP服务器上的文件列表FTP response 421 received.Server closed connection问题的解决
- ubuntu 14.04 VSFTPD 匿名FTP服务器 配置文件