This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
IFS=$'\n' | |
arr=($(dig @dns.server domain_to_search axfr)) | |
unset IFS | |
for i in "${arr[@]:6:92}" | |
do | |
echo "$i" | awk '{print $5,$1}' | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
(echo "Content-Type: text/html"; curl localhost/cgi-bin/report.cgi) | /usr/sbin/sendmail [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
repo_name=$1 | |
test -z $repo_name && echo "Repo name required." 1>&2 && exit 1 | |
curl -u 'username_github' https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
shopt -s nullglob | |
data=(/nas/csi/*) | |
key="$HOME"/.ssh/csi | |
[email protected]:/Drop | |
archive=/nas/data/.data_archive | |
now=$(date +"%Y%m%d-%T") | |
sftp_copy () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#GLOBAL VARS | |
set -x | |
DATE=`date +%Y-%m-%d.%H:%M:%S` | |
RECIPIENTS="[email protected]" | |
STAGING=/nas/tbdata/.encrypted_file | |
EXTRACT=/nas/tbdata2 | |
ARCHIVE=/nas/tbdata/.encrypted_file/md5 | |
MD5="[email protected]:/erp.tar.gpg.md5" | |
DATA="[email protected]:/erp.tar.gpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
shopt -s nullglob | |
exec > /path/to/logfile | |
# Variables | |
sql_path="/path/to/backup" | |
data_path="/path/to/backup" | |
days=7 | |
testvalue=1 | |
# Arrays | |
mapfile -t sql < <(find "$sql_path" -type f -mtime -"$days") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raw=/path/to/dir | |
files=("$raw"/*) | |
for each in "${files[@]}"; do | |
echo "$each" | |
sleep 3 | |
done | |
count=${#files[@]} | |
files_ordered=() | |
for (( i = 0; i < count; i++ )); do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ $(grep -o '\.' file|wc -l) -gt 3 ] && sed -i file -e 's/\./+/g' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create a secure server on your lan e.g. raspi | |
#invoke the following command from the server you will use as socks5 proxy specify port. | |
ssh -o ServerAliveInterval=60 -D0.0.0.0:8888 -f -N "host_with_www_connection" | |
#we have forked a background ssh process creating a socks5 proxy dynamically on ALL interfaces using 8888 on localhost, check with... | |
netstat -ntlp | |
#turn on the firewalld service | |
systemctl status firewalld.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SITESFILE=sites.txt #list the sites you want to monitor in this file | |
#EMAILS="[email protected],[email protected]" #list of email addresses to receive alerts (comma separated) | |
while read site; do | |
if [ ! -z "${site}" ]; then | |
CURL=$(curl -s --head $site) |