Fixed bug on total permutation -- 4 bytes * permutation
On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: fuzzPattern/fuzzPatternSearch modified: fuzzPattern/fuzzPatternSearch.go
This commit is contained in:
Binary file not shown.
@@ -5,6 +5,7 @@ import (
|
|||||||
"gopkg.in/alecthomas/kingpin.v2"
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"strings"
|
"strings"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -26,6 +27,7 @@ func main() {
|
|||||||
|
|
||||||
if len(*patternPointer)<4 {
|
if len(*patternPointer)<4 {
|
||||||
fmt.Println("Input must have at least 4 bytes")
|
fmt.Println("Input must have at least 4 bytes")
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*patternPointer)[:2] == "0x" {
|
if (*patternPointer)[:2] == "0x" {
|
||||||
@@ -38,6 +40,7 @@ func main() {
|
|||||||
|
|
||||||
if len(fullPattern)<4 {
|
if len(fullPattern)<4 {
|
||||||
fmt.Println("Input must have at least 4 bytes")
|
fmt.Println("Input must have at least 4 bytes")
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pattern = fullPattern[:4]
|
pattern = fullPattern[:4]
|
||||||
@@ -60,12 +63,12 @@ func main() {
|
|||||||
fmt.Println("Pattern found:",finalPos)
|
fmt.Println("Pattern found:",finalPos)
|
||||||
} else {
|
} else {
|
||||||
fullCombi = combiMax[0] * combiMax[1] * combiMax[2] * combiMax[3]
|
fullCombi = combiMax[0] * combiMax[1] * combiMax[2] * combiMax[3]
|
||||||
fmt.Println("Full cycle:", fullCombi)
|
fmt.Println("Full cycle:", fullCombi,"*", len(combiArr), "=", fullCombi*len(combiArr))
|
||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
|
||||||
for finalPos < pattLength {
|
for finalPos < pattLength {
|
||||||
fmt.Println("Pattern found:",finalPos)
|
fmt.Println("Pattern found:",finalPos)
|
||||||
finalPos+=fullCombi
|
finalPos+=fullCombi*len(combiArr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user