CS0-003 · Question #14
A security analyst is writing a shell script to identify IP addresses from the same country. Which of the following functions would help the analyst achieve the objective?
The correct answer is B. function x() { info=$(geoiplookup $1) && echo "$1 | $info" }. The function that would help the analyst identify IP addresses from the same country is: function x() { info=$(geoiplookup $1) && echo "$1 | $info" } This function takes an IP address as an argument and uses the geoiplookup command to get the geographic location information…
Question
A security analyst is writing a shell script to identify IP addresses from the same country. Which of the following functions would help the analyst achieve the objective?
Options
- Afunction w() { info=$(ping -c 1 $1 | awk -F "/" 'END{print $1}') && echo "$1 | $info" }
- Bfunction x() { info=$(geoiplookup $1) && echo "$1 | $info" }
- Cfunction y() { info=$(dig -x $1 | grep PTR | tail -n 1 ) && echo "$1 | $info" }
- Dfunction z() { info=$(traceroute -m 40 $1 | awk 'END{print $1}') && echo "$1 | $info" }
How the community answered
(57 responses)- A5% (3)
- B89% (51)
- C2% (1)
- D4% (2)
Explanation
The function that would help the analyst identify IP addresses from the same country is: function x() { info=$(geoiplookup $1) && echo "$1 | $info" } This function takes an IP address as an argument and uses the geoiplookup command to get the geographic location information associated with the IP address, such as the country name, country code, region, city, or latitude and longitude. The function then prints the IP address and the geographic location information, which can help identify any IP addresses that belong to the
Topics
Community Discussion
No community discussion yet for this question.