./busybox sh start_server.sh
```
+By default the server uses the ports 46515-46550. This can be changed in
+`start_server.sh`
+
### Client
To deploy on the client, you'll need to transfer the `build/_output/client`
Once the server is running and a client has connected, files will appear on the
server in `srv/clients/` with the following naming scheme:
-- `_auth-key` - Key used to authenticate clients and store files in the correct
+- `_auth-key` - Key used to authenticate clients
- `_files.log` - Log of files as they are received on the server
- `_info.txt` - Contains basic information about the client
- `_processes.log` - Log of processes as they are run on the client
transferred as they are written on the client
- `C__commandname` - Command output, continuously transferred
-Logs can be monitored as they come in using `lnav`:
+Logs can be monitored as they come in using [lnav](https://lnav.org):
```sh
./lnav -r srv/clients
#!./busybox sh
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 file_port_start file_port_num"
+ exit 1
+fi
+
+FILE_PORT_START=$1
+FILE_PORT_NUM=$2
+
SRVDIR=$(pwd)
verify_input() {
SLEEPTIME=0
while true; do
sleep $(( RANDOM % (SLEEPTIME + 5) + 1 ))
- PORT=$(( (RANDOM * 2 + RANDOM % 2) % 64511 + 1024 ))
+ PORT=$(( (RANDOM * 2 + RANDOM % 2) % FILE_PORT_NUM + FILE_PORT_START ))
nc -w 7 -l -p "$PORT" > "$FILENAME" 2>/dev/null &
NC_PID=$!
# Wait for nc to fail. There seems to be a bug with busybox sh where
#!./busybox sh
SRVPORT=46515
+FILE_PORT_START=46516
+FILE_PORT_NUM=45
CWD=$(pwd)
# -----------------------------------------------------------------------------
mkdir -p "$CWD/srv/clients"
cd "$CWD/srv"
-tcpsvd -c 4096 0.0.0.0 "$SRVPORT" ../busybox sh ../server.sh
+tcpsvd -c 4096 0.0.0.0 "$SRVPORT" ../busybox sh ../server.sh "$FILE_PORT_START" "$FILE_PORT_NUM"