0

Why doesn't this work? I input windows/meterpreter/reverse_tcp and it returns the error...again

def shellcode():
    os.system("clear")
    print style
    print green + "  [+]Your Choose 4 | C Type Format - ShellCode Generate"
    print style
    print payload_types
    print ' '
    payload_choose = raw_input(time + white + "Choose Payload > ")
    while (payload_choose != "windows/meterpreter/reverse_tcp" or "linux/x86/meterpreter/reverse_tcp"):
        print "[-]error"
        payload_choose = raw_input(time + white + "Choose Payload > ")
    print "ok"

1 Answer 1

4

This line:

while (payload_choose != "windows/meterpreter/reverse_tcp" or "linux/x86/meterpreter/reverse_tcp"):

probably doesn't do what you want. I think you probably meant this?

while payload_choose != "windows/meterpreter/reverse_tcp" and payload_choose != "linux/x86/meterpreter/reverse_tcp":

Further explanation

This expression:

a or b

means "a is true or b is true".

This expression:

foo != 'hello' or 'goodbye'

means "(foo != 'hello') is true or 'goodbye' is true". In Python, a non-empty string is considered "truthy", so your original while loop condition is always true.

Sign up to request clarification or add additional context in comments.

3 Comments

one of this.. windows/meterpreter/reverse_tcp or linux/x86/meterpreter/reverse_tcp if i put and must to choose linux/x86/meterpreter/reverse_tcp and windows/meterpreter/reverse_tcp :/
@Inj3ct0r What? I don't understand what you're saying.
So fix your indentation? Make sure you didn't mix tabs and spaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.