Apply signatures from input hash

This commit is contained in:
DataHoarder 2023-12-03 15:47:15 +01:00
parent 9fd8438a4b
commit 5cdf3c3d97
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
2 changed files with 25 additions and 4 deletions

View file

@ -46,5 +46,12 @@
{"objectId": 13, "depth": null},
{"objectId": 36, "depth": null}
]
},
"5999765b57004ce602d04cbc71c3ebc71b9831b51c358eefc77543d9ad63ab80": {
"name": "dagobah_Shoo_Fly.swf",
"description": "remove playback menu",
"remove": [
{"objectId": null, "_objectId": 60, "depth": [0, 156]}
]
}
}

View file

@ -1,6 +1,8 @@
package main
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"flag"
@ -112,10 +114,22 @@ func main() {
var ks KnownSignature
for _, s := range knownSignatures {
if s.Name == path.Base(*inputFile) {
ks = s
break
_, err = file.Seek(0, io.SeekStart)
if err == nil {
hasher := sha256.New()
_, err = io.Copy(hasher, file)
if err == nil {
ks = knownSignatures[hex.EncodeToString(hasher.Sum(nil))]
}
}
if ks.Name == "" || ks.Description == "" {
for _, s := range knownSignatures {
if s.Name == path.Base(*inputFile) {
ks = s
break
}
}
}