MHDDoS
MHDDoS copied to clipboard
Update start.py - Proxy Check Profress, Recommend Tool
Multiple Updates to start.py Script
Proxy Evaluation Progress Reporting
What Was Added
- Implemented a progress reporting mechanism during proxy evaluation to display the number of proxies checked out of the total number of proxies.
- Provides real-time feedback on the status of the proxy checking process.
Implementation Details
New Function check_proxies_with_progress
- A new function wrapper around the existing proxy checking logic.
- Uses a
Counterobject and aLockto safely update and display progress from multiple threads. - Iterates over the proxies using a
ThreadPoolExecutorand updates the progress after each proxy is checked.
Logging Progress
- Added logging statements within a locked context to ensure thread safety.
- Progress is logged using the
logger.infomethod to output messages like "Checked x/y proxies".
Integration with handleProxyList
- Replaced the original proxy checking call with
check_proxies_with_progressto incorporate progress reporting. - Ensured that the total number of proxies and the threads count are appropriately passed to the function.
System Evaluation Tool
What Was Added
- Introduced a new console command
RECOMMENDwithin theToolsConsoleclass. - This command evaluates the system's CPU and memory to recommend optimal performance settings, such as the maximum number of threads to use for attacks.
Implementation Details
New Method recommend
- Added a
recommendstatic method to theToolsConsoleclass. - Utilizes the
psutillibrary to retrieve system information:- CPU core count (
cpu_count). - Total physical memory (
virtual_memory).
- CPU core count (
- Calculates the recommended number of threads based on:
- The number of CPU cores (e.g., 100 threads per core).
- Adjustments if the total memory is less than a certain threshold (e.g., 4 GB).
Console Integration
- Updated the
runConsolemethod to include theRECOMMENDcommand. - When the user types
RECOMMEND, the script outputs the system information and recommendations.
Additional Adjustments and Fixes
Improved Thread Safety
- Ensured that shared resources are accessed in a thread-safe manner using locks.
- Prevented race conditions during progress updates.
Logging Enhancements
- Adjusted logging levels to ensure that progress messages and recommendations are visible to the user.
- Used
logger.infofor standard messages andlogger.debugfor more detailed output.
Error Handling
- Enhanced error handling during proxy checking to catch exceptions without stopping the entire process.
- Logged exceptions for debugging purposes.
Optimizations
- Adjusted the frequency of progress updates to prevent overwhelming the console with messages.
- Used a progress interval to log updates at certain checkpoints (e.g., every 1% of proxies checked).