-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from MrMarioMichel/development
Main-Beta-v5.0
- Loading branch information
Showing
21 changed files
with
350 additions
and
172 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
#!/bin/bash | ||
date=`date +%d%m%y` | ||
date=$(date +%d%m%y) | ||
# --------------------------------------------- | ||
cd PLACEHOLDERFORINSTALLATIONPATH | ||
# --------------------------------------------- | ||
# | ||
echo "[i]: Start of backup @ $(date +%H:%m)" >> ./Log/Backup/log$date.txt | ||
|
||
### Backup Modules ### | ||
./Modules/Backup/Fortinet/Fortinet.sh &>> ./Log/Fortinet/log$date.txt | ||
#./Modules/Backup/Fortinet/Fortinet-Special.sh &>> ./Log/Fortinet/log$date.txt ### Disabled by default ### | ||
./Modules/Backup/Cisco/Cisco.sh &>> ./Log/Cisco/log$date.txt ### Only for sgx00 series working ### | ||
#./Modules/Backup/DELL/DELL.sh &>> ./Log/DELL/log$date.txt ### NOT YET FUNCTIONAL! ### | ||
#./Modules/Backup/HP/HP.sh &>> ./Log/HP/log$date.txt ### NOT YET FUNCTIONAL! ### | ||
# ./Modules/Backup/Fortinet/Fortinet.sh &>> ./Log/Fortinet/log$date.txt ### FUNCTIONAL ### | ||
# ./Modules/Backup/Fortinet/Fortinet-Special.sh &>> ./Log/Fortinet/log$date.txt ### Disabled by default FUNCTIONAL ### | ||
# ./Modules/Backup/Cisco/Cisco.sh &>> ./Log/Cisco/log$date.txt ### Only for sgx00 & n3XXX series working ### | ||
# ./Modules/Backup/DELL/DELL.sh &>> ./Log/DELL/log$date.txt ### Only for nXXXX series working ### | ||
# ./Modules/Backup/HP/HP.sh &>> ./Log/HP/log$date.txt ### NOT YET FUNCTIONAL! ### | ||
|
||
### Archive Compression/Stats/Debugs & Loging ### | ||
### Archive Compression/Debugs & Stats ### | ||
|
||
# Compression | ||
./Modules/Archive/OldConfigsArchiver.sh &> ./Log/Backup/log$date.txt ### Used for compression and deleteion of old configs ### | ||
./Modules/Archive/OldLogsArchiver.sh &> ./Log/Backup/log$date.txt ### Used for compression and deleteion of old logs ### | ||
|
||
# Stats | ||
./Modules/Archive/ArchiveStats.sh &> ./Log/Backup/log$date.txt ### Used for displaying archive stats ### | ||
./Modules/Archive/OldConfigs/Archiver.sh &>> ./Log/Backup/log$date.txt ### Used for compression and deleteion of old configs ### | ||
./Modules/Archive/OldLogs/Archiver.sh &>> ./Log/Backup/log$date.txt ### Used for compression and deleteion of old logs ### | ||
|
||
# Debug | ||
./Modules/Archive/Checker.sh &> ./Log/Backup/log$date.txt ### Used for config copy debugging ### | ||
./Modules/Archive/Fastdebug.sh > ./Log/Failed/Failed-$date.txt ### Used for check failed backup attempts | ||
|
||
#./Modules/FirmwareCheck/Fortinet/FirmwareChecker.sh | sed $'s/<br>/\\\n/g' | sed 'N;s/\n/ /' > ./Devices/Firmware-Versions/Fortinet-Firmware-$date.txt ### Disabled by default ### | ||
./Modules/Archive/Fastdebug.sh &>> ./Log/Failed/Failed-$date.txt ### Used for config copy debugging ### | ||
|
||
# Stats | ||
./Modules/Archive/ArchiveStats.sh &>> ./Log/Backup/log$date.txt ### Used for displaying archive and varius stats ### | ||
# ./Modules/FirmwareCheck/Fortinet/FirmwareChecker.sh ### Disabled by default ### | ||
echo "[i}: End of backup @ $(date +%H:%m)" >> ./Log/Backup/log$date.txt |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,34 @@ | ||
#!/bin/bash | ||
date=`date +%d%m%y` | ||
echo "Current size of ./Archive : $(du -sh ./Archive)" | ||
echo "Current configs in ./Archive $(tree | grep .conf | wc -l)" | ||
|
||
# Stats | ||
currentsizearchive=$(du -sh ./Archive --exclude=./Archive/resources | awk '{print $1}')B | ||
totalconfigsarchive=$(tree | grep .conf | wc -l) | ||
totallines=$(find ./Archive -name "*.conf" -mmin -120 -exec cat {} + | wc -l) | ||
configsinarchive=$(find ./Archive -maxdepth 2 -type f -name "*.conf" -mmin -120 | wc -l) | ||
fortinethostfilecount=$(egrep -v "^\s*(#|$)" ./Devices/Fortinet/Fortinet-Devices.txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | wc -l) | ||
hphostfilecount=$(egrep -v "^\s*(#|$)" ./Devices/HP/HP-Devices.txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | wc -l) | ||
ciscohostfilecount=$(egrep -v "^\s*(#|$)" ./Devices/Cisco/Cisco-Devices.txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | wc -l) | ||
dellhostfilecount=$(egrep -v "^\s*(#|$)" ./Devices/DELL/DELL-Devices.txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | wc -l) | ||
dirsinarchive=$(find ./Archive -maxdepth 1 -type d | wc -l) | ||
minus2=2 # Caused by also counting the ./Archive and ./Archive/resources as a folder | ||
minus1=1 # Caused by also counting the./Archive/resources/config.php as a .conf file | ||
|
||
# Quick Math | ||
avglinesinconfig=$((expr $totallines / $configsinarchive)) | ||
total=$((expr $fortinethostfilecount + $hphostfilecount + $ciscohostfilecount + $dellhostfilecount)) | ||
dirsinarchive=$((expr $dirsinarchive - $minus2)) | ||
totalconfigsarchive=$((expr $totalconfigsarchive - $minus1)) | ||
|
||
echo "------------------------------------------------" | ||
echo "Fortinet hosts in host file .......... $fortinethostfilecount" | ||
echo "HP hosts in host file ................ $hphostfilecount" | ||
echo "Cisco hosts in host file ............. $ciscohostfilecount" | ||
echo "DELL hosts in host file .............. $dellhostfilecount" | ||
echo "Total hosts in host files ............ $total" | ||
echo "Directories in Archiv ................ $dirsinarchive" | ||
echo "Current Configs in Archive ........... $configsinarchive" | ||
echo "Total configs in ./Archive ........... $totalconfigsarchive" | ||
echo "Current size of ./Archive ............ $currentsizearchive" | ||
echo "Total lines operating firewalls ...... $totallines" | ||
echo "Average lines in conifig file ........ $avglinesinconfig" | ||
echo "------------------------------------------------" |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,6 @@ | ||
#!/bin/bash | ||
|
||
user=backup | ||
|
||
echo "[i]: Started Backup of Configs : CISCO" | ||
|
||
for device in `cat ./Devices/Cisco/Cisco-Devices.txt | egrep -v "^\s*(#|$)" | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"` | ||
do | ||
echo -e "[i]: Host --> $device" | ||
if ping -c 3 $device &> /dev/null | ||
then | ||
echo "[i]: $device reachable" | ||
./sgX00.sh $device | ||
name=`cat BackupConfigCisco | grep hostname | sed 's|["?]||g' | sed 's/hostname //'` | ||
mkdir -v Archive/$name | ||
date=`date +"%H-%M_%d-%m-%Y"` | ||
mv -v BackupConfigCisco ./Archive/$name/$name-$date.conf | ||
if [ -f ./Archive/$name/$name-$date.conf ] | ||
then | ||
echo "[i]: File $name-$date.conf found!" | ||
echo "[i]: $device backup succeeded" | ||
else | ||
echo "[i]: File $name-$date.conf not found!" | ||
echo "[i]: $device backup failed" | ||
fi | ||
else | ||
echo "[i]: $device not reachable" | ||
fi | ||
done | ||
# ./Modules/Backup/Cisco/sgX00.sh | ||
# ./Modules/Backup/Cisco/n3XXX.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
user="cisco" | ||
passwd="XXXXXXPASSWORDXXXXXX" | ||
|
||
echo "[i]: Started Backup of Configs : Cisco (n3XXX.sh)" | ||
|
||
for device in $(egrep -v "^\s*(#|$)" ./Devices/Cisco/Cisco-N3xxx-txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") | ||
do | ||
echo -e "[i]: Host --> $device" | ||
if ping -c 3 $device &> /dev/null | ||
then | ||
echo "[i]: $device reachable" | ||
sshpass -p "$passwd" ssh -tt $user@$device <<EOF > BackupConfigCiscoTEMP1 | ||
terminal length 0 | ||
show startup-config | ||
exit | ||
EOF | ||
name=$(grep hostname ./BackupConfigCiscoTEMP1 | sed 's|["?]||g' | sed 's/hostname //' | tr -dc '[:print:]') | ||
grep -v "$name#" BackupConfigCiscoTEMP1 | sed 's/terminal length 0//g' | sed 's/show startup-config//g' | sed 's/exit//g' > BackupConfigCisco | ||
if [ -z "$name" ] | ||
then | ||
echo "[i]: $device Name not found" | ||
else | ||
echo "[i]: $device Name found $name" | ||
mkdir -v ./Archive/$name | ||
date=$(date +"%H-%M_%d-%m-%Y") | ||
mv -v ./BackupConfigCisco ./Archive/$name/$name-$date.conf | ||
if [ -f ./Archive/$name/$name-$date.conf ] | ||
then | ||
echo "[i]: File $name-$date.conf found" | ||
echo "[i]: $device backup succeeded" | ||
else | ||
echo "[i]: File $name-$date.conf not found" | ||
echo "[i]: $device backup failed" | ||
fi | ||
fi | ||
else | ||
echo "[i]: $device not reachable" | ||
fi | ||
done |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
# _ _ _ _ _____ ______ _____ _____ ____ _ _ _____ _______ _____ _ _ _____ _______ _____ ____ _ _ | ||
# | | | | \ | | __ \| ____| __ \ / ____/ __ \| \ | |/ ____|__ __| __ \| | | |/ ____|__ __|_ _/ __ \| \ | | | ||
# | | | | \| | | | | |__ | |__) | | | | | | | \| | (___ | | | |__) | | | | | | | | || | | | \| | | ||
# | | | | . ` | | | | __| | _ / | | | | | | . ` |\___ \ | | | _ /| | | | | | | | || | | | . ` | | ||
# | |__| | |\ | |__| | |____| | \ \ | |___| |__| | |\ |____) | | | | | \ \| |__| | |____ | | _| || |__| | |\ | | ||
# \____/|_| \_|_____/|______|_| \_\ \_____\____/|_| \_|_____/ |_| |_| \_\\____/ \_____| |_| |_____\____/|_| \_| | ||
|
||
# Still working on this. (NOT YET FUNCTIONAL!) | ||
|
||
#!/bin/bash | ||
|
||
user=backup | ||
|
||
echo "Started Backup of Config's" | ||
|
||
for device in `cat ./Devices/DELL/DELL-Devices.txt | egrep -v "^\s*(#|$)"` # Will have a look in the file "DELL-Devices.txt" for all DELL devices | ||
do | ||
echo "[i]: Started Backup of Configs : DELL" | ||
|
||
done | ||
# ./Modules/Backup/DELL/nXXXX.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
user="dell" | ||
passwd="XXXXXXPASSWORDXXXXXX" | ||
|
||
echo "[i]: Started Backup of Configs : DELL (nXXXX.sh)" | ||
for device in $(egrep -v "^\s*(#|$)" ./Devices/DELL/NXXXX.txt | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") | ||
do | ||
echo -e "[i]: Host --> $device" | ||
sshpass -p "$passwd" \ssh -v $user@$device <<EOF > BackupConfigDELLTEMP1 | ||
enable | ||
show running-config | ||
exit | ||
exit | ||
exit | ||
EOF | ||
name=$(grep "hostname" BackupConfigDELLTEMP1 | sed 's|["?]||g' | sed 's/hostname //' | tr -dc '[:print:]') | ||
grep -v "$name>" BackupConfigDELLTEMP1 | grep -v "$name#"> BackupConfigDELL | ||
mkdir -v Archive/$name | ||
date=$(date +"%H-%M_%d-%m-%Y") | ||
mv -v BackupConfigDELL ./Archive/$name/$name-$date.conf | ||
rm BackupConfigDELLTEMP1 | ||
if [ -f ./Archive/$name/$name-$date.conf ] | ||
then | ||
echo "[i]: File $name-$date.conf found!" | ||
echo "[i]: $device backup succeeded" | ||
else | ||
echo "[i]: File $name-$date.conf not found!" | ||
echo "[i]: $device backup failed" | ||
fi | ||
done |
Oops, something went wrong.