summaryrefslogtreecommitdiff
path: root/contrib/quicktun.socks4a
diff options
context:
space:
mode:
authord3v11 <d3v11@d3v11.ano>2012-11-04 12:59:01 +0000
committerd3v11 <d3v11@d3v11.ano>2012-11-04 12:59:01 +0000
commit61adeb2c97ef6a62dae0f2890139253faf00994c (patch)
tree6e22bca4510ba668eeae52b68fdab1b17c048b09 /contrib/quicktun.socks4a
parentc651762fead7748ad1256409456e4896596db24e (diff)
downloadresdb-61adeb2c97ef6a62dae0f2890139253faf00994c.tar.gz
resdb-61adeb2c97ef6a62dae0f2890139253faf00994c.zip
[quicktun.socks4a] $PROTOCOL support (raw, nacl0, nacltai)
Diffstat (limited to 'contrib/quicktun.socks4a')
-rw-r--r--contrib/quicktun.socks4a/README57
-rwxr-xr-xcontrib/quicktun.socks4a/quicktun.socks4a29
-rw-r--r--contrib/quicktun.socks4a/run4
3 files changed, 68 insertions, 22 deletions
diff --git a/contrib/quicktun.socks4a/README b/contrib/quicktun.socks4a/README
index 29a4359..eefe089 100644
--- a/contrib/quicktun.socks4a/README
+++ b/contrib/quicktun.socks4a/README
@@ -1,12 +1,55 @@
hacking quicktun through socks4a:
- peer one should set REMOTE_FLOAT = 0
- peer two should set REMOTE_FLOAT = 1
-
- i've never actually tested this. but
- it should "just work" with minimal
- shit. if it's really that bad you
- can complain to /relayhell/d3v11.
+ i've never actually tested this. but it should "just work"
+ with minimal shit. if it's really that bad you can complain to
+ /relayhell/d3v11.
depends:
quicktun.raw, socat, daemontools,
a lot of fucking patience
+
+env:
+ $DEBUG
+ 1 for debugging, 0 for quiet
+
+ $TUN_MODE
+ this should always be 1
+
+ $PROTOCOL
+ raw, nacl0, nacltai supported
+
+ $INTERFACE
+ named interface of your tunnel
+
+ $REMOTE_FLOAT
+ peer one should set REMOTE_FLOAT = 0
+ peer two should set REMOTE_FLOAT = 1
+
+ $PRIVATE_KEY
+ your private key, necessary for nacl0 and nacltai
+
+ $PUBLIC_KEY
+ peer's public key, necessary for nacl0 or nacltai
+
+ $LOCAL_ADDRESS
+ quicktun.* will bind here
+
+ $LOCAL_PORT
+ quicktun.* will bind here
+
+ $REMOTE_ADDRESS
+ quicktun.socks4a listens here on UDP
+
+ $REMOTE_PORT
+ quicktun.socks4a listens here on UDP
+
+ $DST_ADDRESS
+ REAL REMOTE_ADDRESS
+
+ $DST_PORT
+ REAL REMOTE_PORT
+
+ $SOCKS_ADDRESS
+ listening address of the socks4a proxy
+
+ $SOCKS_PORT
+ listening port of the socks4a proxy
diff --git a/contrib/quicktun.socks4a/quicktun.socks4a b/contrib/quicktun.socks4a/quicktun.socks4a
index c6d1947..65fa86f 100755
--- a/contrib/quicktun.socks4a/quicktun.socks4a
+++ b/contrib/quicktun.socks4a/quicktun.socks4a
@@ -3,6 +3,7 @@ import subprocess, socket, select, fcntl, sys, os
DEBUG = os.getenv( 'DEBUG' ,'1' )
TUN_MODE = os.getenv( 'TUN_MODE' ,'1' )
+PROTOCOL = os.getenv( 'PROTOCOL' ,'raw' )
INTERFACE = os.getenv( 'ppp-tortun' ,'1' )
REMOTE_FLOAT = int(os.getenv('REMOTE_FLOAT' ,'1' ))
@@ -18,20 +19,11 @@ DST_PORT = os.getenv( 'DST_PORT' ,'2998' )
SOCKS_ADDRESS = os.getenv( 'LOCAL_ADDRESS' ,'127.0.0.1' )
SOCKS_PORT = os.getenv( 'LOCAL_PORT' ,'9050' )
-tcp = socket.socket(
- socket.AF_INET,socket.SOCK_STREAM)
-tcp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 )
-tcp.setblocking (0 )
-tcp.bind ((LOCAL_ADDRESS,LOCAL_PORT ))
-tcp.listen (1 )
-tcp_poll = select.poll( )
-tcp_poll.register(tcp.fileno(),select.POLLIN|select.POLLPRI )
-
udp = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
udp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 )
udp.setblocking (0 )
udp.bind ((REMOTE_ADDRESS,REMOTE_PORT ))
-udp_poll = select.poll( )
+udp_poll = select.poll( )
udp_poll.register(udp.fileno(),select.POLLIN|select.POLLPRI )
if REMOTE_FLOAT==0:
@@ -49,6 +41,15 @@ if REMOTE_FLOAT==0:
tun.stdout.fileno(), select.POLLIN|select.POLLPRI)
while REMOTE_FLOAT==1:
+ tcp = socket.socket(
+ socket.AF_INET,socket.SOCK_STREAM)
+ tcp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 )
+ tcp.setblocking (0 )
+ tcp.bind ((LOCAL_ADDRESS,LOCAL_PORT ))
+ tcp.listen (1 )
+ tcp_poll = select.poll( )
+ tcp_poll.register(tcp.fileno(),select.POLLIN|select.POLLPRI )
+
if len(tcp_poll.poll(65536))>0:
tun = tcp.accept ()[0]
tun_stdout = tun.fileno ( )
@@ -63,7 +64,8 @@ fcntl.fcntl(tun_stdin,fcntl.F_SETFL,fcntl.fcntl(
fcntl.fcntl(tun_stdout,fcntl.F_SETFL,fcntl.fcntl(
tun_stdout,fcntl.F_GETFL)&~os.O_NONBLOCK|os.O_NONBLOCK)
-tun = subprocess.Popen(['/usr/sbin/quicktun.raw'],
+tun = subprocess.Popen(
+ ['/usr/sbin/quicktun.'+PROTOCOL],
stdout = subprocess.PIPE,
stdin = subprocess.PIPE )
@@ -102,10 +104,7 @@ while 1:
if ex.errno!=11:
break
- if len(sendq)>65536*128:
- break
-
- if len(recvq)>65536*128:
+ if len(sendq)>65536*128 or len(recvq)>65536*128:
break
tun.terminate( )
diff --git a/contrib/quicktun.socks4a/run b/contrib/quicktun.socks4a/run
index 181f2cd..e669b06 100644
--- a/contrib/quicktun.socks4a/run
+++ b/contrib/quicktun.socks4a/run
@@ -2,9 +2,13 @@
export DEBUG='1'
export TUN_MODE='1'
+export PROTOCOL='nacltai'
export INTERFACE='ppp-tortun'
export REMOTE_FLOAT='1'
+export PRIVATE_KEY='0000000000000000000000000000000000000000000000000000000000000000'
+export PUBLIC_KEY='2fe57da347cd62431528daac5fbb290730fff684afc4cfc2ed90995f58cb3b74'
+
export LOCAL_ADDRESS='127.0.0.1'
export LOCAL_PORT='2998'