| #!/bin/sh |
| |
| # This script is used to store local configuartion data to ease batch building |
| |
| # Please customize this script to fit your local requirements |
| |
| random_characters() { |
| sort --random-sort < replaceable-characters | { |
| IFS= |
| while read -r line; do printf %s "$line"; done |
| } |
| } |
| |
| set -e |
| |
| if [ $# != 1 ]; then |
| printf 'Usage: %s <client-name>\n' "$0" 1>&2 |
| exit 255 |
| fi |
| |
| export CC=gcc |
| export CFLAGS="-Wall -Os -g -fno-common -fomit-frame-pointer -D NDEBUG=1" |
| #export LDFLAGS=-s |
| # Uncomment following line to enable obfuscation for some strings |
| #export STRING_TRANSLITERATION="\"`random_characters`\"`random_characters`\"" |
| # Edit the following line to fill the server address, port number, public key, |
| # as well as the privileged SSHOUT user name |
| sh build.sh <server-address> <server-port> <server-public-key> <privileged-user-name> "$1" |
| # Example: |
| #sh build.sh 127.0.0.1 22 AAAAB3NzaC1yc2EAAAADAQABAAABAQDSCKGsb7l1PmJafA8rs5sluuSmiQQYRYDrHMhZh5alrCEurzcvz9gfuqr42wUifQInM74tz6H4xoZBGq3qlJjoqFRHQc85X6Og2KdY+Xz+NYdkoHTmC6+5v4qDrNZ6dl0p7oABuMvFPCiYl+jd5sfA6Di/sF7t9/02RdJonrmqQd5qdccHUgkSeQ5aCTKgoZGNm6FAxrbyN/q+YSdCK2aDmjR9IedxjT8ipSrrWmQltLZfJ3GNN1TXy/GXSw1sOVEIq5JoDDiJwZZ13l7c0uPSFDHzqR7Q7ThpdbckRG3LDJWMJgc8SF1ptzYkmRK1MAuHYNtrHSw/fAvW5un/UF4f operator |
| printf -- --------------------\\n |
| rm -f "client.$1.stripped" |
| strip "client.$1" -o "client.$1.stripped" |
| #size "client.$1" "client.$1.stripped" || true |
| { file "client.$1" "client.$1.stripped" || size -A "client.$1" "client.$1.stripped" || ls -l "client.$1" "client.$1.stripped"; } 2> /dev/null || true |
| printf -- --------------------\\n |
| echo |
| echo "set -e" |
| printf 'echo "' |
| xz --best < "client.$1.stripped" | base64 -w 80 |
| # You may customize executable file name and service name here |
| echo '" | base64 -d | xz -d > /usr/local/bin/sfc' |
| echo "chmod 755 /usr/local/bin/sfc" |
| printf 'echo "' |
| gzip --best < sfc.service | base64 -w 80 |
| echo '" | base64 -d | gzip -d > /etc/systemd/system/sfc.service' |
| echo "systemctl enable --now sfc" |