Skip to content

Instantly share code, notes, and snippets.

@nega0
Last active June 29, 2017 18:11
Show Gist options
  • Save nega0/0e37929e6b23b568566c40b8071cdac2 to your computer and use it in GitHub Desktop.
Save nega0/0e37929e6b23b568566c40b8071cdac2 to your computer and use it in GitHub Desktop.
colorize `iptables` with grc
## based on https://gist.github.com/nega0/1d232622a1fa3dad176869bbfe747602
## conf file for https://github.com/garabik/grc
## put in ~/.grc/conf.iptables
# chain section headers
regexp=^Chain.*
colors=underline
=======
# column headers
regexp=^num.*
colors=yellow
=======
# reject/drop
regexp=([^y] )(DROP|REJECT)
colors=,,red
=======
# accept
regexp=[^y] (ACCEPT)
colors=,green
=======
# port numbers
regexp=[ds]pt[s]?:(\d+(:\d+)?)
colors=,yellow
=======
# ip number
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\/\d{1,2})?
colours=cyan
=======
# LOGDROP
regexp=([^n] )(LOGDROP)
colors=,,yellow
=======
# LOG
regexp=( )LOG
colors=cyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment