RA(1)
π¦ bestie, you're reading ra(1) and it's literally iconic π¦
okay so welcome to the manual page for ra, the general commands manual. if you're here, you're about to read argus(8) data and honestly? slay. let's get into it π
β¨ NAME β¨
ra β read argus(8) data.
like, that's the whole vibe. it reads argus data. periodt. π
πΈ SYNOPSIS πΈ
ra [raoptions] [-- filter-expression]
π DESCRIPTION π
okay so ra reads argus(8) data from literally anywhere: stdin, an argus-file, or a remote data source. and that remote source can be either an argus-server or a netflow data server. no cap. π«Ά
it filters the records it encounters based on an optional filter-expression, and then either prints the contents of the argus(5) records it encounters to stdout, or appends them into an argus(5) datafile. that's the whole main character energy right there. β¨
π OPTIONS π
-Aβ print aggregate statistics for the input stream on termination. like a little summary era at the end. π-bβ dump the compiled transaction-matching code to standard output and stop. this is useful for debugging filter expressions. lowkey a peek behind the curtain. π-c <char>β specify a delimiter character for output columns. the default is' '(a space, bestie). π¬-C <[host]:portnum>(deprecated) β specify a source of Netflow data. the optional host is the local interface address where Netflow Cisco records are going to be read. if absent, then it is implied that the interface address isAF_ANY. > β οΈ this option is deprecated and the'-S cisco://address:port'is now the recommended option. so maybe don't use it? but we still list it because facts. π«-D <level>β print debug information corresponding to <level> to stderr, if program compiled to support debug printing. as the level increases, so does the amount of debug informationra(1)will print. values range from1-8. so like, 1 is chill and 8 is everything. π-dβ toggle whether to run this program as a daemon. like, do you want it to be a background girly? toggle it. π-e <regex>β match regular expression in flow user data fields. prepend the regex with either"s:"or"d:"to limit the match to either the source or destination user data fields. at this time null bytes in the user data buffer terminate search. examples include:"^SSH-"β look for ssh connections on any port."s:^GET"β look for HTTP GET requests in the source buffer."d:^HTTP.*Unauth"β find unauthorized http response.
depending on the regular expression library that the system supports, you will be able to match many types of binary, octal and hex expressions. see regex.3, pcre.3 and the web for examples. regex girlies rise up. π₯
-E <file>β when using a filter expression at the end of the command, this option will causera(1)to append the records that are rejected by the filter into <file>. like a little reject pile, but make it a file. π-F <conffile>β use <conffile> as a source of configuration information. the format of this file is identical to rarc(5). the data read from <conffile> overrides any prior configuration information. so it's giving override energy. π-hβ print an explanation of all the arguments. help is always a vibe. π-Hβ abbreviate numeric metrics, to make reading large values easier. use the-p <num>option to specify the precision right of the decimal. big numbers but cuter. π’-L <n>β specify howrawill print header labels for the output. supported values are:-1β don't print header labels.0β print the header labels only once, as the beginning of output.> 0β print the header labels every n lines of output.
so like, you can have no labels, one set of labels, or labels every n lines. choose your own adventure. π
-M <mode [mode ...]>β provide addition mode operators. these are generally specific to the individualra*program, or a specific function. available modes forra()are:disaβ interpret DSCodepoints using the US DISA encodingsdsrs=dsrlistβ process these dsrs where a dsrlist has the format:
[+/-]dsr[,[+/-]dsr]
supported dsrs are:
transβ transport information, such as source id and seq number.flowβ flow key data (proto, saddr, sport, dir, daddr, dport)timeβ time stamp fields (stime, ltime).metricβ basic ([s|d]bytes, [s|d]pkts, [s|d]rate, [s|d]load)agrβ aggregation stats (trans, avgdur, mindur, maxdur, stdev).netβ network objects (tcp, esp, rtp, icmp data).vlanβ VLAN tag datamplsβ MPLS label datajitterβ Jitter data ([s|d]jit, [s|d]intpkt)ipattrβ IP attributes ([s|d]ipid, [s|d]tos, [s|d]dsb, [s|d]ttl)psizeβ packet size informationmacβ MAC addresses (smac, dmac, smacclass, dmacclass)icmpβ ICMP specific data (icmpmap, inode)encapsβ Flow encapsulation type indicationsbehaviorβ Behavioral metrics and datalocalβ Locality datatadjβ Time adjustment datacorβ Multi-probe correlation datacocodeβ Country Codesasnβ Autonomous System Number datasuserβ src user captured data bytes (suser)duserβ dst captured user data bytes (duser)scoreβ scoring data
examples are:
-M dsrs=time,flow,metric
-M dsrs=-suser,-duser
eframe=<int>β set ethernet framing adjust for packet byte count.jsonβ print output in json formatlabel="regex"β match flow label withregex(3)regular expression.lock[=nonblock]β aquire an exclusive record lock on output file(s).manβ print management recordsnomanβ do not print management recordsouiβ print oui labels in mac addressesprinter="format"β specify printer formats for printing user data. supported formats are:asciiβ print user buffer as ascii string. use.for unprintable chars.obfuscateβ ascii printer with password obfuscation.hexβ print hex dump of user buffer on separate lines.encode32β print user buffer as 32-bit chars.encode64β print user buffer using 64-bit chars.
pollβ successfully attach to remote data source and then exitrmonβ modify data to support unidiretional RMON stat reportingrtime:factorβ read data from a file, clocking records in as if they being read in realtime. Factor provides an opportunity to specify a multiplication factor, enabling you to read records in a fraction of real time, slowing down reading considerably, or a factor of time, enabling controlled speedup of the reading rate.saslmech="mech"β specify a mandatory SASL mechsql="select"β use"select"as select clause in mysql calls when supported.TZ="tzset"β specify atzset(3)time zone specificationuniβ generate unidirectional flow dataxmlβ print output in xml format.zeroβ print blank port fields as zero, rather that space.
illegal modes are not detectable by the standard library, and so unexpected results in command line parsing may occur if care is not taken with use of this option. so like, be careful bestie. π
-nβ modify number to name converstion. this flag supports 4 states, specified by the modulus of the number of-nflags set. by defaultra*programs do not provide hostname lookups, but they do lookup port and protocol names. the first-nwill suppress port number to service conversion,-nnwill suppress translation of protocol numbers to names (no lookups).-nnnwill return you to full conversion, translating hostnames, port and protocol names, and-nnnnwill return you to the default behavior. because this indicator can be set in the.rarcfile, multiple-nflags progress through the cycle. it's giving cycle energy. π-N [io]<num>, [io]<start-end>, [io]<start+num>β process the first <num> records, the inclusive range <start - end>, or process <num + 1> records starting at index number <start>. the optional 1st character indicates whether the specification is applied to the input or the output stream of records, the default is input. if applied to the input, these are the range of records that match the input filter. so like, you can slice and dice. βοΈ-o optionβ can be used to give options in the format used in the configuration file. this is useful for specifying options for which there is no separate command-line flag. for list of options, and their possible values, see rarc(5). sneaky config vibes. π€«-p <digits>β print <digits> number of units of precision for floating point values. precision, but make it a choice. π―-qβ run in quiet mode. configure Ra to not print out the contents of records. this can be used for a number of maintenance tasks, where you would be interested in the outcome of a program, or its progress, say with the-Doption, without printing each input record. quiet girl era. π€«-r [- | <[type:]file[::soffset[:eoffset]] ...>]β read <type> data from <files> in the order presented on the commandline.'-'denotes stdin. Ra supports reading argus type data (default), cisco and ft, flow-tools type data. if you want to read a set of files and then, when done, read stdin, use multiple occurences of the-roption. Ra can readgzip(1),bzip2(1),xz(1)andcompress(1)compressed data files. byte offset values allow the specification of a range of records within an uncompressed file. byte offsets must be aligned to record boundaries. valid record offsets can be obtained using+offsetas an output field even from compressed files.
examples are:
-r file1 file2 read argus records from file1, then file2.
-r file::34876 read argus records starting at byte offset 34876
-r file::34876:35846 read argus records starting at byte offset 34876 and ending at 35846
-r cisco:file read cisco netflow records from file
-r ft:file read flow-tools based records
-R <dir dir ...>β recursively decend the directory and process all the regular files that are encountered. the function does not decend to links, or directories that begin with'.'. the feature, like the-rcommand, does not do any file type checking. recursive but with boundaries. π
-s <[-][[+[#]]field[:len[:format]] ...>β bestie, this is THE option, the one that decides which fields get printed. π
So like, ra.1 gets its field print list either from its rarc configuration files or straight off the command line. If there's no config anywhere, ra.1 falls back to a default printing field list, with default field lengths. But when you pass a space separated list of fields to -s, you get to completely redefine the list from the command line. No cap.
You can also finesse the config instead of nuking it: stick an optional - and/or +[#] in front of the field list and you can add or subtract fields from the configured list. Iconic.
Field lengths are hard constraints, okay? Meaning field output that blows past the field length gets truncated, and a * gets shoved in as the last character. When you see that little star, that's your sign to add more to the length spec for that specific field. π«Ά
Field lengths (len) less than1are not permitted and will generate an error. Don't do it.
The optional format spec uses sprintf.1 syntax to format the value. Obsessed.
The available fields to print are:
srcidβ Argus source identifier. In V3 records this is a 32-bit integer, IP address, or 4byte ascii string. In V5 records, the srcid is composed of the 128-bitsidor source id, and an optional 4-charinfor interface identifier, separated by a/. You can print out thesidandinfcomponents separately.sidβ Argus source identifier. Introduced in V5 records. Thesidis a maximuinfβ Optional 4-char string interface identifier for this flow data.rankβ Ordinal value of this output flow record i.e. sequence number.stimeβ record start timeltimeβ record last time.transβ aggregation record count.flgsβ flow state flags seen in transaction.seqβ argus sequence number.durβ record total duration.runtimeβ total active flow run time. This value is generated through aggregation, and is the sum of the records duration.idleβ time since the last packet activity. This value is useful in real-time processing, and is the current time - last time.meanβ average duration of aggregated records.stddevβ standard deviation of aggregated duration times.sumβ total accumulated durations of aggregated records.minβ minimum duration of aggregated records.maxβ maximum duration of aggregated records.smacβ source MAC addr.dmacβ destination MAC addr.souiβ oui portion of the source MAC addr.douiβ oui portion of the destination MAC addr.smacclassβ class of the source MAC addr. (UAA, LAA, ELI, SAI, AAI, RES, LM)dmacclassβ class of the destination MAC addr. (UAA, LAA, ELI, SAI, AAI, RES, LM)sencβ source encapsulations processed.dencβ destination encapsulations processed.saddrβ source IP addr.daddrβ destination IP addr.protoβ transaction protocol.sportβ source port number.dportβ destination port number.stosβ source TOS byte value.dtosβ destination TOS byte value.sdsbβ source diff serve byte value.ddsbβ destination diff serve byte value.scoβ source IP address country code.dcoβ destination IP address country code.sttlβ src -> dst TTL value.dttlβ dst -> src TTL value.shopsβ estimate of number of IP hops from src to this point.dhopsβ estimate of number of IP hops from dst to this point.sipidβ source IP identifier.dipidβ destination IP identifier.smplsβ source MPLS identifier.dmplsβ destination MPLS identifier.sgreaddrβ source GRE tunnel address.dgreaddrβ destination GRE tunnel address.greprotoβ Next layer GRE tunnel protocol.autoidβ Auto generated identifier (mysql).sasβ Src origin ASdasβ Dst origin ASiasβ Intermediate origin AS, AS of ICMP generatorcauseβ Argus record cause code. Valid values are Start, Status, Stop, Close, Errornstrokeβ Number of observed keystrokes.snstrokeβ Number of observed keystrokes from initiator (src) to target (dst).dnstrokeβ Number of observed keystrokes from target (dst) to initiator (src).pktsβ total transaction packet count.spktsβ src -> dst packet count.dpktsβ dst -> src packet count.bytesβ total transaction bytes.sbytesβ src -> dst transaction bytes.dbytesβ dst -> src transaction bytes.appbytesβ total application bytes.sappbytesβ src -> dst application bytes.dappbytesβ dst -> src application bytes.pcrβ producer consumer ratio.loadβ bits per second.sloadβ source bits per second.dloadβ destination bits per second.lossβ pkts retransmitted or dropped.slossβ source pkts retransmitted or dropped.dlossβ destination pkts retransmitted or dropped.plossβ percent pkts retransmitted or dropped.pslossβ percent source pkts retransmitted or dropped.pdlossβ percent destination pkts retransmitted or dropped.retransβ pkts retransmitted.sretransβ source pkts retransmitted.dretransβ destination pkts retransmitted.pretransβ percent pkts retransmitted.psretransβ percent source pkts retransmitted.pdretransβ percent destination pkts retransmitted.sgapβ source bytes missing in the data stream. Available afterargus-3.0.4dgapβ destination bytes missing in the data stream. Available afterargus-3.0.4rateβ pkts per second.srateβ source pkts per second.drateβ destination pkts per second.dirβ direction of transactionsintpktβ source interpacket arrival time (mSec)sintdistβ source interpacket arrival time distributionsintpktactβ source active interpacket arrival time (mSec)sintdistactβ source active interpacket arrival time distributionsintpktidlβ source idle interpacket arrival time (mSec)sintdistidlβ source idle interpacket arrival time distributiondintpktβ destination interpacket arrival time (mSec)dintdistβ destination interpacket arrival time distributiondintpktactβ destination active interpacket arrival time (mSec)dintdistactβ destination active interpacket arrival time distribution (mSec)dintpktidlβ destination idle interpacket arrival time (mSec)dintdistidlβ destination idle interpacket arrival time distributionsjitβ source jitter (mSec).sjitactβ source active jitter (mSec).sjitidleβ source idle jitter (mSec).djitβ destination jitter (mSec).djitactβ destination active jitter (mSec).djitidleβ destination idle jitter (mSec).stateβ transaction statelabelβ Metadata label.suserβ source user data buffer.duserβ destination user data buffer.swinβ source TCP window advertisement.dwinβ destination TCP window advertisement.svlanβ source VLAN identifier.dvlanβ destination VLAN identifier.svidβ source VLAN identifier.dvidβ destination VLAN identifier.svpriβ source VLAN priority.dvpriβ destination VLAN priority.srngβ start time for the filter timerange.erngβ end time for the filter timerange.stcpbβ source TCP base sequence numberdtcpbβ destination TCP base sequence numbersmssβ source TCP maximum segment sizedmssβ destination TCP maximum segment sizetcprttβ TCP connection setup round-trip time, the sum of'synack'and'ackdat'.synackβ TCP connection setup time, the time between the SYN and the SYN_ACK packets.ackdatβ TCP connection setup time, the time between the SYN_ACK and the ACK packets.tcpoptβ The TCP connection options seen at initiation. The tcpopt indicator consists of a fixed length field, that reports presence of any of the TCP options that argus tracks The format is:
M - Maxiumum Segment Size
w - Window Scale
s - Selective ACK OK
S - Selective ACK
e - TCP Echo
E - TCP Echo Reply
T - TCP Timestamp
c - TCP CC
N - TCP CC New
O - TCP CC Echo
S - Source Explicit Congestion Notification
D - Destination Explicit Congestion Notification
inodeβ ICMP intermediate node.offsetβ record byte offset in file or stream.smeanszβ Mean of the flow packet size transmitted by the src (initiator).dmeanszβ Mean of the flow packet size transmitted by the dst (target).spktszβ histogram for the src packet size distributionsmaxszβ maximum packet size for traffic transmitted by the src.dpktszβ histogram for the dst packet size distributiondmaxszβ maximum packet size for traffic transmitted by the dst.sminszβ minimum packet size for traffic transmitted by the src.dminszβ minimum packet size for traffic transmitted by the dst.
Examles are:
-s saddr print only the source address.
-s -bytes removes the bytes field from list.
-s +2srcid adds the source identifier after the 2nd field.
-s spkts:18 prints src pkt count with a column width of 18.
-s smpls print the local mpls label in the flow.
-s sgreaddr print the src address of the GRE tunnel in the flow.
-S <[URI://][user[:pass]@]host[:portnum]>β bestie, this is how you pull flow data from somewhere else. You're reading flow data over a bunch of different data formats and transport strategies, and the URI format is what tellsrawhat kind of flow data record you want (argus-tcp,argus-udp,cisco,jflow,sflow) plus the source, given as a name or an address. You can also hand over an optional user and password for protected access. And that optional:portnum? That's for when you want a port number that isn't the default, which is561. π
Examples are:
-S localhost request remote argus records from localhost, using default methods.
-S user@localhost request argus records from localhost, as 'user'.
-S user:pass@localhost request argus records from localhost, as 'user', with 'pass' password.
-S 192.168.0.4:12345 request via TCP argus records from 192.168.0.4, port 12345.
-S argus://user@anubis request argus records from anubis, via TCP port 561, as 'user'.
-S argus-tcp://thoth:12345 request argus records via TCP from thoth, port 12345.
-S argus-udp://set:12345 request argus records via UDP from set, port 12345.
-S cisco://any:9996 read cisco netflow records from AF_ANY, on port 9996.
-S jflow://10.0.0.2:9898 read jflow records sent to 10.0.0.2, on port 9898.
-S sflow://localhost:6343 read sflow records sent to localhost interface, port 6343.
-t <timerange>β the time range you want to match yourargus(5)records against. This one is so flexible β it does explicit ranges, relative ranges, and it even supports wildcarding in the time fields. Obsessed. β¨
The syntax for the <time range> is:
[timeComparisonInd]timeSpecification[-timeSpecification]
timeComparisonInd: [x]i | n | c (default = i)
x negation reverses the result of the time comparison
i intersects match records that were active during this time period
n includes match records that start before and end after the period
c contained match records that start and end during the period
timeSpecification: [[[yyyy/]mm/]dd.]HH[:MM[:SS]]
[yyyy/]mm/dd
yyyy
%d{ymdHMS}
seconds
{ + | - }%d{ymdHMS}
where '*' can be used as a wildcard.
Examples are:
-t 14 specify the time range 2pm-3pm for today
-t 15-23 specify the time range 3pm-11pm for today
-t 2011 all records in the year 2011
-t 2011/08 all records in Aug of the year 2011
-t 2011/08-2011/10 all records in Aug, Sept, and Oct of the year 2011
-t **.14 specify 2pm-3pm, every day this month
-t 1270616652+2s all records that span 10/04/07.01:04:12 EDT.
-t 1999y1m23d10h matches 10-11am on Jan, 23, 1999
-t 10d*h*m15s matches records that intersect the 15 sec,
any minute, any hour, on the 10th of this month
-t ****/11/23 all records in Nov 23rd, any year
-t 23.11:10-14 11:10:00 - 2pm on the 23rd of this month
-t -10m matches 10 minutes before, to the present
-t -1M+1d matches the first day of the this month.
-t -2h5m+5m matches records that start before and end
after the range starting 2 hours 5 minutes
prior to the present, and lasting 5 minutes.
So the way time comparison actually works is with basic intersection operations. A record intersects a specified time range if there's any intersection at all between the time range of the record and the comparison time range β and ngl, that's the default behavior. A record includes the comparison time range when the intersection of the two ranges equals the comparison time, and a record is contained when the intersection equals the duration of the record. The comparison indicator is the first character of the range specification, and there are no spaces. π«Ά
Examples are:
-t n14:10:15-14:10:19 records include these 4s.
-t c14:10-14:10:10 record starts and ends within these 10s.
-t xi-5s+25s record starts or ends 5 seconds earlier and
20 seconds after 'now'.
-T <secs>β readargus(5)from a remote server for<secs>of time. That's it, that's the whole vibe. β³-uβ print your time values using Unix time format (seconds from the Epoch). raw numbers only, no notes. π-w <file> [filter-expression]β append matching data to<file>, in argus file format. And listen: an output-file of'-'makesrawrite theargus(5)records to stdout, which is what lets you "chain"ra*style commands together. The optional filter-expression lets you select specific output. π«-Xβ resets all options back to their default values and overrides therarcfile contents. Use it as the first option. (Yes, first. Don't fight it.)-zβ modify the status field so it represents TCP state changes. The values of the status field when this is enabled are:'s'β Syn Transmitted'S'β Syn Acknowledged'E'β TCP Established'f'β Fin Transmitted (FIN Wait State 1)'F'β Fin Acknowledged (FIN Wait State 2)'R'β TCP Reset
-Z <s|d|b>β modify the status field so it represents actual TCP flag values.<'s'rc |'d'st |'b'oth>. The characters that can show up in the status field when this is enabled are:'F'β Fin'S'β Syn'R'β Reset'P'β Push'A'β Ack'U'β Urgent Pointer'7'β Undefined 7th bit set'8'β Undefined 8th bit set
-3β generate Argus V3 (open source) formatted data when you're writing flow records to a file. β¨
π RETURN VALUES π
ra exits with one of these values, and bestie, you will be checking them:
0β Records matched condition, considering the options provided.1β No records matched the condition, or the source was not an argus stream.> 1β An error occurred. π
π¦ FILTER EXPRESSION π¦
okay so if arguments remain after option processing, the whole collection gets interpreted as a single filter expression. To mark the end of arguments, you need a '--' (double dash) before the filter expression goes onto the command line. Historically a '-' (single dash) was used to separate the filter expression from the command line options, but newer versions of getopt.1 now require the '--' (double dash). so, y'know. adapt. π
The filter expression is what specifies which argus(5) records get selected for processing. If no expression is given, all records are selected β otherwise only those records for which the expression is true will be printed. π«Ά
The syntax is very similar to the expression syntax for tcpdump(1), since the tcpdump compiler was a starting point for the argus(5) filter expression compiler. BUT β and this is important, no cap β the semantics for tcpdump(1)'s packet filter expressions are different when you apply them to transaction record filtering, so there are some major differences.
When attached to a remote argus, ra will send the filter to the argus process, which compiles the filter and uses it to select which argus records get transmitted to the ra application. If you do not want to send a filter to the remote argus, prepend the filter with the keyword "local" to indicate that the filtering will be done within the local ra process.
The expression consists of one or more primitives. Primitives usually consist of an id (name or number) preceded by one or more qualifiers. There are three different kinds of qualifier:
- type β qualifiers say what kind of thing the id name or number refers to. Possible types are
srcid,encaps,ether,host,net,co,port,tos,ttl,ptks,bytes,appbytes,pcr,data,rate,load,loss,ploss,vid,vpri, andmid.
E.g., srcid isis, encaps gre, host sphynx, net 192.168.0.0/16, port domain, ttl 1, ptks gt 2, ploss lt 5. If there is no type qualifier, host is assumed.
- dir β qualifiers specify a particular transfer direction to and/or from an id. Possible directions are
src,dst,src or dstandsrc and dst. E.g.,src sphynx,dst net 192.168.0.0/24,src or dst port ftp,src and dst tos 0x0a,src or dst vid 0x12,dst vpri 0x02. If there is no dir qualifier,src or dstis assumed. - proto β qualifiers restrict the match to a particular protocol. Possible values are those specified in the
/etc/protocolssystem file and a small number of extensions, (that should be defined but aren't). Specific extended values are'ipv4', (to specify just ip version 4), in contrast to the defined proto'ipv6'. The defined proto'ip'reduces to the filter'ipv4 or ipv6'.
When preceded by ether, the protocol names and numbers that are valid are specified in ./include/ethernames.h.
In addition to all of the above, there are some special primitive keywords that don't follow the pattern: gateway, multicast, and broadcast. All of these are described below. π
More complex filter expressions are built up by using the words and, or and not to combine primitives. E.g., host foo and not port ftp and not port ftp-data. To save typing, identical qualifier lists can be omitted. E.g., tcp dst port ftp or ftp-data or domain is exactly the same as tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain.
Allowable primitives are:
srcid argusidβ True if the argus identifier field in the Argus record is srcid, which may be an IP address, a name or a decimal/hexidecimal number.seq [gt | gte | lt | lte | eq] numberβ True if the transport sequence number in the Argus record matches the sequence number expression.encaps typeβ True if the encapsulation used by the flow in the Argus record includes the type. The list of valid encapsulation types is:mpls,eth,802q,llc,pppoe,vxlan,isl,gre,geneve,ah,ipnip,ipnip6,chdlcdst host hostβ True if the IP destination field in the Argus record is host, which may be either an address or a name.src host hostβ True if the IP source field in the Argus record is host.host hostβ True if either the IP source or destination in the Argus record is host.
Any of the above host expressions can be prepended with the keywords ip, arp, or rarp as in:
ip host host
which is equivalent to:
ether proto ip and host host
If host is a name with multiple IP addresses, each address will be checked for a match. π
ether dstehost β true when the ethernet destination address is ehost. That ehost can be a name straight out of/etc/ethers, or just a number (peepethers(3N)for the numeric format, bestie).ether srcehost β true when the ethernet source address is ehost.ether hostehost β true when either the ethernet source or the ethernet destination address is ehost. Covering both bases, love that for us.gatewayhost β true when the transaction used host as a gateway. Like, the ethernet source or destination address was host, but neither the IP source nor the IP destination was host. π host has to be a name, and it has to be findable in both/etc/hostsand/etc/ethers. An equivalent expression is
ether host ehost and not host host
which is flexible enough to work with either names or numbers for host / ehost.
dst netcidr β true when the IP destination address in the Argus record matches the cidr address.src netcidr β true when the IP source address in the Argus record matches the cidr address.netcidr β true when either the IP source or the IP destination address in the Argus record matches the cidr address.dst portport β true when the network transaction is IP based, using either the TCP or UDP transport protocols, and has a destination port value of port. That port can be a number or a name as configured in the/etc/servicesfile (seetcp(4P)andudp(4P)). If you use a name, both the protocol number and the port number get checked. If you use a number or an ambiguous name, the port number is checked for both UDP and TCP protocols β so like,dst port 513will print both tcp/login traffic and udp/who traffic, andport domainwill match both tcp/domain and udp/domain traffic. You can also specify port ranges with numeric values, such asport 53-215. β¨src portport β true when the network transaction has a source port value of port.portport β true when either the source or the destination port in the Argus record is port. And here's the cute part: any of the port expressions above can be prepended with the keywordstcporudp, like
tcp src port port
which matches only tcp connections. slay.
ip protoprotocol β true when the Argus record is an ip transaction (seeip(4P)) of protocol type protocol. protocol can be a number or any of the string values found in/etc/protocols.multicastβ true when the network transaction involved an ip multicast address. And if you specifyether multicast, you can select argus records that involve an ethernet multicast address. π¦broadcastβ true when the network transaction involved an ip broadcast address. By specifyingether broadcast, you can select argus records that involve an ethernet broadcast address.ether protoprotocol β true when the Argus record is of ether type protocol. protocol can be a number or a name likeip,arp, orrarp.[src | dst] loc [gt | gte | lt | lte | eq]number β true when the Locality value for addresses in the Argus record compares to number.[src | dst] ttl [gt | gte | lt | lte | eq]number β true when the TTL in the Argus record compares to number.[src | dst] tos [gt | gte | lt | lte | eq]number β true when the TOS in the Argus record (default) compares to number.[src | dst] vid [gt | gte | lt | lte | eq]number β true when the VLAN id in the Argus record (default) compares to number.[src | dst] vpri [gt | gte | lt | lte | eq]number β true when the VLAN priority in the Argus record (default) compares to number.[src | dst] mid [gt | gte | lt | lte | eq]number β true when the MPLS Label in the Argus record (default) compares to number.[src | dst] pkts [gt | gte | lt | lte | eq]number β true when the packet count in the Argus record (default) compares to number.[src | dst] bytes [gt | gte | lt | lte | eq]number β true when the byte count in the Argus record (default) compares to number.[src | dst] appbytes [gt | gte | lt | lte | eq]number β true when the application byte count in the Argus record (default) compares to number.[src | dst] rate [gt | gte | lt | lte | eq]number β true when the rate in the Argus record (default) compares to number.[src | dst] load [gt | gte | lt | lte | eq]number β true when the load in the Argus record (default) compares to number.
okay so now we get into the vibes of the primitives π Ra filter expressions support primitives that are specific to flow states, and you can use them to select flow records that were in those states at the time they were generated:
normal,wait,timeout,estorcon
There are also primitives that select flows which experienced fragmentation:
fragandfragonly
Support for selecting flows that used multiple pairs of MAC addresses during their lifetime:
multipath
Primitives specific to TCP flows are supported too:
syn,synack,ecn,fin,finack,reset,reuse,retrans,outoforderandwinshut
Primitives specific to TCP options, yes we have those:
tcpopt,mss,wscale,selackok,selack,tcpecho,tcpechoreply,tcptimestamp,tcpcc,tcpccnew,tcpccecho,secnanddecn
Primitives specific to TCP metrics:
maxseg
And primitives specific to ICMP flows are supported:
echo,redirect,timexedandunreach
...where unreach can be further specified using the keywords unrnet, unrhost, unrproto, unrport, unrfrag, unrsrcfail, unrnetunk, unrhostunk, unriso, unrnetpro, unrhostpro, unrnettos, unrhosttos, unrfilter, unrhostpre, and unrprecut, that each correspond to the unreachable icmp codes. π
For some primitives, a direction qualifier is appropriate. These are:
frag,reset,retrans,outoforderandwinshut
π Combining primitives π
Primitives may be combined using:
- A parenthesized group of primitives and operators (parentheses are special to the Shell and must be escaped β do not forget this bestie, the shell will eat them otherwise π).
- Negation (
!ornot). - Concatenation (
and). - Alternation (
or).
Negation has the highest precedence. Alternation and concatenation have equal precedence and associate left to right. And heads up: explicit and tokens, not juxtaposition, are now required for concatenation. no cap.
If an identifier is given without a keyword, the most recent keyword is assumed. For example,
not host sphynx and anubis
is short for
not host sphynx and host anubis
which should not be confused with
not ( host sphynx or anubis )
β οΈ Those three are genuinely different filters, okay? Read them twice. The parentheses change everything.
Expression arguments can be passed to ra(1) as either a single argument or as multiple arguments, whichever is more convenient. Generally, if the expression contains Shell metacharacters, it's easier to pass it as a single, quoted argument. Multiple arguments get concatenated with spaces before being parsed. π«Ά
π Startup Processing π
Ra begins by searching for the configuration file .rarc first in the directory, $ARGUSHOME and then $HOME. If a .rarc is found, all variables specified in the file are set.
Ra then parses its command line options and sets its internal variables accordingly.
If a configuration file is specified on the command-line, using the -f <confile> option, the values in this .rarc formatted file supercede all other values. π
π EXAMPLES π
the moment we've all been waiting for β actual commands, actual slay π
To report all TCP transactions from and to host narly.wave.com, reading transaction data from argus-file argus.data:
ra -r argus.data - tcp and host narly.wave.com
To report all UDP based DNS traffic, reading transaction data from the remote argus.server:
ra -S argus.server - udp port domain
To report all UDP transactions seen by the remote argus.server on the port range 53-256, but not sending the filter to the remote argus process:
ra -S argus.server - local udp port 53-256
Create the argus-file icmp.log with all ICMP events involving the host nimrod, using data from argus-file, but reading the transaction data from stdin:
cat argus-file | ra -r - -w icmp.log - icmp and host nimrod
Read an argus-file at twice normal speed:
ra -r argus.file -M rtime:2
Write ra output in standard formats other than space separated columns:
ra -r argus.file -M json
ra -r argus.file -M xml
β¨ OUTPUT FORMAT β¨
okay bestie, here's the tea on what ra spits out by default. π Is this the objectively best data set you could ever generate? Not necessarily, but it's a totally valid starting point for playing with flow data in general β and ngl, it looks chef's kiss on an 80 column terminal. π
The standard 5-tuple flow format is:
time flgs proto saddr.sport dir daddr.dport pkts bytes state
time
The format of the time field is set by your .rarc file, using syntax that the strftime(3V) routine supports. Default is '%T', periodt.
Argus transactional data has both starting and ending transaction times, with precision down to the nanosecond. But ra just prints the 'stime' field by default β that's the record's starting time. π
flgs
The flgs indicator is a fixed length field. It reports all kinds of flow record + protocol identifiers, states, and attributes. The format is:
Tβ Time Corrected/AdjustedNβ Netflow Originated Data*β Multiple sub-IP encapsulationseβ Ethernet encapsulated flowMβ Multiple mac addresses seenmβ MPLS encapsulated flowlβ LLC encapsulated flowvβ 802.1Q encapsulations/tagswβ 802.11 wireless encapsulationpβ PPP over Enternet encapsulated flowiβ ISL encapsulated flowxβ VXLAN encapsulationGβ GRE encapsulationaβ AH encapsulationPβ IP tunnel encapsulation6β IPv6 tunnel encapsulationHβ HDLC encapsulationCβ Cisco HDLC encapsulationAβ ATM encapsulationSβ SLL encapsulationFβ FDDI encapsulationsβ SLIP encapsulationRβ ARCNET encapsulationIβ ICMP events mapped to this flowUβ ICMP Unreachable event mapped to this flowRβ ICMP Redirect event mapped to this flowTβ ICMP Time Exceeded mapped to this flowRβ TCP port reuse seen*β Both Src and Dst loss/retransmissionsβ Src loss/retransmissionsdβ Dst loss/retransmissionsgβ Gaps in sequence numbers were observed&β Both Src and Dst packet out of orderiβ Src packets out of orderrβ Dst packets out of order@β Both Src and Dst Window ClosureSβ Src TCP Window ClosureDβ Dst TCP Window Closure*β Silence suppression used by both src and dst (RTP)sβ Silence suppression used by srcdβ Silence suppression used by dstEβ Both Src and Dst ECNxβ Src Explicit Congestion Notificationtβ Dst ECNVβ Fragment overlap seen (if fragments seen)fβ Partial Fragment (if fragments seen)Fβ Fragments seenOβ multiple IP options setSβ IP option Strict Source RouteLβ IP option Loose Source RouteTβ IP option Time Stamp+β IP option SecurityRβ IP option Record RouteAβ IP option Router AlertUβ unknown IP options set
yes the same letters show up more than once with different meanings bestie, that's just how it is, no notes π
proto
The proto field tells you the upper protocol used in the transaction. It holds the first 4 characters of the official name of the protocol, as defined in RFC-1700 and configured via the /etc/protocols file. Argus also tries to sniff out the Realtime Transport Protocol (rtp) when it's in use β when it catches rtp, it says so right in this field with the string 'rtp'. π
And if you pass -n twice (-nn), you get the actual protocol number displayed instead. iykyk.
shost
The shost field is meant to convey the originator of the data in the flow. This field is protocol dependent, so for IP protocols it holds the src IP address/name. For TCP and UDP, it also holds the port number/name, separated by a period. π«Ά
The 'src' is generally the entity that first transmits a packet that's part of a flow. But lowkey, the assignment of 'src' and 'dst' semantics gets a little complicated by the notion of loss, or half-duplex monitoring β especially when connection-oriented protocols like TCP are being reported. In that case, the 'src' is the entity that initiated the flow. π
dir
The dir field holds the direction of the transaction, as best as anyone can figure out from the datum, and it's used to show which hosts are transmitting. For TCP, dir indicates the actual source of the TCP connection, and the center character shows the state of the transaction:
-β transaction was NORMAL|β transaction was RESEToβ transaction TIMED OUT.?β direction of transaction is unknown.
daddr
The daddr field conveys the recipient of the data in the flow. Like shost, it's protocol dependent β for IP protocols it holds the dst IP address/name, and optionally the DSAP. π
metrics
metrics are the general sets of fields that reflect the activity of the flow. In the default output there are 4 fields: the first 2 are the packet counts, and the last 2 are the byte counts for that specific transaction. The fields are paired up with the previous host fields, and they represent the packets transmitted by the respective host. β¨
state
The state field shows the principle state for the transaction report, and it's protocol dependent. For all protocols except ICMP, this field reports the basic state of a transaction. π
REQ|INT (requested|initial)
This says it's the initial state report for a transaction, and it only shows up when the argus-server is in DETAIL mode. For TCP connections it's REQ, meaning a connection is being requested. For connectionless protocols like UDP, it's INT.
ACC (accepted)
This says a request/response condition happened, and a transaction has been detected between two hosts. For TCP, it means a connection request got answered and the connection will be accepted β only seen when the argus-server is in DETAIL mode. For connectionless protocols, this state means there was a single packet exchange between two hosts, which could count as a request/response transaction. π
EST|CON (established|connected)
This record type says the reported transaction is active, and has been established or is continuing. Read it as a state report of a currently active transaction. For TCP, EST is only seen in DETAIL mode, and it means the three way handshake for a connection has been completed. π¦
CLO (closed)
TCP specific β this record type means the TCP connection has closed normally. π
TIM (timeout)
No activity was seen relating to this transaction during the argus server's timeout period for this protocol. This state is only seen when there were packets recorded since the last report for this transaction. π
For the ICMP and ICMPv6 protocols, the state field displays specific aspects of the ICMP type. ICMP state can have the values:
ECOβ Echo RequestECRβ Echo ReplySRCβ Source QuenchREDβ RedirectRTAβ Router AdvertisementRTSβ Router SolicitationTXDβ Time ExceededPARβ Parameter ProblemTSTβ Time Stamp RequestTSRβ Time Stamp ReplyIRQβ Information RequestIRRβ Information ReplyMASβ Mask RequestMSRβ Mask ReplyURNβ Unreachable networkURHβ Unreachable hostURPβ Unreachable portURFβ Unreachable need fragmentationURSβ Unreachable source failedURNUβ Unreachable dst network unknownURHUβ Unreachable dst host unknownURISOβ Unreachable source host isolatedUR NPROβ Unreachable network administrative prohibitedURHPROβ Unreachable host administrative prohibitedURNTOSβ Unreachable network TOS prohibitedURHTOSβ Unreachable host TOS prohibitedURFILβ Unreachable administrative filterURPREβ Unreachable precedence violationURCUTβ Unreachable precedence cutoffMRQβ Membership QueryMHRβ Membership ReportNRSβ Neighbor Discovery Router SolicitNRAβ Neighbor Discovery Router AdvertisementNNSβ Neighbor Discovery Neighbor SolicitNNAβ Neighbor Discovery Neighbor AdvertisementPTBβ Packet Too Big
πΈ OUTPUT EXAMPLES πΈ
Okay bestie, these are the vibes you'll actually see on your screen β real ra output, showing off all the different flavors argus data comes in. π
This output was made with the -n option to suppress number translation, so no hostnames, just numbers, periodt.
Thu 12/29 06:40:32 S tcp 132.3.31.15.6439 -> 12.23.14.77.23 CLO
This is a totally normal tcp transaction heading to the telnet port on host 12.23.14.77. The IP Option strict source route was seen. π
Thu 12/29 06:40:32 tcp 132.3.31.15.6200 <| 12.23.14.77.25 RST
This tcp transaction from the smtp port of host 12.23.14.77 got RESET. π A lot of the time that means the transaction was rejected, but β plot twist β some os's will use RST to close an active TCP. So use either the -z or -Zb options to specify exactly what conditions existed during the connection. iykyk.
Thu 12/29 03:39:05 M igmp 12.88.14.10 <-> 128.2.2.10 CON
This is an igmp transaction state report, usually spotted with MBONE traffic. There was more than one source and destination MAC address pair used to support the transaction, suggesting a possible routing loop. π
Thu 12/29 06:40:05 * tcp 12.23.14.23.1043 <-> 12.23.14.27.6000 TIM
This is an X-windows transaction that has TIMEDOUT. Packets were retransmitted during the connection. it's giving "we tried, bestie." π
Thu 12/29 07:42:09 udp 12.9.1.115.2262 -> 28.12.141.6.139 INT
This is an initial netbios UDP transaction state report β meaning this is the first datagram encountered for this transaction. π±
Thu 12/29 06:42:09 icmp 12.9.1.115 <-> 12.68.5.127 ECO
This one represents a "ping" of host 12.9.1.115, and its response. π
This next example shows the ra output of a complete TCP transaction, along with the preceding Arp and DNS requests, while reading from a remote argus-server. The '*' in the CLO report means at least one TCP packet was retransmitted during the transaction. The hostnames in this example are ficticious. (yes, exactly like that, don't come for me π«Ά)
% ra -S argus-tcp://argus-server and host i.qosient.com
ra: Trying argus-server port 561
ra: connected Argus Version 3.0
Sat 12/03 15:29:38 arp i.qosient.com who-has dsn.qosient.com INT
Sat 12/03 15:29:39 udp i.qosient.com.1542 <-> dns.qosient.53 INT
Sat 12/03 15:29:39 arp i.qosient.com who-has qosient.com INT
Sat 12/03 15:29:39 * tcp i.qosient.com.1543 -> qosient.com.smtp CLO
π COPYRIGHT π
Copyright (c) 2000-2024 QoSient. All rights reserved. (iconic, honestly, 24 years of slay π)
π«Ά AUTHORS π«Ά
Carter Bullard (carter@qosient.com). the blueprint, fr fr.
π FILES π
/etc/ra.conf
β¨ SEE ALSO β¨
And now for the reading list, because we're β¨well-readβ¨ in this house:
- Postel, Jon, Internet Protocol, RFC 791, Network Information Center, SRI International, Menlo Park, Calif., May 1981.
- Postel, Jon, Internet Control Message Protocol, RFC 792, Network Information Center, SRI International, Menlo Park, Calif., May 1981.
- Postel, Jon, Transmission Control Protocol, RFC 793, Network Information Center, SRI International, Menlo Park, Calif., May 1981.
- Postel, Jon, User Datagram Protocol, RFC 768, Network Information Center, SRI International, Menlo Park, Calif., May 1980.
- McCanne, Steven, and Van Jacobson, The BSD Packet Filter: A New Architecture for User-level Capture, Lawrwnce Berkeley Laboratory, One Cyclotron Road, Berkeley, Calif., 94720, December 1992.
and that's the whole page, bestie!! π this manual is ra 5.0.3.0, dated 17 October 2023, and it lives at the very bottom of the page as RA(1) β that's your source, your version, and your date all in one lil footer. go forth and ra responsibly, mwah π
πβ¨
π¦ where this page comes from
- debian trixie: argus-client 1:5.0.2+git20250321.41f65e2-2 Β· GPL-2.0-or-later
- ubuntu questing: argus-client 1:5.0.2+git20250321.41f65e2-2ubuntu1
- ubuntu resolute: argus-client 1:5.0.2+git20250321.41f65e2-2ubuntu2 Β· GPL-2.0-or-later
- ubuntu stonking: argus-client 1:5.0.2+git20250321.41f65e2-2ubuntu2 Β· GPL-2.0-or-later
- Copyright (c) 2000-2024 QoSient, LLC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms