dirsearch
dirsearch copied to clipboard
OSError: Too many open files
What is the current behavior?
Errors out during the scan with error - OSError: [Errno 24] Too many open files when ran with domain list as param.
python3 dirsearch.py -l domains.txt
Tried with various thread values as well but still the same error.
What is the expected behavior?
Should not error out instead directory scan should complete.
Any additional information?
Version: dirsearch v0.4.2 OS: macOS
Error:
[########### ] 56% 6427/11460 161/s job:89/1067 errors:220Traceback (most recent call last):
[ ] 0% 5/11460 161/s job:90/1066 errors:220 File "dirsearch.py", line 71, in
python3 dirsearch.py --version
output?
dirsearch v0.4.3
Please, try one of this bugfixes. If you can try both and give us feedback, far far better!
Increasing File Limit with ulimit
on macOS
Temporary Increase
- Open the Terminal.
- Execute
ulimit -n 4096
(or another higher number) to increase the file limit temporarily. - Run
dirsearch
in the same Terminal session.
Permanent Increase
- Open your shell configuration file (
.bashrc
,.bash_profile
,.zshrc
, etc.) in a text editor. - Add the line
ulimit -n 4096
at the end of the file. - Save the file and restart the Terminal.
Modifying dirsearch
Main Function in Python
Edit the Python Script
- Locate the
dirsearch.py
file. - Open it in a text editor.
Import the resource
Module
- Add
import resource
at the beginning of the script.
Set File Limit in Python
- Add these lines at the beginning of the
main
function indirsearch.py
:soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE) resource.setrlimit(resource.RLIMIT_NOFILE, (4096, hard))
@maurosoria I'm not sure but maybe we forgot to close files somewhere? I have a local work that will refactor the entire report-saving thing so let's hope that it will somehow fix this 🙏
yes @shelld3v that must be the issue!! Report manager should close the files but for some reason is not doing it. Perhaps a line missing in controller.py ? Does ReportManager has a proper destructor function?