diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-22 19:52:34 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-22 19:52:34 -0400 |
commit | 04bf5f2b0345332bf906558e82922a80b7901597 (patch) | |
tree | 15235706ca0f62bd10befa052f6f9451f29889ea | |
parent | 95ba29b4a74521327c932adb5738f0252756fc78 (diff) | |
download | Atlas-04bf5f2b0345332bf906558e82922a80b7901597.tar.gz Atlas-04bf5f2b0345332bf906558e82922a80b7901597.zip |
cmd/atlas-import: Still filter out old default pdata after 95ba29b4a74521327c932adb5738f0252756fc78
-rw-r--r-- | cmd/atlas-import/main.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/atlas-import/main.go b/cmd/atlas-import/main.go index 143b500..24e2d81 100644 --- a/cmd/atlas-import/main.go +++ b/cmd/atlas-import/main.go @@ -4,6 +4,8 @@ package main import ( "bytes" "context" + "crypto/sha1" + "encoding/hex" "fmt" "net/netip" "os" @@ -163,7 +165,7 @@ func insertP(n *nsacct, p *pdatadb.DB) (bool, error) { var pd pdata.Pdata if err := pd.UnmarshalBinary(n.PersistentDataBaseline); err == nil { if len(pd.ExtraData) < 140 { - if !bytes.Equal(n.PersistentDataBaseline, pdata.DefaultPdata) { + if !bytes.Equal(n.PersistentDataBaseline, pdata.DefaultPdata) && isOldDefaultPdata(n.PersistentDataBaseline) { if sz, err := p.SetPdata(n.ID, n.PersistentDataBaseline); err != nil { return false, err } else if sz > 2200 { @@ -179,3 +181,8 @@ func insertP(n *nsacct, p *pdatadb.DB) (bool, error) { } return false, nil } + +func isOldDefaultPdata(b []byte) bool { + ss := sha1.Sum(b) + return hex.EncodeToString(ss[:]) == "9dab70c01c475bf976689d4af525aa39db6d73bc" +} |