Skip to content

Instantly share code, notes, and snippets.

View natmchugh's full-sized avatar

Nathaniel McHugh natmchugh

View GitHub Profile
@natmchugh
natmchugh / flipper_plgin.md
Last active November 19, 2022 16:30
Getting a working flipper plugin

clone the flipper repo

git clone git@github.com:flipperdevices/flipperzero-firmware.git

download the build tools requirements

pip3 install -r scripts/requirements.txt

cd applications/plugins

@natmchugh
natmchugh / paxton-covert.html
Last active March 13, 2024 14:30
Convert Paxton Fob Data to ids and vice versa
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Paxton Fob converter</title>
<style>
table, th, td, div {
border: 1px solid black;
}
@natmchugh
natmchugh / copying-Paxton-fobs.md
Last active March 31, 2024 23:21
How to copy, read and write Paxton fobs and cards with an RFIDler

How to copy, read and write Paxton fobs and cards with an RFIDler

A newer version of this info is available at https://badcfe.org/how-to-paxton-with-rfidler/

Paxton fobs and readers are popular in the UK especially the Net2 system where the fobs look like this with a blue ring: Paxton Fob

Paxton readers often look like this:

Paxton Reader

@natmchugh
natmchugh / soroban.py
Created November 23, 2016 11:08
Script what I wrote to learn to recognise numbers on a soroban
import re, random, operator
random.seed()
def get_random_int():
return random.randint(1,999)
def to_soroban(number):
digits = {
0: "**** || *",
1: "*** *|| *",
import random, operator
random.seed()
def get_random_int():
return random.randint(2, 12)
numberOfQs = 10
ops = {"+": operator.add,
"-": operator.sub,
"*": operator.mul,
@natmchugh
natmchugh / fast_reverse.c
Created October 4, 2016 16:35
get the internal state from a PHP lcg in 3 outputs
/*
*
*/
#include <stdio.h>
#include <math.h>
#define MODMULT(a, b, c, m, s) q = s/a;s=b*(s-a*q)-c*q;if(s<0)s+=m;
/* MODMULT computes s*b mod m, provided that m=a*b+c and 0<=c<m */
@natmchugh
natmchugh / lcg.php
Created February 23, 2016 13:51
Brute forcing the seeding of PHP's lcg
<?php
class Lcg
{
private $s1 = 0;
private $s2 = 0;
public function __construct($s1, $s2)
{
$this->s1 = $s1;
@natmchugh
natmchugh / MersenneTwister.php
Created February 18, 2016 14:14
Pure PHP implementation of mt19937 with standard or PHP behaviours
<?php
class MersenneTwister
{
const STANDARD = 1;
const PHP = 2;
// Create a length 624 array to store the state of the generator
private $MT;
@natmchugh
natmchugh / unseeded_mt_rand.php
Last active July 26, 2021 09:07
An example of how to guess the seed used in first call to PHP's mt_rand()
$time = time(0);
$pid = getmypid();
echo 'time is: ',$time,' (just the unix timestamp so very guessable)',PHP_EOL;
echo 'pid is: ',$pid, ' (process id of current PHP process usually in 1000s )',PHP_EOL;
$rand = mt_rand();
echo 'Output of 1st call to uninitialized to mt_rand is: '.$rand,PHP_EOL;
echo 'Output of 2nd call to uninitialized to mt_rand is: '.mt_rand(),PHP_EOL;
echo 'Output of 3rd call to uninitialized to mt_rand is: '.mt_rand(),PHP_EOL;
echo 'Guessing the seed now: ',PHP_EOL;
@natmchugh
natmchugh / kangaroo_ecc.py
Created January 21, 2016 10:35
Using Pollards Kangaroo on an Weierstrass curve
import random
from Ecc import Ecc
from Ecc import Point
A = -95051
B = 11279326
p = 233970423115425145524320034830162017933
q = 233970423115425145498902418297807005944
ecc = Ecc(A, B, p)