Add files via upload

Made little endian for hex as default for fuzzPatternSearch
This commit is contained in:
2018-04-09 20:41:04 +08:00
committed by GitHub
parent 8b407aaa8a
commit 58c07ff1a5
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" "gopkg.in/alecthomas/kingpin.v2"
"encoding/hex" "encoding/hex"
"strings" "strings"
"bytes"
"os" "os"
) )
@@ -32,8 +33,10 @@ func main() {
if (*patternPointer)[:2] == "0x" { if (*patternPointer)[:2] == "0x" {
fmt.Println("Hex detected") fmt.Println("Hex detected")
fmt.Println("Assumed litle endian")
fullBytes, _ := hex.DecodeString((*patternPointer)[2:]) fullBytes, _ := hex.DecodeString((*patternPointer)[2:])
fullPattern = string(fullBytes) fullPattern = string(fullBytes)
fullPattern = strReverse(fullPattern)
} else { } else {
fullPattern = *patternPointer fullPattern = *patternPointer
} }
@@ -101,3 +104,11 @@ func findPos(combiArr []int, startPos int) int {
return answerLength 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()
}