Skip to content

Instantly share code, notes, and snippets.

package wincommands
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
func deletefromslice(n int, slice []byte) []byte {
if n >= len(slice) {
return nil
}
return slice[n:]
}
// http://blog.golang.org/go-slices-usage-and-internals - is a great read for getting your head around slices!
// if reflect.DeepEqual(needle, haystack[:nlen])
// PREPARATORY CHANGES TO SF
1. Use existing -hash flag but change behaviour so can accept a comma separated list of hashes e.g. -hash md5,ssdeep
2. change hash.go file (under /cmd/) so that checksum var is a slice of hashes var checksum []hash.Hash
3. writer interface (cmd/writers.go) updated so writeFile method takes a slice of byte slices for checksum digests (checksum [][]byte)
And all writers (JSON, CSV, YAML etc) updated so they can accept multiple checksum digests.
4. in cmd/sf.go update the identifyRdr func so it ranges through the slice of checksums, calculating for each, and returns a slice of byte slices for checksum digests
// SQLITEANALYSIS CHANGES
5. copy the hash.go flag as hash_sqliteanalysis.go and prepend build tag
6. add spamspam as an import and update the functions in this file
sf -json ~/local/bench/ipres/systems-showcase-files/ | jq '.files[] | select(.errors!="" or .matches[].warning!="") | .filename, .errors, .matches[].warning'
{
"formats": [
{
"format": {
"id": "archives-nz-dev-signature/1",
"name": "Adobe Air",
"version": "1.0",
"mime": "application/vnd.adobe.air-application-installer-package+zip",
"extensions": [
"air"
@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()
@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):
--- 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 / 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
}