Skip to content

Instantly share code, notes, and snippets.

View vpnwall-services's full-sized avatar

Vpnwall Services vpnwall-services

View GitHub Profile
@vpnwall-services
vpnwall-services / omp-commander.sh
Created May 14, 2018 17:10
[OMP Commander] Simplify OMP commands #linux #openvas #shell
#!/bin/bash
if [ -z "$1" ];then
echo "Command ?"
else
COMMAND="$1"
omp --host=localhost --port=9390 --username=admin --password=admin $COMMAND
fi
@vpnwall-services
vpnwall-services / requirements.sh
Last active May 14, 2018 18:56
[Python Rest API] Python example for building an API #linux #python #json #api
#!/bin/bash
cd /opt
mkdir sqlite3-databases ; cd sqlite3-databases
wget http://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip
unzip chinook.zip ; rm chinook.zip
virtualenv venv
source venv/bin/activate
pip install flask flask-jsonpify flask-sqlalchemy flask-restful
pip freeze
@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 / 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
@vpnwall-services
vpnwall-services / first-push.sh
Last active May 14, 2018 21:11
[Github first push] Initialize folder for first push to Github #linux #initial #git
echo "# my project" >> README.md
git init
git add *
git commit -m 'initial commit'
git remote add origin https://github.com/user/project.git
git push -u origin master
@vpnwall-services
vpnwall-services / block-bad.sh
Last active May 14, 2018 23:19
[Block bad IP] Block abusing IP within Iptables #linux #shell #iptables #block
#!/bin/bash
#apt-get install dsniff cutter
echo -e "\nEnter IP you want to block :"
VAR=$1
if [ -z $VAR ]
then
clear
echo -e "\Please input IP and try again ..."
else
echo -e "\nOkay, lets do this ..."
@vpnwall-services
vpnwall-services / remote-forward.sh
Created May 14, 2018 23:53
[Remote port forwarding] Forward a local port to a localhost port on a ssh server #linux #ssh #port #forwarding
#!/bin/bash
# remote port 9000
# local port to forward 3000
ssh -R 9000:localhost:3000 user@example.com
@vpnwall-services
vpnwall-services / reactor-exec.sh
Last active May 21, 2018 15:47
[Push Reactor with Pillar data] Execute a event with data inside #linux #orchestration #saltstack #pillar #reactor #jinja
#!/bin/bash
# Push new dynamic public ip address
# to a dyndns server
salt-call event.send 'vpnwall/custom/event/updatedyndns' \
"{domainname: $(cat /etc/hostname), newip: $(https://icanhazip.com)}"
@vpnwall-services
vpnwall-services / dateinvar.sh
Created May 22, 2018 17:28
[Date in variable name] Append $date to filename #linux #script #basics
#!/bin/bash
today=`date '+%Y_%m_%d__%H_%M_%S'`
filename="/home/el/myfile/$today.ponies"
echo $filename
@vpnwall-services
vpnwall-services / backuprestore.sh
Last active May 22, 2018 19:11
[BackupRestore] Backup and restore functions #linux #script #backup #rsync #menu #array
#!/bin/bash
#PUT DOMAIN NAMES IN THESES VAR
domainnames=("example.com" "example.net")
ctrl_c(){
echo -e "quitting ..."
exit 130;
}