Last active
August 29, 2015 14:14
-
-
Save ei-grad/0d3189111c82ce1fe8c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Conntrack import ConnectionManager, NFCT_O_XML | |
from lxml.etree import fromstring | |
def filter_nat(xml): | |
d = fromstring(xml) | |
orig_src = d.xpath("..//meta[@direction='original']/layer3/src/text()")[0] | |
repl_dst = d.xpath("..//meta[@direction='reply']/layer3/dst/text()")[0] | |
return orig_src != repl_dst | |
for i in ConnectionManager(NFCT_O_XML).list(): | |
if filter_nat(i): | |
print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment