-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into csa-1.12.0-cdh-7.1.9
# Conflicts: # flink-cyber/flink-commands/json-commands/pom.xml
- Loading branch information
Showing
29 changed files
with
13,600 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Publish Release | ||
|
||
on: | ||
schedule: | ||
# At 0:00am each day on the default branch | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Version tag' | ||
required: true | ||
type: string | ||
name: | ||
description: 'Release name' | ||
required: true | ||
type: string | ||
skip_tests: | ||
description: 'Skip tests' | ||
required: true | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
# checks if there's a commit in last 24hr | ||
check_date: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_run: ${{ steps.should_run.outputs.should_run }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: print latest_commit | ||
run: echo ${{ github.sha }} | ||
|
||
- id: should_run | ||
continue-on-error: true | ||
name: check latest commit is less than a day | ||
run: | | ||
test -z $(git rev-list --after="24 hours" ${{ github.sha }}) \ | ||
&& echo "::set-output name=should_run::false" \ | ||
|| (gh run cancel ${{ github.run_id }} \ | ||
&& gh run watch ${{ github.run_id }}) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
publish_release: | ||
needs: check_date | ||
if: ${{ github.event_name == 'workflow_dispatch' || needs.check_date.outputs.should_run != 'false' }} | ||
runs-on: ubuntu-latest | ||
container: maven:3-eclipse-temurin-8 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache local Maven repository | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: /root/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Build and Test with Maven | ||
run: mvn -P '!add-dependencies-for-IDEA,full-build,include-front-end' -B package -DskipTests=${{ github.event_name == 'workflow_dispatch' && inputs.skip_tests || true }} --file flink-cyber/pom.xml | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
with: | ||
tag_name: ${{ inputs.tag }} | ||
name: ${{ inputs.name }} | ||
draft: true | ||
generate_release_notes: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
files: | | ||
flink-cyber/cyber-csd/target/cyber-csd--* | ||
flink-cyber/cyber-csd/target/CYBERSEC-* | ||
flink-cyber/cyber-parcel/target/CYBERSEC-* | ||
- name: Get current date | ||
id: date | ||
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
|
||
- name: Publish artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cybersec-${{ github.event_name == 'workflow_dispatch' && 'release' || 'nightly' }}-${{ env.CURRENT_DATE }} | ||
path: | | ||
flink-cyber/cyber-csd/target/cyber-csd--* | ||
flink-cyber/cyber-csd/target/CYBERSEC-* | ||
flink-cyber/cyber-parcel/target/CYBERSEC-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...llar/src/main/java/org/apache/metron/stellar/common/utils/hashing/tlsh/BitPairsTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.apache.metron.stellar.common.utils.hashing.tlsh; | ||
|
||
class BitPairsTable { | ||
|
||
private static final int BIT_PAIRS_DIFF_TABLE_SIZE = 256; | ||
|
||
private final int[][] table; | ||
|
||
BitPairsTable() { | ||
this.table = generateDefaultBitPairsDiffTable(); | ||
} | ||
|
||
private static int[][] generateDefaultBitPairsDiffTable() { | ||
int[][] result = new int[BIT_PAIRS_DIFF_TABLE_SIZE][BIT_PAIRS_DIFF_TABLE_SIZE]; | ||
|
||
for (int i = 0; i < BIT_PAIRS_DIFF_TABLE_SIZE; i++) { | ||
for (int j = 0; j < BIT_PAIRS_DIFF_TABLE_SIZE; j++) { | ||
int x = i; | ||
int y = j; | ||
int diff = 0; | ||
|
||
for (int z = 0; z < 4; z++) { | ||
int d = Math.abs(x % 4 - y % 4); | ||
|
||
if (d == 3) { | ||
diff += d * 2; | ||
} else { | ||
diff += d; | ||
} | ||
|
||
if (z < 3) { | ||
x /= 4; | ||
y /= 4; | ||
} | ||
} | ||
|
||
result[i][j] = diff; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public int getValue(int row, int column) { | ||
return table[row][column]; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...llar/src/main/java/org/apache/metron/stellar/common/utils/hashing/tlsh/SlidingWindow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.apache.metron.stellar.common.utils.hashing.tlsh; | ||
|
||
|
||
import java.util.function.IntUnaryOperator; | ||
import java.util.stream.IntStream; | ||
|
||
public class SlidingWindow { | ||
public static final int DEFAULT_SIZE = 5; | ||
private final byte[] window; | ||
private int byteCount = 0; | ||
|
||
SlidingWindow() { | ||
this.window = new byte[DEFAULT_SIZE]; | ||
} | ||
|
||
public void put(final byte value) { | ||
int cursor = byteCount % window.length; | ||
window[cursor] = value; | ||
byteCount++; | ||
} | ||
|
||
public int[] getWindow() { | ||
final int startPosition = (byteCount - 1) % window.length; | ||
final IntUnaryOperator reverseIterate = i -> i == 0 ? window.length - 1 : i - 1; | ||
final IntUnaryOperator mapper = i -> window[i] & 0xFF; | ||
return IntStream.iterate(startPosition, reverseIterate) | ||
.limit(window.length) | ||
.map(mapper) | ||
.toArray(); | ||
} | ||
|
||
public int getByteCount() { | ||
return byteCount; | ||
} | ||
|
||
public int getWindowSize() { | ||
return window.length; | ||
} | ||
} |
Oops, something went wrong.