Skip to content

Commit

Permalink
Initial Minimal Release (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagilum2007 authored Sep 11, 2024
1 parent fecd9e5 commit dbc5da4
Show file tree
Hide file tree
Showing 68 changed files with 40,681 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Development Machine Files
.*.swp
*~
*.bak
*.DS_Store
.~lock.*#
#.devcontainer/

# Parsnip/Zeek Output Files
*.svg
*cycles.txt
*.log

# Zeek Test Files
testing/.tmp/
testing/.btest.failed.dat

# Don't ignore baseline log files
!testing/baseline/*/*.log
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Warning! This is an automatically generated file!
#
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

project(HART_IP LANGUAGES C)

list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
find_package(SpicyPlugin REQUIRED)

# Set minimum versions that this plugin needs.
#spicy_required_version("1.2.0")
#zeek_required_version("6.0.0")

if(NOT CMAKE_BUILD_TYPE)
# Default to the release build
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
endif(NOT CMAKE_BUILD_TYPE)

add_subdirectory(analyzer)
16 changes: 16 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

3-Clause BSD License
URL: https://opensource.org/licenses/BSD-3-Clause


Copyright 2024, Battelle Energy Alliance, LLC

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 changes: 31 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
This project contains code from Idaho National Laboratory's ICSNPP Project
Github URL: https://github.com/cisagov/ICSNPP
Licensed under BSD 3-Part License.


© 2024 Battelle Energy Alliance, LLC
ALL RIGHTS RESERVED

Prepared by Battelle Energy Alliance, LLC
Under Contract No. DE-AC07-05ID14517
With the U. S. Department of Energy

NOTICE: This computer software was prepared by Battelle Energy
Alliance, LLC, hereinafter the Contractor, under Contract
No. AC07-05ID14517 with the United States (U. S.) Department of
Energy (DOE). The Government is granted for itself and others acting on
its behalf a nonexclusive, paid-up, irrevocable worldwide license in this
data to reproduce, prepare derivative works, and perform publicly and
display publicly, by or on behalf of the Government. There is provision for
the possible extension of the term of this license. Subsequent to that
period or any extension granted, the Government is granted for itself and
others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide
license in this data to reproduce, prepare derivative works, distribute
copies to the public, perform publicly and display publicly, and to permit
others to do so. The specific term of the license can be identified by
inquiry made to Contractor or DOE. NEITHER THE UNITED STATES NOR THE UNITED
STATES DEPARTMENT OF ENERGY, NOR CONTRACTOR MAKES ANY WARRANTY, EXPRESS OR
IMPLIED, OR ASSUMES ANY LIABILITY OR RESPONSIBILITY FOR THE USE, ACCURACY,
COMPLETENESS, OR USEFULNESS OR ANY INFORMATION, APPARATUS, PRODUCT, OR
PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
OWNED RIGHTS.
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
# icsnpp-hart-ip
Zeek HART-IP Parser - CISA ICSNPP
# HART-IP

## Overview

HART-IP is a Zeek plugin (written in [Spicy](https://docs.zeek.org/projects/spicy/en/latest/)) for parsing and logging fields used by the HART-IP protocol.

HART-IP is the IP extension of the Highway Addressable Remote Transducer (HART) protocol.
The HART protocol is a hybrid analog+digital industrial automation open protocol.
It is currently maintained by the FieldComm Group (https://www.fieldcommgroup.org/).

This parser is a minimal release. While many commands are parsed, not all of them are currently implemented. Additional commands may be added based on community feedback.

## Installation

### Package Manager (Remote Repository)
This script is available as a package for [Zeek Package Manger](https://docs.zeek.org/projects/package-manager/en/stable/index.html)

```bash
zkg refresh
zkg install icsnpp-hart-ip
```

If ZKG is configured to load packages (see @load packages in quickstart guide), this script will automatically be loaded and ready to go.
[ZKG Quickstart Guide](https://docs.zeek.org/projects/package-manager/en/stable/quickstart.html)

If users are not using site/local.zeek or another site installation of Zeek and want to run this script on a packet capture, they can add `icsnpp-hart-ip` to the command to run this script on the packet capture from a cloned version of this repository:

```bash
zeek -Cr <path_to_pcap> icsnpp-hart-ip
```

### Package Manager (Local Folder)
To install from a local version of the repository, navigate to a clean locally cloned version of the repository and run the following commands:

```bash
zkg install .
zeek -Cr <path_to_pcap> local
```

## ICSNPP Packages

All ICSNPP Packages:

* [ICSNPP](https://github.com/cisagov/icsnpp)

### License

Copyright 2024 Battelle Energy Alliance, LLC. Released under the terms of the 3-Clause BSD License (see [`LICENSE.txt`](./LICENSE.txt)).
6 changes: 6 additions & 0 deletions analyzer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spicy_add_analyzer(
NAME HART_IP
PACKAGE_NAME HART_IP
SOURCES zeek_hart_ip.spicy hart_ip_conversion.spicy hart_ip_conversion.cc hart_ip_generateid.spicy hart_ip_generateid.cc hart_ip.spicy hart_ip.evt hart_ip_enum.spicy hart_ip_common_commands.spicy hart_ip_common_commands.evt hart_ip_universal_commands.spicy hart_ip_universal_commands.evt
SCRIPTS __load__.zeek main.zeek hart_ip_types.zeek hart_ip_processing.zeek hart_ip_enum.zeek hart_ip_common_commands_types.zeek hart_ip_common_commands_processing.zeek hart_ip_universal_commands_types.zeek hart_ip_universal_commands_processing.zeek
)
40 changes: 40 additions & 0 deletions analyzer/hart_ip.evt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import HART_IP;
import HART_IP_ENUM;
import HART_IP_GENERATEID;
import HART_IP_UNIVERSAL_COMMANDS;
import HART_IP_COMMON_COMMANDS;
import HART_IP_CONVERSION;
import Zeek_HART_IP;

protocol analyzer spicy::HART_IP_TCP over TCP:
parse with HART_IP::Messages,
ports {5094/tcp};

protocol analyzer spicy::HART_IP_UDP over UDP:
parse with HART_IP::Messages,
ports {5094/udp};

export HART_IP::Messages;
export HART_IP::Message;
export HART_IP::DirectPDUCommand;
export HART_IP::SessionLogRecord;

on HART_IP::Message -> event HART_IP::MessageEvt (
$conn,
$is_orig,
self
);

on HART_IP::DirectPDUCommand -> event HART_IP::DirectPDUCommandEvt (
$conn,
$is_orig,
self
);

on HART_IP::SessionLogRecord -> event HART_IP::SessionLogRecordEvt (
$conn,
$is_orig,
self
);


Loading

0 comments on commit dbc5da4

Please sign in to comment.