MHDDoS icon indicating copy to clipboard operation
MHDDoS copied to clipboard

Update start.py - Proxy Check Profress, Recommend Tool

Open DanHouseman opened this issue 1 year ago • 0 comments

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 Counter object and a Lock to safely update and display progress from multiple threads.
  • Iterates over the proxies using a ThreadPoolExecutor and 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.info method to output messages like "Checked x/y proxies".

Integration with handleProxyList

  • Replaced the original proxy checking call with check_proxies_with_progress to 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 RECOMMEND within the ToolsConsole class.
  • 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 recommend static method to the ToolsConsole class.
  • Utilizes the psutil library to retrieve system information:
    • CPU core count (cpu_count).
    • Total physical memory (virtual_memory).
  • 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 runConsole method to include the RECOMMEND command.
  • 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.info for standard messages and logger.debug for 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).

DanHouseman avatar Sep 20 '24 16:09 DanHouseman