意外的unindent python

-6 python

下面的代码真的很烦我,我已经看了stackoverflow和谷歌但还没有找到任何东西,我是一个非常好的python程序员,还没有,直到现在,发现一个我无法处理的错误.

我已经尝试了一切,但这段代码给了我

IndentationError: unexpected unindent 
Run Code Online (Sandbox Code Playgroud)

这是奇怪的,因为正常的错误是"不期望的缩进",这意味着多次张贴其间距和我如何间隔它所以我经历了整个代码和nada相同的错误,我正确地放入四个空格,一切仍然.. . 没有.救命?

该脚本是出于安全原因和webapp.

#!/usr/bin/python

#!/usr/bin/python
#Greets:SEC4EVER Members.
import hashlib
import base64
import socket
print"""

___  ___ _    _____ _____
|  \/  || |  |_   _|_   _|
| .  . || |    | |   | |
| |\/| || |    | |   | |
| |  | || |____| |  _| |_
\_|  |_/\_____/\_/  \___/
v0.1
"""


def main():
 print '1 - SHA1  Decrypter'; print
print '2 - MD5  Decrypter'
print '3 - Base64 Decrypter'
print '4 - /etc/passwd users extractor'
print '5 - Port Scanner'
elect = input("Select :")

if select==1:
      sha1()
elif select==2:
      md5()
elif select==3:
      base64()
elif select==4:
      extr()
elif select==5:
      scanner()


def   sha1():
    try:
        sha1 = raw_input("\t\n\nSHA1 Hash:")
        dictionary = open("pwds.txt","r")

        for passwd in dictionary.read().split('\n'):
            if hashlib.sha1(passwd).hexdigest() == sha1:

                print("\n\t[OK]"+sha1+" : "+passwd+"\n")


        else:
            print "\n\tFailed; Password not found in dictionary"
            sha1()
    except(IOError):
        print "pwds.txt not found!"
main()
def md5():
    try:
        md5 = raw_input("\t\n\nMD5 Hash:")
        dictionary = open("pwds.txt","r")
        for passwd in dictionary.read().split('\n'):
            if hashlib.md5(passwd).hexdigest() == md5:
                print("\n\t[OK]"+md5+" : "+passwd+"\n")


        else:
            print "\n\tFailed; Password not found in dictionary"
            main()
    except(IOError):
        print "pwds.txt not found!"

def base64():
    try:
     code = raw_input('\n\nBase64:\n\n')
     deco = base64.b64decode(code)
     print '\nDecoded!:\n\n',deco,'\n'
     main()

     def extr():
      try:
       xer = raw_input("/etc/passwd content:")
       passwd_content = xer.split('\n')

       for line in passwd_content :
        y = line.find(':')
       print line[0:y]
       main()

       def scanner():
        try:
         sec4 =raw_input('IP Address:')
         for port in range(1,400):
          s0ck = socket.socket()
         s0ck.settimeout(0.5)
         ip = sec4
         response = s0ck.connect_ex((ip, port))
         if response:
          print ("%d\tclose" %port)
         else:
          print ("%d\topen" %port)
         s0ck.close()

if __name__ !== '__main__': main()
Run Code Online (Sandbox Code Playgroud)

ale*_*cxe 5

base64()函数中,您已经打开了多个try/except/finally块,但是您没有exceptfinally只有多个try语句.

此外,如果您打算继续成为"相当不错的python程序员",请使用4个空格进行缩进,并尝试遵循PEP8样式指南.