Skip to content

Instantly share code, notes, and snippets.

View natmchugh's full-sized avatar

Nathaniel McHugh natmchugh

View GitHub Profile
@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 / Montgomery.py
Created January 12, 2016 21:08
Montgomery Ladder
import random
class Montgomery:
# B*v^2 = u^3 + A*u^2 + u
def __init__(self, A, B, p):
self.A = A
self.B = B
self.p = p
@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 / 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 / MD5_no_padding.php
Last active September 11, 2022 08:23
MD5 algo with padding commented out this makes it suitable for use in length extension attacks as output can then be used as initial values for next block
<?php
//Pre-processing: adding a single 1 bit
// append "1" bit to message
// Notice: the input bytes are considered as bits strings,
// where the first bit is the most significant bit of the byte.[46]
//Pre-processing: padding with zeros
// append "0" bit until message length in bits ≡ 448 (mod 512)
function preProcess($message) {
// $message .= chr(128);
@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;
<?php
$p = '3490529510847650949147849619903898133417764638493387843990820577';
$q = '32769132993266709549961988190834461413177642967992942539798288533';
$N = bi_mul($p, $q);
$c ='96869613754622061477140922254355882905759991124574319874695120930816298225145708356931476622883989628013391990551829945157815154';
$phin = bi_mul(bi_sub($p, 1), bi_sub($q, 1));
$e = 9007;
@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)
@natmchugh
natmchugh / sha1.php
Last active August 10, 2018 15:08
Pure PHP implementation of SHA1from wikipedia pseudo code
<?php
/*
Note 1: All variables are unsigned 32 bits and wrap modulo 232 when calculating, except
ml the message length which is 64 bits, and
hh the message digest which is 160 bits.
Note 2: All constants in this pseudo code are in big endian.
Within each word, the most significant byte is stored in the leftmost byte position
*/
@natmchugh
natmchugh / md4.php
Created March 29, 2014 13:05
Pure PHP MD4 implementation
<?php
function preProcess($message) {
$message .= chr(128);
while (((strlen($message) + 8) % 64) !== 0) {
$message .= chr(0);
}
return $message;
}