Run this Python script on your kali terminal to find your gateway IP using subprocess and regex modules.
#!/usr/bin/env python import subprocess import re #function to find gateway IP using subprocess and regex def get_gateway(): get_route = subprocess.check_output(["ip route"], shell=True) gateway_result = re.search(r"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]\ |2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", str(get_route)) return gateway_result.group(0) gateway = get_gateway() print(gateway)