Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
vpnwall-services / kali-repository
Last active November 26, 2023 19:04
[Kali-Repo] Adds Kali Repository on Linux #linux #repo
#!/bin/bash
apt-get update ; apt-get install -y dirmngr
grep -q -F 'deb http://http.kali.org/kali kali-rolling main contrib non-free' /etc/apt/sources.list || echo 'deb http://http.kali.org/kali kali-rolling main contrib non-free' >> /etc/apt/sources.list
apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6
apt-get update
apt-get install -y -t kali-rolling
@vpnwall-services
vpnwall-services / template.service
Created April 20, 2018 03:46
[Systemd Service Template] Skeleton for a new Systemd service #linux #systemd # service
#Put me in /lib/systemd/system/
[Unit]
Description=My Miscellaneous Service
After=network.target
[Service]
Type=simple
User=nanodano
WorkingDirectory=/home/nanodano
ExecStart=/home/nanodano/my_daemon --option=123
@vpnwall-services
vpnwall-services / clean-old-kernels.sh
Last active October 26, 2024 03:57
[Clean old kernels] Script to deleted unused kernels and free disk space
#!/bin/bash
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get purge -y
@vpnwall-services
vpnwall-services / findbigfiles.sh
Last active October 9, 2018 11:05
[Find big files] Help to find biggest files to free some space #linux #space
#!/bin/bash
#du -a / | sort -n -r | head -n 5
du -Sh / | sort -rh | head -5
find -type f -exec du -Sh {} + | sort -rh | head -n 5
apt-get install -y ncdu
ncdu /
@vpnwall-services
vpnwall-services / find-multi-args.sh
Created April 20, 2018 03:53
[Find with multi arguments] Search with two or more arguments #linux #search
find . -regextype posix-egrep -regex ".*\.(html|scan)"
@vpnwall-services
vpnwall-services / generate-self-cert.sh
Last active December 22, 2020 16:29
[Generate self-signed certificate] Create a self-signed certificate #linux #certificate #ssl
#!/bin/bash
# Generate key and certificate
openssl genrsa -out privkey.pem 4096
openssl req -new -x509 -key privkey.pem -out cert.pem -days 1826
# Generate full self-signed certificate chain
# Create root key
openssl genrsa -des3 -out rootCA.key 4096
@vpnwall-services
vpnwall-services / gen-rand-pass.sh
Last active November 4, 2024 04:24
[Generate random password] Generate a password randomly #linux # generate #password
#!/bin/bash
# Echo three passwords
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%+'|fold -w 28| head -n 3
# Echo one password and put it in clipboard
# Requirements: apt-get install -y xclip
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%+'|fold -w 28| head -n 1|xclip"
openssl rand 60 | openssl base64 -A
@vpnwall-services
vpnwall-services / public_ip.sh
Last active May 14, 2018 20:48
[Get public IP] Retrieve public IP address #linux #ip
#!/bin/bash
curl https://icanhazip.com
@vpnwall-services
vpnwall-services / metasploit-installer.sh
Last active May 24, 2020 01:33
[Metasploit Installer] Automated compilation installer for Metasploit #metasploit #linux #installer
#!/bin/bash
add-apt-repository -y ppa:webupd8team/java
apt-get update
apt-get -y install gpg2
apt-get -y install oracle-java8-installer
apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
@vpnwall-services
vpnwall-services / askvar.sh
Last active May 14, 2018 20:49
[Ask parameter in Bash] Function for asking var to user and check if it's empty or not #bash #variable #loop #example
echo -e "\nEnter your var :"
VAR=$1
if [ -z $VAR ]
then
clear
echo -e "\nvar is empty, try again ..."
else
echo -e "\nvar is okay, lets do this ..."
fi