#๐Ÿ”’ keep getting a unicodecodeError when trying to decode bytes in utf-8

48 messages ยท Page 1 of 1 (latest)

sage lodge
#

result = con.recv(1024).decode("utf-8")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 78: invalid start byte
what the connection is receiving is bytes

harsh crowBOT
#

@sage lodge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

woven spade
#

!d bytes.decode

harsh crowBOT
#

bytes.decode(encoding='utf-8', errors='strict')``````py

bytearray.decode(encoding='utf-8', errors='strict')```
Return the bytes decoded to a [`str`](https://docs.python.org/3/library/stdtypes.html#str).

*encoding* defaults to `'utf-8'`; see [Standard Encodings](https://docs.python.org/3/library/codecs.html#standard-encodings) for possible values.

*errors* controls how decoding errors are handled. If `'strict'` (the default), a [`UnicodeError`](https://docs.python.org/3/library/exceptions.html#UnicodeError) exception is raised. Other possible values are `'ignore'`, `'replace'`, and any other name registered via [`codecs.register_error()`](https://docs.python.org/3/library/codecs.html#codecs.register_error). See [Error Handlers](https://docs.python.org/3/library/codecs.html#error-handlers) for details.

For performance reasons, the value of *errors* is not checked for validity unless a decoding error actually occurs, [Python Development Mode](https://docs.python.org/3/library/devmode.html#devmode) is enabled or a [debug build](https://docs.python.org/3/using/configure.html#debug-build) is used.

Note

Passing the *encoding* argument to [`str`](https://docs.python.org/3/library/stdtypes.html#str) allows decoding any [bytes\-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object) directly, without needing to make a temporary `bytes` or `bytearray` object.
woven spade
#

try changing errors to "ignore"

sage lodge
#

but most of the output is just bytes

woven spade
woven spade
#

and whats con.recv

sage lodge
woven spade
harsh crowBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

woven spade
#

lemme see the code

sage lodge
#

alr

harsh crowBOT
#

Hey @sage lodge!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
sage lodge
#
import socket
IP = "blank"
PORT = 4444
listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
listener.bind((IP,PORT))
listener.listen(0)
print("[+] waiting for incoming connections...")
con, addr = listener.accept()
print(f"[+] connection detected from {addr}")
while True:
    command = input(">>")
    con.send(command.encode("utf-8"))
    result = con.recv(1024).decode("utf-8")
    print(result)

#

@woven spadeit works now ty for ur time

#

its really choppy tho

sage lodge
woven spade
sage lodge
#

it sends commands and the backdoor executes them and sends the output

woven spade
#

<@&831776746206265384> "a listener for a backdoor"

haughty glade
harsh crowBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

sage lodge
#

its mine tho

woven spade
sage lodge
#

its my computer?

haughty glade
#

It's like he didn't even try to hide it

woven spade
sage lodge
#

its on my pc.

woven spade
sage lodge
#

i get it but i saw a guy asking for advice for a RAT so i thought it was ok

potent tapir
sage lodge
potent tapir
sage lodge
#

idk i just thought it was allowed as long as it wasn't used for sum bad

potent tapir
#

Unfortunately we don't have any way of being able to verify that, so we don't provide help on any potentially malicious software, sorry

potent tapir
#

No worries, thanks for understanding

#

?close

summer egretBOT
#

This is not a Modmail thread.

potent tapir
#

!close

harsh crowBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.