window下使用wireshark远程抓包

原文地址:http://www.cfanz.cn/?c=article&a=read&id=100314

由于需要调试pc服务器打印胶片和设备上直接打印胶片之间的区别,研发要求我抓包分析2者之间的差别,但是很快面临一个问题,我没有权限动交换机的权限,他们也没有在交换机上配置端口镜像,于是只好去找小HUB,淘汰了块10几年的集线器,这个几乎快被遗忘的网络设备,由于他是共享网络,容易造成网络事故,很多场地上是禁止使用的,但是他是网络抓包的好工具。。。我找遍每一个角落,都找不到小hub,于是乎让北京的同事给我快递一个过来,可惜EMS再次发扬国企的老大作风,都4天了,我等到花儿都谢了,我的快递还没到,没办法,只好另想办法。。。

   在QQ群里问的时候,有人建议我远程抓包试试,于是我用百度了下,发现wireshark从1.2开始的版本已经开始支持远程抓包了,那么让我们来试验下wireshark远程抓包吧。。。

   首先要在我们需要被抓包的remote机器上确保安装了WinPcap,尽量找最新的版本,安装路径按默认即可。在remote端,进入命令行模式下,切换到winpcap的路径下:C:Program FilesWinPcap,运行rpcapd -h,可以看到各个参数的用法,下面列出参数的用法:

C:Program FilesWinPcap>rpcapd.exe -h  USAGE:  rpcapd [-b <address>] [-p <port>] [-6] [-l <host_list>] [-a <host,port>]  [-n] [-v] [-d] [-s <file>] [-f <file>]  -b <address>: the address to bind to (either numeric or literal).  Default: it binds to all local IPv4 addresses  -p <port>: the port to bind to. Default: it binds to port 2002 -4: use only IPv4 (default both IPv4 and IPv6 waiting sockets are used)  -l <host_list>: a file that keeps the list of the hosts which are allowed  to connect to this server (if more than one, list them one per line).  We suggest to use literal names (instead of numeric ones) in order to  avoid problems with different address families  -n: permit NULL authentication (usually used with '-l')  -a <host,port>: run in active mode when connecting to 'host' on port 'port' In case 'port' is omitted, the default port (2003) is used  -v: run in active mode only (default: if '-a' is specified, it accepts  passive connections as well  -d: run in daemon mode (UNIX only) or as a service (Win32 only)  Warning (Win32): this switch is provided automatically when the service  is started from the control panel  -s <file>: save the current configuration to file  -f <file>: load the current configuration from file; all the switches  specified from the command line are ignored  -h: print this help screen

看了参数的含义,我们需要3个常用的即可:

-l 允许远端可以连接本机,次参数必须

-d 允许rpcapd服务以daemon的方式运行,此参数必须

-n 此参数加上可以让远程连接抓包时不需要输入用户名和密码

以上为我抓包时在remote端运行是加的参数,rpcapd -lnd  即可,但是奇怪的是我用netstat 看机器上运行的端口时,没发现2002端口开着,很诡异,但是不管那么多了,remote这里已经搞定了。

   接着我们在本机打开wireshark,在菜单:Capture---Options,打开之后可以看到

wireshark

我们点击“Add Remote Interface”,弹出添加远程接口的窗口:

交换机

我们在host里面填入remote端的IP,端口时2002,如果不知道可以从rcapd的参数里面看到服务的端口号,如果你在开remote端的服务没有加-n参数的话,这里需要输入用户名和密码,然后点击"OK"就可以了,最后的页面应该是这样的:

服务器

上面可以看到3块网卡,因为我这里的remote端由2个网卡,本机一块网卡,所以有3快,我吧要抓包的那块网卡勾上,然后点击下面的start按钮,就可以开始抓包了。。。

 呵呵,抓包配置基本到此为止,最后附上一张抓到包后的截图做为收尾:

远程


猜你喜欢

转载自blog.csdn.net/shuizhongmose/article/details/20035083