update restricted shell to force (–no-kill) option.
This commit is contained in:
@@ -12,7 +12,7 @@ CYAN='\033[0;36m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# History file
|
||||
HISTFILE="/home/socktop/.socktop_history"
|
||||
HISTFILE="${HOME:-/tmp}/.socktop_history"
|
||||
HISTSIZE=1000
|
||||
|
||||
# Load history from file
|
||||
@@ -135,7 +135,7 @@ main() {
|
||||
# Allow socktop with validated arguments only
|
||||
if [ "$cmd" = "$input" ]; then
|
||||
# No arguments, use default (local profile)
|
||||
/usr/bin/socktop -P local
|
||||
/usr/bin/socktop --no-kill -P local
|
||||
else
|
||||
# Validate and sanitize arguments to prevent command injection
|
||||
# Only allow: -P <profile_name> or ws://<url>
|
||||
@@ -144,11 +144,11 @@ main() {
|
||||
if [[ "$args" =~ ^-P[[:space:]]+[a-zA-Z0-9_-]+$ ]]; then
|
||||
# Extract profile name and validate it
|
||||
profile=$(echo "$args" | sed 's/-P[[:space:]]\+//')
|
||||
/usr/bin/socktop -P "$profile"
|
||||
/usr/bin/socktop --no-kill -P "$profile"
|
||||
# Check for websocket URL (ws:// or wss://)
|
||||
elif [[ "$args" =~ ^wss?://[a-zA-Z0-9\.\:/_-]+$ ]]; then
|
||||
# Validate websocket URL format
|
||||
/usr/bin/socktop "$args"
|
||||
/usr/bin/socktop --no-kill "$args"
|
||||
else
|
||||
# Reject anything else as potentially dangerous
|
||||
echo -e "${RED}Error:${NC} Invalid arguments for socktop"
|
||||
|
||||
Reference in New Issue
Block a user