Solved

Problem while running python script

Posted on 2013-01-19
9
408 Views
Last Modified: 2013-02-10
I have written a program in python, while i am executing it gives a error.here is the last lines of program where i am getting error.

if__name__  == "__main__"
    main()

root#./abc.py
File "./abc.py", line 23
   main()
   ^
IdentationError: unexpected ident
0
Comment
Question by:pawanopensource
  • 5
  • 4
9 Comments
 

Author Comment

by:pawanopensource
ID: 38796802
i think its a problem replated to spacing in program, i am not able to figure out though.
0
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 38796933
You're missing a colon at the end of your if statement.

if__name__  == "__main__"
    main()

Open in new window


should be:

if__name__  == "__main__":
    main()

Open in new window

0
 

Author Comment

by:pawanopensource
ID: 38796951
here is the script and error screen short. plz let me know what mistake i have made.
Python-Script.jpg
Python-Script-Error.jpg
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
LVL 25

Expert Comment

by:clockwatcher
ID: 38797592
Ok... that's not the same error that you posted previously, but the error is pretty self explanatory.  It can't open the file passwords.txt which means either the file doesn't exist in your current directory or if it does, the user account that you're running as doesn't have permissions to it.
0
 

Author Comment

by:pawanopensource
ID: 38797715
Yes you are right. passwords.txt dosent exist.

1 How to make password.txt in current directory
    vi /etc/passwd
     abc:x:1000:1000:UBUNTU,,,:/home/abc:/bin/bash

2 How to give permission to the user abc.

Thx
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 38797744
You can copy it there:

  cp /etc/password ./passwords.txt

To give read permission to it:

  chmod o+r ./passwords.txt

And I'm going to guess at your next question and tell you that you'll need a dictionary file in the same directory called dictionary.txt that contains a password guess per line.
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 38797750
And lastly... you're using a system that is using shadow passwords.  Your /etc/passwd file doesn't contain the hashed passwords in it.  You'd probably want to run it against /etc/shadow.
0
 

Author Comment

by:pawanopensource
ID: 38797755
i have created passwords.txt in the python 2.7 directory. when i am running this program there is no error. but it should prompt password found for user, which it is not doing so.
Python-Script-Error--2.jpg
0
 

Author Comment

by:pawanopensource
ID: 38797762
bro plz guide me, i know i am asking very basic things but plz consider it, as i am not a  
python guy or a programmer,i am kid in python or any programming language.

path where python is stored

root# cd /usr/lib/python2.7/passwdcrack.py

Plz guide me according to this path,

how to run /etc/passwd against /etc/shadow
how to copy passwords.txt
how to make dictionary.txt

Thx a ton
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Introduction On September 29, 2012, the Python 3.3.0 was released; nothing extremely unexpected,  yet another, better version of Python. But, if you work in Microsoft Windows, you should notice that the Python Launcher for Windows was introduced wi…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 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