1
I currently have a Windows 10 laptop connected to a Ubuntu 12.04 Laptop via Ethernet. All of the traffic from the windows system has been routed to go through the Linux laptop and out the Linux systems wireless interface to the WiFi. I have been tasked with setting up the Linux system to log the traffic. My first thought was to use Wireshark. However, I was asked to have the logs in a specific format. This is the sample format I was given:
GET /
Host: bing.com
Cookie: MUID=0B62F80D880C681C2DB4F14E8C0C6BC5
HTTP/1.0 301 Moved Permanently
Date: Wed, 29 Jun 2016 19:34:28 GMT
Location: http://www.bing.com/
----------------------------------------------------------
I was also initially asked if netcat would be appropriate. So after words, I figured netcat was what seemed appropriate. However, I have never used netcat for logging purposes. I have looked up other methods and have tried methods involving pipes and fifo (both of which I have no knowledge of). I always seem to end up with the same result of a blank output file. Any help would be appreciated. Thanks.
So I copied and pasted your code exactly. Bare in mind that I didn't really understand any part of the commands besides the fact that the first word was the command the rest were parameters and options. I got a response that said: tcpdump: awk: line 1: no suitable device found syntax error at or near , – CorruptedOffset – 2016-07-11T19:21:23.777
Try running this as root so that it can listen to all devices. Otherwise, add in
-i <your_device>
to thetcpdump
to specify the network device. – DKing – 2016-07-11T19:28:14.9071I typed in tcpdump -i eth0 and start seeing that the traffic was being captured. How would I go to export this to a log file and would it be in the same format. P.S. I was told to make the log file look exactly like the sample format I posted. – CorruptedOffset – 2016-07-11T19:35:23.167
Just use
>> your_filename
. I'll edit the answer with that in it. – DKing – 2016-07-11T19:40:53.423Thank you very much for the help. You have helped me a lot. Just as a last question. Any idea on how to get the format? – CorruptedOffset – 2016-07-11T19:55:11.623
I'm sure that I could try to help. I'm not certain what you are asking for, though. The data requested in the HTTP request and response headers. The first lines of each are the important parts, and the other lines give more information. The command is listening for the raw packets (over the HTTP and HTTPS ports), and stripping out the plain text data being sent. What type of formatting are you looking for? – DKing – 2016-07-11T20:20:41.697
Essentially the exact same format as the one in the original post. From my guess, this was the original output from the software used when I was tasked. If it is not possible to output in that exact format, do you know of a way to parse it? – CorruptedOffset – 2016-07-11T20:28:51.453
I'm not certain what the difference would be. I'm seeing the HTTP headers and responses. I'm missing the "-"s at the end, but I'm not sure how helpful that would be, as the requests and responses are not likely to be in order. As for the header fields, for the most part, none are required, and they may come in almost any order. If you only want certain headers or if you want them in a specific order, that would take more work. Unless I'm missing something, anything more than this would be up to a developer, and would be too unique for the purpose of this site. – DKing – 2016-07-11T20:48:46.133
That is what I was tasked with. I was never given a reason to be in that particular format; however, it was made very clear to be in that explicit order. However, you are correct the information is there. – CorruptedOffset – 2016-07-11T20:54:12.613