Reputation: 1603
Here is my code:
import urllib
import re
import requests
import httplib
import socket
from colorama import *
from time import gmtime, strftime
def hell():
hcon = raw_input(Fore.RED + Style.BRIGHT + "Website: ")
r = requests.get("http://" + hcon + "/phpmyadmin")
r2 = requests.get("http://" + hcon + "/pma")
if r.status_code == 404:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ not found!")
elif r:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ successfully found! %s /phpmyadmin") % (hcon)
elif r2:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ successfully found! %s /pma") % (hcon)
else:
print(strftime("[%H:%M:%S]", gmtime()) + " nothing found, sorry! try another website.")
hell()
As you can see, If the page /phpmyadmin or /pma exists on the selected website it will output that it was successfully found, If not it will say "nothing found etc etc.."
But I get this error: unindent does not match outer indentation level, I have never occurred this error in any of my previous python scripts.
I've tried to fix the indentation as much as I can but I don't think that will solve it, Can someone help?
Upvotes: -1
Views: 1320
Reputation: 27802
You need to fix the indentation of def hell()
:
import urllib
import re
import requests
import httplib
import socket
from colorama import *
from time import gmtime, strftime
def hell():
hcon = raw_input(Fore.RED + Style.BRIGHT + "Website: ")
r = requests.get("http://" + hcon + "/phpmyadmin")
r2 = requests.get("http://" + hcon + "/pma")
if r.status_code == 404:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ not found!")
elif r:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ successfully found! %s /phpmyadmin") % (hcon)
elif r2:
print(strftime("[%H:%M:%S]", gmtime()) + " /phpmyadmin/ successfully found! %s /pma") % (hcon)
else:
print(strftime("[%H:%M:%S]", gmtime()) + " nothing found, sorry! try another website.")
hell()
Upvotes: 0
Reputation: 280301
You have mixed spaces and tabs. Try opening your code in Notepad or something with an 8-space indentation level and see what it looks like. It definitely doesn't match what you've posted, or you'd be getting "unexpected indent" errors rather than unindent problems.
Upvotes: 0
Reputation: 25271
Copied from a comment since this is now answer-ish.
So the code you pasted is incomplete, so I can't give a direct fix for the error you're getting.
Your error typically shows up when you have a line indented by X spaces, then some indented by X+Y+Z spaces, and finally one indented by X+Y spaces. Whenever you dedent, Python requires you to go back to the same level as one of your previous ones. For example:
def foo():
print "hi!"
return 42
Notice that the return statement's indent is 2 spaces, but no previous line is indented by 2 spaces. This isn't allowed, and it needs to be indented out to 4 spaces, or the print statement moved back to line up at 2 spaces in.
Upvotes: 0
Reputation: 1360
In your case, the hell
method definition must be at the root indentation level.
Upvotes: 2