Welcome!

Apache Authors: Elizabeth White, Pat Romanski, Liz McMillan, Christopher Harrold, Janakiram MSV

Blog Feed Post

The Ins and Outputs of TCPDUMP

As a Network Engineer, I spend a lot of time on, in, and around the terminal. Many of the systems that I work with are remote and taking the time to download a packet capture in the middle of an emergency call and waiting for Wireshark to get the necessary details is just too much of a hassle. (Plus, it makes me feel like I’m an operator in the Matrix with the scrolling code.) Now don’t get me wrong, Wireshark is a great tool and has many uses, but a lot of times it’s just not practical. Besides, are you really going to download the packets from a snort alert and pump them into Wireshark? This my friends is where Tcpdump comes into play and shines.

What is Tcpdump?

Tcpdump is the most commonly and widely used tool to analyze and intercept various types of Ethernet traffic. A network administrator, security auditor, or anyone else dealing in the end to end connectivity of their infrastructure will find this tool pre-installed most of time. Many times when working with third party vendors, sometimes you have to prove that its isn’t your network, firewall, or NAT causing the issue with the application and its just poor coding on their end.

First we will look at some simple traffic and in this case will be an apt install of 2 packages.

The following is the command that I used to to ‘capture’ or record this network traffic.
[prettify]tcpdump -s 1500 -Avvvn -i wlan0 -w package.pcap host 208.100.4.53[/prettify]

Command Breakdown

tcpdump: Name of the application.

[prettify]-s 1500[/prettify]: Snap length is how much of the packet to get. The default is 65535 bytes. Setting the snap length to 0 sets it to it’s default. (According to the man page for my version)

[prettify]-A[/prettify]: Prints the packet in ASCII. Useful for plain text traffic and application troubleshooting.

[prettify]-vvv[/prettify]: Very very verbose – Prints more information about the packet such as TTL and a lot more

[prettify]-n[/prettify]: Won’t convert address to human names

[prettify]-i[/prettify]: Which interface to listen and capture on

[prettify]-w[/prettify]: Write the packet to said file name

[prettify]host[/prettify]: The remote peer

Now that we have successfully written the packets to a file we can now analyze the traffic. In any type of troubleshooting situation you have to start at square one. Lets open this file and pipe it into something useful instead of filling the scroll back buffer and missing the first essential connection details.

Since the TCP/IP stack has retransmission as part of the protocol if the first few packets fail then the rest of the connection is doomed.

<em>tcpdump -s 1500 -Avvvn -r package.pcap | less</em>

The -r switch reads the file instead of writing it. Since we already filtered out any other traffic with the host argument we don’t need to be as detailed in our command. The | (pipe) means direct the standard output (console screen) to another application, in the case “less”. This give us the ability to scroll through the whole .pcap file.

The first the 3 packets represent the 3 way-handshake which every TCP connection must go through to set up the connection.

[prettify]12:26:58.632628 IP (tos 0×0, ttl 64, id 20547, offset 0, flags [DF]

, proto TCP (6), length 60)

10.0.1.38.59181 [email protected]@.
.

..&.d.5.-.PZ..v……………….

.g.5……..

12:26:58.663268 IP (tos 0x0, ttl 51, id 0, offset 0, flags [DF], pr

oto TCP (6), length 60)

208.100.4.53.80 > 10.0.1.38.59181: Flags [S.], cksum 0x7075 (co

rrect), seq 2554095472, ack 1526109303, win 5792, options [mss 1460

,sackOK,TS val 2580458519 ecr 6800437,nop,wscale 7], length 0

E..<[email protected]

..&.P.-. 208.100.4.53.80: Flags [.], cksum 0xb5ab (cor

rect), ack 1, win 46, options [nop,nop,TS val 6800445 ecr 258045851

9], length 0

[email protected]@.

.

..&.d.5.-.PZ..w.<gq...........

.g.=....[/prettify]

And now my host is sending its HTTP GET request to the remote HTTP server. Remember when I said in the beginning that I was going to install two packages? Well you can see two GET requests made to the server in the output below. Can you tell what I was installing?

[prettify]12:26:58.663524 IP (tos 0x0, ttl 64, id 20549, offset 0, flags [DF]

, proto TCP (6), length 435)

10.0.1.38.59181 > 208.100.4.53.80: Flags [P.], cksum 0x0d68 (correct), seq 1:384, ack 1, win 46, options [nop,nop,TS val 6800445 ecr 2580458519], length 383

[email protected]@. A

..&.d.5.-.PZ..w.<gq....^Mh.....

.g.=....GET /debian/pool/main/a/awn-extras-applets/awn-applets-c-extras_0.4.0-3_amd64.deb HTTP/1.1

Host: mirror.steadfast.net

Connection: keep-alive

User-Agent: Debian APT-HTTP/1.3 (0.8.10.3)

GET /debian/pool/main/a/awn-extras-applets/awn-applets-python-extras_0.4.0-3_all.deb HTTP/1.1

Host: mirror.steadfast.net

Connection: keep-alive

User-Agent: Debian APT-HTTP/1.3 (0.8.10.3)
[/prettify]

How do we know that the server even received our request? TCP will always send an ACK, or in the case of a corrupt packet, a reset (RST) the last packet. As you can see in the following output there is the acknowledge of the GET request and then the server's HTTP 200 OK response.

[prettify]
12:26:58.693420 IP (tos 0x0, ttl 51, id 52036, offset 0, flags [DF]

, proto TCP (6), length 52)

208.100.4.53.80 > 10.0.1.38.59181: Flags [.], cksum 0xb406 (cor

rect), ack 384, win 54, options [nop,nop,TS val 2580458549 ecr 6800

445], length 0

[email protected]

..&.P.-.<gqZ......6.......

...5.g.=

12:26:58.750220 IP (tos 0x0, ttl 51, id 52037, offset 0, flags [DF]

, proto TCP (6), length 1500)

208.100.4.53.80 > 10.0.1.38.59181: Flags [.], seq 1:1449, ack 3

84, win 54, options [nop,nop,TS val 2580458605 ecr 6800445], length

1448

[email protected]

..&.P.-.<gqZ......6.H.....

...m.g.=HTTP/1.1 200 OK

Date: Sun, 18 Mar 2012 16:27:03 GMT

Server: Apache/2.2.3 (CentOS)

Last-Modified: Mon, 19 Jul 2010 07:02:03 GMT

ETag: "2ae23c67-1e17e-48bb8254eb0c0"

Accept-Ranges: bytes

Content-Length: 123262

Connection: close

Content-Type: text/plain; charset=UTF-8[/prettify]

And as they say “the rest is history”. Well, technically the rest is of the TCP stream for my packages, but if you are troubleshooting further than the initial connections you are going to need to roll up your sleeves and have a firm grasp of the TCP protocol. If you're not as strong at reading packet captures or understanding how the whole TCP/IP stacks work, then this is the best way to learn with simple, easy to define and read traffic. In my next entry I plan on going more in depth with situational examples.

The post The Ins and Outputs of TCPDUMP appeared first on Hurricane Labs.

Read the original blog entry...

More Stories By Hurricane Labs

Christina O’Neill has been working in the information security field for 3 years. She is a board member for the Northern Ohio InfraGard Members Alliance and a committee member for the Information Security Summit, a conference held once a year for information security and physical security professionals.

IoT & Smart Cities Stories
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publishing company that develops products to help senior professionals in the world's most ICT dependent organizations make risk-based infrastructure and capacity decisions.
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
Charles Araujo is an industry analyst, internationally recognized authority on the Digital Enterprise and author of The Quantum Age of IT: Why Everything You Know About IT is About to Change. As Principal Analyst with Intellyx, he writes, speaks and advises organizations on how to navigate through this time of disruption. He is also the founder of The Institute for Digital Transformation and a sought after keynote speaker. He has been a regular contributor to both InformationWeek and CIO Insight...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...