TCPDUMP

wireshark and tcpdump -r: strange tcp window sizes

泪湿孤枕 提交于 2019-12-03 09:03:39
I'm capturing http traffic with tcpdump and am interested in TCP slow start and how window sizes increase: $ sudo tcpdump -i eth1 -w wget++.tcpdump tcp and port 80 When I view the dump file with Wireshark the progression of window sizes looks normal, i.e. 5840, 5888, 5888, 8576, 11264, etc... But when I view the dump file via $ tcpdump -r wget++.tcpdump -tnN | less I get what seem to be nonsensical windows sizes ( IP addresses omitted for brevity ): : S 1069713761:1069713761(0) win 5840 <mss 1460,sackOK,timestamp 24220583 0,nop,wscale 7> : S 1198053215:1198053215(0) ack 1069713762 win 5672

Parsing pcap taken from wireshark file using - Java

拟墨画扇 提交于 2019-12-03 06:32:16
I am working on converting PCAP file taken from wireshark using JAVA without using native or ready libraries. i converted the bytes to string directly just for checking the meaningful parts of it. then i tried to convert it from hexadecimal to string. It was not meaningful. there is java library jNetPcap which is wrapping all the libpcap library native calls which is written in c. The following picture is captured the wireless network. so the pcap contains the same information: Source ip, destination ip, protocol, length and info I am trying to get the same result form the pcap file which

Understanding Tcpdump filter & bit-masking

♀尐吖头ヾ 提交于 2019-12-03 06:31:54
I am trying to sniff the http headers by using tcpdump. This filter works well but I can't understand it - (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) I've googled it but I can't find any useful info Here is the whole tcpdump command sudo tcpdump -A 'dst [dest host] or src [src host] and tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i eth0 It's not the BPF filter that gets http headers but the "-A" switch on your tcpdump command. Your tcpdump command looks for tcp traffic to certain destination or from a certain source on eth0 where the final BPF filter

Monitoring multiple ports in tcpdump

十年热恋 提交于 2019-12-03 06:28:21
问题 I am trying to find a way to read multiple ports using tcpdump. Suppose I have two ports, p1 and p2, and I want to read the traffic moving through both ports simultaneously. Is there any way to do it using tcpdump or will I have to use some other tool? Basically I am running a proxy server which is running on some port. I want to read the traffic moving through this port as well traffic moving through port 80(HTTP). 回答1: tcpdump port 80 or port 3128 or, alternatively, tcpdump port '(80 or 443

UDP multicast client does not see UDP multicast traffic generated by tcpreplay

為{幸葍}努か 提交于 2019-12-03 06:22:48
I have two programs: server ... it generates UDP traffic on a chosen multicast listener ... it prints UDP traffic on a chosen multicast (it subscribes to a multicast and prints whatever it receives). When I run the server on one machine and listeners on some (other) machine(s), the listener sees UDP traffic and prints it correctly. So these programs should be in a good shape. However, when I try to capture the traffic, on whatever machine, with tcpdump: sudo tcpdump -i eth0 'dst 233.65.120.153' -w 0.pcap and when I later try to replay it, on whatever machine, with tcpreplay: sudo tcpreplay -i

tcpdump详细教程

假装没事ソ 提交于 2019-12-03 04:22:36
tcpdump tcpdump - dump traffic on a network tcpdump是一个用于截取网络分组,并输出分组内容的工具。凭借强大的功能和灵活的截取策略,使其成为类UNIX系统下用于网络分析和问题排查的首选工具 tcpdump 支持针对网络层、协议、主机、网络或端口的过滤,并提供and、or、not等逻辑语句来帮助你去掉无用的信息 命令格式 tcpdump [ -DenNqvX ] [ -c count ] [ -F file ] [ -i interface ] [ -r file ] [ -s snaplen ] [ -w file ] [ expression ] tcpdump格式 抓包选项: -c:指定要抓取的包数量。 -i interface:指定tcpdump需要监听的接口。默认会抓取第一个网络接口 -n:对地址以数字方式显式,否则显式为主机名,也就是说-n选项不做主机名解析。 -nn:除了-n的作用外,还把端口显示为数值,否则显示端口服务名。 -P:指定要抓取的包是流入还是流出的包。可以给定的值为"in"、"out"和"inout",默认为"inout"。 -s len:设置tcpdump的数据包抓取长度为len,如果不设置默认将会是65535字节。对于要抓取的数据包较大时,长度设置不够可能会产生包截断,若出现包截断, :输出行中会出现"[

Understanding Tcpdump filter &amp; bit-masking

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to sniff the http headers by using tcpdump. This filter works well but I can't understand it - (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) I've googled it but I can't find any useful info Here is the whole tcpdump command sudo tcpdump -A 'dst [dest host] or src [src host] and tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i eth0 回答1: It's not the BPF filter that gets http headers but the "-A" switch on your tcpdump command. Your tcpdump command looks for tcp traffic to certain destination or

tcpdump 命令

匿名 (未验证) 提交于 2019-12-03 00:39:02
tcpdump命令 是一款sniffer工具,它可以打印所有经过网络接口的数据包的头信息,也可以使用 - w 选项将数据包保存到文件中,方便以后分析。 语法 tcpdump(选项) 选项 -a:尝试将网络和广播地址转换成名称; -c<数据包数目>:收到指定的数据包数目后,就停止进行倾倒操作; -d:把编译过的数据包编码转换成可阅读的格式,并倾倒到标准输出; - dd :把编译过的数据包编码转换成C语言的格式,并倾倒到标准输出; -ddd:把编译过的数据包编码转换成十进制数字的格式,并倾倒到标准输出; -e:在每列倾倒资料上显示连接层级的文件头; -f:用数字显示网际网络地址; -F<表达文件>:指定内含表达方式的文件; -i<网络界面>:使用指定的网络截面送出数据包; -l:使用标准输出列的缓冲区; -n:不把主机的网络地址转换成名字; -N:不列出域名; -O:不将数据包编码最佳化; -p:不让网络界面进入混杂模式; -q :快速输出,仅列出少数的传输协议信息; -r<数据包文件>:从指定的文件读取数据包数据; -s<数据包大小>:设置每个数据包的大小; -S:用绝对而非相对数值列出TCP关联数; -t:在每列倾倒资料上不显示时间戳记; -tt: 在每列倾倒资料上显示未经格式化的时间戳记; -T<数据包类型>:强制将表达方式所指定的数据包转译成设置的数据包类型; -v

TCP(一)

匿名 (未验证) 提交于 2019-12-03 00:32:02
TCP的特点:三次握手、四次挥手、可靠连接、丢包重传。所有的关键词都围绕着 可靠传输 。 实现可靠传输的核心机制: seq+ack 。通过ack判断是否有丢包,是否需要重传。 三次握手 1)初始状态:client为CLOSED,server为LISTEN,此时client 发送 syn 到server ,client状态变为SYN_SENT; 2)server 收到 syn后回复syn+ack给client,client状态变为SYN_RCVD; 3)client 收到syn+ack后,回复ack向server表示收到了server的syn+ack(此时client连接状态已经是established),当Server收到ack后,状态变成established。 为什么要握手?   1)最重要的目的:告诉对方自己的seq,对方回复ack(收到的seq+包的大小),用于判断是否有丢包; 四次挥手 1)client发送fin包给server,client连接状态变为FIN-WAIT-1; 2)server收到fin包后回复ack给client,表示server知道client要断开了,server连接状态变为CLOSE-WAIT;client收到ack后连接状态变为FIN-WAIT-2; 3)server发送fin包给client,表示server也可以断开了

Wireshark 常用命令

匿名 (未验证) 提交于 2019-12-02 23:43:01
Linux监听端口抓包 tcpdump -i any -s0 port 9000 -w 9000.pcap -vv tcpdump -i any port 9000 and host 10.10.10.10 -w 9000.pcap 过滤某URL http.request.uri.contains "url" 文章来源: https://blog.csdn.net/weixx3/article/details/92187739