-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.py
121 lines (89 loc) · 3.03 KB
/
cli.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
109
110
111
112
113
114
115
116
117
118
119
120
121
from ctypes import cdll
from pyfiglet import Figlet
import os
import colorama
from colorama import Fore, Style
import socket
import time
import requests
import analytics
os.system("pyfiglet --color white -j center -w 200 -f starwars GRINDWALL")
time.sleep(1)
def get_local_ip():
local_ip = ""
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
local_ip = s.getsockname()[0]
except socket.error as e:
print(f"Error: {e}")
finally:
return local_ip
s.close()
def get_public_ip():
pub_ip=""
try:
response = requests.get("curl ifconfig.me")
if response.status_code == 200:
pub_ip = response.text
else:
pub_ip = "Not Found"
except Exception as e:
er = e
return pub_ip
print("\n----------System information----------\n\n\n")
ops = os.name #Operating system
release = os.uname().release if hasattr(os, 'uname') else 'N/A'
version = os.uname().version if hasattr(os, 'uname') else 'N/A'
#processor = os.uname().processor if hasattr(os, 'uname') else 'N/A'
ip_addr = get_local_ip()
pub_ip = get_public_ip()
print("Operating System: ",ops)
time.sleep(1)
print("Release: ",release)
time.sleep(1)
print("Version: ",version)
time.sleep(1)
#print("Processor: ",processor)
print("Local IP address: ",ip_addr)
time.sleep(1)
print("Public IP address: ",pub_ip)
def menu_card():
print(f"\n\n{Fore.YELLOW}[1] Start Grindwall")
print(f"{Fore.YELLOW}[2] Port Scan Server")
print(f"{Fore.YELLOW}[3] Analytics")
print(f"{Fore.RED}[4] Quit")
def get_user_choice():
try:
choice = int(input(f"{Fore.WHITE}Enter your choice: "))
return choice
except ValueError:
print(f"{Fore.RED}Invalid input. Please enter a number.")
return None
def main():
while True:
time.sleep(0.5)
menu_card()
user_choice = get_user_choice()
if user_choice is not None:
if user_choice == 4:
print(f"{Fore.YELLOW}Exiting the program. Goodbye!")
break
elif 1 <= user_choice <= 4:
if user_choice == 1:
print(f"\n\n{Fore.GREEN}Press CTRL+C to stop Grindwall")
print(f"\n{Fore.GREEN}Starting Grindwall.....")
os.system("python3 ./grindwall.py")
if user_choice == 2:
if 'posix' not in ops:
print(f"{Fore.RED}This Feature is Not yet Available on Non-Linux Systems")
else:
go = cdll.LoadLibrary('./goScanner/pythonScanner.so')
print(f"\n{Fore.GREEN}Open Ports on the server: \n\n")
go.fastScanner()
if user_choice == 3:
analytics.analytics_v4()
else:
print(f"{Fore.RED}Invalid choice. Please choose a valid option.")
if __name__ == "__main__":
main()