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

0x00 and 0x0a bytes do not appear in the output #2

Open
jose1711 opened this issue Dec 8, 2021 · 1 comment
Open

0x00 and 0x0a bytes do not appear in the output #2

jose1711 opened this issue Dec 8, 2021 · 1 comment

Comments

@jose1711
Copy link

jose1711 commented Dec 8, 2021

$ cat script.py 
#!/usr/bin/env python
import serial
s = serial.Serial('/dev/ttyUSB0')
s.write(b'\x00\x00\xff\x0a\xff\x00')
$ ./traciex -w foo.file -t /dev/ttyUSB0 ./script.py
tracie: Tracing I/O on Executables
v1.0, released 2020-08-15
Developed by CsokiCraft
tracie is free software; see LICENSE
***tracie v1.0
***Waiting for connection...
***Connected
***tracie v1.0
***Waiting for connection...
***Connected
�
�%  

Expected output:
all 6 bytes appear in the output

Actual output:
only 0xff bytes are present:

$ od -xa foo.file 
0000000    ffff
        del del
0000002
@bence98
Copy link
Owner

bence98 commented Dec 20, 2021

Very interesting find indeed! I did a little debugging, and it seems that this is in fact the case, no \0 or \n characters are being saved to the trace file. However, I do believe that they are being sent in the named pipes, but they aren't handled properly by the shell builtin echo in traciex (line 14). As I do not know how to make echo behave in a binary-friendly way, I think the only option is to not use traciex, but rather make your own Tracie front-end. All the relevant info can be found in tracie.c, lines 14-20. If I have the time, I may try to re-roll traciex in Python3 or C and that will hopefully fix the issue, but until then, use socat or dd (or something similar that properly handles binary data) to read TRACIE_PIPE_W (/tmp/tracie-pipe-w).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants