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

Class AdvancedLoadTester

Scripts/Network Tools/Sod.py:193–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 sys.exit(1)
192
193class AdvancedLoadTester:
194 def __init__(self):
195 self.config_file = "load_test_config.json"
196 self.target_ip = ""
197 self.target_port = 80
198 self.threads = 50
199 self.duration = 30
200 self.packet_size = 1024
201 self.rate_limit = 100 # Requests per second per thread
202 self.timeout = 10
203 self.user_agents = self.load_user_agents()
204 self.stats = {
205 'requests_sent': 0,
206 'requests_successful': 0,
207 'requests_failed': 0,
208 'total_bytes': 0,
209 'start_time': None,
210 'end_time': None,
211 'response_times': []
212 }
213 self.system_stats = {
214 'cpu_percent': 0,
215 'memory_percent': 0,
216 'network_io': (0, 0)
217 }
218 self.running = False
219 self.load_config()
220
221 def load_user_agents(self):
222 return [
223 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
224 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
225 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
226 "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/537.36",
227 ]
228
229 def load_config(self):
230 try:
231 if os.path.exists(self.config_file):
232 with open(self.config_file, 'r') as f:
233 config = json.load(f)
234 self.target_ip = config.get('target_ip', '')
235 self.target_port = config.get('target_port', 80)
236 self.threads = config.get('threads', 50)
237 self.duration = config.get('duration', 30)
238 except:
239 pass
240
241 def save_config(self):
242 config = {
243 'target_ip': self.target_ip,
244 'target_port': self.target_port,
245 'threads': self.threads,
246 'duration': self.duration
247 }
248 try:
249 with open(self.config_file, 'w') as f:
250 json.dump(config, f, indent=4)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected