Skip to content

Commit

Permalink
Merge pull request #19 from noobpk/dev
Browse files Browse the repository at this point in the history
bump to v0.1.6
  • Loading branch information
noobpk authored Nov 12, 2023
2 parents c2b724b + 1a3d8c6 commit 0a5ee8b
Show file tree
Hide file tree
Showing 23 changed files with 24,288 additions and 722 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 12/11/2023

- Release v0.1.6 Gemini-self-protector for Flask
- Add feature end-user beharvior
- Refactor source code
- Fix bug

## 05/10/2023
- Release v0.1.5 Gemini-self-protector for Flask
- Update install page
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The architecture of gemini-self-protector is composed of seven layers however it

Gemini uses a deep learning model that combines Convolutional Neural Network (CNN) and a family of Recurrent neural network (RNN) techniques to detect and identify vulnerabilities.

For more details: [Web-Vuln-Detection-Predict](https://github.com/noobpk/Web-Vuln-Detection-Predict)
For more details: [G-WVD-DL](https://github.com/noobpk/gemini-web-vulnerability-detection/blob/main/DEEPLEARNING.md)

## More About Gemini-Self-Protector

Expand All @@ -68,7 +68,7 @@ Gemini supports 3 modes and recommends sensitivity levels for the application to


## Implement G-WVD Serve
💪 You can implement your own G-WVD serve extremely simply and quickly. Details at [gemini-predict-serve (G-WVD)](https://github.com/noobpk/gemini-predict-serve)
💪 You can implement your own G-WVD serve extremely simply and quickly. Details at [gemini-web-vulnerability-detection (G-WVD)](https://github.com/noobpk/gemini-web-vulnerability-detection)

## Demo

Expand Down
6 changes: 6 additions & 0 deletions gemini-python/gemini_self_protector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.1.5 (12/11/2023)

- Fix bug
- Refactor source code
- Add feature end-user beharvior

## v0.1.5 (05/10/2023)
- Fix bug
- Update install page
Expand Down
2 changes: 1 addition & 1 deletion gemini-python/gemini_self_protector/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gemini_self_protector"
version = "0.1.5"
version = "0.1.6"
description = "Runtime Application Self-Protection"
authors = ["lethanhphuc"]
license = "MIT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
from ._audit import _Audit
from ._gui import _Gemini_GUI
from ._model import Base, tb_User, tb_Config, tb_Summary, tb_RequestLog, tb_AccessControlList, tb_Dependency
from ._cli import _Gemini_CLI
from ._cli import _Gemini_CLI
from ._behavior import _Behavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import session, request
from ._logger import logger
from ._gemini import _Gemini
from ._utils import _Utils


class _Behavior(object):
def init_behavior() -> None:
if "gemini_session" not in session:
client_ip = _Utils.flask_client_ip()
session["gemini_session"] = hash(client_ip + request.user_agent.string)
behavior_id = _Behavior.end_user(request.endpoint)
return behavior_id

def end_user(action) -> None:
end_user_ip = _Utils.flask_client_ip()
g_session = session.get("gemini_session")
method = request.method
size = request.content_length
useragent = request.user_agent.string
behavior_id = _Gemini.store_gemini_behavior_log(
_ipaddress = end_user_ip,
_end_user_session = g_session,
_endpoint = action,
_useragent = useragent,
_method = method,
_status_code = None,
_start_time = None,
_end_time = None,
_elapsed_time = None,
_size = size,
_performance = None,
)
return behavior_id
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def handler_g_wvd_serve_health():
"[+] Connected to G-WVD")
else:
logger.error(
"[x] Cannot connected to G-WVD")
"[x_x] Cannot connect to G-WVD")
while True:
try:
diagnostic = input(
Expand Down Expand Up @@ -105,6 +105,18 @@ def handler_g_wvd_serve_health():
logger.info(
"[!] Please check error log on G-WVD")
sys.exit()
else:
while True:
try:
answer = input("[?] Do you want continue without G-WVD (y/N): ") or "y"
except Exception as e:
logger.error(
"[x_x] Something went wrong at {0}, please check your error message.\n Message - {1}".format('_Gemini_GUI.handler_g_wvd_serve_health', e))
continue
else:
break
if answer == 'N' or answer == 'n':
sys.exit()
else:
while True:
try:
Expand All @@ -119,7 +131,6 @@ def handler_g_wvd_serve_health():

if answer == 'N' or answer == 'n':
sys.exit()

except Exception as e:
logger.error(
"[x_x] Something went wrong at {0}, please check your error message.\n Message - {1}".format('_Gemini_CLI.handler_g_wvd_serve_health', e))
Loading

0 comments on commit 0a5ee8b

Please sign in to comment.