hansmach1ne / LFImap

Local File Inclusion discovery and exploitation tool
Apache License 2.0
214 stars 32 forks source link

Cannot init pip package bad main() call logic -> from lfimap import main #102

Closed hansmach1ne closed 3 months ago

hansmach1ne commented 3 months ago

└─$ python3
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

>>> from lfimap import main
>>> main()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kali/Desktop/leet_toolz/LFImap/lfimap.py", line 264, in main
    if args['param'] in config.url:
                        ^^^^^^^^^^
AttributeError: module 'src.configs.config' has no attribute 'url'. Did you mean: 'urls'?

Issue background:

When running python3 lfimap.py -h, interpreter looks for if(__name__ == "__main__") and enter this block, however once the program is imported as a module and main() is called (like pip configuration does/requires), it will error out, because checkArgs is not called at all in that case:

# Check command-line arguments
if not checkArgs():
    sys.exit(-1)
hansmach1ne commented 3 months ago

Should now be fine to init pip:

Python 3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lfimap import main
>>> main()
[-] Mandatory arguments ('-U', '-F' or '-R') unspecified. Refer to help menu with '-h' or '--help'.