Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #157039
    icare90
    Participant

    Hello,

    Could you please share the codes for the listener and the reverse backdoor for PYTHON 3. Despite many attempts, I don’t manage to make it work.

    oot@kali:~/Documents/python-projects# python listener.py
    (+) Waiting for incoming cnnection
    (+) Got a connection from (‘192.168.193.128’, 54317)
    >> dir
    Traceback (most recent call last):
    File “/root/Documents/python-projects/listener.py”, line 34, in <module>
    my_listener.run()
    File “/root/Documents/python-projects/listener.py”, line 30, in run
    result = self.execute_remotely(command)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/root/Documents/python-projects/listener.py”, line 24, in execute_remotely
    self.reliable_send(command)
    File “/root/Documents/python-projects/listener.py”, line 16, in reliable_send
    json_data = json.dumps(data)
    ^^^^^^^^^^^^^^^^
    File “/usr/lib/python3.11/json/__init__.py”, line 231, in dumps
    return _default_encoder.encode(obj)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3.11/json/encoder.py”, line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3.11/json/encoder.py”, line 258, in iterencode
    return _iterencode(o, 0)
    ^^^^^^^^^^^^^^^^^
    File “/usr/lib/python3.11/json/encoder.py”, line 180, in default
    raise TypeError(f’Object of type {o.__class__.__name__} ‘
    TypeError: Object of type bytes is not JSON serializable

    #157394
    Diego PérezDiego Pérez
    Moderator

    Hi!
    I don’t have the codes, just follow the instructions in the course to be able to make it work with python 3, the error you are getting is covered in the lecture.

    Greetings!
    Diego

    #160839
    icare90
    Participant

    Hello Diego,
    The full lecture is based on python2.
    I didn’t manage to fix the code to make it work with python3.
    Still this object type issue for the serialization.

    Your help would be welcome.
    And more generally speaking, a course updated for python3 would be a plus.

    def reliable_send(self, data):
    json_data = json.dumps(data).encode()
    self.connection.send(json_data)

    def reliable_receive(self):
    json_data =””
    while True:
    try:
    json_data = json_data + self.connection.recv(1024).decode()
    return json.loads(json_data)
    except ValueError:
    continue

    def execute_remotely(self, command):
    self.reliable_send(command)
    return self.reliable_receive()

    #161229
    Diego PérezDiego Pérez
    Moderator

    Hi!
    Where is the error being showed? In the listener or backdoor? Can you share a screenshot of it? Also share some screenshots of the code because it doesn’t have any indentation.

    Greetings!
    Diego

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.