NetScreen Snoop Command

本文介绍如何使用NetScreen防火墙的snoop命令来监控数据流。通过创建过滤器可以精确查看感兴趣的数据包,同时调整详细信息长度来捕获整个数据包。文章还提供了如何查看、导出数据及调试命令的使用方法。

NetScreen Snoop Command

A useful tool for troubleshooting data flow problems through a NetScreen firewall is the snoop command. From a command line interface (CLI) you can enter snoop ? to see options for this command. The command will not provide detailed information on the actions the firewall is taking on packets flowing through it - for that you need to use the debug command - but it will allow you to see what data is flowing through the firewall.

ns5gt-> snoop ?
<return>
detail               snoop detail configuration
filter               snoop filter configuration
info                 show snoop information
off                  turn off snoop
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 0, Active Filters 0
Detail: OFF, Detail Display length: 96

By default snoop sends its output to the dbug buffer rather than the console. If that setting has been changed, you can use set console dbuf to set it to the default value.

The first step in using snoop is to create a filter so that you see only the pertinent data, unless you want to see everything. In the example below, the filter is set to show all data flowing through the firewall between 72.81.210.154 and 192.168.2.3 in both directions. The debug buffer, where the data will be captured, is then cleared and snoop is started.

ns5gt-> snoop filter ip src-ip 72.81.210.154 dst-ip 192.168.2.3 direction both
snoop filter added
ns5gt-> clear dbuf
ns5gt-> snoop
Start Snoop, type ESC or 'snoop off' to stop, continue? [y]/n y

The snoop filter options are as follows:

ns5gt-> snoop filter ?
delete               delete snoop filter
ethernet             snoop specified ethernet
id                   snoop filter id
ip                   snoop ip packet
off                  turn off snoop filter
on                   turn on snoop filter
tcp                  snoop tcp packet
udp                  snoop udp packet

The options for setting an IP filter for snoop are as follows:

ns5gt-> snoop filter ip ?
<return>
direction            snoop direction
dst-ip               snoop filter dst ip
dst-port             snoop filter dst port
interface            interface name
ip-proto             snoop filter ip proto
port                 src or dst port
src-ip               snoop filter src ip
src-port             snoop filter src port
<a.b.c.d>            IP Address
offset               ip offset

You can view the status of snoop and see filter information with snoop info.

ns5gt-> snoop info
Snoop: ON
Filters Defined: 1, Active Filters 1
Detail: OFF, Detail Display length: 96
Snoop filter based on:
id 1(on): IP src-ip 72.81.210.154 dst-ip 192.168.2.3 dir(B)

You can use get dbuf to view the information captured in the debug buffer.

dbuf

get dbuf <arguments>
info        show debug buffer info
mem         show debug buffer memory content
stream      show debug buffer stream

This allows you to view console messages that have been redirected to a debug buffer above.

set dbuf size <size>

Increase the size of the dbuf buffer from the default of 32k.

ns5gt-> get dbuf info
count: 6515, last index: 6515, cur index: 0, size: 32768
start: 0, pause: 0
ns5gt-> get dbuf mem
====6515
32 39 36 35 36 37 2e 30 3a 20 32 28 6f 29 3a 30     296567.0:.2(o):0
30 31 30 64 62 37 64 32 38 36 32 2d 3e 30 30 31     010db7d2862->001
37 33 66 34 34 39 37 35 31 2f 30 38 30 30 0d 0a     73f449751/0800..
20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 32     ..............72
2e 38 31 2e 32 31 30 2e 31 35 34 2d 3e 31 39 32     .81.210.154->192
2e 31 36 38 2e 32 2e 33 2f 36 2c 20 74 6c 65 6e     .168.2.3/6,.tlen
3d 35 32 0d 0a 20 20 20 20 20 20 20 20 20 20 20     =52.............
<text snipped>
ns5gt-> get dbuf stream
296567.0: 2(o):0010db7d2862->00173f449751/0800
              72.81.210.154->192.168.2.3/6, tlen=52
              vhl=45, tos=00, id=32447, frag=4000, ttl=51
              tcp:ports 22->2892, seq=970501524, ack=2243777306, flag=8012/SY
N

296568.0: 2(o):0010db7d2862->00173f449751/0800
              72.81.210.154->192.168.2.3/6, tlen=61
              vhl=45, tos=00, id=32448, frag=4000, ttl=51
	      tcp:ports 22->2892, seq=970501525, ack=2243777306, flag=5018

When you are paging through the display of the debug buffers contents after entering the get dbuf mem or get dbuf stream, which can be abbreviated to get db str, commands, you will see --- more --- displayed. If you type q you can stop the display of information.

If you want to store the contents of the buffer elsewhere for analysis, you can send the buffer's contents to a Trivial File Transfer Protocol (TFTP) server. In the example, below the buffer is sent to a file named netscreen.log on a TFTP server witth IP address 192.168.0.15. For further information on sending log data to a TFTP server, see Send NetScreen Traffic Log to a TFTP Server.

ns5gt-> get dbuf stream > tftp 192.168.0.15 netscreen.log
redirect to 192.168.0.15,netscreen.log
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tftp transferred records = 65
tftp success!

By default, snoop will only capture the headers of packets, i.e. 96 bytes. It won't capture the entire packet. If you want to capture the entire packet, you will need to use snoop detail len, where len specifies the amount of data in bytes you wish to capture for each packet.

ns5gt-> snoop detail ?
<return>
len                  snoop detail length
off                  turn off snoop detail
ns5gt-> snoop detail len ?
<number>             packet length to display (range: 1 - 1514)

If you just use snoop detail, you will get the default length of 96 bytes. So specify the maximum length, if you want to capture the entire packet.

ns5gt-> snoop info
Snoop: OFF
Filters Defined: 0, Active Filters 0
Detail: ON, Detail Display length: 96
ns5gt-> snoop detail
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 0, Active Filters 0
Detail: ON, Detail Display length: 96
ns5gt-> snoop detail len 1514
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 0, Active Filters 0
Detail: ON, Detail Display length: 1514

If you wish to remove the filters you've created you can use the command snoop filter delete. You can disable snoop with snoop off.

ns5gt-> snoop off
Snoop off
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 1, Active Filters 1
Detail: OFF, Detail Display length: 96
Snoop filter based on:
id 1(on): IP src-ip 72.81.210.154 dst-ip 192.168.2.3 dir(B)
ns5gt-> snoop filter delete
All filters removed
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 0, Active Filters 0
Detail: OFF, Detail Display length: 96

If you want to delete only a specific filter rather than all filters you can use snoop filter id <number> where <number> is the filter id.

ns5gt-> snoop info
Snoop: OFF
Filters Defined: 2, Active Filters 2
Detail: ON, Detail Display length: 96
Snoop filter based on:
id 1(on): IP src-ip 192.168.2.3 dir(B)
id 2(on): IP src-ip 192.168.2.3 proto 17 dir(B)
ns5gt-> snoop filter id 1 delete
Filter id 1 removed
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 1, Active Filters 1
Detail: ON, Detail Display length: 96
Snoop filter based on:
id 1(on): IP src-ip 192.168.2.3 proto 17 dir(B)

If I was interested in any UDP traffic from source address 72.81.210.154 to any destination address on port 27900, I could clear the debug buffer of any data already in it, delete any existing filters, and set the filter as shown below. The IP protocol number for UDP is 17, so I use that value for ip-proto to filter on just UDP traffic.

ns5gt-> snoop filter delete
All filters removed
ns5gt-> clear dbuf
ns5gt-> snoop filter ip src-ip 72.81.210.154 dst-port 27900 ip-proto 17
snoop filter added
ns5gt-> snoop info
Snoop: OFF
Filters Defined: 1, Active Filters 1
Detail: OFF, Detail Display length: 96
Snoop filter based on:
id 1(on): IP src-ip 72.81.210.154 dst-port 27900 proto 17 dir(B)
ns5gt-> snoop
Start Snoop, type ESC or 'snoop off' to stop, continue? [y]/n y
ns5gt-> get dbuf stream
305728.0: 1(i):001d70cce905->0010db7d2861/0800
              72.81.210.154->10.45.13.244/17, tlen=35
              vhl=45, tos=00, id=35246, frag=0000, ttl=52
              udp:ports 3040->27900, len=15

ns5gt-> get dbuf mem
====209
33 30 35 37 32 38 2e 30 3a 20 31 28 69 29 3a 30     305728.0:.1(i):0
30 31 64 37 30 63 63 65 39 30 35 2d 3e 30 30 31     01d70cce905->001
30 64 62 37 64 32 38 36 31 2f 30 38 30 30 0d 0a     0db7d2861/0800..
20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 32     ..............72
2e 38 31 2e 32 31 30 2e 31 35 34 2d 3e 31 30 2e     .81.210.154->10.
34 35 2e 31 33 2e 32 34 34 2f 31 37 2c 20 74 6c     45.13.244/17,.tl
65 6e 3d 33 35 0d 0a 20 20 20 20 20 20 20 20 20     en=35...........
20 20 20 20 20 76 68 6c 3d 34 35 2c 20 74 6f 73     .....vhl=45,.tos
3d 30 30 2c 20 69 64 3d 33 35 32 34 36 2c 20 66     =00,.id=35246,.f
72 61 67 3d 30 30 30 30 2c 20 74 74 6c 3d 35 32     rag=0000,.ttl=52
0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20     ................
75 64 70 3a 70 6f 72 74 73 20 33 30 34 30 2d 3e     udp:ports.3040->
32 37 39 30 30 2c 20 6c 65 6e 3d 31 35 0d 0a 0d     27900,.len=15...
0a                                                  .

Scripts to allow you to view NetScreen snoop packet capture information wtih other sniffer tools, such as WireShark, formerly known as Ethereal, are available at NetScreen snoop output to pcap [not tested].

If you need to see how the firewall is processing packets and applying policies to them, you can use the debugging commands instead.

References:

  1. Netscreen Snoop Command
    Scribd
  2. ScreenOS Hidden Commands Revealed
    By: Stephen Gill
    Version: 4.01
    Published: December 10, 2002
    Stephen Gill's home on cymru.com.
  3. NetScreen snoop output to pcap
    By: Florent
    Date: January 11, 2006
    NETwork Security Consortium
  4. ScreenOS: Analyze traffic
    By: Earthbreaker
    Date: February 21, 2009
    Codesnake
内容概要:本文提出了一种基于非合作博弈理论的居民负荷分层调度模型,并结合双层鲸鱼优化算法(Two-level Whale Optimization Algorithm)进行高效求解,模型与算法均通过Matlab代码实现。研究针对电力系统中居民侧用电负荷的复杂调度问题,引入非合作博弈机制刻画各用户之间的利益竞争关系,实现负荷的分层优化分配;同时设计双层优化架构,上层优化资源配置,下层模拟用户自主决策行为,提升了模型的实用性与合理性。通过智能优化算法求解多层级、非凸非线性的博弈模型,有效提高了调度方案的收敛性与全局寻优能力,适用于现代智能电网中的需求侧管理与能源优化场景。; 适合人群:具备电力系统基础理论知识和Matlab编程能力,从事智能电网、能源优化调度、需求侧管理、博弈论应用等方向的科研人员、高校研究生及工程技术人员。; 使用场景及目标:①应用于居民区电力负荷的分层优化调度系统设计与仿真分析;②为非合作博弈在多主体能源系统建模中的应用提供方法论支持;③利用双层鲸鱼算法解决具有嵌套结构的复杂双层优化问题,提升求解效率与调度方案的可行性。; 阅读建议:建议读者结合提供的Matlab代码深入理解模型构建逻辑与算法实现流程,重点关注博弈模型的效用函数设计、纳什均衡求解思路以及双层优化结构的迭代机制,宜配合实际用电数据开展复现实验以验证模型有效性与鲁棒性。
内容概要:本文围绕基于自适应神经模糊推理系统(ANFIS)智能控制器的可再生能源微电网功率管理系统展开研究,结合Simulink仿真实现,深入探讨了微电网中功率的智能调控与经济机组组合调度问题。通过引入ANFIS控制器,有效应对风能、光伏等可再生能源出力的波动性与不确定性,提升系统运行的稳定性与电能质量。研究内容涵盖微电网多源协调控制策略、功率平衡管理、优化调度模型构建及仿真验证,实现了对分布式电源、储能系统和负荷的协同优化,兼顾经济性与可靠性目标,并通过仿真平台验证了所提方法的有效性与优越性。; 适合人群:具备电力系统、自动化或新能源相关专业背景,熟悉Matlab/Simulink仿真环境,从事微电网能量管理、智能控制、能源优化等领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①用于高比例可再生能源接入场景下的微电网能量管理系统研发与教学实践;②为实现微电网功率稳定控制与经济高效运行提供先进的智能控制解决方案;③支撑高水平学术论文复现、科研课题攻关及实际工程项目的仿真验证与方案优化。; 阅读建议:建议结合提供的Simulink模型与相关代码进行动手实践,重点关注ANFIS控制器的设计流程、规则库构建与参数调优方法,并通过与传统PID或MPC控制策略的对比实验,深入理解其在动态响应与鲁棒性方面的优势。同时可进一步拓展文中提出的优化调度逻辑,应用于多目标、多约束的复杂实际应用场景中。
内容概要:本文档聚焦于“直流电机双闭环控制Matlab仿真”,系统阐述了基于Matlab/Simulink平台实现直流电机双闭环控制系统(主要包括速度环与电流环)的设计与仿真全过程。通过构建直流电机的数学模型,结合PI控制器进行调控,实现对电机转速和电枢电流的高精度动态控制,验证控制策略的稳定性与响应性能。文档详细介绍了仿真模型的搭建流程、关键参数的整定方法、系统动态波形的分析手段以及仿真结果的有效性验证,体现了经典自动控制理论在实际电机系统中的工程应用,是电机控制与电力电子技术相结合的典型研究案例。; 适合人群:具备自动控制原理、电机与拖动基础、电力电子技术和Matlab/Simulink仿真能力的电气工程、自动化、机电一体化等专业的本科生、研究生及从事电机驱动系统研发的工程技术人员。; 使用场景及目标:①作为高校课程设计或实验教学材料,帮助学生深入理解双闭环调速系统的工作机理与工程实现;②服务于科研项目,为新型电机控制算法(如滑模、模糊PID等)的开发与性能对比提供基础仿真验证平台;③作为工业界产品前期设计的仿真工具,用于评估不同控制策略在动态响应、抗干扰能力和稳态精度方面的可行性。; 阅读建议:建议读者在学习过程中紧密结合自动控制理论知识,亲手在Simulink环境中搭建完整的双闭环仿真模型,通过反复调整PI控制器的比例与积分参数,观察并分析转速、电流的阶跃响应曲线,从而深刻理解反馈控制的本质、系统稳定性条件以及参数整定对动态性能的影响,进而掌握电机控制系统的设计精髓。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值