Skip to content

Instantly share code, notes, and snippets.

@ariscop
ariscop / gist:45d662258e93b4a607ef
Created December 1, 2014 05:51
MYOB table/index records, schema is elsewhere
0x81f Record 0xfafa 0x191 0x17f 0x0 0x0 b'\xff\xff*' ffffffff 00000000 ffffffff 00000000 00000000 00000000 60000000 12180000 00000000 00000000 8100ee07 00000000 03000000 2206dc07 000c0001 20020204 0100ff00 00000000 12180000 01000000 30090000 00000000 00000000 0600fb01 ff000000 28000000 00000000 80030000 00000000 00000000 00000000 00000000
0x11b0 Record 0xfafa 0x191 0x17f 0x0 0x0 b'misc.dat ' ffffffff 00000000 ffffffff 00200000 0200da0c 4d000000 43000000 00000000 00000000 00000000 81000000 10030000 83000000 00000000 00000100 00020204 00000000 00000000 00000000 02000000 c1120000 00000000 00000000 02000000 ff000000 2f000000 00000000 cf000000 00000000 00000000 00000000 00000000
0x201f Record 0xfafa 0x291 0x27f 0x0 0x0 b'misc.idx ' ffffffff 00000000 ffffffff 00280000 00000000 00000000 43000000 12800800 00000000 00000000 8100ee07 00000000 83000000 d407dc07 00000000 20020204 01000400 02000000 12800800 03000000 30210000 00000000 00000000 0200fb01 ff000000 28000000 00000000 ce000000 00000000 00000000 00000000 00
@ariscop
ariscop / ctdump.py
Last active August 29, 2015 14:10
Tool for dumping schema and data from old ctree databases (works with myob .myo files) (beware the ugly)
#!/usr/bin/python3
import sys
import os
import mmap
from binascii import hexlify
from io import BytesIO
from struct import calcsize, unpack, unpack_from, iter_unpack
from collections import namedtuple, OrderedDict
from pprint import pprint
@ariscop
ariscop / traccar_postgresql_schema.sql
Created December 9, 2014 01:04
Postgresql compatible traccar schema
CREATE TABLE application_settings (
id bigserial NOT NULL,
registrationenabled boolean NOT NULL
);
CREATE TABLE devices (
id bigserial NOT NULL,
name character varying(255),
uniqueid character varying(255),
latestposition_id bigint
@ariscop
ariscop / extract.py
Created January 1, 2015 01:23
Tool for extracting .lmp files from "The Elder Scrolls Travels - Dawnstar"
#!/usr/bin/env python3
import sys, struct
fd = open(sys.argv[1], "rb")
while(True):
byte = fd.read(1)
if byte != b'-':
break
@ariscop
ariscop / bits.py
Last active August 29, 2015 14:13
def _bits(byte):
return [(byte >> 0) & 1,
(byte >> 1) & 1,
(byte >> 2) & 1,
(byte >> 3) & 1,
(byte >> 4) & 1,
(byte >> 5) & 1,
(byte >> 6) & 1,
(byte >> 7) & 1]
@ariscop
ariscop / ts_unpack.py
Created February 11, 2015 01:17
Unpacker for topsee camera firmware
#!/usr/bin/env python3
import sys
import crcmod
from struct import unpack
from collections import namedtuple
def to_hex(data):
return ''.join('%02x' % x for x in data)
@ariscop
ariscop / songhash.py
Last active August 29, 2015 14:15
USDX-WP song hash thingy
#!/usr/bin/env python3
import sys
from hashlib import md5
from re import split
with open(sys.argv[1], "rb") as f:
data = b"".join(x for x in split(b"[\r\n]+", f.read()) if not x.startswith(b"#"))
m = md5()
@ariscop
ariscop / extract_ros.py
Created February 24, 2015 00:25
Extracts .ros firmware files used by some netgear swtiches, eg: ng_gs728_52tp_516tp_bx-60116.ros
#!/usr/bin/env python3
import sys
import lzma
import crcmod
from struct import unpack, iter_unpack
from collections import namedtuple
from functools import partial
from tabulate import tabulate
crc32 = crcmod.predefined.mkPredefinedCrcFun('crc-32')
@ariscop
ariscop / topsee_dev.py
Created March 2, 2015 01:11
Python script that 'emulates' topsee devices
#!/usr/bin/env python3
from socket import socket
import xml.etree.ElementTree as ET
magic = b'\x58\x91\x58\x51'
auth_response = """<?xml version="1.0" encoding="GB2312" ?>
<XML_TOPSEE>
<MESSAGE_HEADER
@ariscop
ariscop / element.py
Created March 19, 2015 03:35
Simple passthrough element for gstreamer 1.0 in python
#!/usr/bin/env python3
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
loop = GObject.MainLoop()
GObject.threads_init()
Gst.init()