This command-line tool is built to detect URL addresses within files located in a designated directory. It supports scanning various file types such as .py
, .yml
, .yaml
, .txt
, .cfg
, .ini
, and more. All discovered URL addresses are logged in a CSV file.
To execute link_scanner
, use the following command:
python linkscaner.py --dirpath path_to_dir_to_scan --output output.csv
If you want to customize it a bit you can use all args:
python linkscaner.py --dirpath your_directory --output output.csv --extensions .py,.yml,.yaml,.txt,.cfg,.ini --regex https?://\S+
The resulting CSV file includes the discovered URLs and their respective file paths.
URL | File |
---|---|
http: //imnotscamlink | C://stable/and/secure/software.py |
--dirpath
: Directory where the scanning will take place.--output
: The name of the CSV file for storing the scan results.--extensions
: List of file extensions to be scanned, separated by commas.--regex
: Regular expression for identifying URL addresses.
- Use the command-line arguments to specify the scanning parameters.
- Ensure you have Python 3.x installed.
- Example command to execute the script is provided above.
The 'site-packages' directory contains third-party packages installed in Python. To locate it, follow these steps:
- Activate your environment or skip it if you use system python
- As suggested here run
this will print out your current python site-packages dir
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
- Locate particular directory you want to scan and actually apply linkscanner.py to it
- Analyze .csv file for some strange references and then check source code for suspicious actions.
This software is released to the public domain without any license restrictions.
This README was created with the assistance of OpenAI's ChatGPT, a large language model. You can learn more about it here