Pennyw0rth / NetExec

The Network Execution Tool
https://netexec.wiki/
BSD 2-Clause "Simplified" License
2.91k stars 310 forks source link

refactoring to fix InterfaceError of DB #400

Open dazzgt opened 1 month ago

dazzgt commented 1 month ago

Issue topic #395 Summary When netexec find a lot of suitable target hosts it start too many calls to DB at once and because of nature of SQLite it leads to InterfaceError. The same can happen with much fewer hosts but get that timing is much harder. This PR don't fix IndexError mentioned in issue topic because it require dirty hack in current realization.

@AkechiShiro you can try to test it.

dazzgt commented 1 month ago

Updated. Accidentally delete reflect_tables from mssql database.

Marshall-Hallenbeck commented 1 month ago

@dazzgt nice, thanks for this PR. Have you run the e2e tests against any hosts?

dazzgt commented 1 month ago

@dazzgt nice, thanks for this PR. Have you run the e2e tests against any hosts?

I ran it against the same subnet where i found this bug. Also there some rdp, winrm, smb test hosts, so i tried to run this protocols too. All works perfectly fine

NeffIsBack commented 1 month ago

Thanks for the PR! Please also run Ruff against the code (install poetry -> poetry run python -m ruff check . --preview)

dazzgt commented 1 month ago

@NeffIsBack fixed two ruff errors.

dazzgt commented 3 weeks ago

If this solution is not good, then i open to suggestion how to fix it more elegant)

NeffIsBack commented 2 weeks ago

If this solution is not good, then i open to suggestion how to fix it more elegant)

Hi, I am currently on vacation so I am not reviewing PRs at the moment. There are also a lot of PRs still waiting for a review, but I will take a deeper look at this one when am back at home. At first glance it looks good though :)

AkechiShiro commented 2 weeks ago

I'm sorry I haven't been able to test this PR on my side, I'm lacking time to do so but I believe it's a good improvement