Skip to content

Instantly share code, notes, and snippets.

@athoune
Created March 31, 2016 13:38
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 athoune/4c9e4c112fec4c908f32aecb329dbeae to your computer and use it in GitHub Desktop.
Save athoune/4c9e4c112fec4c908f32aecb329dbeae to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
from __future__ import print_function
from dns import resolver
from StringIO import StringIO
import sys
buff = StringIO()
answers = resolver.query(sys.argv[1], 'TXT')
for rdata in answers:
for txt in rdata.strings:
buff.write(txt)
buff.seek(0)
txt = buff.read()
if len(sys.argv) > 2:
target = sys.argv[2]
print("")
print("Same lenght", len(txt), len(target))
print(txt)
print(target)
for idx, letter in enumerate(txt):
if target[idx] != letter:
print("^", end="")
else:
print(" ", end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment