UNIX口令破解
1.程序运行需求:

其中dictionary.txt文件为破解口令的字典文件,passwords.txt文件为临时存放UNIX系统密码的文件

2.程序源码:
import crypt
# 以hash方式加密的unix口令,的一般形式为:HXajgneuer/jids 其中前两位“HX”一般称为salt ,剩下的字符不影响哈希结果
# salt是此哈希的盐值,长度是8位,超过8的后面的位数将不影响哈希的结果。
# 在正常情况下,进行加密的时候,这个盐值是随机字符串。
def testPass(cryptPass):
# 根据字典通过crypt函数判断密码
salt = cryptPass[0:2] # 读哈希值得前两位
dictFile = open('dictionary.txt','r')
for word in dictFile.readlines():
word = word.strip('\n') # 清除头尾空格,回车符等
# print(word,salt)
cryptWord = crypt.crypt(word,salt) #使用字典数据利用crypt函数构造密码
# print(cryptWord,cryptPass)
if cryptWord==cryptPass:
print("[+] Found Fassword: " + word + "\n")
else:
print("[-] PassWord Not Find !\n") def main():
passFile = open('passwords.txt')
for line in passFile.readlines():
if ":" in line:
user = line.split(':')[0] #将password中的数据以 “:” 分为user和password两部分,此为user部分
cryptPass = line.split(':')[1].strip('\n') #此为password部分
print("[*] Cracking Password For: "+user)
testPass(cryptPass) #调用检测比对函数 if __name__ == '__main__':
main()

最新文章

  1. 攻城狮在路上(陆)-- 配置hadoop本地windows运行MapReduce程序环境
  2. Modern C++ CHAPTER 2(读书笔记)
  3. atitit  opencv apiattilax总结 约500个函数 .xlsx
  4. 【R】如何确定最适合数据集的机器学习算法 - 雪晴数据网
  5. telnet: connect to address 127.0.0.1: Connection refused
  6. npm 模块常用命令
  7. Linux下mongodb的安装及启动
  8. 1、JS的数据类型
  9. unity学习网站汇总
  10. vim中不能使用“+y拷贝
  11. 邓白氏编码(duns number)申请入口的路径-苹果开发者申请必
  12. 数据结构(树链剖分,堆):HNOI 2016 network
  13. android 自定义圆形进度条
  14. 在ASP.NET Core下使用SignalR技术
  15. ion-scroll zooming="true" android端无法缩放的问题
  16. 服务器http://localhost:8080要求用户输入用户名和密码
  17. javaScript中闭包的工作原理
  18. ubuntu使任何地方右键都能打开terminal
  19. Java集合框架——jdk 1.8 ArrayList 源码解析
  20. Linux内核分析——可执行程序的装载

热门文章

  1. POI做题笔记
  2. js上传文件夹
  3. http communication process
  4. Python回归分析五部曲(三)—一元非线性回归
  5. 2017 ZSTU寒假排位赛 #6
  6. UVA 1393 Highways,UVA 12075 Counting Triangles —— (组合数,dp)
  7. chromedriver安装
  8. CISCO实验记录三:CDP邻居发现
  9. ios真机调试教程(不上架App Store安装到手机)
  10. 使用pyinstaller 打包python程序