Permalink
Browse files

Replaced windows SSH bins with lighter (and working) Plink.exe altern…

…ative (from Putty)
  • Loading branch information...
1 parent 036240e commit 18bc7766b975b281a4d8c2f378827cddde18de3e @tomas tomas committed Oct 19, 2010
View
@@ -268,7 +268,7 @@ open_reverse_tunnel(){
if [ ! -f "$tmpbase/prey-tunnel-${local_tunnel_port}.pid" ]; then
log " -- Opening reverse tunnel from ${local_tunnel_port} to ${remote_tunnel_port} as ${remote_tunnel_user} on ${remote_tunnel_host}..."
- setsid "$base_path/lib/tunnel.sh" ${remote_tunnel_host} ${local_tunnel_port} ${remote_tunnel_port} ${remote_tunnel_user} ${remote_tunnel_pass} &> /dev/null
+ reverse_tunnel_command
if [ -f "prey-tunnel.pid" ]; then
mv "prey-tunnel.pid" "$tmpbase/prey-tunnel-${local_tunnel_port}.pid"
log " -- Tunnel open and ready to serve!"
View
@@ -1,6 +1,7 @@
#!/bin/sh
# Auto SSH Reverse Tunnel script, by Tomas Pollak
# ./tunnel.sh [host] [local_port] [remote_port] [user] [pass]
+# lib/tunnel.sh proxy.preyproject.com 5900 6100 tunnel asdasd
# trap cleanup_tunnel EXIT
@@ -34,10 +35,10 @@ if [ -n "$5" ]; then # using password-based authentication
fi
# echo " -- Connecting to $host_port..."
-ssh -N -o 'ExitOnForwardFailure=yes' -R ${3}:localhost:${2} ${4}@${1} &
+ssh -N -o 'ExitOnForwardFailure=yes' -o 'StrictHostKeyChecking=no' -o 'CheckHostIP=no' -R ${3}:localhost:${2} ${4}@${1} &
tunnel_pid=$!
-sleep 3
+sleep 4
if [ "`ps -p $tunnel_pid | grep $tunnel_pid`" ]; then
echo "$tunnel_pid" > "prey-tunnel.pid"
fi
View
@@ -65,6 +65,10 @@ try_to_connect() {
}
+reverse_tunnel_command(){
+ setsid "$base_path/lib/tunnel.sh" ${remote_tunnel_host} ${local_tunnel_port} ${remote_tunnel_port} ${remote_tunnel_user} ${remote_tunnel_pass} &> /dev/null
+}
+
############################################
# updater-specific functions
############################################
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -90,6 +90,19 @@ try_to_connect() {
fi
}
+reverse_tunnel_command(){
+ "$platform_path/bin/plink.exe" -ssh -C -N \
+ -R ${remote_tunnel_port}:localhost:${local_tunnel_port} \
+ -l ${remote_tunnel_user} -pw ${remote_tunnel_pass} \
+ ${remote_tunnel_host} > /dev/null &
+ local rs=$?
+ local tunnel_pid=$!
+ if [ "$rs" -eq 0 ]; then
+ echo "$tunnel_pid" > "prey-tunnel.pid"
+ fi
+ return $rs
+}
+
############################################
# module functions
############################################

0 comments on commit 18bc776

Please sign in to comment.