使用Xcap发送网络数据包
官網(wǎng):http://xcap.weebly.com/
Description
Xcap is a windows based packet generator & sender tool, you can use it to create a packet, then send it through a specified interfaces on you computer.
xcap's functionality:
-
Constructing packet
-
Sending packet through networking interface
where xcap can be used:
-
networking stack test
-
ethernet device test
-
networking protocol training
Now it supports a lot of protocols, including:
1. Arp/ipv4/ipv6/icmpv4/icmpv6/tcp/udp/udplite/igmp
2. mpls/pppoe/gre
3. rsvp/l2tp/radius/snmp/esp/ah
4. rip/ripng/pim/ospf/igrp/vrrp
5. 802.3/8021x
6. l2 switch protocl, such as stp/lacp
7. other l2/l3 protocols
How to run this tool:
1. you should install winpcap 4.0.2 or higher version at first, if you have already installed wireshark, that is OK.
2. download the zip file
3. unzip it
4. double click xcap.exe
5. please read help(in menu help) at first
What you can do through this tool:
1. create a packet by a packet creating wizard, edit any byte in this packet, to create a packet, you should create a packet group at first, then create new packet in this packet group, double click the new created packet, follow the wizard to complete the packet
2. send the packet you created, you should refresh all interfaces in your computer, you can select one interface and start it, then in the packet group panel, select this interface to send the packets you created.
3. create ipv4&ipv6 fragments, you can create a long packet(can not exceed 16K bytes), then right click the packet, click "create fragments", input length for each fragment, this tool will divid the long packet into some fragments.
4. browse the packet by wireshark, when you create some packets in this tool, if you have installed wireshark in you computer, you can browse this packet in wireshark, to use this function, you should choolse "auto" in system tab in configuration dialog, right on packet group or packet, click "view" command to browse this packet in wireshark.
使用
1. 抓取報(bào)文
1) 點(diǎn)擊主界面工具欄中的“刷新列表”按鈕(或?qū)?yīng)菜單“接口->刷新接口”),所有接口會(huì)列在左側(cè)窗口中,選中要使用的接口。?
2) 點(diǎn)擊工具欄中的“啟動(dòng)接口”按鈕,接口啟動(dòng)。
3) 點(diǎn)擊工具欄中的“開(kāi)始抓包按鈕”,應(yīng)用程序進(jìn)入網(wǎng)絡(luò)監(jiān)聽(tīng)狀態(tài)。
4) 分析報(bào)文
2. 構(gòu)造報(bào)文
報(bào)文隸屬于報(bào)文組,每個(gè)報(bào)文組包含多個(gè)報(bào)文,因此,創(chuàng)建報(bào)文首先要?jiǎng)?chuàng)建報(bào)文組,點(diǎn)擊菜單“報(bào)文組->創(chuàng)建報(bào)文組”或工具欄中創(chuàng)建報(bào)文組按鈕,在彈出的對(duì)話框中輸入報(bào)文組名稱(chēng),確定后,在窗口左側(cè)列表中可以看到自己創(chuàng)建的報(bào)文組,鼠標(biāo)點(diǎn)擊這個(gè)報(bào)文組,右側(cè)窗口出現(xiàn)報(bào)文組
1)創(chuàng)建報(bào)文組,可點(diǎn)擊菜單“報(bào)文組/創(chuàng)建報(bào)文組”,輸入報(bào)文組名稱(chēng),確定。
2)在左側(cè)窗口中選擇已創(chuàng)建的報(bào)文組,右側(cè)窗口顯示該報(bào)文組的界面。
3)在右側(cè)界面中點(diǎn)擊“+”按鈕,創(chuàng)建一個(gè)報(bào)文,輸入名稱(chēng)。
4)雙擊已創(chuàng)建的報(bào)文,出現(xiàn)報(bào)文配置向?qū)?#xff0c;首頁(yè)為以太網(wǎng)頭部。
5)輸入目的MAC和源MAC。源MAC隨便填寫(xiě),目的MAC可填寫(xiě)Ubuntu虛擬機(jī)MAC,Type中選中“EthernetII”,下拉框選擇“0x0800 (IPv4)”。
6)點(diǎn)擊下一步,出現(xiàn)Ipv4頭部頁(yè)面,輸入源IP(隨便寫(xiě)一個(gè)IP地址:192.168.0.33)和目的IP(填寫(xiě)虛擬機(jī)的IP:192.168.0.107),protocol選擇“UDP”。
7)點(diǎn)擊下一步,出現(xiàn)UDP頁(yè)面,源端口10001,目的端口填寫(xiě)“10002”,paylod type 選擇custom。
8)填充data,設(shè)置長(zhǎng)度10,修改data。
9)點(diǎn)擊下方的保存和關(guān)閉按鈕,報(bào)文創(chuàng)建成功。
3. 發(fā)送報(bào)文
1) 獲取接口列表。點(diǎn)擊主界面工具欄中的“刷新列表”按鈕(或?qū)?yīng)菜單“接口->刷新接口”),所有接口會(huì)列在左側(cè)窗口中,選中要使用的接口。
2) 啟動(dòng)接口。選擇一個(gè)接口,點(diǎn)擊工具欄中的“啟動(dòng)接口”按鈕,接口啟動(dòng)。
3) ?發(fā)送報(bào)文。選中剛剛創(chuàng)建的報(bào)文組,選擇報(bào)文,在接口中選擇剛剛啟動(dòng)的接口,點(diǎn)擊循環(huán)發(fā)送。
4)可在Ubuntu中使用tcpdump -i ens33 udp命令查看收到的報(bào)文。
注:紅框內(nèi)依次為:發(fā)送報(bào)文,循環(huán)發(fā)送,選擇接口。
總結(jié)
以上是生活随笔為你收集整理的使用Xcap发送网络数据包的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Linux ping的原理与实现
- 下一篇: GRE tunnel源码分析之发送流程