Skip to content

Commit

Permalink
[FEATURE] Added kex utility into Kali Nethunter distro
Browse files Browse the repository at this point in the history
  • Loading branch information
hxAri committed Jun 29, 2024
1 parent df4c81f commit 6798ba7
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions penguin
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,81 @@ function distroConfig() {
exit 1
fi
fi

echo "$(stdio stdout $distro creating /:usr/bin/kex)"
cat > $source/$folder/usr/bin/kex <<- EOF
#!/bin/env/bash
function start-kex() {
if [[ ! -f ~/.vnc/passwd ]]; then
passwd-kex
fi
USR=\$(whoami)
if [ \$USR == "root" ]; then
SCREEN=":2"
else
SCREEN=":1"
fi
export MOZ_FAKE_NO_SANDBOX=1; export HOME=\${HOME}; export USER=\${USR}; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 nohup vncserver \$SCREEN >/dev/null 2>&1 </dev/null
starting_kex=1
return 0
}
function stop-kex() {
vncserver -kill :1 | sed s/"Xtigervnc"/"NetHunter KeX"/
vncserver -kill :2 | sed s/"Xtigervnc"/"NetHunter KeX"/
return $?
}
function passwd-kex() {
vncpasswd
return $?
}
function status-kex() {
sessions=\$(vncserver -list | sed s/"TigerVNC"/"NetHunter KeX"/)
if [[ \$sessions == *"590"* ]]; then
printf "\n\${sessions}\n"
printf "\nYou can use the KeX client to connect to any of these displays.\n\n"
else
if [ ! -z \$starting_kex ]; then
printf '\nError starting the KeX server.\nPlease try "nethunter kex kill" or restart your termux session and try again.\n\n'
fi
fi
return 0
}
function kill-kex() {
pkill Xtigervnc
return \$?
}
case \$1 in
start)
start-kex
;;
stop)
stop-kex
;;
status)
status-kex
;;
passwd)
passwd-kex
;;
kill)
kill-kex
;;
*)
stop-kex
start-kex
status-kex
;;
esac
EOF

echo "$(stdio stdout $distro chmod+s /:usr/bin/kex)"
chmod 700 $source/$folder/usr/bin/kex

echo "$(stdio stdout $distro fixing sudo)"
echo "$(stdio stdout $distro chmod+s /:usr/bin/sudo)"
Expand Down

0 comments on commit 6798ba7

Please sign in to comment.