Public Websites
For the last few years, I have been maintaining multiple websites for myself and my clients.
The following are the active sites that I continue to maintain and server on my own public facing servers both on-prem and in the cloud.
Windows: Backup user Libraries
This project was a tool dedicated to backing up all user libraries in Windows so the user can rest assured that their data is safe. This code can back up to a network drive so if the computer is not backed up, but the server is, the data the matters will be recoverable.
Code Bits:
SET DriveLetter=P:
SET BackupLocation=\\DC1\Shared\1Backups
SET NetworkAdmin=Admin
SET NetworkAdminPassword=Password
REM Force the mounting by offering the credentials
net use %DriveLetter% %BackupLocation% /user:%NetworkAdmin% %NetworkAdminPassword%
REM Get Current Date
for /F “tokens=1,2,3 delims=_” %%i in (‘PowerShell -Command “& {Get-Date -format “MM_dd_yyyy”}”‘) do (
set MONTH=%%i
set DAY=%%j
set YEAR=%%k
)
REM Make a folder for this PC’s user data to be put.
set SaveDirectory=%computername%-%MONTH%.%DAY%.%YEAR%
mkdir %DriveLetter%\%SaveDirectory%
REM Backup the User Libraries
Robocopy C:\Users\ %DriveLetter%\%SaveDirectory% /MIR /XA:SH /XD AppData /XJD /R:5 /W:15 /MT:32 /V /NP /LOG:Backup.log
echo %message% >> Backup.log
Linux Firewalls
This project was a giant Firewall Configuration tool. There are a total of 29 options that you can set all of which are predefined with the proper IP Tables to open or lock down ports.
Code Bits:
elif [[ “$answer” == 27 ]];
then
### 27: Allow/Block IP Address. ###
echo “What IP Address do you want to block or unblock?”
read IPAddress
if [[ $IPAddress =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]];
then
sudo iptables -$action INPUT -s $IPAddress -j DROP
fi
elif [[ “$answer” == 23 ]];
then
### Allow basic webserver configuration ###
#HTTP and HTTPS
sudo iptables -$action INPUT -p tcp -m multiport –dports 80,443 -m conntrack –ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -$action OUTPUT -p tcp -m multiport –dports 80,443 -m conntrack –ctstate ESTABLISHED -j ACCEPT
Linux Networking
This project was a tool dedicated to showing you everything Networking on your Linux (Ubuntu or CentOS) machine.
Code Bits:
myip=”$(dig +short myip.opendns.com @resolver1.opendns.com)”
printf “\n\nMy WAN/Public IP address: ${myip}\n” | tee -a $file
#Get Internal IP Addresses
ip link show >> links.txt
#Get the DNS being used by Linux. This information is from: /etc/resolv.conf
DNS=$(awk ‘{for(i=1;i<=NF;i++)if($i==”nameserver”)print $(i+1)}’ /etc/resolv.conf)
printf “\n\nDNS Servers: $DNS” | tee -a $file
MAC=$(ifconfig eth0 | grep -Eo ..\(\:..\){5})
printf “\n\nHardware Address: $MAC\n” | tee -a $file
#Check for open ports – outputs open ports, what’s listening, and if programs are using it.
printf “\n\nOpen Ports:”
ports=$(netstat -atup)
printf “\n\nYour ports are:\n$ports” | tee -a $file