Adversaries will likely attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Functionality could exist within remote access tools to enable this, but utilities available on the operating system could also be used. Adversaries may also use local host files in order to discover the hostname to IP address mappings of remote systems.Examples of tools and commands that acquire this information include "ping" or "net view" using Net. The contents of the
C:\Windows\System32\Drivers\etc\hosts
file can be viewed to gain insight into the existing hostname to IP mappings on the system.Specific to Mac, the
bonjour
protocol to discover additional Mac-based systems within the same broadcast domain. Utilities such as "ping" and others can be used to gather information about remote systems. The contents of the/etc/hosts
file can be viewed to gain insight into existing hostname to IP mappings on the system.Utilities such as "ping" and others can be used to gather information about remote systems. The contents of the
/etc/hosts
file can be viewed to gain insight into existing hostname to IP mappings on the system.In cloud environments, the above techniques may be used to discover remote systems depending upon the host operating system. In addition, cloud environments often provide APIs with information about remote systems and services.
Identify remote systems with net.exe.
Upon successful execution, cmd.exe will execute net.exe view
and display results of local systems on the network that have file and print sharing enabled.
Supported Platforms: Windows
net view /domain
net view
Identify remote systems with net.exe querying the Active Directory Domain Computers group.
Upon successful execution, cmd.exe will execute cmd.exe against Active Directory to list the "Domain Computers" group. Output will be via stdout.
Supported Platforms: Windows
net group "Domain Computers" /domain
Identify domain controllers for specified domain.
Upon successful execution, cmd.exe will execute nltest.exe against a target domain to retrieve a list of domain controllers. Output will be via stdout.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
target_domain | Domain to query for domain controllers | String | domain.local |
nltest.exe /dclist:#{target_domain}
Identify remote systems via ping sweep.
Upon successful execution, cmd.exe will perform a for loop against the 192.168.1.1/24 network. Output will be via stdout.
Supported Platforms: Windows
for /l %i in (1,1,254) do ping -n 1 -w 100 192.168.1.%i
Identify remote systems via arp.
Upon successful execution, cmd.exe will execute arp to list out the arp cache. Output will be via stdout.
Supported Platforms: Windows
arp -a
Identify remote systems via arp.
Upon successful execution, sh will execute arp to list out the arp cache. Output will be via stdout.
Supported Platforms: Linux, macOS
arp -a | grep -v '^?'
if [ -x "$(command -v arp)" ]; then exit 0; else exit 1;
echo "Install arp on the machine."; exit 1;
Identify remote systems via ping sweep.
Upon successful execution, sh will perform a ping sweep on the 192.168.1.1/24 and echo via stdout if an IP is active.
Supported Platforms: Linux, macOS
Name | Description | Type | Default Value |
---|---|---|---|
subnet | Subnet used for ping sweep. | string | 192.168.1 |
start_host | Subnet used for ping sweep. | string | 1 |
stop_host | Subnet used for ping sweep. | string | 254 |
for ip in $(seq #{start_host} #{stop_host}); do ping -c 1 #{subnet}.$ip; [ $? -eq 0 ] && echo "#{subnet}.$ip UP" || : ; done
Powershell script that runs nslookup on cmd.exe against the local /24 network of the first network adaptor listed in ipconfig.
Upon successful execution, powershell will identify the ip range (via ipconfig) and perform a for loop and execute nslookup against that IP range. Output will be via stdout.
Supported Platforms: Windows
$localip = ((ipconfig | findstr [0-9].\.)[0]).Split()[-1]
$pieces = $localip.split(".")
$firstOctet = $pieces[0]
$secondOctet = $pieces[1]
$thirdOctet = $pieces[2]
foreach ($ip in 1..255 | % { "$firstOctet.$secondOctet.$thirdOctet.$_" } ) {cmd.exe /c nslookup $ip}