Backing-up your Invicti 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 Invicti services
Before taking a backup, be certain that no scans are running and stop the two services associated with Invicti – the ‘Invicti’ and ‘Invicti Database’ services.
You can either do this from the Windows Task Manager, or from a PowerShell prompt as follows.
Stop-Service -DisplayName 'Invicti Supervisor'
Stop-Service -DisplayName 'Invicti Database'
Backing up files and Data
The next step is to backup files and data. Invicti stores all its data in C:ProgramDataInvicti. 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:ProgramDataInvictilogs directory consists of log files generated by Invicti. Since Invicti logs are mainly used for debugging purposes, you may wish to omit them from your backup.
- Scan Logs – The C:ProgramDataInvictisharedscans 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:ProgramDataInvictisharedupdates directory consists of updates downloaded by Invicti. These updates will be re-downloaded by Invicti if needed and can be omitted from backups.
Re-starting Invicti Services
Once you copy over all the files you need, to restart Invicti, 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 'Invicti Supervisor'
Start-Service -DisplayName 'Invicti 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:ProgramDataInvicti*' # Source directory
$dst = 'C:backup' # Destination directory
$wrk = Join-Path -ChildPath 'tmp' -Path $dst # Working directory
$excls = @('logs','sharedscans','sharedupdates')
# Stop Invicti
Stop-Service -DisplayName 'Invicti Supervisor'
Stop-Service -DisplayName 'Invicti 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 Invicti
Start-Service -DisplayName 'Invicti Supervisor'
Start-Service -DisplayName 'Invicti Database'
Get the latest content on web security
in your inbox each week.



