-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
v-finder3.0.py
159 lines (113 loc) · 5.34 KB
/
v-finder3.0.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#Features to add :
# button for modes :
#position : probably top left
#available modes will be normal(default) and advanced (where the user can customise the nmap options)
# button for configuring scan types :
#position : either at left or right of the button to select scan types (only available in advanced mode)
#customisation would be :
#nmap options
# name of config
# repetition button and vriations in scans :
# position : under or at the side
#the user would be able to repeat scan and also to add a variation in the following scans
#customisation would be :
#scan 1 : basic options : scan2 : user would be able to change the options etc. with all options
import tkinter as tk
import customtkinter
import subprocess
import time
import threading
root = customtkinter.CTk()
root.title("V-finder")
#Definition of frame
#quit tool function
def quit_tool():
root.quit()
customtkinter.set_appearance_mode("Dark")
customtkinter.set_default_color_theme("green")
root.geometry("1200x800")
def distro():
result = subprocess.run(["bash", "distro.sh"], capture_output=True, text=True)
if "Debian" in result.stdout.strip():
command = f'sudo nmap {text} -oN results.txt'
terminal_command = f'lxterminal -e "{command}; read -p \'Press Enter to close...\'"'
process = subprocess.Popen(terminal_command, shell=True)
process.wait()
elif "Ubuntu" in result.stdout.strip():
command = f'sudo nmap {text} -oN results.txt'
terminal_command = f'xterm -e bash -c"{command}; read -p \'Press Enter to close...\'"'
subprocess.Popen(terminal_command, shell=True)
_distro = result.stdout.strip()
if "Kali" in _distro or "Fedora" in _distro:
command = f'sudo nmap {text} -oN results.txt'
terminal_command = f'gnome-terminal -- bash -c"{command}; read -p \'Press Enter to close...\'"'
subprocess.Popen(terminal_command, shell=True)
elif "Manjaro" in result.stdout.strip():
command = f'sudo nmap {text} -oN results.txt'
terminal_command = f'konsole --hold -e -- bash -c"{command}; read -p\'Press Enter to close...\'"'
subprocess.Popen(terminal_command, shell=True)
def option():
scan_type = my_combo.get()
if scan_type in ["Normal", "Advanced", "Aggressive", "Hardcore", "Stealth"]:
distro()
else:
print("Combo box error")
#def start_progress():
# global progress
# progress.start()
#def stop_progress():
# global progress
# progress.stop()
# root.after(0, stop_progress)
def ask_for_ip():
#That's the small window dialog that pops up and ask for ip
global text
dialog = customtkinter.CTkInputDialog(text="Type the ip to scan ", title="IP Entry")
text = dialog.get_input()
#This function defines what happens whzn the start scan button is clicked,
# normally it launches the scan with the details given by the user
# but for the moment I can't get python to open a new terminal
# and then run the scan from there or I would like to display the result in the ui itself but for the moment it's too complicated because I would also need to filter the output.
def start_scan():
global text
global command
global terminal_command
global progress
init_scan.configure(root, text="Initiating Scan...")
init_scan.update()
#progress = customtkinter.CTkProgressBar(root, orientation="horizontal", mode="inderterminate",progress_color="#00ff00")
#progress.pack(pady=12, padx=10)
#threading.Thread(target=start_progress).start()
option()
stop()
def stop():
init_scan.configure(root, text="Start Scan")
#this function enable the start scan button after the user checks the box saying that if he gets arrested it's his fault not the maker's fault
def enable_start_scan_button():
init_scan.configure(state="normal")
#That's the label with the title
custom_font = customtkinter.CTkFont(family="Roboto", size=50)
label = customtkinter.CTkLabel(root, text="V-Finder", font=custom_font, text_color="#00ff00")
label.pack(pady=12, padx=10)
ip_prompt_button = customtkinter.CTkButton(root, text="Enter Ip", fg_color="black", text_color="white", hover_color="blue", command=ask_for_ip )
ip_prompt_button.pack(pady=12, padx=10)
#combo box for selecting scan type
combo = customtkinter.CTkLabel(root, text="Pick a scan type")
combo.pack(pady=5, padx=10)
scan_type = ["Normal", "Advanced", "Aggressive", "Hardcore", "Stealth"]
my_combo = customtkinter.CTkComboBox(root, values=scan_type)
my_combo.pack(pady=5, padx=10)
#other options for experienced users only
#other_options = customtkinter.CTkEntry(master=frame, placeholder_text="Other Options", bg_color="black", border_color="black", text_color="#00ff00", fg_color="black")
#other_options.pack(pady=12, padx=20)
#checkbox
check_var = customtkinter.StringVar(value="off")
checkbox = customtkinter.CTkCheckBox(root, text="I Take on full responsibility if I do any illegal stuff and get arrested.", onvalue="on", offvalue="off", variable=check_var, command=enable_start_scan_button )
checkbox.pack(pady=12, padx=10)
#Start Scan button
init_scan = customtkinter.CTkButton(root, text="Start Scan", fg_color='red', hover_color='green', command=start_scan, state="disabled")
init_scan.pack(pady=12, padx=10)
#quit tool button
quit_button = customtkinter.CTkButton(root, text="Exit", hover_color='red', command=quit_tool)
quit_button.pack(pady=0, padx=100)
root.mainloop()