Rsa NW 11.5 Nwconsole User Guide
Rsa NW 11.5 Nwconsole User Guide
Rsa NW 11.5 Nwconsole User Guide
Prerequisites
All NetWitness Platform appliances have the NwConsole application installed. You can also install it on
Windows, Mac, and CentOS to connect and interact with a Core service.
NwConsole is available from the command line on a NetWitness Platform appliance. If you are
accessing a Core appliance remotely, you need to have the RSA NetWitness Console application
installed on a Windows, Mac, or CentOS machine. To obtain the NetWitness Console application
installer, contact RSA Customer Care.
Access NwConsole
To run NwConsole from the command line on a NetWitness Platform appliance or on a terminal
emulator, at the <$> prompt, type NwConsole (Linux) or nwconsole (Windows). The actual
command is NwConsole, but Windows is not case sensitive. RSA NetWitness Console is displayed as
shown in the following example.
Last login: Thu Sep 24 14:00:42 on console
usxx<username>m1:~ <username>$ NwConsole
RSA NetWitness Platform Console 11.2.0.0.6105
Copyright 2001-2020, RSA Security Inc. All Rights Reserved.
View Help
NwConsole provides help on individual commands as well as help on specific topics.
Caution: To get the latest information, view the command and help topics within NwConsole.
> help
Local commands:
avro2nwd - Convert AVRO files to NWD files
avrodump - Display schema and contents of AVRO file (for debugging)
blockspeed - Tests various write block sizes to determine best setting
compileflex - Compile all flex parsers in a directory
createflex - Create a flex parser that matches tokens read from a file
dbcheck - Perform a database integrity check over one or more
session, meta, packet, log or stat db files
diskspeed - Measures the speed of the disk(s) mounted at a specified
directory
echo - Echos the passed in text to the terminal
encryptparser - Encrypt all parsers in a directory
feed - Create and work with feed files
fmanip - Manipulate a file with XOR and check for embedded PEs
hash - Creates or verifies hashes of database files
help - Provides help information for recognized console commands
history - Displays, erases or executes a command in the command
history
httpAggStats - Tests HTTP aggregation and reports statistics as it
continues
log - Perform operations on a log database
logParse - Parse line delimited logs on stdin and post results to
stdout
logfake - Create a fake log pcap file
lua - Execute a lua script
makec3 - Generate C3 Test Data
makepcap - Convert packet database files to pcap or log files
man - Displays a list of topics or opens a specific manual page
on a topic
metaspeed - Tests read performance over an existing meta db
netbytes - Display statistics on network interface utilization
nwdstrip - Convert full NWD file into just session and meta file
pause - Wait for user input when running a script file
reindex - reindex a collection
sdk - Execute SDK commands based on the C SDK library, type "sdk
help" for more information
sleep - Sleeps for the specified milliseconds
timeout - Globally change the timeout for waiting for a response from
a service
tlogin - Open a trusted SSL connection to an existing service
topQuery - Returns the top N longest running queries from the audit
log (either a file or from the log API)
vslice - Validate index slices
> man
List of topics:
Introduction
Connecting to a Service
Monitoring Stats
Feeds
Converting Packet DB Files to PCAP
Packets
Verifying Database Hashes
SDK Content
SDK Content Examples
Troubleshooting
Type "man <topic>" for help on a specific topic, partial matches are acceptable
>
Type "man <topic>" for help on a specific topic, partial matches are acceptable
> man Packets
Packets
=======
The *packets* command can be used to generate a pcap or log file based on a
list of Session IDs, a time period or a where clause. The command is quite
flexible and can be used on any running service that has access to the raw
data from a downstream component. Before running the command, you must first
*login* to a service and then change directory to the appropriate sdk node,
(e.g., "cd /sdk"). Unlike the *makepcap* command, which only works on the
local file system, this command is meant to be used on a remote service.
login ...
cd /sdk
packets where="service=80 && time='2018-03-01 15:00:00'-'2018-03-01
15:10:00'" pathname="/tmp/march-1.pcap"
Write 10 minutes of HTTP only packets from March 1st, to the file
/tmp/march-1.pcap. All times are in UTC.
Caution: To get the latest information, view the command and help topics within NwConsole.
Quit NwConsole
To exit the NwConsole application, type quit at the command line.
When you use the -c option, you can use additional quotes and escape quotes to include embedded
spaces for the where clause. For example:
where="\"tcp.dstport=443 && time='2020-09-07 17:25:00'-'2020-09-08
05:24:59'\""
The following example shows how to use the -c option for pcap extraction.
[root@nwadmin1 ~]# NwConsole -c login 127.0.0.1:56003:ssl <user> <passowrd> -
c cd sdk -c packets
where="\"tcp.dstport=443 && time='2020-09-07 17:25:00'-'2020-09-08
05:24:59'\""
pathname="/var/netwitness/ny_sdwan_tcp_443_20200930.pcap"
RSA NetWitness NextGen Console 11.3.1.0
>login ...
Successfully logged in to 127.0.0.1:56003 as session 168886
>cd sdk
[127.0.0.1:56003] /sdk
>packets where="tcp.dstport=443 && time='2020-09-07 17:25:00'-'2020-09-08
05:24:59'"
pathname=/var/netwitness/ny_sdwan_tcp_443_20200930.pcap
Writing packets to /var/netwitness/ny_sdwan_tcp_443_20200930.pcap (100%)
Line Editing
You can use the keys in the following table when editing a command.
Key Descripton
Ctrl-U Clears the current line
Ctrl-W Deletes the word that the cursor is on
Ctrl-A Moves the cursor to the beginning of the line
Ctrl-E Moves the cursor to the end of the line
Ctrl-F Moves the cursor forward to the next word
Ctrl-B Moves the cursor backwards to the previous word
Up arrow Displays the previously executed command
Down arrow Displays the command executed after the current command (only valid if the up arrow has
been pressed)
Left arrow Moves the cursor to the previous character
Right arrow Moves the cursor to the next character
Tab Provides context sensitive completion of most commands and their parameters. The Tab
key is very helpful for editing.
For example, to view the Connecting to a Service help topic, at the command line, you can
type man con and then press the Tab key. NwConsole completes the command for you:
man Connecting to a Service
Press Enter to run the command and view the topic.
history Displays a numbered list of previous commands
history Executes a previous command, which is also equivalent to typing !#
execute=# For example, !1 executes the previous command.
history Clears all command history
clear
history Erases a specific command from the history buffer. History is automatically stored from
erase=# one session to the next.
11 Connecting to a Service
NwConsole User Guide
Parameters are formatted in <name>=<value> pairs, with whitespace between each pair. If a
<value> has whitespace, you should place each value in double quotes. If the value itself should have
double quotes, you can escape them by preceding with a backslash. For example: send /sdk query
query="select * where time=\"12-31-2019 14:30:00\"-u" size=100
You must also escape backslashes; a double backslash is treated as a single backslash. It is also possible
to pass special characters by giving their hex value using \x##. For example, \x0a would pass a line
feed in the parameter value.
To send a help message, you would send this:
send /logs help
And your response would look something like this:
description: A container node for other node types
security.roles: everyone,logs.manage
message.list: The list of supported messages for this node
ls: [depth:<uint32>] [options:<string>] [exclude:<string>]
mon: [depth:<uint32>] [options:<uint32>]
pull: [id1:<uint64>] [id2:<uint64>] [count:<uint32>] [timeFormat:<string>]
info:
help: [msg:<string>] [op:<string>] [format:<string>]
count:
stopMon:
download: [id1:<uint64>] [id2:<uint64>] [time1:<date-time>] [time2:<date-time>]
op:<string> [logTypes:<string>] [match:<string>] [regex:<string>]
[timeFormat:<string>] [batchSize:<uint32>]
timeRoll: [timeCalc:<string>] [minutes:<uint32>] [hours:<uint32>] [days:<uint32>]
[date:<string>]
To get more information about a specific message or command, you can specify the msg=<message
name> on the help command as a parameter. For example, look at the pull message help:
send /logs help msg=pull
pull: Downloads N log entries
security.roles: logs.manage
parameters:
id1 - <uint64, optional> The first log id number to retrieve, this is
mutually exclusive with id2
id2 - <uint64, optional> The last log id number that will be sent, defaults to
Connecting to a Service 12
NwConsole User Guide
The built-in message help says that this command grabs the last N log entries if you omit ID1 and ID2.
To look at the last 10 log entries:
send /logs pull count=10 timeFormat=simple
Almost all of the commands on the service follow this simple format. The only commands that do not are
the ones that require more complicated handshaking, like importing a PCAP to a Decoder. To import a
PCAP, use the NwConsole import command, which takes care of the complicated communication
channel handshaking.
Some parameters are specific to NwConsole's send command and are not actually sent to the service.
You can use these parameters to change the output format of the response, write the response to a file,
or read a file from the local machine and send it to the service. The local parameters to NwConsole's
send command all start with two dashes --.
l --output-format — This parameter changes the normal output of the command from plain text
to one of these types: JSON, XML, or HTML. The format values is a text output that only writes
values (query output, stat/config values, and so on) without any other decorations.
l --output-pathname — Instead of writing the output to the terminal, the output is written to the
specified pathname (truncates any existing file).
l --output-append-pathname — This is the same as --output-pathname except that it
appends the output to an existing file (or creates the file if it does not exist).
l --file-data — Reads in a file and uses it as the command payload. This is useful for commands
like /sys fileEdit. The following example shows how you can send an updated index-
concentrator-custom.xml file using NwConsole:
l --file-format — When reading an input file with --file-data, this parameter forces
NwConsole to interpret the file as a specific type of input. The allowed enumerations are: binary,
params, params-list, string and params-binary. As an example, to send a file of
application rules (*.nwr) to a Decoder, you can use this command:
13 Connecting to a Service
NwConsole User Guide
Connecting to a Service 14
Monitoring Stats
You can use NwConsole to watch statistics (stats) change on a service in real time. However, be
warned that this can result in a LOT of output. If you are not careful and monitor too many nodes, the
screen scrolls by too quickly to be useful.
As a simple example, if you log on to a Decoder, you can monitor the capture rate in real time. To do
this, issue these commands after connecting to a Decoder:
cd /decoder/stats
mon capture.rate
That is all you need to do! Now, any time the capture rate changes, it outputs into the console window.
You can add another monitor:
mon capture.avg.size
Now it watches those two stats and outputs those values when they change. You may have noticed that
as you tried to type the second command, the output from the original monitor was messing up your
display. This is the problem with monitoring stats. It is not really meant for doing more than just
watching the stats after the first command is entered.
However, you can stop the monitoring by typing delmons and pressing Enter. Just ignore the output
while you type and it returns you to a proper command prompt. If you want to monitor many stats at
once, you can give the path of the parent stat folder and it monitors all of the stats underneath it. For
example, typing mon /decoder/stats or mon . (they are equivalent) monitors everything. Be
prepared for a lot of output! Remember to enter delmons if it is scrolling too fast.
15 Monitoring Stats
Useful Commands
The following NwConsole commands are useful when interacting with NetWitness Platform Core
services:
l feed: Enables you to create and work with feed files.
l makepcap: Converts Packet database (DB) files to PCAP.
l packets: Retrieves packets or logs from the logged in service.
l hash: Creates or verifies hashes of database files.
The following sections as well as the NwConsole help and topic information (man) pages, provide
additional information.
Feeds
The feed command provides several utilities for creating and examining feed files. A feed file contains
the definition and data of a single feed in a format that has been precompiled for efficient loading by a
Decoder or Log Decoder. For a complete reference on feed definitions, see the "Feed Definitions File"
topic in the Decoder Configuration Guide. Go to the Master Table of Contents to find all RSA
NetWitness Platform 11.x documents.
create
feed create <definitionfile> [-x <password>]
The feed create command generates feed files for each feed defined in a feed definition file. A
definition file is an XML document that contains one or more definitions. Each feed definition specifies
a data file and the structure of that data file. The resulting feed files will be created in the same
directory as the definition file with the same name as the data file, but with the extension changed to
.feed (for example, datafile.csv results in datafile.feed). Any existing files with the target name will be
overwritten without a prompt.
$ ls
example-definition.xml example-data.csv
$ NwConsole
RSA NetWitness Console 11.3.0.0.0
Copyright 2001-2020, RSA Security Inc. All Rights Reserved.
Type "help" for a list of commands or "man" for a list of manual pages.
> feed create example-definition.xml
Creating feed Example Feed...
done. 2 entries, 0 invalid records
All feeds complete.
> quit
$ ls
16 Useful Commands
NwConsole User Guide
Optionally, feed files can be obfuscated using the option -x followed by a password of at least 16
characters (no spaces). This will be applied to all feeds defined in the definition file. In addition to the
feed file, a token file will be generated for each feed file. The token file must be deployed with the
corresponding feed file.
feed create example-definition.xml -x 0123456789abcdef
stats
feed stats <feedfile>
The feed stats command provides summary information for an existing, un-obfuscated feed file.
Specifying an obfuscated feed file will result in an error.
> feed stats example.feed
Example Feed stats:
version : 0
keys count : 1
values count: 2
record count: 2
meta key : ip.src/ip.dst
language keys:
alert Text
dump
feed dump <feedfile> <outfile>
The feed dump command generates a normalized, key-value pair listing of an un-obfuscated feed file.
You can use the resulting file to validate a feed file or assist in determining which records were
considered invalid when the feed was created. Specifying an obfuscated feed file will result in an error.
If outfile exists, the command will abort without overwriting the existing file.
feed dump example.feed example-dump.txt
l makepcap source=/var/lib/netwitness/decoder/packetdb
This command converts every Packet DB file into a corresponding PCAP file in the same directory. If
the disk is almost full, see the next command.
Useful Commands 17
NwConsole User Guide
l makepcap source=/var/lib/netwitness/decoder/packetdb
dest=/media/usb/sde1
This command writes all of the output PCAPs to the directory at /media/usb/sde1.
l makepcap source=/var/lib/netwitness/decoder/packetdb
dest=/media/usb/sde1 filenum=4-6
This command only converts the files numbered 4 through 6 and skips all other files. In other words, it
converts the Packet DB files: packet-000000004.nwpdb, packet-000000005.nwpdb, and packet-
000000006.nwpdb.
Packets
You can use the packets command to generate a PCAP or log file based on a list of Session IDs, a
time period, or a where clause. This command is very flexible, and you can use it on any running
service that has access to the raw data from a downstream component. Before running the command,
you must first login to a service and then change directory to the appropriate SDK node (for example,
cd /sdk). Unlike the makepcap command, which only works on the local file system, you use this
command for a remote service.
login ...
cd /sdk
packets where="service=80 && time='2020-03-01 15:00:00'-'2020-03-01 15:10:00'"
pathname="/tmp/march-1.pcap"
This command writes 10 minutes of HTTP-only packets from March 1st to the file /tmp/march-1.pcap.
All times are in UTC.
l packets time1="2020-04-01 12:30:00" time2="2020-04-01 12:35:00"
pathname=/media/sdd1/packets.pcap.gz
This command writes all packets between the two times to a GZIP compressed file at
/media/sdd1/packets.pcap.gz.
18 Useful Commands
NwConsole User Guide
Useful Commands 19
SDK Content Command
One of the powerful commands in NwConsole is sdk content. It contains numerous options to do
just about anything, at least as far as extracting content from the NetWitness Platform Core stack. You
can use it to create PCAP files, log files, or extract files out of network sessions (for example, to grab
all of the pictures from email sessions). It can append files, have a maximum size assigned before
creating a new file, and automatically clean up files when the directory grows too large. It can run
queries in the background to find new sessions. It breaks queries into manageable groups and performs
those operations automatically. When the group is exhausted, it does a requery to get a new set of data
for further operations. The list of options for the SDK content command is very extensive.
Because the command has so many options, this document provides examples of commands for different
use cases.
Before you can run sdk content, there are a few commands (like logging into a service) that you
need to run first. Here are some examples:
l First connect to a service:
sdk open nw://admin:netwitness@10.10.25.50:50005
l If you need to connect over SSL, use the nws protocol:
sdk open nws://admin:netwitness@10.10.25.50:56005
l Keep in mind that you are passing a URL and must URL encode it properly. If the password is
p@ssword, the URL looks like this:
sdk open nw://admin:p%40ssword@10.10.25.50:50005
This also applies to username.
l Once you log in, you can set an output directory for the commands: sdk output <some
pathname>
l For command line help, type: sdk content
Before you try the example commands, it is important to understand the sessions parameter. This
parameter is very important and controls how much or how little data you want to grab (the where
clause is also important). The sessions parameter is either a single session ID or a range of session IDs.
All NetWitness Platform Core services work with session IDs, which start at 1 and increase by 1 for
every new session added to the service (network or log session). Session IDs are 64-bit integers, so they
can get quite large.
For example, to keep it simple, assume we have a Log Decoder that has ingested and parsed 1000 logs.
On the service, you now have 1000 sessions with session IDs from 1 to 1000 (session ID 0 is never
valid). If you want to operate over all 1000 sessions, you pass sessions=1-1000. If you only want
to operate over the last 100 sessions, you pass sessions=901-1000. Once the command finishes
processing session 1000, it exits back to the console prompt.
Many times, however, we do not care about specific session ranges. We just want to run a query over all
of them and process the sessions that match a query. Here are some shortcuts that simplify this:
l The letter l (lowercase L) means lower bound or the lowest session ID.
l The letter u means the highest session ID. In fact, it actually means the highest session ID for future
sessions as well. In other words, if you pass sessions=l-u, this special range means operate over
all the current sessions in the system, but also do not quit processing, and as new sessions enter the
system, process those, too. The command pauses and waits for new sessions once it reaches the last
session on the service. To summarize, the command never exits and goes into continuous processing
mode. It runs for days, months, or years, unless it is killed.
l If you do not want the command to run forever, you can pass now for the upper limit. This determines
the last session ID on the service at the time the command starts and processes all sessions until it
reaches that session ID. Once it reaches that session ID, the command exits, regardless of how many
sessions may have been added to the service since the command started. So, for the example Log
Decoder, sessions=200-now starts processing at session 200 and goes all the way to session
1000 and quits. Even if another 1000 logs were added to the Log Decoder after the command started,
it still exits after processing session 1000.
l The parameter sessions=now-u means start at the very last session and continue processing all
new sessions that come in. It does not process any existing sessions (except the last one), only new
sessions.
l If you want to run this continually and have it remember the last session it processed between
invocations, use the sessionPersist={pathname} parameter. The pathname should be a valid
filename where the command will write the last successful session id. Upon restart, it will read the
last session id and pick up where it left off.
For example commands and what they do, type man sdk content examples or see SDK Content
Command Examples.
threat.category indexed at least at the IndexKeys level (the operators exists and
!exists only require an index at the key level, although values work fine, too).
l sdk tailLogs
or (the equivalent command):
sdk content render=pcap console=true sessions=now-u
This is a fun little command. It actually uses sdk content behind the scenes. The purpose of this
command is to view all incoming logs on a Log Decoder. As logs come into the Log Decoder (you
can also run it on a Broker or Concentrator), they are output on the console screen. It is a great way to
see if the Log Decoder is capturing and what exactly is coming into the Log Decoder. This command
runs in continuous mode. Do not use it if the Log Decoder is capturing at a high ingest rate (this
command cannot keep up with it). However, it is helpful for verification or troubleshooting purposes.
Note: Do not expect great performance with this command, especially with packets.
Gathering the packets for a session involves a lot of random I/O and can drastically slow
down the export. Logs do not suffer as much from this problem (only one log per
session), but behind the scenes, this command uses the /sdk content API, which is not a
performance-minded streaming API like /sdk packets.
Note: This command only makes sense for packet sessions, not logs.
found anywhere in the packets or logs, it outputs the session ID along with the text it found and the
surrounding text for context. The where clause indicates that it only searches web and email traffic.
The ci parameter means that it is a case-insensitive search. You can substitute regex for
keyword and it performs a regex search.
The following sections, as well as the NwConsole help and topic information (man) pages, provide
additional information.
whatIsWrong
When a service is not working correctly, the reason is usually somewhere in the logs that the service has
written. You can use the whatIsWrong console command to obtain a snapshot of a service's
configuration, stats, and failure and warning logs (with surrounding context logs) for a specified past
period of time, which defaults to the previous seven days. You can save the results of running
whatIsWrong into a specified plain-text file. The output of this command can be a useful starting
point to help determine what is currently wrong with a service.
To use the whatIsWrong console command, log on to the service to troubleshoot using the login
command, and run the whatIsWrong command.
Note: Use help whatIsWrong to see all of the available parameters, including the number of
days or hours to look back for events, the pathname to store results, whether or not to append or
overwrite the results file, and the delimiter to use for log fields. You can also limit the number of most
recent logs used to find context, and you can specify how many context logs per warning or failure log
to retrieve.
Whenever you receive a request for logs for a Core service, you should run the whatIsWrong
command first and use the results collected as a starting point.
dbcheck
The dbcheck command is used to perform consistency checking of database files (session, meta,
packets, logs, stats, and so on). This might be necessary when a service cannot start because of errors in
the consistency of the database files. Normally a service would automatically recover and correct any
consistency issues on startup, but there are times when this does not occur. When a service starts (like
Decoder), it typically does not read or open most database files in order to start quickly. It assumes most
files are in a consistent state and only does a cursory check of the most recently written files. If there
are problems, dbcheck can perform those consistency checks, but ONLY if the service is not running.
Caution: Do not attempt to run this command while a service is running.
topQuery
The topQuery command can help pinpoint queries that are taking an excessively long time to run. This
command parses the audit logs of a service and returns the top N longest running queries for the
specified time period.
The easiest way to run it is to log on to the service (usually a Broker or Concentrator) and type
topQuery. The default behavior is to return the top 100 longest running queries for the last seven days.
Type help topQuery for the list of parameters. Here are some additional examples with
explanations:
l topQuery hours=12 top=10
This command returns the top 10 queries for the last 12 hours.
netbytes
The netbytes command is very useful for troubleshooting the network connections on the current host.
It displays continuous send and receive statistics for all network interfaces. Once executed, you must
press Ctrl-C to exit this command, which also exits NwConsole.
netspeed
The netspeed command is used to troubleshoot the connection between the host computer running
NwConsole and the remote computer connected to it through the login command. You must supply the
amount of bytes to transfer and it will time the speed of the connection. The netspeed command is very
useful for troubleshooting aggregation performance issues that might be network related.
login somedecoder:50004 admin ...
netspeed transfer=4g
To troubleshoot the connection between a Concentrator and a Decoder, SSH into the Concentrator, run
NwConsole, and then log on to the Decoder and run netspeed. The output from the command gives
you an indication of the maximum network throughput. If it is much less than the standard 1 Gbps
interface, it could indicate a network issue.