During a penetration test, you need to script a change to the IP address of your testing machine to match a new target subnet for further exploration. Which script accomplishes this task while also verifying that the new IP address was correctly assigned?
ifconfig 10.10.20.50 netmask 255.255.255.0
ipconfig /set address 'Local Area Connection' static 10.10.20.50 255.255.255.0
The correct answer is a script that utilizes the ifconfig command to set the desired IP address and then checks the successful assignment of the new IP using the ifconfig command again. In this scenario, successful assignment is verified by examining if the new IP address is listed in the ifconfig output.
ifconfig eth0 10.10.20.50 netmask 255.255.255.0 doesn't validate the change, which is crucial for ensuring the tester is functioning within the right IP range.
ifconfig 10.10.20.50 netmask 255.255.255.0 is incorrect because the script is missing the interface name, which is required to set the IP address.
ipconfig /set address 'Local Area Connection' static 10.10.20.50 255.255.255.0 is incorrect because the ipconfig command is a Windows command and would not set an IP address on Linux systems, which commonly use ifconfig or ip commands.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the `ifconfig` command in Linux?
Open an interactive chat with Bash
Why is it important to verify an IP address assignment after changing it?
Open an interactive chat with Bash
What does 'netmask' mean in the context of networking?