summaryrefslogtreecommitdiff
path: root/share/hackvr/examples/hackvrd/ident
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2020-04-18 02:38:52 -0500
committerepoch <epoch@thebackupbox.net>2020-04-18 02:38:52 -0500
commit5417ee3aacf64d3b3b164ba2a529daacb101ebb9 (patch)
treeeea6fdd0ef6c378f143341cf141529006bcdb029 /share/hackvr/examples/hackvrd/ident
parente7019fb09653472bb57474638188dcba337f1a3c (diff)
parent459bff40e078a3979573000a903b288bcc9a8d3f (diff)
downloadhackvr-5417ee3aacf64d3b3b164ba2a529daacb101ebb9.tar.gz
hackvr-5417ee3aacf64d3b3b164ba2a529daacb101ebb9.zip
Merge branch 'master' of ssh://lin.thebackupbox.net:65432/~/hackvr
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