Skip to content

Instantly share code, notes, and snippets.

View csobankesmarki's full-sized avatar
💭
Just meditate.

Csoban Kesmarki csobankesmarki

💭
Just meditate.
  • Hungary
View GitHub Profile
@csobankesmarki
csobankesmarki / sec_browse.py
Created May 17, 2020 21:47 — forked from rootVIII/sec_browse.py
sec_browse.py - Auto-configures Firefox network settings and opens a secure Tor/Firefox browser session for the # time specified by -t
#! /usr/bin/python3
from os import popen, remove, getcwd
from selenium import webdriver
from subprocess import call
from sys import exit
from time import sleep
from argparse import ArgumentParser
from threading import Thread
# rootVIII
# sec_browse.py - Auto-configures Firefox network settings
@csobankesmarki
csobankesmarki / register.sh
Last active November 19, 2020 07:20
register new or verify existing Let's Encrypt account by using secret key
#!/usr/bin/env bash
#
# This file register a new or verify an existing Let's Encrypt account
# Usage:
# re-register.sh <secret key file> <e-mail address>
#
# It will provide the json reply from Let's Encrypt when trying to register an
# account with a key assigned even if the account exists already.
# The json contains the details of the new/existing account.
package main
/*
#cgo CFLAGS: -I/usr/include/
#cgo LDFLAGS: -ldinamo -ltacndlib
#include <dinamo.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
package main
import (
"crypto"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/ThalesIgnite/crypto11"
@csobankesmarki
csobankesmarki / ssh_term_pkcs11_2.go
Created November 19, 2020 07:39 — forked from blacknon/ssh_term_pkcs11_2.go
ssh_term_pkcs11_2.go
package main
import (
"crypto"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/ThalesIgnite/crypto11"
copied from http://www.lorier.net/docs/ssh-ca - all credit there.
## Using a CA with SSH
Using a CA with ssh means you can sign a key for a user, and everywhere that the user trusts the CA you can login, without having to copy your SSH key everywhere again. This allows for things like fast rollover of keys (eg: daily), or trusting the fingerprint of a machine that you're logging into, which can be very useful when you're managing large numbers of machines, or machines that get new host keys (eg by reinstalling) regularly.
You'll probably want at least openssh 5.6, although some of the functionality is available in 5.3.
Creating the CA key
ssh-keygen -f /etc/ssh/ca
@csobankesmarki
csobankesmarki / convert private key
Last active July 18, 2024 17:12
Convert OpenSSH ED25519 to OpenSSL ED25519
(printf \\x30\\x2e\\x02\\x01\\x00\\x30\\x05\\x06\\x03\\x2b\\x65\\x70\\x04\\x22\\x04\\x20;egrep -v "^-" | tr -d '\n' | base64 -d | dd bs=161 skip=1 2>/dev/null | dd bs=32 count=1 2>/dev/null) | openssl pkey -inform der -outform pem
@csobankesmarki
csobankesmarki / gitignore_per_git_branch.md
Created October 8, 2021 06:27 — forked from wizioo/gitignore_per_git_branch.md
HowTo have specific .gitignore for each git branch

How to have specific .gitignore for each git branch

Objective

My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.

Solution

My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion. I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.

@csobankesmarki
csobankesmarki / socket_file.sh
Created October 21, 2021 13:15 — forked from jadell/socket_file.sh
Read and write to a socket using only Bash
#!/bin/bash
#
# Bash must have been compiled with this ability: --enable-net-redirections
# The device files below do not actually exist.
# Use /dev/udp for UDP sockets
exec 3<>/dev/tcp/host/port
# Write to the socket as with any file descriptor
echo "Write this to the socket" >&3
@csobankesmarki
csobankesmarki / unix_socket.sh
Created October 21, 2021 13:19
Read and write UNIX sockets from BASH
#!/bin/bash
while true; do
SKT_PATH=/var/run/mysock.sock
rm $SKT_PATH
INPUT=$(mktemp -u)
mkfifo -m 600 "$INPUT"
OUTPUT=$(mktemp -u)
mkfifo -m 600 "$OUTPUT"