Assignment 3.1: PowerShell and DNS - Ptsoares/SEC_335_Techjournal GitHub Wiki
Overview
The goal of this assignment was to create a PowerShell script that would output the hostname and IP addresses of a network. This is important for pen testers, as you might not always have direct access through the Kali box and may need to use other existing resources. The script can be found here.
Useful Commands and Instructions
The script has two parameters that are taken along with the file execution in-line:
.\resolveDNS.ps1 [NETWORK_PREFIX] [DNS_SERVER_ADDRESS]
[NETWORK_PREFIX] is the first three octets of the network without the third "."
[DNS_SERVER_ADDRESS] is the IP address of the DNS server for that network
Issues and Troubleshooting
Please note that this command is only compatible with /24 networks, since the prefix is a fixed length.
Additionally, when attempting to run this command on a Windows device, make sure you're able to run scripts and that you are in the correct directory where the file is stored, or you're pointing at that file path.
Here's the command for allowing script (note that this was used in a testing environment and isn't an inherently safe command to run, consider alternative specifications than "unrestricted":
Set-ExecutionPolicy unrestricted