Skip to content

Commit e70bcea

Browse files
Merge pull request #193 from AikidoSec/add-restlet-sample-app
Create JavaRestlet sample app to build support for Restlet apps
2 parents 5920555 + 2a52d27 commit e70bcea

31 files changed

Lines changed: 1521 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.log
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Define variables
2+
GRADLEW = ./gradlew
3+
JAR_FILE = build/libs/demo-0.0.1-SNAPSHOT.jar
4+
JAVA_AGENT = ../../dist/agent.jar
5+
6+
# Default target
7+
.PHONY: all
8+
all: build
9+
10+
# Build the project
11+
.PHONY: build
12+
build:
13+
@echo "Building the project..."
14+
chmod +x $(GRADLEW)
15+
$(GRADLEW) build
16+
17+
# Run the application with the Java agent
18+
.PHONY: run
19+
run: build
20+
@echo "Running JavaRestletMySQL with Zen & ENV (http://localhost:8106)"
21+
AIKIDO_TOKEN="token" \
22+
AIKIDO_REALTIME_ENDPOINT="http://localhost:5000/realtime" \
23+
AIKIDO_ENDPOINT="http://localhost:5000" \
24+
AIKIDO_BLOCK=1 \
25+
AIKIDO_LOG_LEVEL="debug" \
26+
nohup java -javaagent:$(JAVA_AGENT) -jar $(JAR_FILE) --server.port=8106 > output1.log &
27+
28+
# Run the application without Zen
29+
.PHONY: runWithoutZen
30+
runWithoutZen: build
31+
@echo "Running JavaRestletMySQL without Zen & ENV (http://localhost:8107)"
32+
AIKIDO_TOKEN="random-invalid-token" \
33+
nohup java -jar $(JAR_FILE) --server.port=8107 > output2.log &
34+
35+
# Clean the project
36+
.PHONY: clean
37+
clean:
38+
@echo "Cleaning the project..."
39+
$(GRADLEW) clean
40+
41+
.PHONY: kill
42+
kill:
43+
pkill -f java
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Restlet + MySQL vulnerable sample app
2+
- Inserting a malicious dog : `Malicious Pet", "Gru from the Minions") -- `
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group = 'com.example'
6+
version = '0.0.1-SNAPSHOT'
7+
8+
java {
9+
sourceCompatibility = '17'
10+
targetCompatibility = '17'
11+
}
12+
13+
repositories {
14+
mavenCentral()
15+
}
16+
17+
dependencies {
18+
implementation 'org.restlet:org.restlet:2.6.0'
19+
//implementation 'org.restlet:org.restlet.ext.json:2.3.12'
20+
//implementation 'org.restlet:org.restlet.ext.servlet:2.3.12'
21+
implementation files('../../dist/agent_api.jar')
22+
//compileOnly 'org.projectlombok:lombok'
23+
implementation 'mysql:mysql-connector-java:8.0.33'
24+
//annotationProcessor 'org.projectlombok:lombok'
25+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#This file is generated by updateDaemonJvm
2+
toolchainVersion=21
42.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

sample-apps/JavaRestletMySQL/gradlew

Lines changed: 252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)