fixxing command injection vulnerability, need some future changes (refactor, remove proxychains4 and remove run, only drun mode for starting process)
This commit is contained in:
@@ -31,8 +31,7 @@ get_desktop_files() {
|
||||
exec=$(
|
||||
grep -m1 '^Exec=' "$f" \
|
||||
| cut -d= -f2- \
|
||||
| sed 's/%[fFuUik]//g' \
|
||||
| xargs
|
||||
| sed 's/%[fFuUik]//g'
|
||||
)
|
||||
|
||||
type=$(
|
||||
@@ -90,12 +89,31 @@ build_run() {
|
||||
}
|
||||
|
||||
|
||||
extract_proxy() {
|
||||
local conf="${PROXYCHAINS_CONF_FILE:-/etc/proxychains4.conf}"
|
||||
[ -f "$conf" ] || conf="/etc/proxychains.conf"
|
||||
[ -f "$conf" ] || return
|
||||
|
||||
local line
|
||||
line=$(awk '/^\[ProxyList\]/{found=1; next} found && NF && !/^#/{print; exit}' "$conf")
|
||||
[ -n "$line" ] || return
|
||||
|
||||
local ptype host port
|
||||
ptype=$(echo "$line" | awk '{print $1}')
|
||||
host=$(echo "$line" | awk '{print $2}')
|
||||
port=$(echo "$line" | awk '{print $3}')
|
||||
|
||||
echo "${ptype}://${host}:${port}"
|
||||
}
|
||||
|
||||
update_cache() {
|
||||
build_drun > "$DRUN_CACHE.tmp"
|
||||
build_run > "$RUN_CACHE.tmp"
|
||||
|
||||
mv "$DRUN_CACHE.tmp" "$DRUN_CACHE"
|
||||
mv "$RUN_CACHE.tmp" "$RUN_CACHE"
|
||||
|
||||
extract_proxy > "$CACHE_DIR/proxy.conf"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user