Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python3.5
- # coding: utf-8
- import subprocess
- def dig():
- with open('domains.txt') as file:
- for domain in file:
- cmd = subprocess.check_output(["dig",domain.strip(), "+nocomments" ,
- "+noquestion", "+noauthority",
- "+noadditional", "+nostats"])
- IP = cmd.decode()[cmd.decode().rfind("\t",0):].strip()
- if IP == "212.129.34.27":
- print('{} run at {}'.format(domain.strip(),IP))
- def checkdomain():
- with open('httpd.conf') as file:
- domains =[]
- check = False
- for line in file:
- if "<VirtualHost *:80>" in line:
- check = True
- continue
- if line.startswith("ServerName") and check == True:
- print('ServerName: {}'.format(line.split()[1:]))
- domains.append(line.split()[1:])
- if line.startswith("ServerAlias") and check == True:
- print('ServerAlias: {}\n'.format(line.split()[1:]))
- domains.append(line.split()[1:])
- with open('domains.txt', 'w') as file:
- for i in domains:
- for d in i:
- file.write('{}\n'.format(d))
- checkdomain()
- dig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement