$ nmap -sC -sV -Pn 10.10.10.88 Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-04-30 13:59 CST Nmap scan report for 10.10.10.88 Host is up (0.067s latency). Not shown: 999 closed ports PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) | http-robots.txt: 5 disallowed entries | /webservices/tar/tar/source/ | /webservices/monstra-3.0.4/ /webservices/easy-file-uploader/ |_/webservices/developmental/ /webservices/phpmyadmin/ |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-title: Landing Page
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 31.70 seconds
#------------------------------------------------------------------------------------- # backuperer ver 1.0.2 - by ȜӎŗgͷͼȜ # ONUMA Dev auto backup program # This tool will keep our webapp backed up incase another skiddie defaces us again. # We will be able to quickly restore from a backup in seconds ;P #-------------------------------------------------------------------------------------
# Set Vars Here basedir=/var/www/html bkpdir=/var/backups tmpdir=/var/tmp testmsg=$bkpdir/onuma_backup_test.txt errormsg=$bkpdir/onuma_backup_error.txt tmpfile=$tmpdir/.$(/usr/bin/head -c100 /dev/urandom |sha1sum|cut -d' ' -f1) check=$tmpdir/check
# formatting printbdr() { for n in $(seq 72); do /usr/bin/printf $"-"; done } bdr=$(printbdr)
# Added a test file to let us see when the last backup was run /usr/bin/printf $"$bdr\nAuto backup backuperer backup last ran at : $(/bin/date)\n$bdr\n" > $testmsg
# Cleanup from last time. /bin/rm -rf $tmpdir/.* $check
# Added delay to wait for backup to complete if large files get added. /bin/sleep 30
# Test the backup integrity integrity_chk() { /usr/bin/diff -r $basedir$check$basedir }
/bin/mkdir $check /bin/tar -zxvf $tmpfile -C $check if [[ $(integrity_chk) ]] then # Report errors so the dev can investigate the issue. /usr/bin/printf $"$bdr\nIntegrity Check Error in backup last ran : $(/bin/date)\n$bdr\n$tmpfile\n" >> $errormsg integrity_chk >> $errormsg exit 2 else # Clean up and save archive to the bkpdir. /bin/mv $tmpfile$bkpdir/onuma-www-dev.bak /bin/rm -rf $check .* exit 0 fi
# set both start and cur equal to any backup file if it's there start=$(find /var/tmp -maxdepth 1 -type f -name ".*") cur=$(find /var/tmp -maxdepth 1 -type f -name ".*")
# loop until there's a change in cur echo"Waiting for archive filename to change..." while [ "$start" == "$cur" -o "$cur" == "" ] ; do sleep 10; cur=$(find /var/tmp -maxdepth 1 -type f -name ".*"); done
# Grab a copy of the archive echo"File changed... copying here" cp $cur .
# get filename fn=$(echo$cur | cut -d'/' -f4)
# extract archive tar -zxf $fn
# remove robots.txt and replace it with link to root.txt rm var/www/html/robots.txt ln -s /root/root.txt var/www/html/robots.txt
# remove old archive rm $fn
# create new archive tar czf $fn var
# put it back, and clean up mv $fn$cur rm $fn rm -rf var
# wait for results echo"Waiting for new logs..." tail -f /var/backups/onuma_backup_error.txt