Where packets are stored on tshark using live capture? - save

I'm writing a real time sniffer using python and tshark and I'm a bit worried about where packets or data are stored in tshark. The idea is being able to execute the python script for days or weeks without stopping it and I'm not really sure if this concern could be a problem.
I have studied and have tried to understand tshark source code from here but I didn't found any line of code concerning this issue.
Is there anyone who knows how this works?
Thank you.

So, by query, the packets captured on the interfaces are applied with the "filter" of the TShark options, and then redirected to the stdout. However, there exists provision to redirect it to specific log file, in specified format.
For Example:
tshark -T json -i eth0 -O UDP -n > log.out
For more options, refer here.

Related

How to log TLSv1.3 keys in JSSE for Wireshark to decode traffic

I've been (successfully) looking at TLSv1.2 traffic in Wireshark via a key logfile. But I'd like to do something similar to TLSv1.3.
https://github.com/square/okhttp/pull/6060
This follows the approach described here https://security.stackexchange.com/questions/35639/decrypting-tls-in-wireshark-when-using-dhe-rsa-ciphersuites
I'm wondering if anyone has similar working with Java JSSE for TLSv1.3?
I know I need to log CLIENT_EARLY_TRAFFIC_SECRET, CLIENT_HANDSHAKE_TRAFFIC_SECRET, SERVER_HANDSHAKE_TRAFFIC_SECRET, CLIENT_TRAFFIC_SECRET_0 or SERVER_TRAFFIC_SECRET_0. But I'm not sure of the right hooks in JSSE.
Found prior art on https://wiki.wireshark.org/TLS#Using_the_.28Pre.29-Master-Secret
Specifically
https://github.com/neykov/extract-tls-secrets
and
http://jsslkeylog.sourceforge.net/
Found prior art on https://wiki.wireshark.org/TLS#Using_the_.28Pre.29-Master-Secret
Specifically
https://github.com/neykov/extract-tls-secrets
and
http://jsslkeylog.sourceforge.net/
For The github project, download https://repo1.maven.org/maven2/name/neykov/extract-tls-secrets/4.0.0/extract-tls-secrets-4.0.0.jar
Then run the following command before it attempts to connect. The sample program for OkHttp prints the PID and then has a 10 second delay for this reason.
$ java -jar ~/Downloads/extract-tls-secrets-4.0.0.jar list
$ java -jar ~/Downloads/extract-tls-secrets-4.0.0.jar <pid> /tmp/secrets.log

.lua are deleted when trying to copy nodemcu from one ESP8266 to another

I'm trying to make a full memory dump of ESP8266 running nodemcu (with some .lua files) to make a copy of it. I'm using esptool.py for a dump. Like this: esptool.py.exe -p COM3 -b 230400 read_flash 0 0x200000 test.bin
When I look inside test.bin, I can see my lua code. So, those files are definitely there. But, when I upload this .bin to another ESP , nodemcu starts filesystem format procedure. Therefore, all .lua files are deleted. NodeMCU build itself seems to be fine.
Why does this happen if I make a full dump of the flash? Is there a register flag or something what defines that nodemcu should format filesystem? How can I copy ESP keeping all .lua files in place?
Seems like NodeMCU was missing init data on 0x3fc000.
So, the best way to solve an issue was to make a complete memory dump.
esptool.py.exe -p COM3 -b 230400 read_flash 0 0x400000 test.bin in my case.

How to extract the "info" field from a pcap file?

I have a pcap file with me and I opened it in Wireshark, I want to extract a specific field basically the "Info" field from the pcap trace and port it to a text file, which I can then parse and use for data analysis. I looked up certain StackOverflow posts and those posts mentioned to use TShark, but I couldn't find any way of extracting the "info" field using TShark. It would be great if someone could point me to an automated way of dumping field specific data to a text file. I have also pasted the image of the wireshark dump for convenience.
With tshark version 1.12.0 or later:
tshark -r inFile.pcap -T fields -e _ws.col.Info > outFile.csv
tshark -r FILE -T fields -e col.info
All of these options are documented in the manual: http://www.wireshark.org/docs/man-pages/tshark.html

Is TelosB mote compatible with Contiki-OS?

I found exp5438 and z1 motes, which have TI MSP430x as a MCU, in the Contiki code tree, and we know that TI MSP430 is the TelosB mote's microcontroller.
I would like to know if TelosB motes are compatible with Contiki ?
The telosB mote is compatible with Contiki OS, in fact I am using them with Contiki. To program them, in case you are using Instant Contiki, you will need to install the GCC for the MSP430 micro controller. You can use the next command:
sudo apt-get install gcc-msp430
On the other hand, I think to solve the problem of your answer I think you just need to be root. So try the next:
sudo -s
make TARGET=sky hello-world.upload
I hope that help you out.
Cheers!
currently I am using telosb to run contiki applications. I followed the official site tutorial and apparently if u do make TARGET=sky it compiles the source files. However, doing make TARGET=sky hello-world.upload does not work. Shows
make sky-reset sky-upload
make[1]: Entering directory `/home/user/contiki-2.6/examples/hello-world'
make -k -j 1 sky-reset-sequence
make[2]: Entering directory `/home/user/contiki-2.6/examples/hello-world'
Done
make[2]: Leaving directory `/home/user/contiki-2.6/examples/hello-world'
make -j 1 sky-upload-sequence
make[2]: Entering directory `/home/user/contiki-2.6/examples/hello-world'
Done
make[2]: Leaving directory `/home/user/contiki-2.6/examples/hello-world'
make[1]: Leaving directory `/home/user/contiki-2.6/examples/hello-world'
rm hello-world.ihex
which according to the official site tutorial means that the board is not connected. I am very certain it is connected. Also, make login never shows anything for me since the previous command didnt work.
Eventually, a friend of mine discovered a way to flash contiki applications into telosb. However, you need TinyOS development environment in your Instant Contiki. You can find information on setting up TinyOS environment in Ubuntu on www.eetutorials.com.
This doesn't seem like a proper way of doing it but well so far it works for me when running simple applications
Step 1:
Compile your applications by doing:
make TARGET=sky application-name
Step 2:
msp430-objcopy application-name.sky -O ihex application-name.ihex
sudo tos-bsl --telosb -c /dev/ttyUSB0 -r -e -I -p application-name.ihex
However, make login still doesn't show anything hence I have been seeing my printf outputs
via Serial Port Terminal application which need to be installed. My guess is that contiki supports sky but not really for telosb? I am no expert and I can't tell the difference between the 2 boards. However, hope this information help and hope a contiki expert can further clarify on this.
Cheers
telosb mote is the same as a tmote sky or sky. The name is all the same platform.
I dont know from which vendor you have the board, but they have to work.
I am also using sky motes with contiki and i had no complications from the beginning.
Try to use the code in the following site: Unreadable output results when typing "make login"
This will print a message every second.
PS: Try to update your question if you found more information, dont add an answer since it confuses people.

start capturing with command line in libpcap format

I try to start capturing with Wireshark using command line but the default output file is pcap extension but Wireshark - pcapng file type and I need libpcap file type.
My command is
tshark.exe" -i interfacenumber -W MyFile.pcap
I also tried
tshark.exe" -i 1 -F libpcap -W MyFile.pcap
and in this case no file created on my disk although I can see the packets in the command line window
tshark.exe -i 1 -F libpcap -w MyFile.pcap`
is the right answer (note the lower case 'w').
(-W does something different. There's lot's of tshark options, so you need to look carefully at the tshark -h output to make sure you're using the right option).
Since the -F libpcap option is not working for me either, I'm using another command line tool in the same directory:
editcap -F libpcap currentFile.pcap(ng) libpcapConvertedFile.pcap where "currentFile.whatever" is the pcapng-formatted file and "libpcapConvertedFile.whatever" is the outputted legacy libpcap format.
I run this once tshark is done capturing the original file.
I think that in the newest Wireshark versions (1.8.x or 1.10.x) you cannot start capturing in libpcap format and the default format is pcapng (also pcap extension - try to use verion 1.6.x)
That's what solve my problem
http://www.wireshark.org/download/win64/all-versions/
http://www.wireshark.org/download/win32/all-versions/

Resources