Skip to content

Instantly share code, notes, and snippets.

@mritunjay-k
Last active April 30, 2019 01:37
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 mritunjay-k/7b127b511a321b2e7e0dc9fd86f7c2bf to your computer and use it in GitHub Desktop.
Save mritunjay-k/7b127b511a321b2e7e0dc9fd86f7c2bf to your computer and use it in GitHub Desktop.
Takes a file containing list of domains as an input and gives their ipv4 address as an output in another file. I developed it basically for using masscan. It can also be used for educational purposes too.
#!/usr/bin/env python
import sys
import socket
try:
read_file = open(input("Enter path of the file containing subdomains: "),'r')
for host in read_file:
try:
ip=socket.gethostbyname(host.rstrip("\n"))
print(ip)
file = open("found_ip.txt","a")
file.write(ip+"\n")
file.close()
except:
print("Not Found")
read_file.close()
except:
print("File doesn't exist")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment