I am currently trying to automatically append unique IP's that attack my Artillery Honeypot to a text file.
I've gotten to a point in this script where I am monitoring syslog for changes (where artillery puts new attack logs), and running the grep command to find all unique IP's in syslog each time it is modified.
What I need to do now is pipe the grep command output to 'something' that will only append unique IP's that aren't already in the text file they are to be appended to.
#!/bin/bash
import inotify-tools
inotifywait -r -m -e modify /var/log/syslog |
while read path _ file; do
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" /var/log/syslog | sort | uniq | ??????
done
I'm just looking for the command I need to pipe to in order to append the unique IP's to a text file, but only if they don't exist in the text file already. Thank you