python-security/pyt

Add a "don't ask me anymore" option to the interactive mode

KevinHock opened this issue ยท 3 comments

this is where we ask for input in vulnerabilities.py

Hi, can I try to solve this issue ?

Hi prithvisingh, definitely ๐Ÿ‘๐Ÿ™

I'll try to make the issue description etc. better later today, but for understanding the code a bit more see this pr #81 :)

Hi @prithvisingh18
So in vulnerabilities.py

We can change it here when the user types stop
https://github.com/python-security/pyt/blob/master/pyt/vulnerabilities/vulnerabilities.py#L304-L310
e.g. change it to Is the return value of {} with tainted argument "{}" vulnerable? (Y/n/stop)
and check for if user_says.startswith('s'):

This seems like it can be solved in 1 of 3 ways

  • make ui_mode an object, not an int (so that we can change it by reference)
  • use a global variable everywhere we currently use it (so that we can set the global to the variable)
  • raise an exception, catch the exception and then proceed with a different value

These are all kind of ugly, what do you think is nice? :)
I kind of think making it an object would be the best way, b/c trying to catch an exception in the loop, and still keeping what the user previously entered via y and n will lead to ugly code.