Jacob Bender wrote:
Dear Python Tutors,

I was wondering how to break into my one program I made using brute force
methods. Here's the code:

password = "Helloworld"
try= raw_input("What's the password?")
while try != password:
     try = raw_input("Incorrect, what's the password?")

I know how to do it in the command line, but not through another program.
Generating the random tries for the password isn't the issue, but entering
the password(s) in between the two programs is an issue because I don't know
how to make programs communicate through raw inputs.


Normally you would do this by redirecting standard input. What operating system are you using? In Linux, you would do something like:


# run script foo.py taking input from the output of bar.py
foo.py < bar.py


at the shell. I don't know how to do it in DOS.

However, I don't know if this will actually work for raw_input. It may not. Try it and see.

Perhaps a better way is to have your program accept a user name and password on the command line, and only prompt for them if not given. Then you can say:

foo.py --user=fred --password="y8Mr3@hzi"


Hope this helps,



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to