This commit is contained in:
noise 2025-05-23 16:30:44 +03:00
parent e1fcfb7394
commit 7d928c633f
5 changed files with 92 additions and 1 deletions

View File

@ -1,3 +1,18 @@
# smuggler # smuggler
A steganography tool that abuses UTF-8 PUAs to encode messages, which can be used as subtle attacks on AI prompts A steganography tool that abuses UTF-8 PUAs to encode messages, which can be used for subtle attacks on AI prompts
```
user@angeltech:$ go build .
```
```
user@angeltech:$ ./smuggler encode "test"
Encoded: 󠁴󠁥󠁳󠁴
```
```
user@angeltech:$ ./smuggler decode "<000e0074><000e0065><000e0073><000e0074>"
Decoded: test
```
Example of interaction with Grok, for reference:
![Example of interaction with Grok](image.png)

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module gitea.angeltech.jp/Angel-Technologies/smuggler
go 1.24.3

BIN
image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

73
main.go Normal file
View File

@ -0,0 +1,73 @@
package main
import (
"fmt"
"os"
"strings"
)
const (
PUA_START = 0xE0000
)
func encodeHiddenMessage(message string) string {
var hidden strings.Builder
for _, char := range message {
hidden.WriteRune(PUA_START + char)
}
return hidden.String()
}
func decodeMixedMessage(input string) string {
var decoded strings.Builder
var hiddenBuffer strings.Builder
inHiddenSequence := false
for _, char := range input {
if char >= PUA_START && char < PUA_START+0xFFFF {
if !inHiddenSequence && hiddenBuffer.Len() > 0 {
decoded.WriteString(hiddenBuffer.String())
hiddenBuffer.Reset()
}
inHiddenSequence = true
hiddenBuffer.WriteRune(char - PUA_START)
} else {
if inHiddenSequence {
decoded.WriteString(hiddenBuffer.String())
hiddenBuffer.Reset()
inHiddenSequence = false
}
decoded.WriteRune(char)
}
}
if hiddenBuffer.Len() > 0 {
decoded.WriteString(hiddenBuffer.String())
}
return decoded.String()
}
func main() {
if len(os.Args) < 3 {
fmt.Println("Usage:")
fmt.Println(" Encode: go run main.go encode \"secret message\"")
fmt.Println(" Decode: go run main.go decode \"󠁳󠁥󠁣󠁲󠁥󠁴\"")
os.Exit(1)
}
command := os.Args[1]
text := strings.Join(os.Args[2:], " ")
switch command {
case "encode":
hidden := encodeHiddenMessage(text)
fmt.Printf("Encoded: %s\n", hidden)
case "decode":
decoded := decodeMixedMessage(text)
fmt.Printf("Decoded: %s\n", decoded)
default:
fmt.Println("Invalid command. Use 'encode' or 'decode'.")
os.Exit(1)
}
}

BIN
smuggler Executable file

Binary file not shown.