鱼C论坛

 找回密码
 立即注册
查看: 1658|回复: 2

[已解决]写爆破zip小程序遇到的问题

[复制链接]
发表于 2017-7-17 12:58:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
是这样的,我写了一个爆破zip的小程序,密码就在导入的字典中,可就是破解不了,我猜测我可能是不懂处理导进去的字符串,所以求各位大神指点一下.
zip压缩文件的密码是"1234"

程序能运行

下边是代码

  1. import zipfile, threading

  2. def fi(zFile, password):
  3.     try:
  4.         zFile.extractall(pwd=password)
  5.         return password
  6.     except:
  7.         pass
  8.    
  9. zfile = zipfile.ZipFile("1111.zip")

  10. pas = open("字典2.txt", "r")

  11. for line in pas.readlines():
  12.     password = line.strip('\n')
  13.     print (password)
  14.     guess = fi(zfile, password)
  15.     if guess:
  16.         print ("成功了 ")
  17.         print ("Password =", guess)


  18. """
  19.         t = threading.Thread(target=files, args=(zFile, password))
  20.         t.start()
  21. """
复制代码


然后我直接输入密码也行不通

  1. import zipfile, threading

  2. def fi(zFile, password):
  3.     try:
  4.         zFile.extractall(pwd=password)
  5.         return password
  6.     except:
  7.         pass
  8.    
  9. zfile = zipfile.ZipFile("1111.zip")

  10. i = fi(zfile, '1234')
  11. print (i)


  12. """
  13.         t = threading.Thread(target=files, args=(zFile, password))
  14.         t.start()
  15. """
复制代码
最佳答案
2017-7-17 16:11:03
import zipfile, threading

def fi(zFile, password):
    try:
        zFile.extractall(pwd=password.encode('utf-8'))
        return password
    except:
        pass
   
zfile = zipfile.ZipFile("字典2.zip",'r')

pas = open("字典2.txt", "r")

for line in pas.readlines():
        password = line.strip('\n')
       # print (password)
        guess= fi(zfile, password)
        if guess:
                print ("成功了 ")
                print ("Password =", guess)


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-7-17 16:11:03 | 显示全部楼层    本楼为最佳答案   
import zipfile, threading

def fi(zFile, password):
    try:
        zFile.extractall(pwd=password.encode('utf-8'))
        return password
    except:
        pass
   
zfile = zipfile.ZipFile("字典2.zip",'r')

pas = open("字典2.txt", "r")

for line in pas.readlines():
        password = line.strip('\n')
       # print (password)
        guess= fi(zfile, password)
        if guess:
                print ("成功了 ")
                print ("Password =", guess)


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-7-17 18:49:36 | 显示全部楼层
ba21 发表于 2017-7-17 16:11
import zipfile, threading

def fi(zFile, password):

nice  谢了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-29 21:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表