欢迎关注:1,欢迎关注本博客,你可点击右手边的【QQ邮件订阅】订阅本博客!2,本博客推出江湖救急计划,主要为工作中遇到疑难杂症的兄弟提供远程技术支持和分析,如有需要,请在江湖救急计划页面给我留言!

联想网御防火墙抓包方法

作者:易隐者 发布于:2012-3-16 17:49 Friday 分类:参考资料

       网御防火墙也带有tcpdump抓包功能,网御防火墙使用tcpdump需要使用root登录。

登录用户名为:root
密码为:g8#6vod3

       关于tcpdump使用的方法参见linux的《tcpdump的使用手册》。

 WEBUI图形化界面的方式

       在WEBUI图形化界面中进行抓包相对比较简单,在“状态检测”->“网络测试”中,有“tcpdump”选项,但是只能指定接口来抓包,如下图示:

点击查看原图


命令行方式

       通过串口、ssh或者telnet的方式登录防火墙。
1,首先需要在防火墙上先要开启相应的管理权限,如下图所示: 

点击查看原图

2,用户名密码使用dump这是一个专门的抓报用户名。也可以用管理员登录的身份进行抓包,用户名与密码:administrator  或者是用户名:administrator 密码:leadsec@7766 ,不同的版本密码不一样。
3,tcpdump的使用说明和案例
tcpdump -i eth0  -c 1000 –s 0 –w  eth0.cap   (注:物理设备显示或者WEBUI界面显示的接口名称为FEX表示,而抓包时是以ETHY显示,Y为X-1)
-c 1000  代表抓1000个包,-s  0  代表抓完整的数据包(可省略)    -w    代表写入dom  ,文件名后坠cap
例如:抓来自192.168.100.77的包,用命令
tcpdump -i eth1 -n host 192.168.100.77  -c 1000 –s 0 –w  eth0.cap
-n表示不解析域名
例如:抓来自端口号为9998的包,用命令
tcpdump -i eth1 port 9998 -c 1000 –s 0 –w  eth0.cap
例如:抓来自vpn内的包,用命令
tcpdump -i ipsec -c 1000 –s 0 –w  eth0.cap
第二步、上传抓包
使用sz   eth0.cap命令可以将第一步所抓的包上传到SecureCRT软件安装的目录下的一个download的子目录里,文件名为eth0.cap,用ethereal可以打开这个文件。
dump>sz  eth0.cap
第三步、清除抓包文件  ,这个步骤一定要做
用命令rm  eth0.cap文件可以清空用tcpdump抓的包

阅读全文>>

标签: tcpdump 防火墙 抓包 联想网御

评论(0) 引用(0) 浏览(12665)

Juniper防火墙下抓包方法

作者:易隐者 发布于:2012-3-16 17:44 Friday 分类:参考资料

debug flow basic

       相对于其他防火墙而言,Juniper防火墙提供许多有效的查错工具,其中之一就是debug flow basic, 应用方式举例如下:
1. 先设置过滤列表,使得防火墙只对需要的数据包进行分析. 即set ffilter命令:
ns208-> set ffilter ?  
dst-ip      flow filter dst ip
dst-port    flow filter dst port
ip-proto    flow filter ip proto
src-ip       flow filter src ip
src-port    flow filter src port
=DBtZ|~4f@ 
ns208-> set ffilter src-ip 192.168.1.10
filter added 
ns208-> get ff
Flow filter based on:
id:0 src ip 192.168.1.10
ns208-> set ffilter src-ip 192.168.1.11
filter added
ns208-> get ff
Flow filter based on:
id:0 src ip 192.168.1.10
id:1 src ip 192.168.1.11
看出来了吗? 设置两次ffilter的结果是两个过滤列表之间是OR的关系. 如果直接设  

set ffilter src-ip 192.168.1.11 dst-ip 194.73.82.242 就是AND的关系了.
2. 开启debug
ns208-> debug flow basic
3. 发送测试数据包或让小部分流量穿越防火墙
4. 停止debug
ns208-> undebug all
5. 检查防火墙对所转发的符合过滤条件的数据包的分析结果: }
ns208-> get db stream
****** 12553.0: packet received [60]****** Packet arrived on the eth1 interface  tF(UJO xk 
ipid = 29503(733f), @d7806910 IP id
packet passed sanity check. I rbyB6. ¬ 
ethernet1:192.168.1.10/1280->194.73.82.242/512,1(8/0) Src IP, Port, Dst IP, port incl Protocol 1
chose interface ethernet1 as incoming nat if. Int eth1 is placed in NAT mode  s<`Nxz@0 
search route to (192.168.1.10->194.73.82.242) in vr trust-vr for vsd-0/flag-0/ifp-null Route lookup in trust-vr 
route 194.73.82.242->1.1.1.2, to ethernet3 route found to gateway 1.1.1.2 exiting interface int eth3 
routed (194.73.82.242, 0.0.0.0) from ethernet1 (ethernet1 in 0) to ethernet3 packet routed
policy search from zone 2-> zone 1 Policy lookup performed from Trust (2) to Untrust (1) 
Permitted by policy 3 matched policy ID 3
choose interface ethernet3 as outgoing phy if choose physical interface eth3
no loop on ifp ethernet3. r4Ok(8f6¬D 
session application type 0, name None, timeout 60sec session time created as 60 seconds for ICMP
service lookup identified service 0. service lookup performed 
existing vector list 1-559ef00.
Session (id:76) created for first pak 1 Create session with ID 76 
route to 1.1.1.2 Routed packet to 1.1.1.2 
arp entry found for 1.1.1.2 Already had ARP entry for 1.1.1.2 
nsp2 wing prepared, ready
cache mac in the session Cached MAC address in the session
flow got session.
flow session id 76 
post addr xlation: 1.1.1.1->194.73.82.242. Translate src address to egress interface IP
packet send out to 0010db103041 through ethernet3 Packet sent out on the wire
6. 清除防火墙缓存的debug结果: 
ns208-> clear db
7. 清除防火墙的过滤设置 
ns208->unset ffilter 0
ns208->get ffilter

Snoop

        Snoop 是Juniper防火墙另外一个有效的查错工具,它和debug flow basic的区别是: snoop类似于在防火墙的接口上抓包,可以根据具体接口, 数据包的方向, 协议等等要素进行过滤抓包; debug flow basic则对数据包如何穿越防火墙进行分析,将防火墙的对数据包的处理过程显示出来. Snoop的使用举例如下: 1. 先设置过滤列表,使得防火墙只对需要的数据包进行分析. 即snoop filter命令: 
ns208-> snoop filterdelete          delete snoop filter >
ethernet        snoop specified ethernet
id            snoop filter id |
ip            snoop ip packet ?YcG
off            turn off snoop filter dwjYU\on            turn on snoop filter
tcp            snoop tcp packet udp            snoop udp packet 7 

ns208-> snoop filter ip
direction        snoop direction
dst-ip          snoop filter dst ip dst-port        snoop filter dst port
interface        interface name
ip-proto        snoop filter ip proto a port          src or dst port Pv
src-ip          snoop filter src ip 1)TEIsrc-port        snoop filter src port
    IPv4 Address 
offset          ip offset UqDqF
ns208-> snoop info
Snoop: OFF
Filters Defined: 2, Active Filters 2
Detail: OFF, Detail Display length: 96 EE
Snoop filter based on: id 1(on): IP dir(I) qc
id 2(on): IP dst-ip 172.27.68.1 dir(B) :WdL
RHtx3{S/ 
2. 开启snoop 进行抓包 YC
ns208-> snoopStart Snoop, type ESC or 'snoop off' to stop, continue? [y]/n y
3. 发送测试数据包或让小部分流量穿越防火墙
 4. 停止snoop ns208-> snoop off
5. 检查防火墙对所转发的符合过滤条件的数据包的分析结果(非采用上面的filter,而是采用另外的filter): 
ns208-> get db stream 5Y =M <ZEC&NBSP; q#I>m¬u=JJ 
          1.    The packet comes into the Netscreen from the Trusted side client.            55864.0: 0(i):005004bb815f->0010db00ab30/0800    D *MoEd 
            10.0.0.36->10.10.10.14/1, tlen=60    vhl=45, id=31489, frag=0000, ttl=32
          2.    The packet then leaves the Netscreen, on it’s way to the destination host.      55864.0: 1(o):0010db00ab31->00104bf3d073/0800            10.10.10.10->10.10.10.14/1, tlen=60 uS
            vhl=45, id=31489, frag=0000, ttl=31 r
          3.    The packet then returns to the Netscreen from the host. &W          55864.0: 1(i):00104bf3d073->0010db00ab31/0800 |_+% 'XtU 
              10.10.10.14->10.10.10.10/1, tlen=60 |yxLm              vhl=45, id=12289, frag=0000, ttl=128 
          4.    Finally, the packet is returned to the client on the trusted side. -
          55864.0: 0(o):0010db00ab30->005004bb815f/0800 4 /W|~=y            10.10.10.14->10.0.0.36/1, tlen=60 
            vhl=45, id=12289, frag=0000, ttl=127 6,19usXw:M 
6. 清除防火墙缓存的debug结果:ns208-> clear db W7. 清除防火墙的snoop过滤设置 
ns208-> snoop filter delete   
All filters removed

阅读全文>>

标签: debug 防火墙 抓包 Juniper snoop

评论(0) 引用(0) 浏览(9823)

Hillstone防火墙抓包方法

作者:易隐者 发布于:2012-3-10 17:51 Saturday 分类:参考资料

debug

通过Debug定位NBC策略匹配问题相关说明如下:

使用注意:
         Debug功能开启后,有可能会产生CPU使用率高或设备打印输出大量信息,引起设备无法管理。
         请仔细理解Debug功能后,再使用相关调试功能。
         使用过程中,可以双击ESC关闭Debug功能;当设备开启Debug后无法管理设备,您也可以选择重启设备,设备重启后会自动关闭Debug功能
相关命令介绍:
         Debug dp filter src-ip X.X.X.X         //配置debug需要定位分析的源IP地址
         Show dp-filter                     //确认上一条配置的debug 数据转发过滤条件是否正确,如果配置错误可以使用“undebug dp filter id ”删除后重新配置
         debug dp policy lookup              //开启设备策略查找调试功能
         show debug                                                    //确认已经开启的设备调试功能
         clear logging debug                //清除历史调试打印信息
show logging debug                //查看debug打印日志
使用举例:
         设备配置了很多的NBC策略,目前发现172.20.10.68这个源IP没有达到客户城的NBC策略功能,现要求查看172.20.10.68访问某URL时匹配的NBC策略名称。
相应的调试过程如下(红色为输入的命令):
SG6000-1(M)# debug dp filter src-ip 172.20.10.68
assigned id: 1
SG6000-1(M)# show dp-filter
---------------------------------------------------------------
vrouter name:trust-vr
---------------------------------------------------------------
id: 1
src-ip: 172.20.10.68 vrouter: trust-vr
---------------------------------------------------------------
SG6000-1(M)# debug dp policy lookup
SG6000-1(M)# show debug
dp:
  policy:
    lookup, enabled
SG6000-1(M)# clear logging debug
SG6000-1(M)# show logging debug
2011-05-24 10:00:32, DEBUG@FLOW: core 1 (sys up 0x169795ff ms): Pak src zone tru
st, dst zone untrust, prot 6, dst-port 80.
Auth-user id 0
Policy 37 matches, ===PERMIT=== (此处显示匹配了防火墙第37条策略,行为允许)
nbc match rule = 139\163mail   (此处显示匹配了NBC的“139\163mail”这条策略)


2011-05-24 10:00:32, DEBUG@FLOW: core 2 (sys up 0x1697962d ms): Pak src zone tru
st, dst zone untrust, prot 6, dst-port 80.
Auth-user id 0
Policy 37 matches, ===PERMIT===
nbc match rule = 139\163mail

SG6000-1(M)# undebug all               (此处非常重要,一定要在Debug使用完成后,关闭所有Debug功能)
SG6000-1(M)# undebug dp filter id 1
SG6000-1(M)# show debug
SG6000-1(M)# show dp-filter
---------------------------------------------------------------
vrouter name:trust-vr
---------------------------------------------------------------
[ FAQ88 ] 如何通过Debug定位NBC策略匹配问题? - FAQ Information   Updated today (24 May 2011)

snoop

Snoop的语法应该跟juniper的差不多,暂无详细的相关资料。

阅读全文>>

标签: debug 防火墙 抓包 snoop Hillstone

评论(0) 引用(0) 浏览(23706)

思科ASA防火墙下抓包方法

作者:易隐者 发布于:2012-2-26 17:43 Sunday 分类:参考资料

ASA防火墙抓包示例

capture asa_capture_inside_1 type raw-data access-list tac_capture buffer 10000000 interface inside
capture asa_capture_outside_1 type raw-data access-list tac_capture buffer 10000000 interface outside
no capture asa_capture_inside_1
no capture asa_capture_outside_1
clear capture asa_capture_inside_1
clear capture asa_capture_outside_1
copy /pcap capture:asa_capture_inside_1 tftp://172.16.1.200/asa_inside_capture.cap
copy /pcap capture:asa_capture_outside_1 tftp://172.16.1.200/asa_outside_capture.cap


access-list test permit ip host ip (inside) host ip(outside)
access-list test permit ip host ip (outside) host ip (inside)
capture inside access-list test buffer 10000000 interface inside interface outside
capture outside access-list test buffer 10000000 interface outside interface inside

其他示例

1 ,cisco防火墙troubleshooting之capture packet
首先定义需要抓报的类型,使用acl:
access-list capture permit icmp any any
capture test access-list capture interface outside
这样当有icmp包经过outside接口时,就会被抓取下来

copy /pcap capture: test tftp:

Source capture name [test]?  

Address or name of remote host []? 10.10.166.27

Destination filename [test]? test1

这样就会把原始包抓取下来,然后扩展名改为dmp
show capture test
或者通过:https://10.10.166.138/capture/captest/pcap直接可以查看
通过这个地址:https://10.10.166.138/capture/http/pcap来下载

no capture test
删除capture test缓存

       在抓取包的时候,如果是TCP,UDP数据包(基于状态)的时候,只有初始数据包处理,后续包直接进入加速处理器,不会被抓到。
       例如从一个接口1进入,从2口出来,然后返回数据包从2口进入,从1口出来。这个时候数据包只有1口进的时候才被抓取。而当专区icmp(没有状态)的时候,不管是进还是出都会被抓到,就是说,在1,2口的进出口都会被抓到。

2,思科防火墙与oracle兼容性有问题的抓包过程

配置要抓包的数据流
access-list tac_capture permit ip host 59.42.158.1 host 172.16.99.1
access-list tac_capture permit ip host 172.16.99.1 host 59.42.158.1
capture pix_dmz_capture_1 access-list tac_capture buffer 10000000 interface dmz
capture pix_inside_capture_1 access-list tac_capture buffer 10000000 interface inside
capture tac_dmz_capture intreface dmz
capture tac_inside_capture interface inside
            
 显示一些配置
show clock
show conn local 172.16.99.1
show conn foreign 59.42.158.18
show local-host 172.16.99.1
show local-host 59.42.158.1
show xlate local 172.16.99.1
show xlate global 59.42.158.1
show capture
拷贝capture 到tftp服务器上。
copy capture:pix_dmz_capture_1 tftp://172.16.1.200/pix_dmz_capture.cap pcap
copy capture:pix_inside_capture_1 tftp://172.16.1.200/pix_inside_capture.cap pcap
取消capture
clear capture tac_capture
no capture pix_dmz_capture_1
no capture pix_inside_capture_1
配置要抓包的数据流
access-list tac_capture permit ip host 59.42.158.1 host172.16.99.1
access-list   tac_capture permit ip host 172.16.99.1 host 59.42.158.1
capture asa_capture_inside_1 type raw-data access-list tac_capture buffer 10000000 interface inside
capture asa_capture_outside_1 type raw-data access-list tac_capture buffer 10000000 interface outside
capture tac_capture_inside access-list tac_capture interface inside
capture tac_capture_outside access-list tac_capture interface outside
c)
show clock
show conn address 172.16.99.1
show conn address 59.42.158.1
show local-host 172.16.99.1
show local-host 59.42.158.1
show asp drop
show xlate
show capture
d)拷贝capture到tftp服务器上
copy /pcap capture:asa_capture_inside_1 tftp://172.16.1.201/asa_inside_capture.cap
copy /pcap capture:asa_capture_outside_1 tftp://172.16.1.201/asa_outside_capture.cap
e)取消capture
no capture asa_capture_inside_1
no capture asa_capture_outside_1
clear capture asa_capture_inside_1
clear capture asa_capture_outside_1

阅读全文>>

标签: 防火墙 ACL 抓包 思科 ASA

评论(0) 引用(0) 浏览(50449)

思科PIX防火墙下抓包方法

作者:易隐者 发布于:2012-2-26 17:42 Sunday 分类:参考资料

命令语法

capture capture_name [type {asp-drop [drop-code] | raw-data | isakmp | webvpn user webvpn-user [url url]}] [access-list access_list_name] [buffer buf_size] [ethernet-type type] [interface interface_name] [packet-length bytes] [circular-buffer][trace trace_count] 

 在版本6.2中首次出现。
 可捕获在ACL中匹配的包。
 可用sniffer软件,如Iris,ethereal,sniffer等打开。
 保存在内存中,缺省512kb,当buffer满的时候会自动停止。

关键步骤:
 在ACL定义感兴趣的数据流。
 将ACL应用到目标接口。

示例

1,先设置感兴趣流量的ACL
access-list cisco_test  permit ip  host 211.91.211.54   host 61.242.223.17
access-list cisco_test  permit ip host 61.242.223.17 host 211.91.211.54
2,抓包
capture in_cap interface inside access-list cisco_test
capture out_cap interface outside access-list cisco_test
3,查看数据包
show capture
show capture in_cap detail
show capture out_cap detail
4,保存数据包
https://61.242.X.X/capture/in_cap/pcap
https://61.242.X.X/capture/out_cap/pcap
注意:确保PIX上启用了http server。

另外的示例

capture pix_dmz_capture_1 access-list tac_capture buffer 10000000 interface dmz

//抓取DMZ接口的数据包,抓包缓存为10000000B,抓包范围为ACL tac_capture,抓包保存的文件名为pix_dmz_capture_1。
capture pix_inside_capture_1 access-list tac_capture buffer 10000000 interface inside

//抓取inside接口的数据包,抓包缓存为10000000B,抓包范围为ACL tac_capture,抓包保存的文件名为pix_inside_capture_1。
no capture pix_dmz_capture_1

//删除抓包文件pix_dmz_capture_1
no capture pix_inside_capture_1

//删除抓包文件pix_inside_capture_1
copy capture:pix_dmz_capture_1 tftp://172.16.1.200/pix_dmz_capture.cap pcap

//将抓包文件pix_dmz_capture_1copy到tftp服务器172.16.1.200上。
copy capture:pix_inside_capture_1 tftp://172.16.1.200/pix_inside_capture.cap pcap

阅读全文>>

标签: 防火墙 ACL 抓包 思科 PIX

评论(0) 引用(0) 浏览(7755)

Powered by 易隐者 基于emlog 皖ICP备12002343号-1