about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <git@emile.space>2024-11-06 19:02:30 +0100
committerEmile <git@emile.space>2024-11-06 19:02:30 +0100
commit7898c82413fe3d8e0f554ae682c6598ec1c28a93 (patch)
tree49277fb53fd390f4cc645dfdc9c26a36e5676713
parentfbfee6c9d2d7bb6b40ed0defbc5a94d15182171f (diff)
bot updates
-rw-r--r--src/bot.go5
-rw-r--r--templates/botSingle.html16
-rw-r--r--templates/bots.html6
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 @@
       <tr><td><hr></td><td><hr></td></tr>
 
       <tr>
-        <td>CMD</td>
-        <td>{{ .bytecode_r2cmd }}</td>
+        <td></td>
+        <td>Command converting your source into bytes:</td>
       </tr>
-      <tr>
+      <tr class="trhover">
+        <td style="width: 100ex; ">CMD</td>
+        <td style="width: 100ex; ">{{ .bytecode_r2cmd }}</td>
+      </tr>
+      <tr class="trhover">
         <td>Bytecode</td>
         <td>{{ .bytecode }}</td>
       </tr>
@@ -86,10 +90,14 @@
       <tr><td><hr></td><td><hr></td></tr>
 
       <tr>
+        <td></td>
+        <td>The disassembly of your source:</td>
+      </tr>
+      <tr class="trhover">
         <td>CMD</td>
         <td>{{ .disasm_r2cmd }}</td>
       </tr>
-      <tr>
+      <tr class="trhover">
         <td>Disasm</td>
         <td><pre>{{ .disasm }}</pre></td>
       </tr>
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 @@
   <span id="allbots"></span>
   <h1><a href="#allbots">All Bots</a></h1>
 
-  <table class="trhover">
+  <table>
+    <tr>
+      <td>Bot</td>
+      <td>User</td>
+    <tr>
   {{ range $bot := .bots }}
     <tr>
       <td>