-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathFateh.py
65 lines (51 loc) · 2.17 KB
/
Fateh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from os import system
from termcolor import colored
from cores.tool_data import banner, CommandModes, main_help
from cores.shell_generator import ShellGenerator
from cores.autocompleter import CommandCompleter
from cores.functions import checking_requirements, ip_lookup
from cores.connection_handler import Handler
import os
class Fateh:
def __init__(self):
checking_requirements()
self.tool_banner = banner()
self.cwd = colored(os.getcwd(), "red")
self.available_mode_commands = CommandModes.server_commands
self.shell_gen = ShellGenerator()
def start(self):
completer = CommandCompleter(self.available_mode_commands)
while True:
command = completer.read_input(colored(f"server ~ {colored(os.getcwd(), 'green')}", "red"))
try:
if len(command) < 1:
print(colored("[-] Dont't play with me bro ~_~", "red"))
elif command == "generator":
self.shell_gen.command_prompot()
elif "geo_ip" in command:
_, ip = command.split()
ip_lookup(ip)
elif command == "exit" or command == "0":
exit(0)
elif "start_listener" in command:
command = command.replace("start_listener", "").strip().split()
if len(command) == 3:
s_type, host, port = command
Handler(s_type, host, int(port))
else:
print(colored("""
[-] You must enter 3 values ex:
start_listener tcp 127.0.0.1 8080
""", "red"))
elif "cd" in command:
_, directory = command.split(" ")
os.chdir(directory)
elif "_help" in command:
main_help("Server")
else:
system(command)
except Exception as error_message:
print(colored(f"[-] {error_message}", "red"))
if __name__ == '__main__':
my_server = Fateh()
my_server.start()