Skip to content

Commit

Permalink
Merge pull request #12 from ADORSYS-GIS/fix/Issue-11
Browse files Browse the repository at this point in the history
Fix/issue 11
  • Loading branch information
MarantosGeorge authored Nov 11, 2024
2 parents 4b6df15 + f003109 commit bd2b5ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 6 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ install_snort_linux() {
print_step "Installing" "Snort for Linux"

# Get the default network interface
INTERFACE=$(ip route | grep default | awk '{print $5}')
# Get all network interface excluding virtual network interfaces
INTERFACE=$(ip -o link show | awk -F': ' '{print $2}' | grep -E '^(en|eth|wl)' | tr '\n' ' ')

# Function to install Snort on Linux
install_snort_apt() {
Expand All @@ -134,16 +135,16 @@ install_snort_linux() {

# Function to configure Snort to use the main network interface and set HomeNet
configure_snort_interface() {
if [ ! -f /etc/snort/snort.conf ]; then
if [ ! -f /etc/snort/snort.debian.conf ]; then
# Create snort.conf with minimal configuration
echo "config interface: $INTERFACE" | sudo tee -a /etc/snort/snort.conf
echo "DEBIAN_SNORT_INTERFACE=\"$INTERFACE\"" | sudo tee -a /etc/snort/snort.debian.conf
else
# Update existing snort.conf
maybe_sudo sed -i "s/^config interface: .*/config interface: $INTERFACE/" /etc/snort/snort.conf
maybe_sudo sed -i "s/^DEBIAN_SNORT_INTERFACE=.*/DEBIAN_SNORT_INTERFACE=\"$INTERFACE\"/" /etc/snort/snort.debian.conf
fi
}

# Run the configuration function
# Run the configuration function
configure_snort_interface

# Restart Snort service
Expand Down
9 changes: 8 additions & 1 deletion scripts/windows/snort.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ function Install-Snort {
$taskAction = New-ScheduledTaskAction -Execute "C:\Snort\bin\snort.exe" -Argument "-c C:\Snort\etc\snort.conf -A full -l C:\Snort\log\ -i 5 -A console"
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
$taskSettings = New-ScheduledTaskSettingsSet -Hidden
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -Settings $taskSettings -RunLevel Highest

if (Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue) {
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
Write-Host "Scheduled Task already exists, Unregisting to Update Scheduled Task"
}
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger - Settings $taskSettings -RunLevel Highest
Write-Host "Registering Snort to Run at Startup"


Write-Host "Installation and configuration completed!"
}
Expand Down

0 comments on commit bd2b5ae

Please sign in to comment.