This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howto:phantom-firmware-tools [2017/08/12 12:21] czokie [Contribute] |
howto:phantom-firmware-tools [2019/02/17 06:18] (current) kornvichs ToDo checked: DUML dumping has never worked for me on OSX. Need to understand how this could work including hardware required. |
||
---|---|---|---|
Line 24: | Line 24: | ||
===== 5. Capture some traffic ===== | ===== 5. Capture some traffic ===== | ||
- | python3 comm_serial2pcap.py -b155200 | + | python3 comm_serial2pcap.py -b115200 |
The intent is for this command to sit between two serial ports, with serial breakout and capturing the serial TX and RX streams, being duplicated into two ports. I don't have a hardware breakout yet, so I have not yet tried this. | The intent is for this command to sit between two serial ports, with serial breakout and capturing the serial TX and RX streams, being duplicated into two ports. I don't have a hardware breakout yet, so I have not yet tried this. | ||
+ | |||
+ | ===== 6. serialsnoop.sh ===== | ||
+ | The code below was created by jan2642 as an alternate way of sniffing duml. It is still a prototype at this stage but listed here to provide a way for Mac users to get some duml love. | ||
+ | |||
+ | <file bash serialsnoop.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | # Listen in on serial port connections. | ||
+ | # (Note that max packet size is hardcoded to be 512) | ||
+ | # Written by jan2642 | ||
+ | |||
+ | if [ " | ||
+ | echo " | ||
+ | fi | ||
+ | |||
+ | / | ||
+ | inline string PATHNAME = "' | ||
+ | |||
+ | #pragma D option quiet | ||
+ | #pragma D option switchrate=10hz | ||
+ | /* #pragma D option bufpolicy=ring */ | ||
+ | |||
+ | dtrace::: | ||
+ | { | ||
+ | } | ||
+ | |||
+ | syscall:: | ||
+ | { | ||
+ | self-> | ||
+ | self-> | ||
+ | } | ||
+ | |||
+ | syscall:: | ||
+ | / | ||
+ | { | ||
+ | the_pid = pid; | ||
+ | the_fd = arg1; | ||
+ | | ||
+ | self-> | ||
+ | self-> | ||
+ | } | ||
+ | |||
+ | syscall:: | ||
+ | /pid == the_pid && arg0 == the_fd/ | ||
+ | { | ||
+ | self-> | ||
+ | self-> | ||
+ | } | ||
+ | |||
+ | syscall:: | ||
+ | / | ||
+ | { | ||
+ | if (arg0 > 0) { | ||
+ | printf(" | ||
+ | tracemem(copyin(self-> | ||
+ | printf(" | ||
+ | } | ||
+ | | ||
+ | self-> | ||
+ | } | ||
+ | |||
+ | syscall:: | ||
+ | /pid == the_pid && arg0 == the_fd/ | ||
+ | { | ||
+ | if (arg2 > 0) { | ||
+ | printf(" | ||
+ | tracemem(copyin(arg1, | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' 2> /dev/null | python -c ' | ||
+ | import sys | ||
+ | |||
+ | def parse_block(buf): | ||
+ | lines = buf.split(" | ||
+ | meta = lines[0].split(" | ||
+ | |||
+ | proc = meta[1] | ||
+ | direction = meta[2] | ||
+ | size = int(meta[3]) | ||
+ | |||
+ | print(" | ||
+ | |||
+ | if size > 512: | ||
+ | size = 512 | ||
+ | |||
+ | for i in xrange(0, (size / 16) + 1): | ||
+ | data = lines[2 + i].strip().split(" | ||
+ | remain = 16 | ||
+ | if i == size / 16: | ||
+ | remain = size % 16 | ||
+ | for j in xrange(0, remain): | ||
+ | print(" | ||
+ | print("" | ||
+ | |||
+ | for line in sys.stdin: | ||
+ | if line.startswith(" | ||
+ | buf = ""; | ||
+ | if line.startswith(" | ||
+ | parse_block(buf) | ||
+ | buf += line | ||
+ | ' | ||
+ | |||
+ | # vim: expandtab: | ||
+ | </ | ||
+ | |||
===== Contribute ===== | ===== Contribute ===== | ||
- | < | + | < |