利用Python 破解类unix系统 /etc/shadow 文件hashed password

一个比较实用的脚本吧.
破解一些弱口令还行
其他的只能去md5相关网站交钱破解喽

还是要自备字典 和 待破解文件
password文件一定是从/etc/shadow 获取的哦

#!/usr/bin/env python
# coding=utf-8

#By LiT0

import crypt
import sys
from concurrent.futures import ThreadPoolExecutor

def testpasswd(user,crypt_pass,word):
    salt = crypt_pass.split('$')[2]
    insalt = '${}${}$'.format('6',salt)
    word = word.strip('\n')
    crypt_word = crypt.crypt(word,insalt)
    if crypt_pass == crypt_word:
        print ("[*] Successful Cracked user : {} ".format(user))
        print ("[+] Found Password: {}\n".format(word))
        return

def readpasswd():
    with open(sys.argv[1],'r') as passwd_file:
        for line in passwd_file:
            if ":" in line:
                user = line.split(':')[0]
                crypt_pass = line.split(':')[1].strip(' ')
                if len(crypt_pass) > 16:
                    with ThreadPoolExecutor(2) as Executor:
                        with open(sys.argv[2],'r') as dict_file:
                            for word in dict_file:
                                Executor.submit(testpasswd,user,crypt_pass,word)

    print ('[*] All Done!')

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print ("Usage:\n\t请准备好阴影文件和爆破字典\n\t如: ./nix_passwd.py password.txt dict.txt ")
        sys.exit(0)
    print ('[*] Runing... ...')
    readpasswd()
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值