-
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 #8 from Zeerg/develop
v0.2
- Loading branch information
Showing
15 changed files
with
152 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ name: Docker Image CI | |
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
|
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ services: | |
helix-honeypot: | ||
build: ./ | ||
ports: | ||
- "8000:8000" | ||
- "8000:8000" | ||
entrypoint: [/helix-honeypot, -mode=ad] |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/labstack/echo/v4" | ||
"os" | ||
) | ||
// Literally streams /dev/random to the response since Kubectl has no input validation or timeouts lol | ||
func ActiveDefenseHandler(c echo.Context) error { | ||
devRandom, _ := os.Open("/dev/random") | ||
return c.Stream(201, "application/json", devRandom) | ||
} |
This file was deleted.
Oops, something went wrong.
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,86 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/labstack/echo/v4" | ||
"net/http" | ||
"encoding/json" | ||
"fmt" | ||
) | ||
// ApiHandler returns the api.json embedded file | ||
func ApiHandler(c echo.Context) error { | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet("api.json"), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} | ||
// ApiResourceList returns the api_resourcelist.json embedded file | ||
func ApiResourceList(c echo.Context) error { | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet("api_resourcelist.json"), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} | ||
// ApiGroupList returns the api_grouplist.json embedded file | ||
func ApiGroupList(c echo.Context) error { | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet("api_grouplist.json"), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} | ||
// Root Route Handler | ||
func RootHandler(c echo.Context) error { | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet("root.json"), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} | ||
// Pods Handler for default routes etc..Just returns blank | ||
func PodsHandler(c echo.Context) error { | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet("empty_list.json"), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} | ||
// Handler for any k8s resource like deployments etc. | ||
func ResourceHandler(c echo.Context) error { | ||
json_map := make(map[string]interface{}) | ||
err := json.NewDecoder(c.Request().Body).Decode(&json_map) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(404, json_map) | ||
} | ||
//Pods Handler just returns a 201 and echo's back the post request | ||
func PostHandler(c echo.Context) error { | ||
json_map := make(map[string]interface{}) | ||
err := json.NewDecoder(c.Request().Body).Decode(&json_map) | ||
c.Logger().Print(json_map) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(201, json_map) | ||
} | ||
//Pods Handler | ||
func ServiceHandler(c echo.Context) error { | ||
servicePathBase := "resource_dump/" | ||
service := c.Param("service") | ||
version := c.Param("version") | ||
fileName := "serverresources.json" | ||
filePath := fmt.Sprintf("%s%s/%s/%s", servicePathBase, service, version, fileName) | ||
var data map[string]interface{} | ||
err := json.Unmarshal(embedGet(filePath), &data) | ||
if err != nil { | ||
c.Logger().Print(err) | ||
} | ||
return c.JSON(http.StatusOK, data) | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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