Skip to content

Instantly share code, notes, and snippets.

View rgerganov's full-sized avatar

Radoslav Gerganov rgerganov

View GitHub Profile
@rgerganov
rgerganov / sign
Created February 18, 2020 09:41
TPM2 sign
#!/bin/sh
tpm2_createprimary -c primary.ctx
tpm2_create -C primary.ctx -G ecc -u key.pub -r key.priv
tpm2_load -C primary.ctx -u key.pub -r key.priv -c key.ctx
tpm2_readpublic -f pem -o key.pem -c key.ctx
echo "my message" > message.dat
sha256sum message.dat | awk '{ print "000000 " $1 }' | xxd -r -c 32 > message.dat.digest
tpm2_sign -c key.ctx -g sha256 -d -f plain -o message.dat.sig message.dat.digest
openssl dgst -verify key.pem -keyform pem -sha256 -signature message.dat.sig message.dat
@rgerganov
rgerganov / gerrit.user.js
Last active February 12, 2020 09:42
Userscript for hiding CI comments in Gerrit
// ==UserScript==
// @name Toggle CI comments in patches
// @author Radoslav Gerganov <rgerganov@vmware.com>
// @include https://review.openstack.org/#/c/*
// ==/UserScript==
function main() {
// these are CIs for Nova, feel free to modify this list
var ciNames = ["Jenkins",
"turbo-hipster",
@rgerganov
rgerganov / filter.py
Created August 17, 2018 14:08
filter
#!/usr/bin/python
import sys
for line in sys.stdin:
if 'url:' in line:
print line
sys.stdout.flush()
@rgerganov
rgerganov / vfo.c
Created July 13, 2018 12:05
RPi + char lcd + uinput
#include <stdio.h>
#include <linux/input.h>
#include <linux/uinput.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <wiringPi.h>
@rgerganov
rgerganov / wakeup.sh
Created March 3, 2018 20:39
Wake up script for OSX
#!/bin/bash
wake_time="2018-03-04.02:30:00"
wake_time_epoch=$(date -j -f %Y-%m-%d.%H:%M:%S $wake_time +%s)
while [ 1 ]; do
now_epoch=$(date +%s)
if [ $now_epoch -ge $wake_time_epoch ]; then
break
fi
@rgerganov
rgerganov / exploit.c
Last active January 7, 2018 15:28
The exploit
#include <stdio.h>
#include <linux/input.h>
#include <linux/uinput.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
@rgerganov
rgerganov / jay.py
Created October 31, 2017 08:44
jay
#!/usr/bin/env python
def is_bigger(a, b):
aa = a.split('.')
bb = b.split('.')
for x,y in zip(aa, bb):
if int(x) > int(y):
return True
return False
@rgerganov
rgerganov / astra_hack.py
Last active October 25, 2017 08:11
Astra hack
#!/usr/bin/env python
import os
import socket
import threading
import SocketServer
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def send_response(self, resp):
self.request.sendall("HTTP/1.1 200 OK\r\n")
@rgerganov
rgerganov / keybase.md
Created February 14, 2017 09:36
Keybase proof

Keybase proof

I hereby claim:

  • I am rgerganov on github.
  • I am rgerganov (https://keybase.io/rgerganov) on keybase.
  • I have a public key whose fingerprint is 5837 D10B AA3E 24E1 FA26 FE85 DCEB 64AA 28EC 50FC

To claim this, I am signing this object:

@rgerganov
rgerganov / nss-chrome-linux.patch
Created January 18, 2017 09:48
libnss patch to make Chrome accept VIO's certificate on Linux
--- nss-3.23/nss/lib/certdb/certdb.c 2016-02-26 22:51:11.000000000 +0200
+++ /opt/src/nss-3.23/nss/lib/certdb/certdb.c 2017-01-18 11:36:57.009855896 +0200
@@ -1198,11 +1198,12 @@
/* turn off the special bit */
requiredUsage &= (~KU_KEY_AGREEMENT_OR_ENCIPHERMENT);
switch (keyType) {
case rsaKey:
- requiredUsage |= KU_KEY_ENCIPHERMENT;
+ // hack for VIO's certificate