#!/usr/bin/env python
# -*- coding:UTF-8 -*- import crypt
import sys # 哈希密码的前两位就是盐的前两位,这里我们假设盐只有两位。
# 程序分两部分,一部分是打开字典,另一部分是哈希匹配密码 #standard DES, two salt
def desPass(cryptpass):
#get salt from the front place
saltf = cryptpass[0:2]
return saltf #for $6$
def sha512Pass(cryptpass):
saltf = "$6$"+cryptpass.split("$")[2]
return saltf #for $5$
def sha256Pass(cryptpass):
saltf = "$5$"+cryptpass.split("$")[2]
# saltf = "$5$rounds=5000$anexamplestringf"
return saltf def main():
banner = '''
python CrackPass.py 5
one params is type for you are cracking
0 ---- standard DES for 2 salt
5 ---- sha256 crypt $5$salt$secret
6 ---- sha512 crypt $6$salt$secret salt contains $5$salt
if $salt contain "$",will cause inaccuracy. Maybe you need set the salt by your hand,for example:# saltf = "$5$rounds=5000$anexamplestringf"
'''
print banner
method = sys.argv[1]
passfile = open('Password','r')
#从文件中一行一行读取
for line in passfile.readlines():
cryptpass = line.strip()
print "Cracking Password For: %s"%cryptpass #select type
if method == "":
salt = desPass(cryptpass)
elif method == "":
salt = sha512Pass(cryptpass)
elif method == "":
salt = sha256Pass(cryptpass)
print salt
dictfile = open('dictionary','r')
for word in dictfile.readlines():
word = word.strip('\n')
cryWord = crypt.crypt(word,salt) if cryptpass == cryWord:
print "Found passwd: %s"%word
print "ok"
return
print "Password not found!" if __name__ == '__main__':
main()

现在只写了$6$  $5$开头的和一种普通的DES两位盐加密的

爆破linux一般用¥6¥

注意一般密文由3部分组成,以”$”分隔,第一部分为ID,第二部分为盐值,第三部分为加密密文

真正的盐值包括ID部分,我上面判断salt是根据$分割,默认是密文中只有三个$

有时salt中本来就含有$,

这时就需要自己指定salt了,saltf = "$5$rounds=5000$anexamplestringf"

可以观察出来,观察不出来,就多尝试

我的  QQ921658495  希望与大家交流

爆破linux密码 $6$3uwqC9JI$d9iPRmTDAoXs/IbsplxS3iyeErHqw7fUycacXNHyZk1UCSwFEydl515/zXN7OEwHnyUaqYcNG的更多相关文章

  1. 爆破root密码hash John the Ripper和hydra爆破ssh密码

    官方网站:http://www.openwall.com/john/ 下载:wget http://www.openwall.com/john/j/john-1.8.0.tar.gz 解压:tar - ...

  2. 使用单用户模式破解Linux密码

    使用单用户模式破解Linux密码 特别说明:在实际工作应用中,安装Linux操作系统必须设置装载口令,否则很容易被破解. 1.使用reboot指令重启Linux操作系统 2.在进入操作系统数秒时,单击 ...

  3. 使用John the ripper工具来尝试破解Linux密码

    这篇文章主要介绍了使用John the ripper工具来尝试破解Linux密码的方法,这款工具可能主要被用来破解系统用户的密码以获得文件操作权限,需要的朋友可以参考下 John有别于Hdra之类的工 ...

  4. 修复linux密码

    To reset the root password of your server, you will need to boot into single user mode. Access the M ...

  5. Python 破解Linux密码

    简介:因为Linux的密码都是加密过的(例如:$6$X.0bBN3w$NfM7YYHevVfCnZAVruItAEydaMJCF.muefZsxsgLK5DQoahW8Pqs1BSmoAFfi5J/b ...

  6. 忘记linux密码

    http://blog.163.com/xygzlyq@126/blog/static/22585899200810471512530/

  7. 使用sha512算法加密linux密码

    查看当前主机的加密算法: [root@realserver ~]# authconfig --test |grep hashing password hashing algorithm is sha5 ...

  8. 一条命令修改Linux密码

    方法一.直接使用passwd命令 /bin/echo newpass|/usr/bin/passwd --stdin username *注:该方式只适用于红帽系操作系统,比如centos,redha ...

  9. python多线程爆破压缩包密码

    import zipfile from threading import Thread #多线程库 import optparse #选定字典或者文件 def extractFile(zfile,pa ...

随机推荐

  1. HDU3746 Teacher YYF 题解 KMP算法

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3746 题目大意:给你一个串 \(s\) ,要求 \(s\) 的开头或结尾添加最少的字符,使得添加后的串 ...

  2. 只要是使用函数file_get_contents访问 https 的网站都要开启

    使用file_get_contents();报错failed to open stream: Unable to find the socket transport "ssl" - ...

  3. 禁用GPU版本TensorFlow,切换到CPU版本TensorFlow。

    #禁用gpu版本TensorFlow,因为CUDA号码从0开始,这里直接让CUDA使用-1的GPU,自然就无法使用gpu了. 代码前面加入: import osos.environ["CUD ...

  4. Python--day23--面向对象思想求正方形面积

  5. java多异常处理

    声明异常时尽可能声明具体异常类型,方便更好的处理; 方法声明几个异常就对应有几个catch块; 若多个catch块中的异常出现继承关系,父类异常catch块放在最后; 在catch语句块使用Excep ...

  6. webpack打包前删除之前的所有文件

    安装插件: npm install --save-dev clean-webpack-plugin 在webpack.prod.conf.js 中引入:  const { CleanWebpackPl ...

  7. ZR979B. 【十联测 Day 9】唯一睿酱

    ZR979B. [十联测 Day 9]唯一睿酱 题目大意: 给定一个数组\(r_i\),表明对于第\(i\)个数来说,他是\([max(1,i - r_i),min(n,i+r_i)]\)中最大的,求 ...

  8. Makefile记录

    需要把sum.c编译汇编成可执行程序zzj zzj:sum.o gcc -o zzj sum.osum.o:sum.c gcc -c -o sum.o sum.cclean: rm -rf *.o z ...

  9. slim的中间件

    slim中间件的作用简单来说就是过滤数据,request过来的数据要经过中间件才能到达内部,然后内部数据要到达外部的时候,也要经过中间件,正常通过才能到达外部

  10. hibernate 大对象类型的hibernate映射

    在 Java 中, java.lang.String 可用于表示长字符串(长度超过 255), 字节数组 byte[] 可用于存放图片或文件的二进制数据. 此外, 在 JDBC API 中还提供了 j ...