Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/usr/local/bin/python3.5
  2. # coding: utf-8
  3.  
  4. import subprocess
  5.  
  6. def dig():
  7. with open('domains.txt') as file:
  8. for domain in file:
  9. cmd = subprocess.check_output(["dig",domain.strip(), "+nocomments" ,
  10. "+noquestion", "+noauthority",
  11. "+noadditional", "+nostats"])
  12. IP = cmd.decode()[cmd.decode().rfind("\t",0):].strip()
  13. if IP == "212.129.34.27":
  14. print('{} run at {}'.format(domain.strip(),IP))
  15.  
  16. def checkdomain():
  17. with open('httpd.conf') as file:
  18. domains =[]
  19. check = False
  20. for line in file:
  21. if "<VirtualHost *:80>" in line:
  22. check = True
  23. continue
  24. if line.startswith("ServerName") and check == True:
  25. print('ServerName: {}'.format(line.split()[1:]))
  26. domains.append(line.split()[1:])
  27. if line.startswith("ServerAlias") and check == True:
  28. print('ServerAlias: {}\n'.format(line.split()[1:]))
  29. domains.append(line.split()[1:])
  30.  
  31. with open('domains.txt', 'w') as file:
  32. for i in domains:
  33. for d in i:
  34. file.write('{}\n'.format(d))
  35.  
  36. checkdomain()
  37. dig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement