-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from noobpk/dev
Bump to main
- Loading branch information
Showing
12 changed files
with
288 additions
and
32 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 |
---|---|---|
@@ -1,19 +1,105 @@ | ||
# gemini-predict-serve | ||
A predict serve for gemini-self-protector | ||
# Gemini Predict Serve | ||
This is a prediction module for detecting web application vulnerabilities used for gemini-self-protector | ||
|
||
## Deploy Predict Serve with Docker | ||
## Web Application Vulnerabilities Detection | ||
|
||
To deploy predict serve using docker, follow these steps - | ||
This is a detection method that using combine Convolutional Neural Network (CNN) and a family of Recurrent Neural Network (RNN) to analyze features and relationships in requests from users and predict whether they are vulnerability or not. | ||
|
||
1. Download this `docker-compose.yml` on your local machine or any other system where you have installed Docker. Replace `your-auth-key` with whatever you want. Suggest to use `uuid` or `sha256` for this key. | ||
## Vulnerabilities Detection | ||
|
||
- Cross-Site Scripting | ||
- SQL Injection | ||
- Path Traversal (LFI) | ||
- Command Injection | ||
- Remote File Inclusion (RFI) | ||
- Json & XML Injection | ||
- HTML5 Injection | ||
- Server Side Includes (SSI) Injection | ||
|
||
## Get this image | ||
Obtain the latest Gemini Predict Serve image by executing the following command: | ||
|
||
``` | ||
docker pull noobpk/gemini-predict-serve:latest | ||
``` | ||
|
||
## Launching through the Command Line: | ||
Initiate the Predict Serve with the command line using Docker. Choose the appropriate configuration based on your needs: | ||
|
||
For basic usage without Kafka streaming: | ||
|
||
``` | ||
docker run --name gemini-predict-serve -p 5000:443 --rm -e AUTH_KEY=your-authen-key gemini-predict-serve | ||
``` | ||
|
||
If you have an Apache Kafka server and want to enable streaming: | ||
|
||
``` | ||
$ wget -O docker-compose.yml https://raw.githubusercontent.com/noobpk/gemini-self-protector/dev/predict-server/docker-compose.yml | ||
docker run --name gemini-predict-serve -p 5000:443 --rm \ | ||
-e AUTH_KEY=your-authen-key \ | ||
-e ENABLE_KAFKA_STREAMING=True \ | ||
-e KAFKA_BOOTSTRAP_SERVER=your-kafka-server \ | ||
-e KAFKA_TOPIC=gemini-data-streaming \ | ||
-e KAFKA_USERNAME= \ | ||
-e KAFKA_PASSWORD= \ | ||
-e KAFKA_SECURITY_PROTOCOL=PLAINTEXT \ | ||
gemini-predict-serve | ||
``` | ||
2. Open terminal in that directory | ||
|
||
3. Run following command to run container | ||
## Simplified Deployment with Docker Compose | ||
|
||
For an even more streamlined deployment process, Docker Compose provides a user-friendly alternative: | ||
|
||
### 1. Download the Docker Compose File: | ||
|
||
Acquire the `docker-compose.yml` file from the repository onto your local machine or any system with Docker installed: | ||
|
||
``` | ||
$ docker-compose up | ||
``` | ||
wget -O docker-compose.yml https://raw.githubusercontent.com/noobpk/gemini-predict-serve/main/docker-compose.yml | ||
``` | ||
|
||
### 2. Run the Containers: | ||
|
||
Navigate to the directory containing the docker-compose.yml file using your terminal and execute the following command: | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
## Configuration | ||
|
||
Setup with the Gemini Predict Serve Docker image using the following environment variables: | ||
|
||
- `AUTH_KEY` : Authentication key for predict API | ||
- `ENABLE_KAFKA_STREAMING` : Enable send message to kafka. Defaults: False | ||
- `KAFKA_BOOTSTRAP_SERVER` : Kafka server. Example : localhost:9092 | ||
- `KAFKA_TOPIC` : Kafka topic. Defaults: gemini-data-streaming | ||
- `KAFKA_USERNAME` : Kafka username | ||
- `KAFKA_PASSWORD` : Kafka password | ||
- `KAFKA_SECURITY_PROTOCOL` : Kafka security protocol. Required | ||
|
||
## Ping Pong | ||
``` | ||
curl --location 'https://127.0.0.1:5000/ping' --insecure \ | ||
--header 'Authorization: your-authen-key' | ||
``` | ||
|
||
## Predict | ||
|
||
``` | ||
$ curl --location 'https://127.0.0.1:5000/predict' --insecure \ | ||
--header 'Authorization: your-authen-key' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"data":"../../../../etc/passwd"}' | ||
``` | ||
|
||
## Kafka Extensions | ||
|
||
### Real time Predict Plot | ||
|
||
 | ||
|
||
## More About Repository | ||
Github: [gemini-predict-serve](https://github.com/noobpk/gemini-predict-serve) | ||
|
||
Image Issues: [Find or create an issues](https://github.com/noobpk/gemini-predict-serve/issues) |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ __pycache__/ | |
.env | ||
docker-compose.yml | ||
Dockerfile | ||
requirements.txt | ||
docker-compose.dev.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
version: "3" | ||
|
||
services: | ||
gemini-web-vuln-detection: | ||
image: gemini-web-vuln-detection | ||
gemini-predict-serve: | ||
image: gemini-predict-serve | ||
build: . | ||
environment: | ||
- AUTH_KEY=your-authen-key | ||
- AUTH_KEY= | ||
- ENABLE_KAFKA_STREAMING= | ||
- KAFKA_BOOTSTRAP_SERVER= | ||
- KAFKA_TOPIC=gemini-data-streaming | ||
- KAFKA_USERNAME= | ||
- KAFKA_PASSWORD= | ||
- KAFKA_SECURITY_PROTOCOL=PLAINTEXT | ||
ports: | ||
- "5000:443" | ||
container_name: gemini-web-vuln-detection | ||
container_name: gemini-predict-serve | ||
restart: unless-stopped |
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 |
---|---|---|
@@ -1,11 +1,17 @@ | ||
version: "3" | ||
|
||
services: | ||
gemini-web-vuln-detection: | ||
image: noobpk/gemini-web-vuln-detection | ||
gemini-predict-serve: | ||
image: noobpk/gemini-predict-serve | ||
environment: | ||
- AUTH_KEY="your-authen-key" | ||
- ENABLE_KAFKA_STREAMING=False | ||
- KAFKA_BOOTSTRAP_SERVER= | ||
- KAFKA_TOPIC=gemini-data-streaming | ||
- KAFKA_USERNAME= | ||
- KAFKA_PASSWORD= | ||
- KAFKA_SECURITY_PROTOCOL=PLAINTEXT | ||
ports: | ||
- "3000:443" | ||
container_name: gemini-web-vuln-detection | ||
- "5000:443" | ||
container_name: gemini-predict-serve | ||
restart: unless-stopped |
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,11 @@ | ||
from kafka import KafkaConsumer | ||
|
||
consumer = KafkaConsumer('gemini-data-streaming', | ||
bootstrap_servers=['localhost:9092'], | ||
auto_offset_reset='earliest', | ||
enable_auto_commit=False) | ||
|
||
for message in consumer: | ||
print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition, | ||
message.offset, message.key, | ||
message.value)) |
Oops, something went wrong.