Closed nrathaus closed 1 week ago
This code change will also allow writing unit-test, today you cannot call this:
src.attacks.rfi.test_rfi('http://localhost:4280/vulnerabilities/fi/?page=PWN', post='')
To preform a test, as it uses args
which are coming from parsing the cmdline, which doesn't exist in unitest
I can provide a PR for these changes (moving args into a class, and fixing all the code that accesses that information)
@nrathaus Yeah, agreed on this. It would be nice if we can write simple tests like this? You can create a PR if you have the time, I will review it and hopefully merge it, if everything checks out! Thanks again!
I created a PR https://github.com/hansmach1ne/LFImap/pull/97
There are some conflicts due to my branch not being in sync with yours when I created it
I tried to fix most of them to make it easier to compare the changes
At the moment the constant calling to:
from src.utils.arguments import args
Is causing the code to have complexity that makes it impossible to:
args
is accessed as it doesn't know which arguments exist/don't existargs = parser.parse_args()
code is called and parameters areinit
I suggest to move the
arguments.py
code so that is not all sitting in the 'global' rather inside a class,init
once when the code starts, stores the variables inside adict
rather thanargs
or insideself
values of this class, pass this newly created class around to whoever needs it or still use it as a global (but prevent its init from being called on every import)