-
Notifications
You must be signed in to change notification settings - Fork 0
/
S0cket.py
108 lines (87 loc) · 2.69 KB
/
S0cket.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import socket
import logging
import sys
import os
class Colors:
reset = "\033[0m"
bold = "\033[01m"
disable = "\033[02m"
underline = "\033[04m"
reverse = "\033[07m"
strikethrough = "\033[09m"
invisible = "\033[08m"
class Foreground:
black = "\033[30m"
red = "\033[31m"
green = "\033[32m"
orange = "\033[33m"
blue = "\033[34m"
purple = "\033[35m"
cyan = "\033[36m"
light_grey = "\033[37m"
dark_grey = "\033[90m"
light_red = "\033[91m"
light_green = "\033[92m"
yellow = "\033[93m"
light_blue = "\033[94m"
pink = "\033[95m"
light_cyan = "\033[96m"
class Background:
black = "\033[40m"
red = "\033[41m"
green = "\033[42m"
orange = "\033[43m"
blue = "\033[44m"
purple = "\033[45m"
cyan = "\033[46m"
light_grey = "\033[47m"
def clear():
os.system("cls" if os.name == "nt" else "clear")
def set_title(title):
try:
if os.name == "nt":
os.system(f"title {title}")
else:
os.system(f'echo -ne "\\033]0;{title}\\007"')
except Exception as e:
print(f"Error setting title: {e}")
def print_banner():
print(f""" {Colors.Foreground.dark_grey}/\ """)
print(
f""" /{Colors.Foreground.yellow}vvvvvvvvvvvv{Colors.Foreground.dark_grey} \{Colors.Foreground.light_grey}--------------------------------------, """
)
print(
f""" {Colors.Foreground.dark_grey}`{Colors.Foreground.yellow}^^^^^^^^^^^^{Colors.Foreground.dark_grey} /{Colors.Foreground.light_grey}=====================================/ """
)
print(f" {Colors.Foreground.dark_grey}\/{Colors.reset}")
def get_integer_input(prompt):
while True:
try:
value = int(input(prompt))
return value
except ValueError:
print("Invalid input. Please enter an integer.")
def main():
while True:
try:
user_input = input(">>> ")
except KeyboardInterrupt:
sys.exit()
if user_input == "help":
print(help_menu)
elif user_input == "clear":
clear()
elif user_input.startswith("cmd"):
command = user_input[4:].strip()
os.system(command)
elif user_input == "1":
ip = input("\nIP: ")
port = get_integer_input("Port: ")
if __name__ == "__main__":
help_menu = """
"""
clear()
set_title("S0cket - @batuafk")
print_banner()
main()
os.system("pause")