It wouldn't even take eight new lines of code there are already open source scripts made for detecting Tor and proxy IP addresses from log files.