zoukankan      html  css  js  c++  java
  • Python for 循环的黑色料理

    Linux的口令破解

    Python for循环可以遍历任何序列的项目,如一个列表或者一个字符串。

    语法:

    for循环的语法格式如下:

    for iterating_var in sequence:
        statements(s)
     1 import crypt
     2 
     3 def testPass(cryptPass):
     4     slat = cryptPass[0:2]
     5 
     6 dictFile = open('dictionary.txt','r')
     7 for word in dictFile.readlines():
     8     word = word.strip('
    ')
     9     cryptWord = crypt.crypt(word,salt)
    10     if (cryptWord == cryptPass):
    11         print "[+] Found Password: "+word+"
    "
    12         return
    13 
    14     print"[-] Password Not Found. 
    "
    15     return
    16 
    17 def main():
    18     passFile = open('passwords.txt')
    19     for line in passFile.readlines():
    20         if ":" in line:
    21           user = line.split(':')[0]
    22           cryptPass = line.split(':')[1].split(' ')
    23           print "[*] Cracking Password for: "+user
    24           testPass(cryptPass)
    25 
    26 if __name__ == "__main__":
    27     main()
  • 相关阅读:
    springMVC静态资源
    MyBatis Generator
    使用springMVC时的web.xml配置文件
    Semaphore
    spring注解驱动--组件注册
    第1章 初始Docker容器
    docker面试整理
    第5章 运输层
    验证码
    带进度条的上传
  • 原文地址:https://www.cnblogs.com/Sam-r/p/5468763.html
Copyright © 2011-2022 走看看