Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the size of data packets to less than mtu #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nxbender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
parser.add_argument('-d', '--domain', required=True)

parser.add_argument('-f', '--fingerprint', help='Verify server\'s SSL certificate has this fingerprint. Overrides all other certificate verification.')
parser.add_argument('-m', '--mtu', type=int, default=1280, help='Connection Maximum Transmission Unit (MTU), used to determine size of packets sent to server.')
parser.add_argument('-m', '--max-line', type=int, default=1514, help='Maximum length of a single line of PPP data sent to the server')

parser.add_argument('--debug', action='store_true', help='Show debugging information')
parser.add_argument('-q', '--quiet', action='store_true', help='Don\'t output basic info whilst running')
Expand Down
5 changes: 1 addition & 4 deletions nxbender/sslconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ def __init__(self, session_id, *args, **kwargs):

self.buf = b''
self.wbuf = b''
# Set the length of lines over the TLS connection to ensure result fits in one packet.
# Overhead is 2 bytes at start, 2 bytes line ending
self.line_length = self.options.mtu - 4

def fileno(self):
return self.s.fileno()
Expand Down Expand Up @@ -111,7 +108,7 @@ def writes_pending(self):

def write_pump(self):
while len(self.wbuf):
packet = self.wbuf[:self.line_length]
packet = self.wbuf[:self.options.max_line]
buf = struct.pack('>L', len(packet)) + packet
self.s.sendall(buf)
self.wbuf = self.wbuf[len(packet):]
Expand Down