Похоже, что snort не записывает журнал предупреждений при обработке pcap-файла, однако он должен вести правильный журнал перехвата пакетов (, например./var/log/snort/snort.log.1502097194
).
Поскольку он не записывает журнал предупреждений, вместо этого вы можете заставить snort записывать сообщения журнала предупреждений в системный журнал, используя флаг -s
(, или журнал событий в Windows, используя -E
), например.:
snort -s -l /var/log/snort/ -r /pcaps/example.pcap -c /etc/snort/snort.conf
Затем вы должны увидеть предупреждения в системном журнале, например.:
$ sudo tail -f /var/log/messages
Aug 7 09:08:05 snort snort: [1:2101919:23] GPL FTP CWD overflow attempt [Classification: Attempted Administrator Privilege Gain] [Priority: 1] {TCP} 142.167.88.44:61383 -> 192.168.5.122:21
В вашем случае, вероятно, snort.log
не содержит данных, так как оповещения не срабатывали. Вы должны быть в состоянии подтвердить это либо просмотрев системный журнал, либо в сводном отчете впоследствии, например.:
Action Stats:
Alerts: 1 ( 5.263%)
Logged: 1 ( 5.263%)
Passed: 0 ( 0.000%)
Если бы у вас всегда было подключено ровно 2 монитора, это было бы очень просто делать с Башем:
#!/usr/bin/env bash
screen_size=$(xrandr | grep ' connected' | awk '{print $3}' | cut -f1 -d"+")
IFS=$'\n'
readarray -t <<<"$screen_size"
feh --bg-fill ~/wallpaper/foo--"${MAPFILE[0]}".png ~/wallpaper/foo--"${MAPFILE[1]}".png
Но если количество подключенных мониторов может варьироваться, что, скорее всего, практический случай, вы можете создать команду feh
и затем запустить это с eval
вот так:
#!/usr/bin/env bash
screen_size=$(xrandr | grep ' connected' | awk '{print $3}' | cut -f1 -d"+")
IFS=$'\n'
readarray -t <<<"$screen_size"
feh_command="feh --bg-fill"
for i in "${MAPFILE[@]}"
do
echo size: "$i"
feh_command="$feh_command ~/wallpaper/foo--$i.png"
done
eval "$feh_command"
Вы можете использовать --no-xinerama
, и в этом случае любое указанное вами изображение будет отображаться на всех экранах. Единственный вопрос тогда будет заключаться в том, как бы вы объединили все свои изображения вместе, чтобы сделать один фон рабочего стола, в соответствии с тем, как вы настроили свои мониторы...
Единственное, что пришло мне в голову, это использовать ImageMagick, хотя это было бы довольно нелепо и запутанно.Итак, я все равно решил сделать это...Вот и все:
#!/bin/sh
AWK_XRANDR_PARSE='/ connected/ {
split($3,sizePos,"+")
split(sizePos[1],size,"x")
print size[1] "," size[2] "," sizePos[2] "," sizePos[3]
}'
# Fetches a wallpaper for the monitor of size $1x$2. $1 is the required width,
# and $2 is the required height.
wallpaper_file() {
# Use a case or string substitution to pick out any image files you fancy on
# your system... They must be printf'd.
printf "$HOME/.desktop"
}
# Writes any line whose $2nth column is equal to that of the first line.
# Columns are split by $1.
matching() {
SENTINEL="$([ "$#" -gt 2 ] && printf '%s' "$3" || printf 'sentinel')"
awk -F"$1" -v first="$SENTINEL" \
"{if (first == \"$SENTINEL\") first = \$$2; if (\$$2 == first) print}"
}
# Writes the value within the variable named "$1".
cat() {
printf '%s' "${!1}"
}
# Writes the $2nth column. Columns are split by $1.
nth() {
awk -F"$1" "{print \$$2}"
}
# This one variable assignment takes xrandr's output, parses it via awk, runs
# the wallpaper_file, takes it's output, and combines all that information into
# a list of tuples. Each item in the list represents a monitor, and the tuple
# is roughly equivalent to 'W,H,X,Y,F', where W is width, H is height, X is the
# X position, Y is the Y position, and F is the file of the image.
DISPLAYS="$(while read X Y REST; do
printf '%s,%s,%s,%s\n' "$X" "$Y" "$REST" "$(wallpaper_file "$X" "$Y")"
done < <(xrandr | awk "$AWK_XRANDR_PARSE" | \
awk -F',' '{print $1 " " $2 " " $3 "," $4}'))"
# This simply finds the monitor that is the farthest out in the X direction,
# and is the widest. It then combines the X position and the width of the
# monitor to find the absolute width of your desktop.
PLACEMENT_WIDTH="$(cat DISPLAYS | sort -rnt, -k3 | matching, 3)"
SIZE_WIDTH="$(cat PLACEMENT_WIDTH | sort -rnt, -k1 | head -n1)"
WIDTH="$(("$(cat SIZE_WIDTH | nth, 1)" + "$(cat SIZE_WIDTH | nth, 3)"))"
# Same goes on as above, but with the height and Y direction.
PLACEMENT_HEIGHT="$(cat DISPLAYS | sort -rnt, -k4 | matching, 4)"
SIZE_HEIGHT="$(cat PLACEMENT_HEIGHT | sort -rnt, -k2 | head -n1)"
HEIGHT="$(("$(cat SIZE_HEIGHT | nth, 2)" + "$(cat SIZE_HEIGHT | nth, 4)"))"
# Take all that information, and make a wallpaper file from it via imagemagick.
magick -size $WIDTH'x'$HEIGHT canvas:black \
$(cat DISPLAYS | awk -F',' '{print $5 " -geometry " $1 "x" $2 "+" $3 "+" $4 " -composite"}') \
/tmp/wallpaper.png
# Then set it as the background.
feh --bg-fill --no-xinerama /tmp/wallpaper.png
Я опубликовал весь сценарий как суть здесь , если хотите.
Я знаю, что, возможно, мне не стоило этого делать, но, черт возьми, я все равно это сделал.