Git Product home page Git Product logo

unifuzz's Introduction

unifuzz

Original unifuzz.c code came from here: https://sqlitetoolsforrootsmagic.wikispaces.com/file/view/unifuzz.c/469471116/unifuzz.c

..and the need for a such an extension is explained here: https://sqlitetoolsforrootsmagic.wikispaces.com/RMNOCASE+-+faking+it+in+SQLite+Expert%2C+command-line+shell+et+al

The above page provides a link to a WIN32 DLL for use on Windows systems, which cannot be used on macOS or Linux systems. Therefore the code needs to be compiled to work on a macOS system.

This page gives some details on how to compile a SQLite loadable extension: https://sqlite.org/loadext.html

One hurdle in using the unifuzz.c code is that the author(s) used the Windows CompareStringW() function, and warns us of this. A replacement for this code is needed for the extension to link.

Wine (https://www.winehq.org/) provides code for running Windows programs on Unix-based systems (like macOS). Rather than install Wine and figuring out how to get the unifuzz extension to use the runtime libraries, it was decided to just statically compile the needed function into the extension itself.

This required some mining operations to retrieve only the needed code and some minor editing to establish the minimal set of files needed. Only two C source files from the base Wine source files were modified -- all other files are used as is.

Compiling

This has only been tested on a macOS system (MacBook Pro (15-inch, Early 2011) running macOS Sierra Version 10.12.6)

Also installed on the system is MacPorts (including Apple's Xcode Developer Tools), sqlite3 3.20.1 (from MacPorts)

Having the source for Wine is not necessary (but may be necessary in the future).

Clone the repository and compile:

% git clone https://github.com/mooredan/unifuzz.git
% cd unifuzz
% make

That's it. The result should be the SQLite loadable extension "unifuzz.dylib"

Usage

Run sqlite3 referencing a SQLite database, ... Load the extension with .load ... Run queries

The transcript below shows the collation error prior to loading the extension and success after doing so.

$ sqlite3 ~/Documents/Genealogy/RootsMagic/ZebMoore.rmgc
SQLite version 3.20.1 2017-08-24 16:21:36
Enter ".help" for usage hints.
sqlite> SELECT Surname, Given FROM NameTable WHERE Surname LIKE "Moore" LIMIT 10;
Error: no such collation sequence: RMNOCASE
sqlite> .load unifuzz
sqlite> SELECT Surname, Given FROM NameTable WHERE Surname LIKE "Moore" LIMIT 10;
Moore|
Moore|?
Moore|?
Moore|Abram Schultz
Moore|Ada
Moore|Ada
Moore|Ada G
Moore|Ada Grace
Moore|Ada Mae
Moore|Ada Pearl
sqlite> .quit

To Do

  • Automatically reference the Wine source files and copy the necessary files over and patch the two files that need modification.

  • Release compiled extensions for various platforms (being with macOS)

  • Resolve the last two compile warnings (initialization of array of struct variables)

  • More testing? ...seems to be working OK, however it might choke on names where non-English characters are used in names

Acknowledgements

Big thanks to the following folks, without them blazing the trail, writing and testing the original code, none of this would have been possible:

  • Jean-Christophe Deschamps : last known author of unifuzz.c
  • Tom Holden : founder(?) and maintainer of SQLite Tools for RootsMagic
  • Wine authors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.