Closed v0idcat closed 3 years ago
A new replacement function is found. This function effectively replaces the inputimeout function in use before. Due to the way it works, only tiny changes to the existing program were required to fix this issue and remove the dependency. A real use example of before & after the changes is shown below. Only thing that's required now is further testing to make sure everything is working as intended and nothing is broken due to these changes.
BEFORE:
rerun_scan = inputimeout(prompt=f"{bcolors.BOLD}[*] Would you like to rerun the scan? y/N {bcolors.ENDC}", timeout = 30) # Setting input timeout
AFTER:
rerun_scan = tinput(f"{bcolors.BOLD}[*] Would you like to rerun the scan? y/N {bcolors.ENDC}", 30) # Setting input timeout
SOLUTION:
class TimeoutOccurred(Exception):
pass
def tinput(prompt, timeout): # This forces the program to only be usable on Linux
sys.stdout.write(prompt)
sys.stdout.flush()
ready, _, _ = select.select([sys.stdin], [],[], timeout)
if ready:
return sys.stdin.readline().rstrip('\n') # Expect stdin to be line-buffered
raise TimeoutOccurred```
Fully implemented. Should be working now, all that's required is some testing to make sure everything is working as intended.
'inputimeout' is a module that needs to be installed for the program to auto-run some commands incase the user is distracted at the time of request; this capability was added to insure enumeration is ongoing even without user input after a certain amount of time has passed.
Preferably this program should work out of the box. This is to further reduce time loss when using this software for the first time, at least. It also helps users to use it on freshly-installed OSes without having to install any extra modules they probably won't need for any other program.
This could help: https://stackoverflow.com/questions/15528939/python-3-timed-input
Another solution is provided here: https://www.semicolonworld.com/question/44145/python-3-timed-input
Documentation: https://docs.python.org/3/library/threading.html Search for "Timer Objects"