Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] - نسخه متنی

Mike D. Schiffman

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Sample Program—Punch

The following program illustrates some of the basic functionalities of libnet-1.1.0. Punch is a small UDP packet blaster. It builds a series of UDP datagrams by using the link-layer interface and furiously sends them to the user-specified destination. The user determines the number of datagrams sent by using the port list argument. The user can also specify an optional payload to include with each packet.

Punch is moderately useful for network and OS performance testing. With no arguments, Punch displays its usage as follows:


tradecraft: # ./punch
punch 1.0 [UDP packet shaping/blasting tool]
usage: ./punch:
-s ip Source IP address
-d ip Destination IP address
-p port list UDP port list (x-y,z)
[-f] Fast mode, minimal screen output
[-p payload] payload
[-s usec] Microsecond pause between writing

A sample invocation of Punch is as follows:


tradecraft:~# ./punch -s10.1.2.3 -d10.1.2.4 -p7,53,161,200-210 -
p".........."
punch 1.0 [UDP packet shaping/blasting tool]
wrote 52 byte UDP packet to port 7
wrote 52 byte UDP packet to port 53
wrote 52 byte UDP packet to port 161
wrote 52 byte UDP packet to port 200
wrote 52 byte UDP packet to port 201
wrote 52 byte UDP packet to port 202
wrote 52 byte UDP packet to port 203
wrote 52 byte UDP packet to port 204
wrote 52 byte UDP packet to port 205
wrote 52 byte UDP packet to port 206
wrote 52 byte UDP packet to port 207
wrote 52 byte UDP packet to port 208
wrote 52 byte UDP packet to port 209
wrote 52 byte UDP packet to port 210
Time spent in loop: 0.3233 seconds
Packets sent: 14
Packet errors: 0
Bytes written: 728

Punch successfully wrote 14 UDP packets, each 52 bytes long, to a small series of ports on host 10.1.2.4 from host 10.1.2.3. The 52-byte packet consists of the following components: an Ethernet header of 14 bytes, an IP header of 20 bytes, a UDP header of 8 bytes, and a payload of 10 bytes. The time spent in the UDP construction and packet injection loop is displayed for use as a loose metric for measuring the system's performance (possibly against other machines running the same code). Another sample invocation of Punch is as follows:


tradecraft:~# ./punch -s 10.1.2.3 -d 10.1.2.4 -p1- -f
-p"..........."
punch 1.0 [UDP packet shaping/blasting tool]
.
Time spent in loop: 8.406499 seconds
Packets sent: 65535
Packet errors: 0
Bytes written: 3407820

Here, Punch invokes in "fast" mode with a port list argument specifying the entire range of UDP ports (and again with the same payload). Punch's fast mode reduces the relatively CPU-expensive screen output to almost nothing, which enables the user to get a better assessment of the time requirements entailed in packet construction and injection. A single dot prints for each packet pushed to the writing primitive. Upon successful completion, a backspace character is sent to the screen (savvy users will note that this behavior is the same of ping invoked with the "-f" switch). As you can see, building and writing 65,535 packets takes significantly more time than generating only 14 packets (producing 65,535 packets without the "-f" switch would cause this number to increase measurably). Another invocation of Punch is as follows:


tradecraft:~# ./punch -s 10.1.2.3 -d 10.1.2.4 -P1-1000 -f -p
'perl -e 'print "." x 1400"
punch 1.0 [UDP packet shaping/blasting tool]
...............................................................................
...............................................................................
...............................................................................
....................................................
Time spent in loop: 0.163819 seconds
Packets sent: 865
Packet errors: 135
Bytes written: 1247330

Again, Punch invokes in fast mode-this time with a smaller port list argument but a much larger packet payload of 1400 bytes. The larger payload pushes the limits of the operating system kernel packet buffer space and results in a 13.5 percent packet injection error rate (the kernel cannot empty the packet buffer fast enough before another one pushes down). To reduce this error rate, the user would have to lower the payload size or increase the pause rate between packet writes. This information is useful because the user can learn a bit about time versus memory tradeoffs.

/ 135