diff --git a/CHANGELOG.md b/CHANGELOG.md index e533c89..3c954e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # CHANGELOG -* **2024.08.26 Current** +* **2024.08.29 Current** + * `GUI-Warp.app`: Added an internal launcher - `starter.c` + * `ts-warp.sh`: Enable `PF`-firewall in `ts-warp.sh` `start`; Minor fixes for `PF` on `macOS` in `GUI-Warp` on `stop` * `pidlist.c`: `ACT` shows destination IP-address, when internal proxy servers are used * `ts-warp.c`: `-D 0..512` DPI bypass fragment size by default 0 - disabled; To enable use a positive value, e.g., 2 diff --git a/gui/ports/macOS/Makefile b/gui/ports/macOS/Makefile index 217634b..29362d5 100644 --- a/gui/ports/macOS/Makefile +++ b/gui/ports/macOS/Makefile @@ -40,26 +40,32 @@ all: ts-warp ts-warp_x64: $(CC) $(CFLAGS) -o ts-warp_x64 -target x86_64-apple-macos11 $(WARP_FILES) $(CC) $(CFLAGS) -o ts-pass_x64 -target x86_64-apple-macos11 $(PASS_FILES) + $(CC) $(CFLAGS) -o starter_x64 -target x86_64-apple-macos11 starter.c ts-warp_arm: $(CC) $(CFLAGS) -o ts-warp_arm -target arm64-apple-macos11 $(WARP_FILES) $(CC) $(CFLAGS) -o ts-pass_arm -target arm64-apple-macos11 $(PASS_FILES) + $(CC) $(CFLAGS) -o starter_arm -target arm64-apple-macos11 starter.c ts-warp: ts-warp_x64 ts-warp_arm lipo -create -output ts-warp ts-warp_x64 ts-warp_arm lipo -create -output ts-pass ts-pass_x64 ts-pass_arm + lipo -create -output starter starter_x64 starter_arm ts-warp_x64-ssh2: $(CC) $(CFLAGS) -DWITH_LIBSSH2=1 -o ts-warp_x64 -lcrypto -lssl -lssh2 -lz -L./ -target x86_64-apple-macos11 $(WARP_FILES) $(CC) $(CFLAGS) -o ts-pass_x64 -target x86_64-apple-macos11 $(PASS_FILES) + $(CC) $(CFLAGS) -o starter_x64 -target x86_64-apple-macos11 starter.c ts-warp_arm-ssh2: $(CC) $(CFLAGS) -DWITH_LIBSSH2=1 -o ts-warp_arm -lcrypto -lssl -lssh2 -lz -L./ -target arm64-apple-macos11 $(WARP_FILES) $(CC) $(CFLAGS) -o ts-pass_arm -target arm64-apple-macos11 $(PASS_FILES) + $(CC) $(CFLAGS) -o starter_arm -target arm64-apple-macos11 starter.c ts-warp-ssh2: ts-warp_x64-ssh2 ts-warp_arm-ssh2 lipo -create -output ts-warp ts-warp_x64 ts-warp_arm lipo -create -output ts-pass ts-pass_x64 ts-pass_arm + lipo -create -output starter starter_x64 starter_arm clean: - rm -rf ts-warp ts-warp_x64 ts-warp_arm ts-pass ts-pass_x64 ts-pass_arm *.o *.dSYM *.core + rm -rf ts-warp ts-warp_x64 ts-warp_arm ts-pass ts-pass_x64 ts-pass_arm starter starter_x64 starter_arm *.o *.dSYM *.core diff --git a/gui/ports/macOS/build.sh b/gui/ports/macOS/build.sh index ff56fbe..ecefc55 100644 --- a/gui/ports/macOS/build.sh +++ b/gui/ports/macOS/build.sh @@ -98,10 +98,15 @@ $pv/bin/python3 setup.py py2app && # echo "-- Archiving ----------------------------------------------------------------------------------------------------" && # tar cvf - -C dist gui-warp.app | gzip --best > gui-warp.app.tgz && +# Installing the app-launcher - starter +mv dist/gui-warp.app/Contents/MacOS/gui-warp dist/gui-warp.app/Contents/MacOS/app +cp starter dist/gui-warp.app/Contents/MacOS/gui-warp + echo "-- Creating DMG -------------------------------------------------------------------------------------------------" && mkdir GUI-Warp mv dist/gui-warp.app GUI-Warp ln -s /Applications GUI-Warp + hdiutil create GUI-Warp-tmp.dmg -ov -volname "GUI-Warp" -fs HFS+ -srcfolder "GUI-Warp" hdiutil convert GUI-Warp-tmp.dmg -format UDZO -o GUI-Warp.dmg diff --git a/gui/ports/macOS/gui-warp.py b/gui/ports/macOS/gui-warp.py index 4a4e00d..9284565 100644 --- a/gui/ports/macOS/gui-warp.py +++ b/gui/ports/macOS/gui-warp.py @@ -60,7 +60,7 @@ def __init__(self, width=800, height=560, self.password = '' - self.version = 'v1.0.30-mac' + self.version = 'v1.0.31-mac' self.width = width self.height = height diff --git a/gui/ports/macOS/starter.c b/gui/ports/macOS/starter.c new file mode 100644 index 0000000..ca62c9f --- /dev/null +++ b/gui/ports/macOS/starter.c @@ -0,0 +1,45 @@ +/* -------------------------------------------------------------------------- */ +/* Trivial starter program to launch other applications */ +/* -------------------------------------------------------------------------- */ + +/* + "THE BEER-WARE LICENSE" (Revision 42): + zmey20000@yahoo.com wrote this file. As long as you retain this notice you + can do whatever you want with this stuff. If we meet some day, and you think + this stuff is worth it, you can buy me a beer in return Mikhail Zakharov +*/ + + +/* -------------------------------------------------------------------------- */ +#include +#include +#include +#include +#include + +/* -------------------------------------------------------------------------- */ +#define APP_NAME "app" +#define DIRBUFSZ 256 + +/* -------------------------------------------------------------------------- */ +int main(int argc, char *argv[]) { + char buf[DIRBUFSZ]; + + if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) { + fprintf(stdout, + "Run a program (default name: app) in the same directory\n\n" + "Usage: %s [program]\n", basename(argv[0])); + return 0; + } + + setuid(geteuid()); + + if (argv[0][0] == '/') + strncpy(buf, dirname(argv[0]), DIRBUFSZ); + else + getcwd(buf, DIRBUFSZ); + sprintf(buf + strnlen(buf, DIRBUFSZ), "/%s", APP_NAME); + + return execl(buf, APP_NAME, NULL); +} + diff --git a/gui/ports/macOS/ts-warp.sh b/gui/ports/macOS/ts-warp.sh index a5d7a7f..baecec4 100644 --- a/gui/ports/macOS/ts-warp.sh +++ b/gui/ports/macOS/ts-warp.sh @@ -68,6 +68,7 @@ _start() { _check_root printf "Starting ts-warp: " + /sbin/pfctl -eq awk -v pf_conf="$tswarp_prefix"/etc/ts-warp_pf.conf ' /ts-warp/ {next} /ns-warp/ {next} @@ -85,7 +86,7 @@ _start() { print("anchor \"ns-warp\"") printf("load anchor \"ts-warp\" from \"%s\"\n", pf_conf) } - ' /etc/pf.conf | /sbin/pfctl -f - + ' /etc/pf.conf | /sbin/pfctl -q -f - echo $tswarp_options $* | xargs $SCRIPTPATH/ts-warp > /dev/null } @@ -126,7 +127,8 @@ _stop() { [ -f "$tswarp_pidfile" ] && rm -f "$tswarp_pidfile" pkill -x ts-warp - /sbin/pfctl -f /etc/pf.conf + /sbin/pfctl -q -a ts-warp -F all + /sbin/pfctl -q -a ns-warp -F all } # ---------------------------------------------------------------------------- # diff --git a/ts-warp.sh.in b/ts-warp.sh.in index 6298397..4609526 100644 --- a/ts-warp.sh.in +++ b/ts-warp.sh.in @@ -85,6 +85,7 @@ _start() { ;; Darwin|FreeBSD|OpenBSD) + /sbin/pfctl -eq awk -v pf_conf="$tswarp_prefix"/etc/ts-warp_pf.conf ' /ts-warp/ {next} /ns-warp/ {next} @@ -102,7 +103,7 @@ _start() { print("anchor \"ns-warp\"") printf("load anchor \"ts-warp\" from \"%s\"\n", pf_conf) } - ' /etc/pf.conf | /sbin/pfctl -f - + ' /etc/pf.conf | /sbin/pfctl -q -f - ;; *)