diff --git a/.gitignore b/.gitignore index 7ad4ffc..4f36ff8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ +.idea/ diff --git a/README.md b/README.md index ea43936..dfe37e1 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,28 @@ # gxor -gxor程序根据输入的二进制文件进行异或运算输出 + +**gxor** 程序根据输入的二进制文件进行异或运算输出 ``` [gxor] Xor Binary file -Usage : +Usage : gxor -input-file payload.bin -output-file out.bin -xor-key 10 -appendFlag A +``` + -gxor -input-file payload.bin -output-file out.bin -xor-key 10 +## 使用帮助 ``` +Usage of ./gxor: + -append-flag string + flag for file head, 1 bytes (default "A") + -input-file string + input bin file + -output-file string + input bin file (default "output.bin") + -xor-key int + input xor key (default 8) +``` + +- append-flag 主要是为了防止直接异或过的shellcode代码被查杀,因此可以在文件头添加一些字符串 + + diff --git a/gxor.go b/gxor.go index f235a32..7a3bf26 100644 --- a/gxor.go +++ b/gxor.go @@ -11,7 +11,7 @@ var ( inputBinaryFile = flag.String("input-file", "", "input bin file") xorKey = flag.Int("xor-key", 8, "input xor key") outputBinaryFile = flag.String("output-file", "output.bin", "input bin file") - appendFlag = flag.String("append-flag", "A", "flag for file head, 1 bytes") + appendFlag = flag.String("append-flag", "", "flag for file head, 1 bytes") ) func usage() { @@ -48,7 +48,10 @@ func main() { fmt.Println(err) return } - newFile.Write([]byte(*appendFlag)) + + if len(*appendFlag) > 0 { + newFile.Write([]byte(*appendFlag)) + } newFile.Write(data) fmt.Println("[*]Flag Size:", len(*appendFlag)) fmt.Println("[*]Output:", *outputBinaryFile)