Skip to content

Instantly share code, notes, and snippets.

@garytan
garytan / grow_part.sh
Created August 16, 2023 07:17
enlarge disk partition of linux vm
#!/bin/bash
echo 1 > /sys/class/block/sda/device/rescan
sudo apt-get install -y cloud-utils
growpart /dev/sda 1
resize2fs /dev/sdba
@garytan
garytan / get_tds_cert.py
Created July 19, 2023 08:00 — forked from lnattrass/get_tds_cert.py
A terrible way to connect to MS SQL Server and dump the certificate as a PEM
import sys
import pprint
import struct
import socket
import ssl
from time import sleep
# Standard "HELLO" message for TDS
prelogin_msg = bytearray([ 0x12, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x06, 0x01, 0x00, 0x20,
0x00, 0x01, 0x02, 0x00, 0x21, 0x00, 0x01, 0x03, 0x00, 0x22, 0x00, 0x04, 0x04, 0x00, 0x26, 0x00,

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

@garytan
garytan / build-openssl.sh
Created July 15, 2020 03:15 — forked from bmaupin/build-openssl.sh
Build openssl (with SSLv2/3 support for security testing)
#!/bin/bash
# Cache sudo password
sudo -v
# Get latest OpenSSL 1.0.2 version from https://openssl.org/source/
# v1.1.0 seems to have removed SSLv2/3 support
openssl_version=1.0.2k
# Install build dependencies
# repack
apktool b <apk_folder> -o <output_path>
# self signed certificate
keytool -genkey -v -keystore my-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-key.keystore xxx.apk alias_name
Acta: admin / 123456
Appro: admin / 9999
Avigilon: admin / admin
Axis: root / pass
Basler: admin / admin
Boschs: service / service
Brickcom: admin / admin
Canon: root / (Camera Model)
CBC: admin / admin
CNB: root / admin
adb shell pm list packages
adb shell pm path com.example.someapp
adb pull /data/app/com.example.someapp-2.apk path/to/desired/destination
enablecredsspsupport:i:0
// Default
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
// ACCEPT
iptables -A INPUT -i ens33 -s 192.168.1.0/24 -j ACCEPT
// STATEFUL
iptables -A INPUT -i ens33 -m state --state ESTABLISHED,RELATED -j ACCEPT
$ ssh-keygen -o -a 100 -t ed25519