Skip to content

Instantly share code, notes, and snippets.

@pkrumins
Created November 20, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkrumins/d50d7e12492362fcbbf5 to your computer and use it in GitHub Desktop.
Save pkrumins/d50d7e12492362fcbbf5 to your computer and use it in GitHub Desktop.
iptables.list('Tunnels', function (rules) {
var ports = {};
rules.forEach(function (rule) {
if (rule.parsed.target == 'REJECT') return;
// extract tcp destination ports
var match = rule.raw.match(/tcp dpt:(\d+)/);
if (match) {
ports[parseInt(match[1])] = 1;
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment