community-id-java

A Java implementation of the Community ID flow hashing standard (https://github.com/corelight/community-id-spec)

License

License

Categories

Categories

Java Languages Unity Business Logic Libraries Game Development
GroupId

GroupId

com.rapid7.communityid
ArtifactId

ArtifactId

community-id-java
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

community-id-java
A Java implementation of the Community ID flow hashing standard (https://github.com/corelight/community-id-spec)
Project URL

Project URL

https://github.com/rapid7/community-id-java
Project Organization

Project Organization

Rapid 7, Inc.
Source Code Management

Source Code Management

https://github.com/rapid7/community-id-java

Download community-id-java

How to add to project

<!-- https://jarcasting.com/artifacts/com.rapid7.communityid/community-id-java/ -->
<dependency>
    <groupId>com.rapid7.communityid</groupId>
    <artifactId>community-id-java</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.rapid7.communityid/community-id-java/
implementation 'com.rapid7.communityid:community-id-java:2.0.1'
// https://jarcasting.com/artifacts/com.rapid7.communityid/community-id-java/
implementation ("com.rapid7.communityid:community-id-java:2.0.1")
'com.rapid7.communityid:community-id-java:jar:2.0.1'
<dependency org="com.rapid7.communityid" name="community-id-java" rev="2.0.1">
  <artifact name="community-id-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rapid7.communityid', module='community-id-java', version='2.0.1')
)
libraryDependencies += "com.rapid7.communityid" % "community-id-java" % "2.0.1"
[com.rapid7.communityid/community-id-java "2.0.1"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

community-id-java

This package provides a Java 8 implementation of the open Community ID flow hashing standard.

This library supports IPV4 and IPV6 addresses and TCP, UDP, and STCP network protocols. It does not support ICMP protocols.

How it works

The Community ID Generator creates a Community ID string by taking in a protocol, source IP address, source port, destination address, and destination port. It creates two IpPortPair objects and sorts them in a deterministic order. It then packs the necessary bytes in NBO order, and produces a 20-byte SHA1 digest. Then, base64 encodes it or turns it into a hexadecimal string depending on configuration. It appends the value to "1:" for version 1.

The Community ID generator is configurable to take in a seed value to be packed and encoded as well as a boolean for base64 encoding. Only the first two bytes of the seed value will be used in the Community ID.

Getting community-id-java

To add community-id-java to your Maven project, use the following:

<dependency>
    <groupId>com.rapid7.communityid</groupId>
    <artifactId>community-id-java</artifactId>
    <version>2.0.0</version>
</dependency>

Example of creating a Community ID:

CommunityIdGenerator generator = new CommunityIdGenerator();  

//The default constructor will set seed to 0 and base64 to true

String result = generator.generateCommunityId(Protocol.UDP, 
    InetAddress.getByName("192.168.1.52"), 54585, InetAddress.getByName("8.8.8.8"), 53);

result will look like:

"1:Q9We8WO3piVF8yEQBNJF4uiSVrI=".
com.rapid7.communityid

Rapid7

Versions

Version
2.0.1
2.0.0