Git Product home page Git Product logo

Comments (5)

rofl0r avatar rofl0r commented on June 17, 2024 2

thanks! does this commit 95ecc4b fix the issue for you ?

from nat-tunnel.

Saturnix avatar Saturnix commented on June 17, 2024

Yes, but now I get:

Traceback (most recent call last):
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 258, in <module>
    cl.setup()
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 75, in setup
    self.controlsock = self._setup_sock('adm')
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 70, in _setup_sock
    nonce = sock.recv(NONCE_LEN*2 + 1).rstrip('\n')
  File "C:\Program Files (x86)\nat-tunnel-master\rocksock.py", line 316, in recv
    data += chunk
TypeError: can only concatenate str (not "bytes") to str

So I tried to change line 298 of rocksock.py from data = '' to data = b'' and I get:

Traceback (most recent call last):
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 258, in <module>
    cl.setup()
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 75, in setup
    self.controlsock = self._setup_sock('adm')
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 70, in _setup_sock
    nonce = sock.recv(NONCE_LEN*2 + 1).rstrip('\n')
TypeError: a bytes-like object is required, not 'str'

Tried changing (in lines 70 and 71 of natsrv.py):

nonce = sock.recv(NONCE_LEN*2 + 1).rstrip('\n')
sock.send(_hash(cmd + self.secret + nonce) + '\n')

to

nonce = sock.recv(NONCE_LEN*2 + 1).rstrip(b'\n')
sock.send(_hash(cmd + self.secret + nonce) + b'\n')

and I get:

Traceback (most recent call last):
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 258, in <module>
    cl.setup()
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 75, in setup
    self.controlsock = self._setup_sock('adm')
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 71, in _setup_sock
    sock.send(_hash(cmd + self.secret + nonce) + b'\n')
TypeError: can only concatenate str (not "bytes") to str

from nat-tunnel.

schtritoff avatar schtritoff commented on June 17, 2024

Regarding python3 - on Ubuntu 20.04.3 LTS (Focal Fossa) + Python 3.8.10 it works, but on other system I still have errors.

OS: Manjaro Linux (arch), Linux 5.4.150-1-MANJARO x86_64
Python 3.9.7

server

Traceback (most recent call last):
  File "/root/nat-tunnel/natsrv.py", line 252, in <module>
    srv = NATSrv(args.secret, adminip, int(adminport), clientip, int(clientport))
  File "/root/nat-tunnel/natsrv.py", line 133, in __init__
    self.hashlen = len(_hash(""))
  File "/root/nat-tunnel/natsrv.py", line 9, in _hash
    return hashlib.sha256(str).hexdigest()
TypeError: Unicode-objects must be encoded before hashing

client

Traceback (most recent call last):
  File "/root/nat-tunnel/natsrv.py", line 258, in <module>
    cl.setup()
  File "/root/nat-tunnel/natsrv.py", line 75, in setup
    self.controlsock = self._setup_sock('adm')
  File "/root/nat-tunnel/natsrv.py", line 70, in _setup_sock
    nonce = sock.recv(NONCE_LEN*2 + 1).rstrip('\n')
  File "/root/nat-tunnel/rocksock.py", line 316, in recv
    data += chunk
TypeError: can only concatenate str (not "bytes") to str

So it seems that python 3.8 is ok, but fails on 3.9 ?

from nat-tunnel.

rofl0r avatar rofl0r commented on June 17, 2024

self.controlsock = self._setup_sock('adm')

this was changed in git, it appears you're running an older version on that manjaro box ?

from nat-tunnel.

schtritoff avatar schtritoff commented on June 17, 2024

Yeah, my fault. Forgot to git pull origin mastet on that machine... Sorry and thanks for nice simple solution.

from nat-tunnel.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.