Skip to content

Instantly share code, notes, and snippets.

@jpginc
Last active October 4, 2018 01:38
Show Gist options
  • Save jpginc/69506b3c584cb93b40501c048d8954dc to your computer and use it in GitHub Desktop.
Save jpginc/69506b3c584cb93b40501c048d8954dc to your computer and use it in GitHub Desktop.
dns3
asciiHex := ""
loop, Read, allDnsQuery.txt
{
IfInString, A_loopreadline, 34.205.75.67
continue ;there is an entry for the query and response, elminate one to remove duplicates
query := StrSplit(A_LoopReadLine, " ")[2] ;get the query (remove the IP address)
query := RegExReplace(query, "\.") ;remove the dot's as they aren't part of the ascii hex
query := RegExReplace(query, "torrabotenterprises") ;not part of the ascii hex
StringTrimLeft, query, query, 18 ; the first 18 characters appear to be nonsense
if(query) ;if there is any data left
asciiHex .= query
}
f := fileopen("asciiHex.txt", "w")
f.write(asciiHex)
f.close()
f := fileopen("decoded.txt", "w")
f.write(asciiHexToStr(asciiHex))
f.close()
asciiHexToStr(str)
{
decoded := "", start := -1
while(start <= StrLen(str)) {
decoded .= chr("0x" SubStr(str, (start := start + 2), 2))
}
return decoded
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment