Skip to content

Instantly share code, notes, and snippets.

sig = "10 00 00 00 'Word.Document.' ['6'-'7'] 00"
l = sig.split("'")
ns = ""
for i in range(len(l)):
if i % 2 != 0:
ns += "".join([hex(ord(x))[2:] for x in l[i]])
else:
ns += l[i]
print ns
package itforarchivists
import (
"encoding/json"
"fmt"
"net/http"
"github.com/richardlehane/siegfried/pkg/core"
"github.com/richardlehane/siegfried/pkg/pronom"
)
@richardlehane
richardlehane / droid_pronom_diff
Created November 16, 2014 10:59
Differences between pronom and droid
This shows the fails when I compare signatures from PRONOM report files with DROID signature file v79.
A little background:
In siegfried, signatures are lists of frames. Frames enclose patterns. Frames tell you where to test, patterns perform the test.
The test output below shows the text printout of failing signatures. Within the parentheses, pipes separate each frame.
In the first example, the "F" means it is a fixed frame. This implies a fixed offset from either the BOF (B) or EOF (E). The first example is therefore at a fixed offset of 0 bytes from the BOF. The enclosed pattern is a sequence (seq) of 4 bytes. The frame that follows is also a fixed frame (F) but it is anchored to the previous frame (P), not to the BOF. In EOF segments you will see frames to the left of the EOF frame are anchored to their succeeding (S) frames.
The last frame in the test output below is a WW which stands for window. In the example below, it should be a window of between 0 and 16000 bytes from the EOF. The DROID signatu
@richardlehane
richardlehane / sf.py
Last active August 29, 2015 14:15
Archivematica FPR script for sf
#!/usr/bin/env python
import base64
import json
import urllib2
import sys
sfurl = 'http://localhost:5138/identify/'
try:
---
siegfried : 0.8.3
scandate : 2015-02-28T14:09:20+11:00
signature : pronom.gob
created : 2015-02-19T11:50:57+11:00
identifiers :
- name : 'pronom'
details : 'DROID_SignatureFile_V81.xml; container-signature-20150218.xml'
---
filename : 'debug.jpg'
@richardlehane
richardlehane / bininstall
Last active August 29, 2015 14:18
Bintray install
wget -qO - https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb http://dl.bintray.com/siegfried/debian wheezy main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install siegfried
@richardlehane
richardlehane / guid.go
Last active August 29, 2015 14:18
GuidFromName
testName := "Bagaaqy23kudbhchAaq5u2chNd"
testGuid := "{20001801-5DE6-11D1-8E38-00C04FB9386D}"
func GuidFromName(n string) (Guid, error) {
n = strings.ToLower(n)
buf, err := charConvert([]byte(n))
if err != nil {
return Guid{}, err
}
--- FAIL: TestParseDroid (0.84s)
parse_test.go:195: Parse Droid: signatures for fmt/41 are not equal:
Reports: (F B:0 seq ffd8ffed | F P:2 seq "Photoshop 3.0\x008BIM" | WW E:0-16000 seq ffd9)
Droid: (F B:0 seq ffd8ffed | F P:2 seq "Photoshop 3.0\x008BIM" | F E:0 seq ffd9)
parse_test.go:195: Parse Droid: signatures for fmt/279 are not equal:
Reports: (WW B:0-4 seq "fLaC\x00\x00\x00\"")
Droid: (F B:0 seq "fLaC\x00\x00\x00\"")
parse_test.go:195: Parse Droid: signatures for fmt/385 are not equal:
@richardlehane
richardlehane / fpr.py
Last active August 29, 2015 14:21
fpr client script
from __future__ import print_function
import socket
import subprocess
import sys
def file_tool(path):
return subprocess.check_output(['file', path]).strip()
def main(path):
@richardlehane
richardlehane / frankenstein_id.py
Last active August 29, 2015 14:22
combine siegfried and archivematica extension matching
from __future__ import print_function
import os.path
import json
import subprocess
import sys
def file_tool(path):
return subprocess.check_output(['file', path]).strip()