From 7898c82413fe3d8e0f554ae682c6598ec1c28a93 Mon Sep 17 00:00:00 2001 From: Emile Date: Wed, 6 Nov 2024 19:02:30 +0100 Subject: bot updates --- src/bot.go | 5 +++++ templates/botSingle.html | 16 ++++++++++++---- templates/bots.html | 6 +++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/bot.go b/src/bot.go index a2e8c99..4708fee 100644 --- a/src/bot.go +++ b/src/bot.go @@ -430,6 +430,7 @@ func botSingleHandler(w http.ResponseWriter, r *http.Request) { data["res"] = queryres } + // fetch the session and get the user that made the request session, _ := globalState.sessions.Get(r, "session") username := session.Values["username"].(string) @@ -438,6 +439,7 @@ func botSingleHandler(w http.ResponseWriter, r *http.Request) { data["err"] = "Could not get the id four your username... Please contact an admin" } + // get the bot that was requested bot, err := BotGetById(int(botid)) data["bot"] = bot data["user"] = viewer @@ -449,6 +451,9 @@ func botSingleHandler(w http.ResponseWriter, r *http.Request) { } defer r2p1.Close() + // TODO(emile): improve the archs and bit handling here. I'll use the first one for now, + // but it would be nice to loop over all of them (would be a matrix with archs and bits + // on the axes) src := strings.ReplaceAll(bot.Source, "\r\n", "; ") radareCommand := fmt.Sprintf("rasm2 -a %s -b %s \"%+v\"", bot.Archs[0].Name, bot.Bits[0].Name, src) bytecode, err := r2cmd(r2p1, radareCommand) diff --git a/templates/botSingle.html b/templates/botSingle.html index dcb874f..024e2c1 100644 --- a/templates/botSingle.html +++ b/templates/botSingle.html @@ -75,10 +75,14 @@

- CMD - {{ .bytecode_r2cmd }} + + Command converting your source into bytes: - + + CMD + {{ .bytecode_r2cmd }} + + Bytecode {{ .bytecode }} @@ -86,10 +90,14 @@

+ + The disassembly of your source: + + CMD {{ .disasm_r2cmd }} - + Disasm
{{ .disasm }}
diff --git a/templates/bots.html b/templates/bots.html index 34fa0c2..70018dd 100644 --- a/templates/bots.html +++ b/templates/bots.html @@ -7,7 +7,11 @@

All Bots

- +
+ + + + {{ range $bot := .bots }}
BotUser
-- cgit 1.4.1