Fixed little endian search

This commit is contained in:
Samuel
2018-04-09 11:54:41 +08:00
parent 5cec0a4ae7
commit 23fa77dbe2
2 changed files with 11 additions and 0 deletions

Binary file not shown.

View File

@@ -5,6 +5,7 @@ import (
"gopkg.in/alecthomas/kingpin.v2"
"encoding/hex"
"strings"
"bytes"
"os"
)
@@ -32,8 +33,10 @@ func main() {
if (*patternPointer)[:2] == "0x" {
fmt.Println("Hex detected")
fmt.Println("Assumed litle endian")
fullBytes, _ := hex.DecodeString((*patternPointer)[2:])
fullPattern = string(fullBytes)
fullPattern = strReverse(fullPattern)
} else {
fullPattern = *patternPointer
}
@@ -101,3 +104,11 @@ func findPos(combiArr []int, startPos int) int {
return answerLength
}
func strReverse(before string) string {
var newBuff bytes.Buffer
for i,_ := range before {
newBuff.WriteByte(before[len(before)-i-1])
}
return newBuff.String()
}