mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
1f59685530 | |||
f658a26b32 | |||
3fb8a667b3 | |||
8963bbc86d | |||
44ec44ea5c |
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ jobs:
|
|||||||
run: go build ./...
|
run: go build ./...
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
with:
|
with:
|
||||||
category: "/language:${{matrix.language}}"
|
category: "/language:${{matrix.language}}"
|
||||||
|
19
.github/workflows/docker-image.yml
vendored
19
.github/workflows/docker-image.yml
vendored
@ -1,31 +1,30 @@
|
|||||||
|
---
|
||||||
name: Docker Hub Image
|
name: Docker Hub Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CD:
|
CD:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
-
|
- name: Login to Docker Hub
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||||
-
|
- name: Set up QEMU
|
||||||
name: Set up Docker Buildx
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
- name: Build and push
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: m4r10/beelzebub:${{ github.ref_name }}
|
tags: m4r10/beelzebub:${{ github.ref_name }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
@ -229,7 +229,7 @@ passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|post
|
|||||||
deadlineTimeoutSeconds: 60
|
deadlineTimeoutSeconds: 60
|
||||||
plugin:
|
plugin:
|
||||||
llmProvider: "openai"
|
llmProvider: "openai"
|
||||||
llmModel: "gpt4-o" #Models https://platform.openai.com/docs/models
|
llmModel: "gpt-4o" #Models https://platform.openai.com/docs/models
|
||||||
openAISecretKey: "sk-proj-123456"
|
openAISecretKey: "sk-proj-123456"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|post
|
|||||||
deadlineTimeoutSeconds: 60
|
deadlineTimeoutSeconds: 60
|
||||||
plugin:
|
plugin:
|
||||||
llmProvider: "openai"
|
llmProvider: "openai"
|
||||||
llmModel: "gpt4-o"
|
llmModel: "gpt-4o"
|
||||||
openAISecretKey: "sk-proj-123456"
|
openAISecretKey: "sk-proj-123456"
|
||||||
prompt: "You will act as an Ubuntu Linux terminal. The user will type commands, and you are to reply with what the terminal should show. Your responses must be contained within a single code block."
|
prompt: "You will act as an Ubuntu Linux terminal. The user will type commands, and you are to reply with what the terminal should show. Your responses must be contained within a single code block."
|
||||||
```
|
```
|
||||||
|
@ -11,5 +11,5 @@ passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|post
|
|||||||
deadlineTimeoutSeconds: 6000
|
deadlineTimeoutSeconds: 6000
|
||||||
plugin:
|
plugin:
|
||||||
llmProvider: "openai"
|
llmProvider: "openai"
|
||||||
llmModel: "gpt4-o"
|
llmModel: "gpt-4o"
|
||||||
openAISecretKey: "sk-proj-12345"
|
openAISecretKey: "sk-proj-12345"
|
@ -3,17 +3,16 @@ version: "3.9"
|
|||||||
services:
|
services:
|
||||||
beelzebub:
|
beelzebub:
|
||||||
build: .
|
build: .
|
||||||
#network_mode: host # Not work on Mac OS
|
|
||||||
container_name: beelzebub
|
container_name: beelzebub
|
||||||
restart: always
|
restart: always
|
||||||
ports: # Remove me, if you use configuration network_mode: host
|
ports:
|
||||||
- "22:22"
|
- "22:22"
|
||||||
- "2222:2222"
|
- "2222:2222"
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
- "8081:8081"
|
- "8081:8081"
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
- "2112:2112" # Prometheus openmetrics
|
- "2112:2112" #Prometheus Open Metrics
|
||||||
environment:
|
environment:
|
||||||
RABBITMQ_URI: ${RABBITMQ_URI}
|
RABBITMQ_URI: ${RABBITMQ_URI}
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -67,8 +67,11 @@ func (suite *IntegrationTestSuite) TestInvokeHTTPHoneypot() {
|
|||||||
response, err := resty.New().R().
|
response, err := resty.New().R().
|
||||||
Get(suite.httpHoneypotHost + "/index.php")
|
Get(suite.httpHoneypotHost + "/index.php")
|
||||||
|
|
||||||
|
response.Header().Del("Date")
|
||||||
|
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
suite.Equal(http.StatusOK, response.StatusCode())
|
suite.Equal(http.StatusOK, response.StatusCode())
|
||||||
|
suite.Equal(http.Header{"Content-Length": []string{"15"}, "Content-Type": []string{"text/html"}, "Server": []string{"Apache/2.4.53 (Debian)"}, "X-Powered-By": []string{"PHP/7.4.29"}}, response.Header())
|
||||||
suite.Equal("mocked response", string(response.Body()))
|
suite.Equal("mocked response", string(response.Body()))
|
||||||
|
|
||||||
response, err = resty.New().R().
|
response, err = resty.New().R().
|
||||||
|
@ -85,7 +85,7 @@ func TestGetHoneypotsConfigurationsWithResults(t *testing.T) {
|
|||||||
resp, err := httpmock.NewJsonResponse(200, &[]HoneypotConfigResponseDTO{
|
resp, err := httpmock.NewJsonResponse(200, &[]HoneypotConfigResponseDTO{
|
||||||
{
|
{
|
||||||
ID: "123456",
|
ID: "123456",
|
||||||
Config: "apiVersion: \"v1\"\nprotocol: \"ssh\"\naddress: \":2222\"\ndescription: \"SSH interactive ChatGPT\"\ncommands:\n - regex: \"^(.+)$\"\n plugin: \"LLMHoneypot\"\nserverVersion: \"OpenSSH\"\nserverName: \"ubuntu\"\npasswordRegex: \"^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$\"\ndeadlineTimeoutSeconds: 60\nplugin:\n llmModel: \"gpt4-o\"\n openAISecretKey: \"1234\"\n",
|
Config: "apiVersion: \"v1\"\nprotocol: \"ssh\"\naddress: \":2222\"\ndescription: \"SSH interactive ChatGPT\"\ncommands:\n - regex: \"^(.+)$\"\n plugin: \"LLMHoneypot\"\nserverVersion: \"OpenSSH\"\nserverName: \"ubuntu\"\npasswordRegex: \"^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$\"\ndeadlineTimeoutSeconds: 60\nplugin:\n llmModel: \"gpt-4o\"\n openAISecretKey: \"1234\"\n",
|
||||||
TokenID: "1234567",
|
TokenID: "1234567",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -120,7 +120,7 @@ func TestGetHoneypotsConfigurationsWithResults(t *testing.T) {
|
|||||||
PasswordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$",
|
PasswordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$",
|
||||||
DeadlineTimeoutSeconds: 60,
|
DeadlineTimeoutSeconds: 60,
|
||||||
Plugin: parser.Plugin{
|
Plugin: parser.Plugin{
|
||||||
LLMModel: "gpt4-o",
|
LLMModel: "gpt-4o",
|
||||||
OpenAISecretKey: "1234",
|
OpenAISecretKey: "1234",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -117,7 +117,7 @@ func traceRequest(request *http.Request, tr tracer.Tracer, HoneypotDescription s
|
|||||||
HostHTTPRequest: request.Host,
|
HostHTTPRequest: request.Host,
|
||||||
UserAgent: request.UserAgent(),
|
UserAgent: request.UserAgent(),
|
||||||
Cookies: mapCookiesToString(request.Cookies()),
|
Cookies: mapCookiesToString(request.Cookies()),
|
||||||
Headers: mapHeaderToString(request.Header),
|
Headers: request.Header,
|
||||||
Status: tracer.Stateless.String(),
|
Status: tracer.Stateless.String(),
|
||||||
RemoteAddr: request.RemoteAddr,
|
RemoteAddr: request.RemoteAddr,
|
||||||
SourceIp: host,
|
SourceIp: host,
|
||||||
@ -133,18 +133,6 @@ func traceRequest(request *http.Request, tr tracer.Tracer, HoneypotDescription s
|
|||||||
tr.TraceEvent(event)
|
tr.TraceEvent(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mapHeaderToString(headers http.Header) string {
|
|
||||||
headersString := ""
|
|
||||||
|
|
||||||
for key := range headers {
|
|
||||||
for _, values := range headers[key] {
|
|
||||||
headersString += fmt.Sprintf("[Key: %s, values: %s],", key, values)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return headersString
|
|
||||||
}
|
|
||||||
|
|
||||||
func mapCookiesToString(cookies []*http.Cookie) string {
|
func mapCookiesToString(cookies []*http.Cookie) string {
|
||||||
cookiesString := ""
|
cookiesString := ""
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ func (sshStrategy *SSHStrategy) Init(beelzebubServiceConfiguration parser.Beelze
|
|||||||
OpenAIKey: beelzebubServiceConfiguration.Plugin.OpenAISecretKey,
|
OpenAIKey: beelzebubServiceConfiguration.Plugin.OpenAISecretKey,
|
||||||
Protocol: tracer.SSH,
|
Protocol: tracer.SSH,
|
||||||
Host: beelzebubServiceConfiguration.Plugin.Host,
|
Host: beelzebubServiceConfiguration.Plugin.Host,
|
||||||
Model: beelzebubServiceConfiguration.Plugin.LLMProvider,
|
Model: beelzebubServiceConfiguration.Plugin.LLMModel,
|
||||||
Provider: llmProvider,
|
Provider: llmProvider,
|
||||||
CustomPrompt: beelzebubServiceConfiguration.Plugin.Prompt,
|
CustomPrompt: beelzebubServiceConfiguration.Plugin.Prompt,
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ type Event struct {
|
|||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
Client string
|
Client string
|
||||||
Headers string
|
Headers map[string][]string
|
||||||
Cookies string
|
Cookies string
|
||||||
UserAgent string
|
UserAgent string
|
||||||
HostHTTPRequest string
|
HostHTTPRequest string
|
||||||
|
Reference in New Issue
Block a user