Browse Source

shc: fix tmpdir and compiler command

master
Leonid Plyushch 5 years ago
parent
commit
4397da959f
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 2
      packages/shc/build.sh
  2. 55
      packages/shc/src-shc.c.patch

2
packages/shc/build.sh

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Shell script compiler"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="Krishna Kanhaiya @kcubeterm"
TERMUX_PKG_VERSION=4.0.3
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/neurobin/shc/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=7d7fa6a9f5f53d607ab851d739ae3d3b99ca86e2cb1425a6cab9299f673aee16
TERMUX_PKG_DEPENDS="clang"

55
packages/shc/src-shc.c.patch

@ -0,0 +1,55 @@
diff -uNr shc-4.0.3/src/shc.c shc-4.0.3.mod/src/shc.c
--- shc-4.0.3/src/shc.c 2019-07-01 19:37:08.000000000 +0300
+++ shc-4.0.3.mod/src/shc.c 2020-05-07 15:01:57.944329115 +0300
@@ -153,7 +153,7 @@
"\" * Copyright 2019 - Intika <intika@librefox.org>\",",
"\" * Replace ******** with secret read from fd 21\",",
"\" * Also change arguments location of sub commands (sh script commands)\",",
-"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",",
+"\" * clang -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",",
"\" */\",",
"\"\",",
"\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",",
@@ -365,7 +365,7 @@
" FILE *fp;",
" int line = 0;",
"",
-" if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}",
+" if ((fp = fopen(\"@TERMUX_PREFIX@/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}",
" for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);",
" fflush(fp);fclose(fp);",
"}",
@@ -375,11 +375,11 @@
" char cmd[4096];",
"",
" cc = getenv(\"CC\");",
-" if (!cc) cc = \"cc\";",
+" if (!cc) cc = \"clang\";",
"",
-" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");",
-" if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}",
-" remove(\"/tmp/shc_x.c\"); return 0;",
+" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"@TERMUX_PREFIX@/tmp/shc_x.so\", \"@TERMUX_PREFIX@/tmp/shc_x.c -ldl\");",
+" if (system(cmd)) {remove(\"@TERMUX_PREFIX@/tmp/shc_x.c\"); return -1;}",
+" remove(\"@TERMUX_PREFIX@/tmp/shc_x.c\"); return 0;",
"}",
"",
"void arc4_hardrun(void * str, int len) {",
@@ -396,7 +396,7 @@
" shc_x_file();",
" if (make()) {exit(1);}",
"",
-" setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);",
+" setenv(\"LD_PRELOAD\",\"@TERMUX_PREFIX@/tmp/shc_x.so\",1);",
"",
" if(pid==0) {",
"",
@@ -429,7 +429,7 @@
" memcpy(tmp2, str, lentmp);",
"",
" //Clean temp",
-" remove(\"/tmp/shc_x.so\");",
+" remove(\"@TERMUX_PREFIX@/tmp/shc_x.so\");",
"",
" //Sinal to detach ptrace",
" ptrace(PTRACE_DETACH, 0, 0, 0);",
Loading…
Cancel
Save