Backing-up your Acunetix data and settings is important and should be done frequently, especially on production systems. This post will show how to do this manually and will also offer a sample implementation in PowerShell for automating the process.
Stopping Acunetix services
Before taking a backup, be certain that no scans are running and stop the two services associated with Acunetix – the ‘Acunetix’ and ‘Acunetix Database’ services.
You can either do this from the Windows Task Manager, or from a PowerShell prompt as follows.
Stop-Service -DisplayName 'Acunetix'
Stop-Service -DisplayName 'Acunetix Database'
Backing up files and Data
The next step is to backup files and data. Acunetix stores all its data in C:\ProgramData\Acunetix 11. While you can simply backup and restore the entire directory, depending on your requirements, you may wish to omit the directories listed below from your backup.
- Logs – The C:\ProgramData\Acunetix 11\logs directory consists of log files generated by Acunetix. Since Acunetix logs are mainly used for debugging purposes, you may wish to omit them from your backup.
- Scan Logs – The C:\ProgramData\Acunetix 11\share\scans directory consists of scan logs and other files used for troubleshooting purposes. Since such data is used for debugging you may wish to omit them from your backup.
- Updates – The C:\ProgramData\Acunetix 11\share\updates directory consists of updates downloaded by Acunetix. These updates will be re-downloaded by Acunetix if needed and can be omitted from backups.
Re-starting Acunetix Services
Once you copy over all the files you need, to restart Acunetix, simply restart the same two services stopped earlier.
You can either do this from the Windows Task Manager, or from a PowerShell prompt as follows.
Start-Service -DisplayName 'Acunetix'
Start-Service -DisplayName 'Acunetix Database'
Automating Backups
The following is a sample implementation of the above backup procedure using PowerShell 5.0. Of course, you can customize this further to fit your requirements.
# Check if user running this script is an Administrator
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script`nPlease re-run this script as an Administrator"
Break
}
# Set variables
$src = 'C:\ProgramData\Acunetix\*' # Source directory
$dst = 'C:\backup' # Destination directory
$wrk = Join-Path -ChildPath 'tmp' -Path $dst # Working directory
$excls = @('logs','shared\scans','shared\updates')
# Stop Acunetix
Stop-Service -DisplayName 'Acunetix'
Stop-Service -DisplayName 'Acunetix Database'
# Create the working directory
mkdir -Path $wrk -Force
# Copy files
Copy-Item -Path $src -Destination $wrk -Recurse
# Remove excluded directories from backup
ForEach($excl in $excls)
{
$del = Join-Path -ChildPath $excl -Path $dst
If(Test-Path $del){
Remove-Item $del -Recurse
}
}
# Create a ZIP archive
$zip_name = $(Get-Date -f yyyyMMddHHmmss) + '-acunetix-archive.zip'
$zip_path = Join-Path -ChildPath $zip_name -Path $dst
Compress-Archive -Path "$wrk\*" -DestinationPath $zip_path
# Remove all working files
Remove-Item $wrk -Recurse
# Start Acunetix
Start-Service -DisplayName 'Acunetix'
Start-Service -DisplayName 'Acunetix Database'
Get the latest content on web security
in your inbox each week.