Pcapr.Local

Pcapr.Local

Pcapr.Local is a gem that can automatically parse any packet capture and create a .par file suitable for generating a Scenario in Mu Studio. It's designed to help you create Scenarios for proprietary protocols that need custom Wireshark dissectors (pcapr.Local uses the locally-installed Wireshark application when indexing a .pcap).

This document provides details for the following:

After installing and configuring Pcapr.Local, you can copy or move your pcap files to the designated pcaps directory and Pcapr.Local will automatically index those files. Then, using a web browser, you can view the list of pcaps and their indexes, generate reports, or download the index as a PAR file that you can use in Mu Studio to create a Scenario.

Requirements

To run pcapr.Local, you must install it on a system that also includes the following:

  • Linux (any flavor). You can install on a dedicated Linux system or in a virtual machine (VM).
  • Ruby (1.8.6, 1.8.7, 1.9.2) + Rubygems (1.3.7 or higher). When using Ruby 1.8.6, you must install rubygems 1.3.7. Rubygems officially ceased support for ruby 1.8.6 as of the rubygems 1.4.0 release, so any version 1.4.x or higher will not install on a ruby 1.8.6 system.
  • CouchDB. Local and remote installations supported. If you have configured a username and password for the CouchDB service, you'll need to provide those user credentials during the pcapr.Local gem installation.
  • Wireshark (any version). Pcapr.Local will automatically use the installed version of tshark (a component of Wireshark) to create the pcap indexes. When using a package manager (such as aptitude on Ubuntu), you might need to install tshark separately if it's not included as part of the Wireshark installation.
  • Zip (any version). Pcapr.Local requires zip to create PAR files from your indexed pcaps.
  • pcapr-local.gem. If the Linux system has Internet connectivity, you can use the gem command (supported by rubygems) to quickly download and install the Pcapr.Local gem. Otherwise, you'll need to manually download the gem, copy it to the Linux system, and install it.

back to top ↑

Installing & Configuring

After ensuring that your Linux system has all the necessary pre-requisites for running Pcapr.Local, you can download the pcapr-local gem and configure it for your system.

You can install and run pcapr.Local as a root user or as a regular (non-root) user. If the Linux system has Internet connectivity, you can use the gem command (supported by rubygems) to quickly download and install the Pcapr.Local gem. Otherwise, you'll need to manually download the gem and copy it to the Linux system before installing.

After installing the gem, configure the gem by answering a few questions about where you want to store pcaps and indexes, the IP and port on which you want to access pcapr.Local, and the location of your CouchDB service (your answers are saved as a configuration file at: ~/.pcapr_local/config). When configuration is complete, the pcapr server process continues running in the background, performing tasks such as checking for new pcaps and creating indexes.

To view activities during configuration, tail the pcapr.Local log file with the command: tail -F ~/pcapr.Local/log/server.log

To Install Pcapr.Local:

To install over the Internet:

  1. Login to the Linux system on which you want to install pcapr.Local.
  2. Install the pcapr-local gem using the gem command:

    gem install pcapr-local

To install manually:

  1. Download the pcapr.Local gem from http://rubygems.org/gems/pcapr-local.
  2. Copy the gem to the Linux system on which you want to install the gem.
  3. Login to the Linux system.
  4. Change to the directory that contains the gem, then install it using the gem command:

    gem install pcapr-local.gem

To Configure Pcapr.Local:

  1. Run the configuration tool using the startpcapr command:

startpcapr

This command starts the configuration process in which you'll be asked several questions.

  1. Answer the following seven (7) questions when prompted:
Question Answer
A. Where should pcapr.Local store user files?

[/root/pcapr.Local]

Press Enter to accept this default. This sets the directory for storing all pcapr-related files.

B. Which directory would you like to scan for indexable pcaps?

[/root/pcapr.Local/pcaps]

Press Enter to accept this default. This sets the directory for storing packet captures. Any .pcap file you place in this directory will be automatically indexed by pcapr.Local.

C. Where would you like to store index files?

[/root/pcapr.Local/indexes]

Press Enter to accept this default. This sets the directory for storing .pcap indexes. Indexes are automatically created for every .pcap file in the pcapr.Local/pcaps directory (or whatever directory you specified as the pcap repository in question A).

D. What IP address should pcapr.Local run on?

[127.0.0.1]

Press Enter to accept this default. This sets the IP address at which you can access pcapr.Local. For example, if you want to access pcapr.Local at IP address 10.10.1.175 , you should enter that address here.

E. What port should pcapr.Local listen on?

[8080]

Press Enter to accept this default. This sets the port at which you can access pcapr.Local. For example, if you want to access pcapr.Local at 10.10.1.175:8888, you should enter 8888 here.

F. Pick a name for your CouchDB database (database will be created automatically).

[pcapr_local_root]

Press Enter to accept this default. This creates a CouchDB database for pcaps and their indexes.

G. pcapr.Local requires CouchDB to run. Where is your CouchDB server?

[http://127.0.0.1:5984]

If you have not yet configured a username and password for the CouchDB service, press Enter to accept this default.

However, if you have configured a username and password for the CouchDB service, you must provide those user credentials. Type the following and then press Enter:

http://user:password@127.0.0.1:5984

  1. After answering all questions, the following message confirms a successful installation:

Thank you. Configuration is saved at /root/.pcapr_local/config.
Starting server at ip:port
Log is at /root/pcapr-directory/log/server.log
Moving server process to the background. Run 'stoppcapr' to stop the server.

Where ip:port are values given in questions D and E.

Where pcapr-directory is the value given in question A.

You are now ready to copy your .pcap files into the pcap directory, where pcapr.Local will automatically index them and create PAR files that you can use in Mu Studio to generate Scenarios.

back to top ↑

Using Pcapr.Local

After installing and configuring pcapr.Local, you can copy your .pcap files into the pcap directory, where pcapr.Local will automatically index them and create a .par file (a Pcap ARchive, or PAR) that you can use in Mu Studio to generate Scenarios. (A PAR file contains dissection data from your local Wireshark installation, enabling you to use custom dissectors for proprietary protocols.)

When you've moved some pcaps into the pcaps directory, you are ready to use the Pcapr.Local UI to view the indexes for those pcaps. The UI has three components:

  • Browse. Displays a list of indexed pcaps, with their associated services and more recent index statistics. Select a pcap to view its details and/or download a PAR file for creating a Scenario.
  • Folders. Displays a list of subdirectories in the pcap directory. By default, this list is empty but you can create new directories using the command line (mkdir directory-name). However, you'll need to put at least one pcap into a subdirectory before that directory will appear in the Folders tab.
  • Services. Displays a tag cloud of services found in all indexed pcaps.

Keep in mind that any changes made at the command line will take about a minute to appear in the UI.

To View Indexes & Get PAR files:

  1. Add packet captures into the pcaps directory (/root/pcapr.Local/pcaps by default). For example, to move all .pcap files from a local directory to the pcaps folder on the Linux system, type:

scp *.pcap root@linux-ip:pcapr.Local/pcaps

  1. Wait about about a minute. Pcapr.Local checks the pcap directory every 60 seconds, indexing any new pcaps automatically.
  2. Using your web browser, view the indexed pcaps at http://ip:port/home/index.html (where ip:port is IP address and port on the Linux system you configured during pcapr.Local configuration).
  3. Select the .pcap for which you want to view details:
    • Clicking the file.pcap link takes you to pcapr.net, where you can use xtractor to explore the indexed pcap.
    • Selecting indexed returns you to the list of indexed pcaps.
  4. Click PAR file to download the .par file for that .pcap.
  5. In Mu Studio, import the .par file to create a Scenario. Because the packet capture has already been dissected, the generation process skips flow selection and automatically displays the Scenario Editor.

back to top ↑

Tips & Tricks

The following section includes tips and tricks for using pcapr.Local.

Pcapr.Local Doesn't See Pcaps

If you added pcaps to the pcap directory but they don't appear in the list of indexed pcaps, try the following:

  • Wait about about a minute then check again. Pcapr.Local checks the pcap directory every 60 seconds, indexing any new pcaps automatically.
  • Check the config file (~/.pcapr_local/config) to confirm that you are putting your pcaps in the correct directory.

Cannot Download a PAR File

If you get an error when attempting to download the PAR file for a pcap, you probably don't have Zip installed on your Linux system. Try installing Zip (on Ubuntu, type apt-get install zip) then try to download the PAR file again (you don't need to re-index the pcap).

Starting & Stopping Pcapr.Local

  • To stop the pcapr.Local server, use the command stoppcapr
  • To start/restart the pcapr.Local server, use the command startpcapr

Organizing Pcaps

When managing large numbers of pcaps, use the command line to create subdirectories in the pcaps directory (mkdir directory-name), then place pcaps files in these subdirectories. Pcapr.Local will automatically index any .pcap file in the main pcaps directory and any included subdirectories.

In the pcapr.Local UI, select the Folders tab to view a list of subdirectories in the pcap directory. However, you'll need to put at least one pcap into a subdirectory before that directory will appear in the Folders tab (and you might need to wait up to 60 seconds).

Getting PAR files From the Command Line

You can create PAR files at the command line instead of using the pcapr.Local UI.

  1. Login to the Linux system running pcapr.Local.
  2. Change to the pcaps directory.
  3. Specify the name of the pcap using the pcap2par command:

    pcap2par filename.pcap

This command creates a PAR file called export.par in the current directory.

To specify the location and name of the .par file, use a path argument with the pcap2par command. For example:

pcap2par my-test-traffic.pcap ~/par_files/my-test-traffic.par

This command creates a .par file named "my-test-traffic.par" in the "par_files" directory.

back to top ↑