summaryrefslogtreecommitdiff
path: root/share/hackvr/examples/hackvrd/ident
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2020-04-14 11:49:04 +0000
committerepoch <epoch@hack.thebackupbox.net>2020-04-14 11:49:04 +0000
commitc0e38b3d008c2aa07c7cd03a0ce74edbaf05f8e5 (patch)
tree516730b92d856d4fb65d4b875ba7fc05c125bf7f /share/hackvr/examples/hackvrd/ident
parent35b84411ef9e69ab01bf0de789cce296d302110e (diff)
downloadhackvr-c0e38b3d008c2aa07c7cd03a0ce74edbaf05f8e5.tar.gz
hackvr-c0e38b3d008c2aa07c7cd03a0ce74edbaf05f8e5.zip
added a bunch of the hackvr-server scripts
Diffstat (limited to 'share/hackvr/examples/hackvrd/ident')
-rwxr-xr-xshare/hackvr/examples/hackvrd/ident16
1 files changed, 16 insertions, 0 deletions
diff --git a/share/hackvr/examples/hackvrd/ident b/share/hackvr/examples/hackvrd/ident
new file mode 100755
index 0000000..f4e7599
--- /dev/null
+++ b/share/hackvr/examples/hackvrd/ident
@@ -0,0 +1,16 @@
+#!/bin/sh
+if [ $# -lt 4 ];then
+ echo usage: ident.sh our-host their-host 113 their-port our-port
+ exit 1
+fi
+REMOTE_PORT="$4"
+SERVER_PORT="$5"
+IDENT_PORT="$3"
+REMOTE_ADDR="$2"
+SERVER_ADDR="$1"
+username="$(printf "%s, %s\r\n" "$REMOTE_PORT" "$SERVER_PORT" | (ncat -s "$SERVER_ADDR" "$REMOTE_ADDR" "$IDENT_PORT" 2>/dev/null || echo 'ERROR:ERROR:ERROR:ERROR') | tr -d '\r' | cut -d: -f4)"
+if [ "$username" ];then
+ printf "%s\n" "$username"
+else
+ exit 1
+fi