Technology

Protocol – An ASCII Header Generator for Community Protocols


0x01 Introduction

Protocol is a straightforward say-line tool that serves two capabilities:

  • Present a straightforward potential for engineers to bask in a explore at new network
    protocol headers, straight from the say-line,
    with out having to
    google for the relevant RFC or for grotesque header image diagrams.

  • Present a potential for researchers and engineers to posthaste generate ASCII
    RFC-worship header diagrams for their have custom protocols.

0x02 Downloading Protocol

The latest model of protocol is on hand by GitHub. It goes to even be
downloaded
straight from here
or visiting the next net set up and clicking on the
button “Download ZIP”.

Alternatively, the code is also checked out the utilization of GIT, running the next
say (If precipitated for a username and password, don’t enter any, staunch hit Enter):

  • git clone https://github.com/luismartingarcia/protocol.git

Documentation and additional knowledge is frequently on hand in this net set up.

0x03 Installing Protocol

Protocol is also installed by running the incorporated setup.py script as follows:

  • setup.py set up

Point out that in say to set up Protocol, root or administrative privileges
are required. On GNU/Linux systems, it might probably probably perhaps perhaps even be installed as follows:

  • sudo ./setup.py set up

0x04 Working Protocol

Once installed, Protocol is also speed from the say line. The syntax is
the next:

protocol

or

protocol

The following subsections describe every potential.

0x04.1 Exhibiting Existing Protocols

The first potential lets customers print ASCII headers for gift network
protocols. In particular, the next protocols are on hand.

"ethernet"            : Ethernet
"8021q"               : IEEE 802.1q
"dot1q"               : IEEE 802.1q
"tcp"                 : Transmission Administration Protocol (TCP)
"udp"                 : Person Datagram Protocol (TCP)
"ip"                  : Cyber net Protocol (IP), model 4.
"ipv6"                : Cyber net Protocol (IP), model 6.
"icmp"                : Cyber net Administration Message Protocol (ICMP)
"icmp-trail station":   : ICMP Destination Unreachable
"icmp-time"           : ICMP Time Exceeded
"icmp-parameter"      : ICMP Parameter Distress
"icmp-source"         : ICMP Source Quench
"icmp-redirect"       : ICMP Redirect
"icmp-echo"           : ICMP Echo Seek files from/Answer
"icmp-timestamp"      : ICMP Timestamp Seek files from/Answer
"icmp-knowledge"    : ICMP Files Seek files from/Answer
"icmpv6"              : ICMP for IPv6 (ICMPv6)
"icmpv6-trail station"  : ICMPv6 Destination Unreachable
"icmpv6-worthy"          : ICMPv6 Packet Too Good
"icmpv6-time"         : ICMPv6 Time Exceeded
"icmpv6-parameter"    : ICMPv6 Parameter Distress
"icmpv6-echo"         : ICMPv6 Echo Seek files from/Answer
"icmpv6-rsol"         : ICMPv6 Router Solicitation
"icmpv6-radv"         : ICMPv6 Router Advertisement
"icmpv6-nsol"         : ICMPv6 Neighbor Solicitation
"icmpv6-nadv"         : ICMPv6 Neighbor Advertisement
"icmpv6-redirect"     : ICMPv6 Redirect

One or extra of the protocols listed above is also printed. Right here are about a
examples:

protocol tcp
protocol dot1q
protocol tcp udp
protocol ipv6 icmpv6 icmpv6-redirect

Point out that protocol names don’t also can still be entirely specified, as lengthy as there
shouldn’t be any ambiguity. For instance ‘protocol et’ is expounded to ‘protocol
ethernet’. At any time when there might be ambiguity (e.g. ‘protocol icmpv6-r’, an inventory of
doable options will probably be displayed.

$ protocol icmpv6-r
Ambiguous protocol specifier 'icmpv6-r'. Did you imply any of these?
  icmpv6-radv
  icmpv6-redirect
  icmpv6-rsol

0x04.2 Exhibiting Custom-made Protocols

Besides already gift protocols, Protocol can portray any arbitrary
protocol headers. In say to sort that, as a replace of specifying the title of
an gift protocol, a custom protocol specification is also equipped. Such
specification must comply with a straightforward however explicit syntax:

[?OPTIONS]”

The set up [LIST_OF_FIELDS] is a comma-separated list of protocol field names
and lengths (expressed in bits), and [?OPTIONS] is an optional phase that
enables customers to specify layout modifiers for the ASCII header. Point out that if
any of the sphere names contains areas, the protocol specification also can still be
enclosed in double quotes.

0x04.1.1 Self-discipline Lists

The largest phase of a protocol specification are field lists. This
is staunch a comma-separated list of title:length tuples, where title represents
the textual recount material that describes the protocol field and can private any persona,
aside from for ‘?’ and length is an integer elevated than zero, representing the
amount of bits the sphere takes within the header. Right here are about a examples:

Kind:8,Code:8,Checksum: 16,Message Body: 64

Source Port: 16,Destination Port: 16,Size: 16,Checksum: 16

Point out that there might be not any such thing as a whitespace after the commas. Right here’s a restriction
that might perhaps still be revered.Also, converse that field lengths don’t must align
to the length of the road. If a particular field is too lengthy, Protocol will
staunch wrap it to the next line. Right here are some examples:

$ protocol "Source: 16,TTL:8,Reserved: 40"
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Source            |      TTL      |               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
|                            Reserved                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


$ protocol "Source: 16,Reserved: 40,TTL:8"
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Source            |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +-+-+-+-+-+-+-+-+
|                    Reserved                   |      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

$ protocol "Reserved: 32,Goal Take care of: 128"
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Reserved                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                         Goal Take care of                        +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

0x04.1.2 Ideas

Once the list of fields has been specified, customers also can optionally pass
formatting options to govern the potential the ASCII header is generated.
Ideas are equipped as a comma-separated list of set up=price substances.
The first one is preceded by the ‘?’ signal, which lets Protocol figure out
where the sphere list ends and where the list of options begins. The options
within the intervening time on hand are the next:

bits=       : Different of bits per line. By default it is 32, related as
                 IETF. Right here's helpful for protocols that don't align
                 completely to 32-bit phrases, worship Ethernet.
numbers=  : Instructs protocol to print or steer clear of printing the bit
                 counts on top of the header.
evenchar=   : Instructs protocol to exercise the equipped persona, as a replace
                 of the default "-" as the persona in even positions of
                 the horizontal traces.
oddchar=    : Same as evenchar however for characters in authentic positions of
                 the horizontal traces. By default it takes the price '+'
startchar=  : Instructs protocol to exercise the equipped persona as a replace
                 of the default "+" for the first station of an horizontal
                 line.
endchar=    : Same as startchar however for the persona within the closing
                 station of the horizonal traces.
sepchar=    : Instructs protocol to exercise the equipped persona as a replace
                 of the default "|" for the sphere separator persona.

The following map exhibits the persona modifiers described above.

Bit counts                                                     sepchar(|)
 ^   ^                                                              |
 |   |                                                              |
 |   |                                                              |
 0   |               1                   2                   3      |
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |
|             Source            |      TTL      |    Reserved   | |
						   bits(32)

0x04.3 Deliver-line Ideas

Besides per-protocol layout specifiers, Protocol also can moreover be configured
the utilization of say-line parameter. The following list gives a description of
every possibility on hand.

Usage: protocol { or } [OPTIONS]
PARAMETERS:
           : Title of an gift protocol
               : Self-discipline by field specification of non-gift protocol
OPTIONS:
 -b, --bits       : Different of bits per line
 -f, --file          : Read specs from a textual recount material file
 -h, --reduction          : Displays this reduction knowledge
 -n, --no-numbers    : Lift out now not print bit numbers on top of the header
 -V, --model       : Displays new model
 --evenchar    : Personality for the even positions of horizontal traces
 --oddchar     : Personality for the authentic positions of horizontal traces
 --startchar   : Personality that starts horizontal traces
 --endchar     : Personality that ends horizontal traces
 --sepchar     : Personality that separates protocol fields

0x05 Examples

This share gives additional examples on how to speed protocol.

$ protocol tcp
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Source Port          |        Destination Port       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Acknowledgment Number                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Offset|  Res. |     Flags     |             Window            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Checksum           |         Pressing Pointer        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Ideas                    |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


$ protocol "Source Port: 16,Destination Port: 16,Sequence Number: 32,
  Acknowledgment Number: 32,Offset:4,Res.:4,Flags:8,Window: 16,Checksum: 16,
  Pressing Pointer: 16,Ideas: 24,Padding:8"
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Source Port          |        Destination Port       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Acknowledgment Number                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Offset|  Res. |     Flags     |             Window            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Checksum           |         Pressing Pointer        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Ideas                    |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


$ protocol "Field4:4,Field4:4,Field8:8,Self-discipline16: 16,Self-discipline32: 32,Self-discipline64: 64?
  bits=16,numbers=y,startchar=*,endchar=*,evenchar=-,oddchar=-,sepchar=|"
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
*-------------------------------| Field4| Field4|     Field8    |
*-------------------------------|            Self-discipline16            |
*-------------------------------|                               |
Self-discipline32            |                               |
*-------------------------------|                               |
|                               |
Self-discipline64            |                               |
|                               |
*-------------------------------$ protocol ip --bits 16
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Model|  IHL  |Form of Service|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Full Size         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Identification        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Flags|     Fragment Offset     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Time to Are residing |    Protocol   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Header Checksum        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+         Source Take care of        +
|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+      Destination Take care of      +
|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Ideas            |
+               +-+-+-+-+-+-+-+-+
|               |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


$ protocol udp --oddchar "-" --startchar "-" --endchar "-"
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-----------------------------------------------------------------
|          Source Port          |        Destination Port       |
-----------------------------------------------------------------
|             Size            |            Checksum           |
-----------------------------------------------------------------


$ protocol ipv6 --no-numbers
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Model| Net site traffic Class |               Waft Designate              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Payload Size        |  Next Header  |   Hop Restrict   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                         Source Take care of                        +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                       Destination Take care of                     +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


$ protocol udp icmp
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Source Port          |        Destination Port       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Size            |            Checksum           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Kind     |      Code     |            Checksum           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                          Message Body                         +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

0x06 Contact, Reinforce and Trojan horse Reporting

For any questions, malicious program experiences, malicious program fixes, feature requests, code
contributions, etc, please contact me the utilization of the e-mail deal with displayed
below. Please converse that Protocol’s strengthen is staunch worship
IP transport: most productive-effort. I will sort my most productive to tackle your enquiries however
no guarantees. Particular strengthen programs are on hand for these moving to
send me genuine $$$ by Paypal 😉

Related Articles

Back to top button
%d bloggers like this: