Created
July 23, 2018 11:54
-
-
Save asheshambasta/d3cf739ea683b0a49ed3b721cb3502f2 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
-- stack ghci --package dns --package bytestring | |
-- import Network.DNS.Resolver | |
-- import Network.DNS.Lookup | |
-- import qualified Data.ByteString.Char8 as BSC | |
-- reads newline separated domain names and dumps their A records to an output file. | |
readFile "/tmp/domains.txt" | |
>>= return . map BSC.pack . lines | |
>>= \domains -> mapM (\d -> withResolver seed (\s -> lookupA s d >>= return . (,) d )) domains | |
>>= \ts -> writeFile "/tmp/resolv.txt" $ unlines . map show $ ts | |
-- beware of very large files! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment