I have been using the following on my Raspberry pi which basically captures data from a weather hub I have connected to a USB port on the PI.
sudo tcpdump -A -n -p -l -i eth1 -s0 -w - tcp dst port 80 |
stdbuf -oL strings -n8 |
./parser
The output buffer is read via a python script.
I want to move the whole process onto a windows (10) machine and so far I have the following working via CMD under Win10.
tcpdump -A -n -p -l -i eth1 -s0 -w - tcp dst port 80
The output however, is totally unreadable because I can not figure out the rest of the command under windows. Specifically
| stdbuf -oL strings -n8 |./parser
Any help with this would greatly be appreciated
I have tried this under PowerShell but I end up with the same garbled text
./tcpdump -A -n -p -l -i 5 | ForEach-Object {
[Console]::WriteLine($_)
[Console]::Out.Flush()
$_
} | Set-Content program.log
====================================== When I issue the following command RaspPi
sudo tcpdump -A -n -p -l -i eth1 -s0 -w - tcp dst port 80 | stdbuf -oL strings -n8
I will get the following output
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
GET /weatherstation/updateweatherstation?dateutc=now&action=updateraw&realtime=1
&id=24C86E010F25&mt=tower&sensor=00015666
&humidity=74&tempf=26.6
&baromin=30.39&battery=normal&rssi=4
HTTP/1.1
hubapi.myacurite.com
User-Agent: Hub/224
Connection: close
stdbufis a Linuxism -- and it only serves to change the buffering defaults forstrings, telling it to write output as fast as it can; you don't need it.strings -n8is searching for runs of printable characters -- you should be able to write your own code to do that. Powershell has regex functionality, right? Search for strings matching[[:graph:][:space:]]{8,}, print only those matches one-per-line and there you are, adjusting the syntax for whichever regex engine is in use.strings, but we'd need to know the content of the packets you're intercepting. I would be not one tiny bit surprised, though, if we could get the output you wanted just with a bettertcpdumpcommand (or atsharkcommand or similar) once we knew the packet format../parseris an does, but note that there's a downloadablestrings.exeSysInternals utility, which seem to support the option you're looking for.