MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / start_load_test

Method start_load_test

Scripts/Network Tools/Sod.py:513–567  ·  view source on GitHub ↗

Start comprehensive load testing

(self, test_type)

Source from the content-addressed store, hash-verified

511 time.sleep(1)
512
513 def start_load_test(self, test_type):
514 """Start comprehensive load testing"""
515 if not self.target_ip:
516 print(f"{Colors.RED}[!] Please configure target first!{Colors.RESET}")
517 return False
518
519 print(f"{Colors.GREEN}[+] Starting {test_type} load test on {self.target_ip}:{self.target_port}{Colors.RESET}")
520 print(f"{Colors.YELLOW}[!] Duration: {self.duration}s | Threads: {self.threads} | Rate: {self.rate_limit} req/s/thread{Colors.RESET}")
521
522 # Reset stats
523 self.stats = {
524 'requests_sent': 0,
525 'requests_successful': 0,
526 'requests_failed': 0,
527 'total_bytes': 0,
528 'start_time': datetime.now(),
529 'end_time': None,
530 'response_times': []
531 }
532
533 self.running = True
534
535 test_methods = {
536 "HTTP Load": self.realistic_http_flood,
537 "WebSocket Load": self.websocket_load_test,
538 "Database Simulation": self.database_query_simulation,
539 "File Upload": self.file_upload_simulation,
540 "Mixed Workload": self.mixed_workload_test,
541 }
542
543 test_func = test_methods.get(test_type)
544 if not test_func:
545 print(f"{Colors.RED}[!] Unknown test type!{Colors.RESET}")
546 return False
547
548 # Start system monitoring thread
549 system_thread = threading.Thread(target=self.system_monitor)
550 system_thread.daemon = True
551 system_thread.start()
552
553 # Start test threads
554 threads = []
555 for i in range(self.threads):
556 thread = threading.Thread(
557 target=test_func,
558 args=(self.target_ip, self.target_port, self.duration)
559 )
560 thread.daemon = True
561 threads.append(thread)
562 thread.start()
563
564 # Monitor progress
565 self.monitor_test()
566
567 return True
568
569 def system_monitor(self):
570 """Monitor system resources during test"""

Callers 1

mainFunction · 0.95

Calls 3

monitor_testMethod · 0.95
printFunction · 0.85
startMethod · 0.45

Tested by

no test coverage detected