Skip to content

Instantly share code, notes, and snippets.

@jbpzen
jbpzen / vdi-file-compacting.md
Last active August 19, 2022 09:20
How to compact VirtualBox's VDI file size?

BETTER

use CloneVDI.exe to clone to remote disk:

  • keep uuid
  • compact disk backup old replace files

Source: StackOverflow

@jbpzen
jbpzen / script-template.sh
Created December 15, 2020 15:04 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
@jbpzen
jbpzen / bitstringToQrCode.py
Created November 2, 2019 12:15
bitstring to QR Code
from PIL import Image
bitstring=""
outimg= Image.new("RGB",(25,25),"black")
pixels_out = outimg.load()
count=-1
for i in range(0,25):
for j in range (0,25):
@jbpzen
jbpzen / RSA_hastad.py
Created October 31, 2019 18:52
RSA hastad broadcast attack
import gmpy2
N = n1*n2*n3
N1 = gmpy2.div(N,n1)
N2 = gmpy2.div(N,n2)
N3 = gmpy2.div(N,n3)
u1 = gmpy2.invert(N1, n1)
u2 = gmpy2.invert(N2, n2)
u3 = gmpy2.invert(N3, n3)
@jbpzen
jbpzen / base32-padding.go
Created October 17, 2019 12:30 — forked from mndrix/base32-padding.go
Add padding characters to base32 encoded data
package main
import (
"encoding/base32"
"fmt"
"strings"
)
func main() {
data := "2246b2egzcc3ktvvoklo5cvzh4"
@jbpzen
jbpzen / attributes.rb
Created May 7, 2019 16:08 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@jbpzen
jbpzen / startwlan.md
Created April 28, 2019 10:33 — forked from spacehuhn/startwlan.md
little bash script to enable monitor mode

Some wireless cards support monitor mode but won't work with airmon-ng. This is a little script helps you turning the monitor mode on! (+ it also sets the channel and the tx-power)

Usage: startWlan.sh [Interface:wlan0] [Channel:1] [Txpower:30] [Bandwidth:HT20|HT40+|HT40-]

Examples:
./startWlan.sh - enables monitor mode on wlan0, sets channel to 1 and tx-power to 30dBm.
./startWlan.sh wlan1 11 33 - enables monitor mode on wlan1, sets channel to 11 and tx-power to 33dBm.
./startWlan.sh wlan0 6 - enables monitor mode on wlan0, sets channel to 6 and tx-power to 30dBm.

Script:

@jbpzen
jbpzen / content_discovery_nullenc0de.txt
Created April 27, 2019 17:31 — forked from nullenc0de/content_discovery_nullenc0de.txt
content_discovery_nullenc0de.txt
This file has been truncated, but you can view the full file.
/
$$$lang-translate.service.js.aspx
$367-Million-Merger-Blocked.html
$defaultnav
${idfwbonavigation}.xml
$_news.php
$search2
£º
.0
@jbpzen
jbpzen / postgres-cheatsheet.md
Created April 27, 2019 16:08 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@jbpzen
jbpzen / index.sh
Created April 27, 2019 09:40 — forked from max-mapper/index.sh
generate ES512 and RS256 elliptic curve keypairs for JWT JWK (JSON Web Token JSON Web Key) using openssl
# RS256
# private key
openssl genrsa -out rs256-4096-private.rsa 4096
# public key
openssl rsa -in rs256-4096-private.rsa -pubout > rs256-4096-public.pem
# ES512
# private key
openssl ecparam -genkey -name secp521r1 -noout -out ecdsa-p521-private.pem
# public key