Skip to content

Instantly share code, notes, and snippets.

View lichti's full-sized avatar
👨‍💻
🏊🏻🚴🏻🏃🏻

Gustavo Lichti lichti

👨‍💻
🏊🏻🚴🏻🏃🏻
View GitHub Profile
@lichti
lichti / scan_hosts.sh
Last active January 4, 2024 22:46
Automate nmap scanning for multiple domains with threads
#!/bin/bash
# Author: Gustavo Lichti
# Email: [email protected]
# Usage: ./scan_hosts.sh --hosts <hosts_file> --host xpto.xxx --host xpto2.xxx --threads <number_of_threads> --output <output_directory>
SCRIPT_STARTED=$(date +"%Y%m%d_%H%M")
# Function do add log Line
@lichti
lichti / rgvalidator.py
Created November 11, 2020 05:39
Validate Brazilian RG
###
# Explain
# RG Number -> AB.CDE.FGH-V
# X=(Hx9)+(Gx8)+(Fx7)+(Ex6)+(Dx5)+(Cx4)+(Bx3)+(Ax2)+(100xV)
# Y= X%11
# If Y (rest of division) is 0 the RG is Valid
###
# Function to validate Brazilian "RG"
def isValidRG(number,dv):
@lichti
lichti / dog.sh
Created January 2, 2020 15:32 — forked from flyzjhz/dog.sh
Openwrt watchdog script
#!/bin/sh
# save dog.sh in /root/dog.sh.
# You can use winscp with scp protocol to do this.
# Using ssh set executation permission and replace the crontab:
# chmod +x /root/dog.sh
# echo "* * * * * /root/dog.sh" | crontab -
# fix wpad / wpad-mini / hostapd stop working bug
logread -l 100 | grep -n "IEEE 802.11: did not acknowledge authentication response"
@lichti
lichti / yubikey_unlock_luks.sh
Created February 6, 2019 18:14
Using yubikey to unlock LUKS partitions
# Using yubikey to unlock LUKS partitions
# My SDB3 is a partitions with luks, with lvm and ma root fs (/)
# My SDA1 ia my data partition with luks mounted at /data
# I will use yubikey as 2FA to unlock the SDB3 and the SDA1 will be unlocked by a key file
## On SDB3
# Configure the slot two of yubikey to challenge mode
@lichti
lichti / yubikey_pam_auth.sh
Created February 6, 2019 18:02
Script to configure yubikey as a 2FA in linux login
# Script to configure yubikey as a 2FA in linux login
# Distro Ubuntu 18.04
# Install pam module
sudo apt install libpam-u2f
# Register device for user
pamu2fcfg -u<user> | sudo tee -a /etc/u2f_mappings
# Cofigure yubike as required to login
@lichti
lichti / yubikey_lock_device.sh
Created February 6, 2019 17:52
This process do lock all sessions when a yubikey is removed from device
#!/bin/bash
# This process do lock all sessions when a yubikey is removed from device
# Script to block all open sessions
cat <<-'EOF' | sudo tee /usr/local/bin/gnome_lock_all_sessions
#!/bin/sh
for bus in /run/user/*/bus; do
echo "bus: ${bus}"
uid=$(basename $(dirname $bus))
@lichti
lichti / lichti-swap-usage.sh
Created November 3, 2018 20:44
who is using your swap?
function lichti-swap-usage {
echo "Mem status";
echo "========================================";
free -m
echo "========================================";
SORT="kb"; # {pid|kB|name} as first parameter, [default: kb]
[ "$1" != "" ] && { SORT="$1"; }
[ ! -x `which mktemp` ] && { echo "ERROR: mktemp is not available!"; exit; }
MKTEMP=`which mktemp`;
@lichti
lichti / Bandit.txt
Created September 11, 2018 13:51
Python Bandit Howto SAST
git clone xxxx
cd xxxx
virtualenv .venv
source .venv/bin/activate
pip install bandit
bandit -r ./src -f html -o output.html -x /tests -v -ll -lll
@lichti
lichti / sast-ast-tools.txt
Created September 11, 2018 04:20
SAST - AST - Tools
[all]
https://github.com/mre/awesome-static-analysis
https://www.owasp.org/index.php/Source_Code_Analysis_Tools
https://samate.nist.gov/index.php/Source_Code_Security_Analyzers.html
[Python]
https://bandit.readthedocs.io/en/latest/
https://github.com/PyCQA/bandit
https://github.com/python-security/pyt
@lichti
lichti / grafana-dash-gen.txt
Created September 2, 2018 16:58
Grafana dashboard generator
https://github.com/uber/grafana-dash-gen
https://github.com/weaveworks/grafanalib