1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
|
.\" Text automatically generated by txt2man
.TH packit 8 "04 Nov 2021" "packit-1.8" "Network packet generator and capture tool"
.SH NAME
\fBPackit \fP- network packet generator and capture tool
\fB
.SH SYNOPSIS
.nf
.fam C
\fBPacket\fP capture:
\fBpackit\fP \fB-m\fP \fIcapture\fP [\fB-cGHnvsX\fP] [\fB-i\fP \fIinterface\fP] [\fB-r\fP|\fB-w\fP \fIfile\fP] \fIexpression\fP
\fBPacket\fP injection:
\fBpackit\fP \fB-m\fP \fIinject\fP [\fB-t\fP \fIprotocol\fP] [\fB-aAbcCdDeFgGhHIjJkKlLmMnNoOpPqQrRsSTuUvwWxXyYzZ\fP] [\fB-i\fP \fIinterface\fP]
.fam T
.fi
.fam T
.fi
.SH DESCRIPTION
Packit is a network auditing tool. It's value is derived from its ability to
customize, \fIinject\fP, monitor, and manipulate IP traffic. By allowing you to
define (spoof) all TCP, UDP, ICMP, IP, ARP, RARP and Ethernet header options,
Packit can be useful to test firewalls, intrusion detection systems, port
scanning, simulating network traffic and general TCP/IP auditing. Packit is
also an excellent tool for learning TCP/IP.
.SH PACKIT BASE OPTIONS
.TP
.B
\fB-m\fP mode
Select a runtime mode. Currently supported modes
are \fIcapture\fP, \fIinject\fP and trace. The default mode is \fIinject\fP.
.SH PACKET CAPTURE OPTIONS
\fBPacket\fP \fIcapture\fP options are as follows:
.TP
.B
\fB-c\fP count
Specify the number of packets to \fIcapture\fP.
.TP
.B
\fB-e\fP
Display link-layer header data.
.TP
.B
\fB-G\fP
Display the timestamp in GMT rather than localtime.
.TP
.B
\fB-i\fP \fIinterface\fP
Listen on \fIinterface\fP. If unspecified, \fBpackit\fP will use the lowest numbered
device in the 'up' state (excluding loopback).
.TP
.B
\fB-n\fP
Do not resolve host addresses to names but resolve ports numbers.
Disables DNS lookups.
.TP
.B
\fB-nn\fP
Do not resolve ports numbers to their \fIprotocol\fP names but resolve host
addresses.
.TP
.B
\fB-nnn\fP
Do not resolve host addresses or port numbers.
.TP
.B
\fB-r\fP \fIfile\fP
Read packet data from tcpdump formatted binary log \fIfile\fP. Example: a \fIfile\fP
created with \fB-w\fP option.
.TP
.B
\fB-s\fP snaplen
Read snaplen bytes of data from each packet rather than the default of 68.
.TP
.B
\fB-v\fP
Enables verbose packet \fIcapture\fP.
.TP
.B
\fB-w\fP \fIfile\fP
Write the raw packets to \fIfile\fP rather than displaying time to stderr.
.TP
.B
\fB-X\fP
Display hexadecimal & ascii dump of each packet up to snap length bytes.
.TP
.B
\fIexpression\fP
Selects which packets should be displayed. If no \fIexpression\fP is
given, all packets are displayed. This option is based in pcap
library. See the \fBpcap-filter\fP(7) manpage for more detailed information.
.SH PACKET INJECTION AND TRACE
\fBPacket\fP injection is used to define and \fIinject\fP a network traffic onto
your network. You have the ability to define essentially any ARP, IP, TCP,
UDP, ICMP and Ethernet header value. This can be valuable in a number of ways,
including testing firewalls, intrusion detection systems, simulating traffic
flow and general TCP/IP auditing.
.SH CHOOSE A PROTOCOL
.TP
.B
\fB-t\fP \fIprotocol\fP
Specify the type of packet to \fIinject\fP. Supported values are: ARP,
RARP, TCP, UDP and ICMP. This option defaults to TCP in \fIinject\fP
mode and to ICMP in trace mode.
.SH PACKET INJECTION AND TRACE GENERAL
This section documents the operational command-line options.
.TP
.B
\fB-c\fP count
The value of count is the total number of packets we would like to
\fIinject\fP (a count value of 0 means forever).
.TP
.B
\fB-b\fP burst rate
Specifies the number of packets to \fIinject\fP every interval (defined
by \fB-w\fP). A burst rate of 0 will send packets as quickly as possible.
.TP
.B
\fB-h\fP
Host response mode. Enabling this option will print any packet you
\fIinject\fP and then wait to see if the remote host responds. See \fB-H\fP
option for timeout.
.TP
.B
\fB-H\fP timeout
Specify the timeout value (in seconds) to use with '\fB-h\fP'. This value
defaults to '1' second.
.TP
.B
\fB-i\fP \fIinterface\fP
Specify the \fIinterface\fP to transmit from, if the machine has multiple
interfaces.
.TP
.B
\fB-I\fP tci
Specify 802.1Q TCI (VLAN ID/CFI/priority combination). This feature
is EXPERIMENTAL.
.TP
.B
\fB-v\fP
Verbose injection mode. Displays each packet you \fIinject\fP. It also has
the same effect as in \fIcapture\fP mode while used with the '\fB-h\fP' option.
.TP
.B
\fB-p\fP payload
This option defines the payload portion of the header. Hex payload
should be prefixed with '0x' with each value separated by a
whitespace. An ASCII example: \fB-p\fP 'hello, this is my packet'. A Hex
example: \fB-p\fP '0x 70 61 63 6B 69 74'.
.TP
.B
\fB-w\fP interval
Specify the number of seconds to wait between packet bursts. This
value defaults to '1' second.
.TP
.B
\fB-Z\fP length
Specify the size of the \fBpacket\fP(s) to \fIinject\fP. The maximum value
is 65535.
.SH IP HEADER OPTIONS
This section documents the IP header command-line options.
.TP
.B
\fB-s\fP src address
The IP address the packet will appear to come from. If unspecified,
\fBpackit\fP will default to the IP address of the lowest numbered device
in the 'up' state, excluding loopback.
.TP
.B
\fB-sR\fP
Use a random source IP address.
.TP
.B
\fB-d\fP dst address
The IP address of the machine you would like to contact.
.TP
.B
\fB-dR\fP
Use a random destination IP address.
.TP
.B
\fB-o\fP type of service
TOS values are typically in hexadecimal format, however, \fBpackit\fP only
accepts TOS values as integers. Below are the 4 valid TOS bit values:
.RS
.IP \(bu 3
Minimize delay: 16 (0x10)
.IP \(bu 3
Maximize throughput: 8 (0x08)
.IP \(bu 3
Maximize reliability: 4 (0x04)
.IP \(bu 3
Minimize monetary cost: 2 (0x02)
.RE
.TP
.B
\fB-n\fP ID number
The ID number is used to identify each datagram sent by a host. It
generally increments by one with each datagram sent. This value is
random by default.
.TP
.B
\fB-T\fP TTL
The TTL value defines the upper limit on the number of devices
through which the datagram may pass to reach it's destination. The
default value is 128.
.TP
.B
\fB-V\fP IP \fIprotocol\fP number
Specify the IP \fIprotocol\fP associated with this packet (RAWIP only).
The default value is 255.
.SH TCP HEADER OPTIONS
This section documents the TCP header command-line options.
.TP
.B
\fB-S\fP src port
The port from which our source address is communicating from. This
value is random by default.
.TP
.B
\fB-D\fP dst port
The port on the destination we would like to communicate on. In
\fIinject\fP mode this value is 0 by default while in trace mode this
value is random by default. You may also specify a range of
addresses in the format: \fB-D\fP 1:1024.
.TP
.B
\fB-f\fP
Do not fragment this packet.
.TP
.B
\fB-F\fP tcp flags
There are 6 TCP header flag bits. They can be used in combination
with one another and are specified using the following identifiers:
.RS
.IP \(bu 3
S : SYN (Synchronization sequence number)
.IP \(bu 3
F : FIN (Sender is finished)
.IP \(bu 3
A : ACK (Acknowledgement number is valid)
.IP \(bu 3
P : PSH (Receiver should push this data to the remote host)
.IP \(bu 3
U : URG (The urgent pointer is valid)
.IP \(bu 3
R : RST (Reset this connection)
.PP
As an example, to set the SYN and FIN bits use the following: \fB-F\fP SF
.RE
.TP
.B
\fB-q\fP sequence number
The sequence number is a 32-bit unsigned (positive) number used to
identify the byte in a stream of data from the sending TCP to the
receiving TCP that the first byte of data represents.
.TP
.B
\fB-a\fP ack number
The acknowledgement (ack) number defines the next sequence number
that the sender of the ack expects to see. It is typically the
sequence number + 1 during valid TCP communication. It is a 32-bit
unsigned (positive) number.
.TP
.B
\fB-W\fP window size
The window size provides flow control. It is a 16-bit number that
defines how many bytes the receiver is willing to accept. The default
value is 1500.
.TP
.B
\fB-u\fP urgent pointer
In valid TCP communication, the urgent pointer is only useful if the
URG flag is set. Used with the sequence number, it points to the last
byte of urgent data.
.SH UDP HEADER OPTIONS
This section documents the UDP header command-line options. UDP is the default
IP \fIprotocol\fP for TRACE mode.
.TP
.B
\fB-S\fP src port
The port from which our source address is communicating from. This
value is random by default.
.TP
.B
\fB-D\fP dst port
The port on the destination we would like to communicate on. In
\fIinject\fP mode this value is 0 by default while in trace mode this
value is random by default. You may also specify a range of
addresses in the format: \fB-D\fP 1:1024.
.SH ICMP HEADER OPTIONS
This section documents the ICMP header command-line options.
.TP
.B
\fB-K\fP type
Specify the ICMP type. See docs/ICMP.txt for details on types. On
Debian systems this \fIfile\fP can be found at /usr/share/doc/\fBpackit\fP/ICMP.txt.
.TP
.B
\fB-C\fP code
Specify the ICMP code. See docs/ICMP.txt for details on codes. On
Debian systems this \fIfile\fP can be found at /usr/share/doc/\fBpackit\fP/ICMP.txt.
.RE
.PP
ICMP ECHO REQUEST AND ECHO REPLY OPTIONS
.RS
.TP
.B
\fB-N\fP id number
Define the 16-bit ICMP identification number. This value is random
by default.
.TP
.B
\fB-Q\fP sequence number
Define the 16-bit ICMP sequence number. This value is random by default.
.RE
.PP
ICMP UNREACHABLE OR REDIRECT OR TIME EXCEEDED OPTIONS
.RS
.TP
.B
\fB-g\fP gateway
Define the gateway in which to redirect traffic to. This option is
only used for ICMP redirects (type 5).
.TP
.B
\fB-j\fP address
Define the source address of the original packet.
.TP
.B
\fB-J\fP src port
Define the source port of the original packet.
.TP
.B
\fB-l\fP address
Define the destination address of the original packet.
.TP
.B
\fB-L\fP dst port
Define the destination port of the original packet.
.TP
.B
\fB-m\fP time to live
Define the Time To Live of the original packet. This option
defaults to 128.
.TP
.B
\fB-M\fP id
Define the IP ID of the original packet. This option defaults to
random.
.TP
.B
\fB-O\fP type of service
Define the Type of Service of the original packet. See the
\fB-o\fP option for the possible values.
.TP
.B
\fB-P\fP \fIprotocol\fP
Define the \fIprotocol\fP of the original packet. This option
defaults to UDP.
.RE
.PP
MASK REQUEST AND MASK REPLY OPTIONS
.RS
.TP
.B
\fB-N\fP id number
Define the 16-bit ICMP identification number. This value is random
by default.
.TP
.B
\fB-Q\fP sequence number
Define the 16-bit ICMP sequence number. This value is random by
default.
.TP
.B
\fB-G\fP address mask
Define the address network mask. The default value for this option
is 255.255.255.0.
.RE
.PP
TIMESTAMP REQUEST AND TIMESTAMP REPLY OPTIONS
.RS
.TP
.B
\fB-N\fP id number
Define the 16-bit ICMP identification number. This value is random
by default.
.TP
.B
\fB-Q\fP sequence number
Define the 16-bit ICMP sequence number. This value is random by
default.
.TP
.B
\fB-U\fP original timestamp
Define the 32-bit original timestamp. This value is 0 by default.
.TP
.B
\fB-k\fP received timestamp
Define the 32-bit received timestamp. This value is 0 by default.
.TP
.B
\fB-z\fP transmit timestamp
Define the 32-bit transmit timestamp. This value is 0 by default.
.SH ARP AND RARP HEADER OPTIONS
This section documents the ARP/RARP header command-line options. These options
have the ability to do the most damage with the least effort, especially on
large cable and DSL networks. Use with caution.
.PP
Packit only supports ARP/RARP \fIprotocol\fP addresses in IPv4 format
.TP
.B
\fB-A\fP operation type
Define the ARP / RARP / IRARP operation type. The valid options are
as follows:
.RS
.IP \(bu 3
1 : ARP Request (Default for ARP packages)
.IP \(bu 3
2 : ARP Reply
.IP \(bu 3
3 : Reverse ARP Request (Default for RARP packages)
.IP \(bu 3
4 : Reverse ARP Reply
.IP \(bu 3
5 : Inverse ARP Request
.IP \(bu 3
6 : Inverse ARP Reply
.RE
.TP
.B
\fB-y\fP target IP address
The IP address of the target host.
.TP
.B
\fB-yR\fP
Use a random target host IP address.
.TP
.B
\fB-Y\fP target ethernet address
The Ethernet (hardware) address of the target host.
.TP
.B
\fB-YR\fP
Usage a random target host Ethernet address.
.TP
.B
\fB-x\fP sender IP address
The IP address of the sender host.
.TP
.B
\fB-xR\fP
Use a random sender host IP address.
.TP
.B
\fB-X\fP sender ethernet address
The Ethernet (hardware) address of the sender host.
.TP
.B
\fB-XR\fP
Usage a random sender host Ethernet address.
.SH ETHERNET HEADER OPTIONS
This section documents the Ethernet header command-line options.
.TP
.B
\fB-e\fP src ethernet address
The Ethernet (hardware) address the packet will appear to come from.
If not defined, the original Ethernet address will be used.
.TP
.B
\fB-eR\fP
Use a random source Ethernet address. If you define this, you will most
likely need to define the destination Ethernet header value as well. When
using either \fB-e\fP or \fB-E\fP, you enable link level packet injection and the
destination cannot be auto-defined while injecting in this manner.
.TP
.B
\fB-E\fP dst ethernet address
The Ethernet (hardware) of the next routeable \fIinterface\fP which the packet
will cross while making it's way to the destination.
.TP
.B
\fB-ER\fP
Use a random destination Ethernet address. The following two rules should
be followed if you actually want the destination to receive the packets
you're sending:
.RS
.IP 1. 4
If the destination exists beyond your default route (gateway),
the destination Ethernet address should be set to the default
routes Ethernet address. This can typically be found by using
the \fBarp\fP(8) command.
.IP 2. 4
If the destination exists on your subnet, the destination
Ethernet address should be set to its Ethernet address. This
can typically be found by using the \fBarp\fP(8) command.
.SH PACKET CAPTURE EXAMPLES
Print all TCP communications that doesn't revolve around SSH (port 22):
.PP
.nf
.fam C
# packit -m cap 'tcp and not port 22'
.fam T
.fi
Print the start and end packets (the SYN and FIN packets) of each TCP
conversation that involves a non-local host, don't resolve addresses and
display hex/ascii dump of the packet:
.PP
.nf
.fam C
# packit -m cap -nX 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet'
.fam T
.fi
Write the first 10 ICMP packets captured to a \fIfile\fP:
.PP
.nf
.fam C
# packit -m cap -c 10 -w /tmp/mylog 'icmp'
.fam T
.fi
.SH PACKET INJECTION EXAMPLES
Inject 10 ICMP type 8 (echo request) packets from host '3.1.33.7' to
host '192.168.0.1' and watch for a response:
.PP
.nf
.fam C
# packit -t icmp -s 3.1.33.7 -d 192.168.0.1 -c 10 -h
.fam T
.fi
Inject an ICMP type 18 (mask reply) packet with an ICMP id of 211 and an
address mask of 255.255.255.0:
.PP
.nf
.fam C
# packit -t icmp -K 18 -d 127.0.0.1 -N 211 -G 255.255.255.0
.fam T
.fi
Inject 5 TCP packets from random hosts to 'www.example.com' with the SYN flag
set, a window size of 666, a random source Ethernet address, a destination
Ethernet address of 00:53:00:0f:00:0d, with a payload of "HI JOHN", displaying
each packet injected.
.PP
.nf
.fam C
# packit -sR -d www.example.com -F S -c 5 -W 666 -eR -E 00:53:00:0f:00:0d -p 'HI JOHN' -v
.fam T
.fi
or simplifying the MAC address:
.PP
.nf
.fam C
# packit -sR -d www.example.com -F S -c 5 -W 666 -eR -E 0:53:0:f:00:d -p 'HI JOHN' -v
.fam T
.fi
Inject a total of 1000 TCP packets in 20 packet per second bursts
from 192.168.0.1 on port 403 to 192.168.0.20 on port 80 with the SYN and RST
flags set, a sequence number of 12345678910 and a source Ethernet address
of 0:0:0:0:0:0:
.PP
.nf
.fam C
# packit -s 192.168.0.1 -d 192.168.0.20 -S 403 -D 80 -F SR -q 12345678910 -c 1000 -b 20 -e 0:0:0:0:0:0
.fam T
.fi
Inject a TCP packets from 10.22.41.6 to 172.16.1.3 on ports ranging from 1-1024
with the SYN flag set and display each packet we send:
.PP
.nf
.fam C
# packit -s 10.22.41.6 -d 172.16.1.3 -D 1-1024 -F S -v
.fam T
.fi
Inject a broadcast ARP reply stating that 4.3.2.1 is at 00:53:00:01:02:03.
Also, spoof the source Ethernet address for a little more authenticity and
supply the payload in hex:
.PP
.nf
.fam C
# packit -t arp -A 2 -x 4.3.2.1 -X 5:4:3:2:1:0 -e 00:53:00:01:02:03 -p '0x 70 61 63 6B 69 74'
.fam T
.fi
.SH TRACE ROUTE EXAMPLES
Appear as a DNS response by using a UDP source port of 53 (DNS):
.PP
.nf
.fam C
# packit -m trace -t UDP -d 192.168.2.35 -S 53
.fam T
.fi
Appear as HTTP traffic by using TCP port 80:
.PP
.nf
.fam C
# packit -m trace -t TCP -d www.google.com -S 80 -FS
.fam T
.fi
.SH BUGS
.IP \(bu 3
Due to limitations in some versions of *BSD, specifying arbitrary Ethernet
and/or ARP header data may not be supported.
.IP \(bu 3
ARP \fIcapture\fP data is incomplete.
.IP \(bu 3
Please send bug reports, questions, requests, fixes and pull requests
to https://github.com/resurrecting-open-source-projects/\fBpackit\fP/issues
.SH SEE ALSO
\fBarp\fP(8), \fBpcap\fP(3), \fBpcap-filter\fP(7), \fBtcpdump\fP(1)
.SH AUTHOR
The original author of \fBpackit\fP is Darren Bounds. Currently, this project is
maintained by volunteers.
.PP
The latest version of Packit can be found at
https://github.com/resurrecting-open-source-projects/\fBpackit\fP
|