forked from decoder-it/KrbRelayEx-RPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadddns.py
35 lines (30 loc) · 1.05 KB
/
adddns.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from ipaddress import IPv4Network, IPv4Address
from colorama import Fore, Style
from uuid import uuid4
import dns.resolver
import dns.update
import dns.query
import dns.rcode
import importlib
import random
import socket
import queue
import argparse
parser = argparse.ArgumentParser(description=" domain, dnip, hostname, and hostip arguments.")
parser.add_argument("--domain", required=True, help="Specify the domain name.")
parser.add_argument("--dnsip", required=True, help="Specify the domain's IP address.")
parser.add_argument("--hostname", required=True, help="Specify the hostname.")
parser.add_argument("--hostip", required=True, help="Specify the host's IP address.")
args = parser.parse_args()
domain = args.domain
dnsip = args.dnsip
hostname = args.hostname
hostip = args.hostip
delete = dns.update.Update(domain)
delete.delete(hostname)
response = dns.query.tcp(delete, dnsip, timeout=10)
print(response.rcode())
add = dns.update.Update(domain)
add.add(hostname, 300, "A", hostip)
response = dns.query.tcp(add, dnsip, timeout=10)
print(response.rcode())