Apply signatures from input hash
This commit is contained in:
parent
9fd8438a4b
commit
5cdf3c3d97
|
@ -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]}
|
||||
]
|
||||
}
|
||||
}
|
22
swf2ass.go
22
swf2ass.go
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue