Define raw_input() for Python 3

In Python 3, __raw_input()__ has been replaced with __input()__
* Also added __.strip()__ to input statements to deal gracefully with leading or trailing spaces.
This commit is contained in:
cclauss 2018-06-02 09:43:44 -04:00 committed by GitHub
parent 1c160e4544
commit 9be4666773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,11 @@ from __future__ import print_function
import socket, subprocess, sys import socket, subprocess, sys
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
subprocess.call('clear', shell=True) subprocess.call('clear', shell=True)
print('''\t print('''\t
@ -25,9 +30,9 @@ print('''\t
''') ''')
target_ip = raw_input("\t Please enter the IP address of the target host:") target_ip = raw_input("\t Please enter the IP address of the target host:").strip()
port_1 = int(raw_input("\t Enter the first port to scan:\t")) port_1 = int(raw_input("\t Enter the first port to scan:\t").strip())
port_2 = int(raw_input("\t Enter the last port to scan:\t")) port_2 = int(raw_input("\t Enter the last port to scan:\t").strip())
print("~"*50) print("~"*50)
print("\n ...scanning target now. ", target_ip) print("\n ...scanning target now. ", target_ip)
print("~"*50) print("~"*50)