Skip to content

Commit

Permalink
Merge pull request #10 from CybercentreCanada/stage
Browse files Browse the repository at this point in the history
Merge stage to main
  • Loading branch information
cccs-shellyw authored Jul 29, 2024
2 parents 12b2f02 + 68b9b96 commit e78dcf5
Show file tree
Hide file tree
Showing 21 changed files with 1,425 additions and 224 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

jobs:
build-release-jar:
name: build and release Kangooroo ShadowJar
name: build and release Kangooroo Distribution
runs-on: ubuntu-latest

steps:
Expand All @@ -26,8 +26,9 @@ jobs:
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.0.2
- run: gradle shadowJar
- run: gradle distZip
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/libs/KangoorooStandalone.jar
files: |
build/distribution/*
123 changes: 97 additions & 26 deletions .github/workflows/test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.0.2
- run: gradle test
Expand All @@ -42,39 +42,41 @@ jobs:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.0.2
- run: gradle shadowJar
- uses: browser-actions/setup-chrome@v1.4.0
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 120
chrome-version: 126
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '120.0.6099.109'
chromedriver-version: '126.0.6478.63'
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output && mkdir tmp && cp build/libs/KangoorooStandalone.jar .
run: cp /usr/local/bin/chromedriver . && mkdir output && mkdir tmp && cp build/distributions/kangooroo-*.zip .

- name: Install Kangooroo Java
run: unzip -j kangooroo-*.zip kangooroo*/lib/* -d lib && unzip -j kangooroo-*.zip kangooroo*/bin/* -d bin

- name: Run Kangooroo with default settings
run: java -jar KangoorooStandalone.jar --url https://duckduckgo.com/
run: ./bin/kangooroo -mods summary --url https://duckduckgo.com/

- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output/168ce875a2188cce97924a11f6a918df/ > output1.txt
cmp --silent test/integration_test/assert_output_files.txt output1.txt && echo "All expected output files are present." || exit 1
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1

- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requested_url" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requested_url_ip" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actual_url" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actual_url_ip" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processing_time" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "creationDate" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
Expand All @@ -98,24 +100,94 @@ jobs:
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.0.2
- run: gradle shadowJar
- run: gradle distZip

- uses: browser-actions/setup-chrome@v1.4.0
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 120
chrome-version: 126

- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '120.0.6099.109'
chromedriver-version: '126.0.6478.63'

- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/libs/KangoorooStandalone.jar .
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/kangooroo-*.zip .

- name: Install Kangooroo Java
run: unzip -j kangooroo-*.zip kangooroo*/lib/* -d lib && unzip -j kangooroo-*.zip kangooroo*/bin/* -d bin

- name: Run Kangooroo with Proxy
run: java -jar KangoorooStandalone.jar -cf test/integration_test/test_conf.yml --url https://duckduckgo.com/
run: ./bin/kangooroo -cf test/integration_test/test_conf.yml -mods summary --url https://duckduckgo.com/

- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output2/168ce875a2188cce97924a11f6a918df/ > output2.txt
cmp --silent test/integration_test/assert_output_files.txt output2.txt && echo "All expected output files are present." || exit 1
- name: Check if kangooroo connected to the proxy
run: |
sleep 10
docker logs "${{ job.services.proxypy.id }}" >& output3.txt
grep -qe "duckduckgo.com:443" output3.txt
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1

with-proxy-sandbox-integration-test:
name: Integration Test Kangooroo with Proxy
runs-on: ubuntu-latest

services:
proxypy:
image: abhinavsingh/proxy.py
ports:
- 8899:8899

steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.0.2
- run: gradle distZip

- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 126

- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '126.0.6478.63'

- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/kangooroo-*.zip .

- name: Install Kangooroo Java
run: unzip -j kangooroo-*.zip kangooroo*/lib/* -d lib && unzip -j kangooroo-*.zip kangooroo*/bin/* -d bin

- name: Run Kangooroo with Proxy and Sandbox
run: ./bin/kangooroo -mods summary --no-sandbox -cf test/integration_test/test_conf.yml --url https://duckduckgo.com/

- name: Check all output files of Kangooroo is present
run: |
Expand All @@ -130,15 +202,14 @@ jobs:
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- run: cat output2/168ce875a2188cce97924a11f6a918df/results.json
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requested_url" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actual_url" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processing_time" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "creationDate" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.gradle/
/build/
.idea/
gradle/wrapper/gradle-wrapper.properties
.vscode/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Kangooroo
# ![kangooroo_with_title](https://github.com/CybercentreCanada/kangooroo/assets/148795333/db3f342c-21a4-42b9-92eb-53dd6b4b7cb0)


## Description

Expand Down
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'eclipse'
id 'com.github.johnrengelman.shadow' version '7.0.0+'
id 'application'
}
repositories {
mavenCentral()
}

group 'ca.gc.cyber'
version '1.0.8'
version '2.0.1'

eclipse {
project.natures 'org.eclipse.buildship.core.gradleprojectnature'
}

dependencies {

Expand Down Expand Up @@ -91,6 +88,11 @@ jar {

}

application {
mainClass = "ca.gc.cyber.kangooroo.KangoorooStandaloneRunner"
}


shadowJar {
zip64 = true
archiveBaseName.set('KangoorooStandalone')
Expand Down
Empty file added chromedriver
Empty file.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https://nexus.u.azure.chimera.cyber.gc.ca/repository/gradle-distributions/gradle-7.4.2-bin.zip
Empty file modified gradlew
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion resources/conf.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# YAML Format
# http://www.yaml.org/start.html

version: '1.0.8'
version: '2.0.1'

temporary_folder: './tmp/'
output_folder: './output/'
Expand All @@ -10,6 +10,9 @@ browser_settings:
DEFAULT:
user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
window_size: "1280x720"
PHISHING:
user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
window_size: "1280x720"
SMISHING:
user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"
window_size: "375x667"
Expand Down
Loading

0 comments on commit e78dcf5

Please sign in to comment.