()
| 427 | # grab the interface ip address |
| 428 | # |
| 429 | def grab_ipaddress(): |
| 430 | try: |
| 431 | rhost = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
| 432 | rhost.connect(('google.com', 0)) |
| 433 | rhost.settimeout(2) |
| 434 | revipaddr = rhost.getsockname()[0] |
| 435 | rhost = raw_input(setprompt("0", "IP address or URL (www.ex.com) for the payload listener (LHOST) [" + revipaddr + "]")) |
| 436 | if rhost == "": rhost = revipaddr |
| 437 | |
| 438 | except Exception: |
| 439 | rhost = raw_input(setprompt("0", "Enter your interface/reverse listener IP Address or URL")) |
| 440 | |
| 441 | if validate_ip(rhost) == False: |
| 442 | while 1: |
| 443 | choice = raw_input(setprompt(["2"], "This is not an IP address. Are you using a hostname? [y/n] ")) |
| 444 | if choice == "" or choice.lower() == "y": |
| 445 | print_status("Roger that ghostrider. Using hostnames moving forward (hostnames are 1337, nice job)..") |
| 446 | break |
| 447 | else: |
| 448 | rhost = raw_input(setprompt(["2"], "IP address for the reverse connection [" + rhost + "]")) |
| 449 | if validate_ip(rhost) == True: break |
| 450 | else: |
| 451 | choice = raw_input(setprompt(["2"], "This is not an IP address. Are you using a hostname? [y/n] ")) |
| 452 | if choice == "" or choice.lower() == "y": |
| 453 | print_status("Roger that ghostrider. Using hostnames moving forward (hostnames are 1337, nice job)..") |
| 454 | break |
| 455 | |
| 456 | # rhost return when verified |
| 457 | return rhost |
| 458 | |
| 459 | # |
| 460 | # cleanup old or stale files |
no test coverage detected