Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
a818105d
Commit
a818105d
authored
May 01, 2010
by
Avery Pennarun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client now listens on a socket and gets SO_ORIGINAL_DST correctly.
parent
f84b87d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
client.py
client.py
+27
-0
helpers.py
helpers.py
+6
-0
No files found.
client.py
0 → 100644
View file @
a818105d
import
struct
from
socket
import
*
from
helpers
import
*
def
original_dst
(
sock
):
SO_ORIGINAL_DST
=
80
SOCKADDR_MIN
=
16
sockaddr_in
=
sock
.
getsockopt
(
SOL_IP
,
SO_ORIGINAL_DST
,
SOCKADDR_MIN
)
(
proto
,
port
,
a
,
b
,
c
,
d
)
=
struct
.
unpack
(
'!hhBBBB'
,
sockaddr_in
[:
8
])
assert
(
htons
(
proto
)
==
AF_INET
)
ip
=
'
%
d.
%
d.
%
d.
%
d'
%
(
a
,
b
,
c
,
d
)
return
(
ip
,
port
)
def
main
(
remotename
,
subnets
):
log
(
'Starting sshuttle proxy.
\n
'
)
listener
=
socket
()
listener
.
setsockopt
(
SOL_SOCKET
,
SO_REUSEADDR
,
1
)
listener
.
bind
((
'0.0.0.0'
,
1234
))
listener
.
listen
(
10
)
log
(
'Listening on
%
r.
\n
'
%
(
listener
.
getsockname
(),))
while
1
:
s
,
srcip
=
listener
.
accept
()
dstip
=
original_dst
(
s
)
print
'Incoming connection from
%
r to
%
r.'
%
(
srcip
,
dstip
)
helpers.py
0 → 100644
View file @
a818105d
import
sys
,
os
def
log
(
s
):
sys
.
stdout
.
flush
()
sys
.
stderr
.
write
(
s
)
sys
.
stderr
.
flush
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment