Skip to content

Instantly share code, notes, and snippets.

@vkobel
vkobel / permit-signer.html
Created December 21, 2023 15:29
Web3 signer for the EIP-20 Permit method
<!DOCTYPE html>
<html>
<head>
<title>ERC20 Permit Signing</title>
<script src="https://cdn.jsdelivr.net/npm/web3/dist/web3.min.js"></script>
</head>
<style>
body {
@vkobel
vkobel / hash_kernel_module.c
Last active August 19, 2023 13:35
Example of using the Linux Kernel Crypto API for SHA256 hashing (tested with 5.6)
#include <linux/module.h>
#include <crypto/hash.h>
struct sdesc {
struct shash_desc shash;
char ctx[];
};
static struct sdesc *init_sdesc(struct crypto_shash *alg)
{
@vkobel
vkobel / kernel_rootkit.c
Last active October 22, 2022 16:54
Simple "rootkit" kernel module (tested with Linux 5.6.3) that adds a device handler taking a PID and upgrade it to root (example in the comments below)
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/cred.h>
#include <linux/fs.h>
MODULE_LICENSE("GPL");
struct task_struct *get_task_struct_by_pid(unsigned pid)
{
struct pid *proc_pid = find_vpid(pid);
@vkobel
vkobel / init.vim
Created September 7, 2019 11:31
my vim configuration (nvim)
❯ ccat ~/.config/nvim/init.vim
" ======================
" Plugins are define here
" ======================
call plug#begin('~/.vim/plugged')
Plug 'Valloric/YouCompleteMe'
Plug 'scrooloose/nerdtree'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'itchyny/lightline.vim'
@vkobel
vkobel / 21-yubikey.rules
Last active July 25, 2019 14:38
YubiKey lock screen when unplugged
## /etc/udev/rules.d/21-yubikey.rules
ACTION=="remove", SUBSYSTEM=="input", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0407", RUN+="/usr/local/bin/lockscreen.sh"
@vkobel
vkobel / patchfile.diff
Last active May 23, 2019 16:21
paramiko crypto remove warnings patch for master(cf7d49d66f3b1fbc8b0853518a54050182b3b5eb)
diff --git a/ecdsakey.py b/ecdsakey.py
index b73a969e..353c5f9e 100644
--- a/ecdsakey.py
+++ b/ecdsakey.py
@@ -160,12 +160,12 @@ class ECDSAKey(PKey):
pointinfo = msg.get_binary()
try:
- numbers = ec.EllipticCurvePublicNumbers.from_encoded_point(
+ key = ec.EllipticCurvePublicKey.from_encoded_point(
@vkobel
vkobel / wg0-client1.conf
Created June 23, 2018 16:59
Wireguard config example (VPN home)
[Interface]
Address = 10.0.0.2/24
PrivateKey = <Client 1 Priv Key>
[Peer]
PublicKey = <Server Pub Key>
Endpoint = <Server Public IP>:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

Keybase proof

I hereby claim:

  • I am vkobel on github.
  • I am kob (https://keybase.io/kob) on keybase.
  • I have a public key ASC--Xup1G4N3kXzgP9dyVqlpN2T0Nnc6_K1ds9K7uh4ZAo

To claim this, I am signing this object:

@vkobel
vkobel / EcRecover.sol
Created July 6, 2017 13:40
Ethereum Solidity - example contract that shows how to use the ecrecover function to works along with eth_sign
pragma solidity ^0.4.11;
contract EcRecover {
function verify(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address) {
bytes32 prefixedHash = sha3("\x19Ethereum Signed Message:\n32", hash);
return ecrecover(prefixedHash, v, r, s);
}
}
0xbb14b3d84229e9702fdd0a73056f0bd19236873d