IndentationError:请求缩进块帮助

时间:2015-10-29 16:45:11

标签: python

运行我的python脚本时遇到问题 当我运行它时,我收到了这条消息

IndentationError: expected an indented block

这是我的代码

#!/usr/bin/env python
import hashlib
import sys

def main():
if len(sys.argv) < 2:

print "[ + ] Usage: %s <hash>" % sys.argv[0]

exit(0)

    commonStrings = [
        "Diaa",
        "Diab",
        "Mohammad",
        "test",
        "7amama",
        "sos",
        "lolo",
        "hacked",
        "try",
        "a_diaa_2007@yahoo.com",
        "secgeek",
        "lnxg33k",
        "diaa.diab.2012@gmail.com",
        "dia2diab@yandex.com",
        "dia2diab@yahoo.com"
        ]

    for i in commonStrings:
        if hashlib.md5(i).hexdigest() == sys.argv[1]:
        print "[ + ] OK i got it."
        print "[ + ] The hash value [ %s ] is the md5 of [ %s ]." % (sys.argv[1], i)
        exit(0)
    print "[ ! ] The hash not found on your own list."

if __name__ == "__main__":
    main()

1 个答案:

答案 0 :(得分:3)

这似乎是正确的缩进。

#!/usr/bin/env python
import hashlib
import sys

def main():
    if len(sys.argv) < 2:    
        print "[ + ] Usage: %s <hash>" % sys.argv[0]   
        sys.exit(0)

    commonStrings = [
        "Diaa",
        "Diab",
        "Mohammad",
        "test",
        "7amama",
        "sos",
        "lolo",
        "hacked",
        "try",
        "a_diaa_2007@yahoo.com",
        "secgeek",
        "lnxg33k",
        "diaa.diab.2012@gmail.com",
        "dia2diab@yandex.com",
        "dia2diab@yahoo.com"
    ]

    for i in commonStrings:
        if hashlib.md5(i).hexdigest() == sys.argv[1]:
            print "[ + ] OK i got it."
            print "[ + ] The hash value [ %s ] is the md5 of [ %s ]." % (sys.argv[1], i)
            sys.exit(0)

    print "[ ! ] The hash not found on your own list."

if __name__ == "__main__":
    main()