summaryrefslogtreecommitdiff
path: root/hamachi_direct_fisher.sh
diff options
context:
space:
mode:
Diffstat (limited to 'hamachi_direct_fisher.sh')
-rwxr-xr-xhamachi_direct_fisher.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/hamachi_direct_fisher.sh b/hamachi_direct_fisher.sh
new file mode 100755
index 0000000..c8e1412
--- /dev/null
+++ b/hamachi_direct_fisher.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+while true; do
+ HOST=$( hamachi list | grep "\[.*\]" | sed -r 's|^.*owner\: ||g; s|[\(\)]||g' | awk '{print $2, " ", $1}' )
+ [[ -n "$HOST" ]] && break
+ hamachi login
+ sleep 5
+done
+
+echo "Attempting to establish direct connection with: $HOST"
+
+while true; do
+
+ CONNECTION=$( hamachi list | grep "$HOST" | sed -r "s|^.*(\ ){25}||g; s|(\ ){2,3}.*||g" )
+ echo "Connection: $CONNECTION"
+
+ [[ "$CONNECTION" = "via server" ]] && sleep 5 && continue
+
+ [[ "$CONNECTION" = "direct" ]] && break || ( hamachi logout && sleep 5 && hamachi login && sleep 5 )
+
+done \ No newline at end of file