forked from chenkaie/Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtunnel.sh
executable file
·48 lines (44 loc) · 2.17 KB
/
tunnel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#/bin/bash
# This is a really cool ssh login style
# Catch me if you can :)
VIMSSH="vim"
VIMSSH_PATH="$HOME/tmp/"
cd $VIMSSH_PATH
export PATH=.:$PATH
case "$1" in
*dd-wrt-proxy*)
# -D [bind_address:]port
# Specifies a local "dynamic" application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound
# to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application
# protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will
# act as a SOCKS server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the configuration file.
#
# Note: -D mode only do a port fowarding on local side, i.e. works only on telnet localhost port, rather than telnet PUBLIC_IP port
# Therefore we have to do a public port fowarding e.g.
# step 1. kent@hostname $ ssh -R 7321:rd1-2:22 [email protected] -o TCPKeepAlive=no -o ServerAliveInterval=60
# step 2. ubuntu@hostname $ ssh -D 8888 localhost -p7321 -lkent -vvv -N
# step 3. ubuntu@hostname $ socat TCP-LISTEN:12345,fork TCP:localhost:8888
# step 4. Setup browser proxy settings as "SOCK v5" + "amazon-ec2.no-ip.org:12345"
autossh -M 0 -D 172.16.5.31:52525 -R 7322:rd1-2:22 [email protected] -p2222 -o TCPKeepAlive=no -o ServerAliveInterval=60
;;
*dd-wrt*)
#autossh -M 0 -R 7322:rd1-2:22 [email protected] -p2222 -o TCPKeepAlive=no -o ServerAliveInterval=60
$VIMSSH config_videoin.xml
;;
*totoro*)
autossh -M 0 -R 7321:rd1-2:22 [email protected] -p3063 -o TCPKeepAlive=no -o ServerAliveInterval=60
;;
*funp*)
autossh -M 0 -R 7322:rd1-2:22 [email protected] -p22 -o TCPKeepAlive=no -o ServerAliveInterval=60
;;
*amazon*)
autossh -M 0 -R 7322:rd1-2:22 [email protected] -p22 -o TCPKeepAlive=no -o ServerAliveInterval=60
;;
*ptt*)
$VIMSSH config_system.xml
;;
*)
echo "Usage : $0 [dd-wrt|totoro|funp|ptt]"
exit 1
;;
esac