docs: add verified build instructions; fix bincmp ssdeep API
- README "Building From Source" section covering all Go and Rust tools; every command tested (rustc, go build, goipgrep make build/test) - bincmp: ssdeep.HashFromFile does not exist in pinned ssdeep v0.4.0, switch to FuzzyFilename; fix two go vet warnings - ignore in-place build outputs for bincmp/gopname/goinfo Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@ Binwally (Go Version): Binary and Directory tree comparison tool
|
||||
|
||||
Usage: go run . <dir1/file1> <dir2/file2>
|
||||
`
|
||||
fmt.Printf(usage)
|
||||
fmt.Print(usage)
|
||||
os.Exit(1)
|
||||
}
|
||||
path1 := os.Args[1]
|
||||
@@ -49,7 +49,7 @@ Usage: go run . <dir1/file1> <dir2/file2>
|
||||
compareTrees(path1, path2, &diffs)
|
||||
|
||||
if len(diffs) == 0 {
|
||||
fmt.Println("No diffs found\n")
|
||||
fmt.Println("No diffs found")
|
||||
} else {
|
||||
totalScore := 0
|
||||
for _, score := range diffs {
|
||||
@@ -61,15 +61,15 @@ Usage: go run . <dir1/file1> <dir2/file2>
|
||||
}
|
||||
} else if !info1.IsDir() && !info2.IsDir() {
|
||||
// Both are files
|
||||
hash1, err := ssdeep.HashFromFile(path1) // CORRECTED
|
||||
hash1, err := ssdeep.FuzzyFilename(path1)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to hash file %s: %v", path1, err)
|
||||
}
|
||||
hash2, err := ssdeep.HashFromFile(path2) // CORRECTED
|
||||
hash2, err := ssdeep.FuzzyFilename(path2)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to hash file %s: %v", path2, err)
|
||||
}
|
||||
score, err := ssdeep.Distance(hash1, hash2) // CORRECTED
|
||||
score, err := ssdeep.Distance(hash1, hash2)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to compare hashes: %v", err)
|
||||
}
|
||||
@@ -196,9 +196,9 @@ func compareFiles(path1, path2 string, diffs *[]int) {
|
||||
|
||||
if !bytes.Equal(b1, b2) {
|
||||
// Files differ, use ssdeep
|
||||
hash1, _ := ssdeep.HashFromFile(path1) // CORRECTED
|
||||
hash2, _ := ssdeep.HashFromFile(path2) // CORRECTED
|
||||
score, _ := ssdeep.Distance(hash1, hash2) // CORRECTED
|
||||
hash1, _ := ssdeep.FuzzyFilename(path1)
|
||||
hash2, _ := ssdeep.FuzzyFilename(path2)
|
||||
score, _ := ssdeep.Distance(hash1, hash2)
|
||||
fmt.Printf("%5s differs %s\n", strconv.Itoa(score), getRelativePath(path1))
|
||||
*diffs = append(*diffs, score)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user