-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkex.sh
104 lines (94 loc) · 2.8 KB
/
kex.sh
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
#!/bin/bash
echo -e "[File name : kex location : /data/data/com.termux/files/home/kali-arm64/usr/bin or /usr/bin in kali ] <if you need edit it do it carefully!>
\n+=====*** KEX MENU ***=====+\n\nTermux home : \n\tUsage : nethunter kex <option>\n\t<option> : start stop status kill ->(chance of error due to proc not mounted) restart reset \n\tExample : nethunter kex start"
echo -e "\n\nIn kali cmd (after type nethunter in termux) \n\tUsage: kex <option>\n\t<option> : start stop status kill ->(chance of error due to proc not mounted) restart reset \n\tExample ┌──(kali㉿localhost)-[~] └─$ : kex start \n** start Kali NetHunter cli as root is not recommended in this script \n\n=============================================================================================="
vnc_start() {
if [ ! -f ~/.vnc/passwd ]; then
vnc_passwd
fi
USR=$(whoami)
if [ $USR = "root" ]; then
SCR=:1
else
SCR=:2
fi
export USER=$USR; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 nohup vncserver $SCR >/dev/null 2>&1 </dev/null
}
vnc_stop() {
vncserver -kill :*
return $?
}
vnc_passwd() {
vncpasswd
return $?
}
vnc_status() {
session_list=$(vncserver -list)
if [[ $session_list == *"590"* ]]; then
echo "$session_list"
else
echo "There is nothing to list :)"
echo "You can start a new session by << vncserver -depth 24 -geometry 1920x1080 :1 >> after typing << nethunter >>"
fi
}
vnc_kill() {
pkill Xtigervnc
return $?
}
vnc_restart() {
cd ~/.vnc/
rm -rf *.log *.pid
cd /
rm -rf /tmp/.X* /tmp/.xfsm* /tmp/.l2s* /tmp/.ICE-unix
vnc_stop
vnc_start
vnc_status
echo "If no port number or display number displayed - only heading displayed - script failed at restarting "
}
vnc_reset() {
cd ~/.vnc/
rm -rf *.log *.pid
cd /
rm -rf /tmp/.X* /tmp/.xfsm* /tmp/.l2s* /tmp/.ICE-unix
echo "Cleaned files.New User : "
vnc_passwd
}
function ask() {
while true; do
read -p "Do you want to restart kex [Y|y or N|n] :" REPLY
case $REPLY in
[Yy]* )
vnc_restart
vncserver -depth 24 -geometry 1920x1080 :1
;;
[Nn]* )
exit
;;
* ) echo "Please answer yes or no.";;
esac
done
}
case "$1" in
start)
vnc_start
vnc_status
echo -e "\nIf you can't see PROCESS_ID or showing (stale) change SCR:2 to SCR:Any_Number in /use/bin/kex\n"
;;
stop)
vnc_stop
;;
status)
vnc_status
;;
kill)
vnc_kill
;;
restart)
vnc_restart
;;
reset)
vnc_reset
;;
*)
vncserver -depth 24 -geometry 1920x1080 :1
esac