exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 109 discussion

Actual exam question from CompTIA's PT0-002
Question #: 109
Topic #: 1
[All PT0-002 Questions]

A penetration tester downloaded the following Perl script that can be used to identify vulnerabilities in network switches. However, the script is not working properly.

Which of the following changes should the tester apply to make the script work as intended?

  • A. Change line 2 to $ip= ג€10.192.168.254ג€;
  • B. Remove lines 3, 5, and 6.
  • C. Remove line 6.
  • D. Move all the lines below line 7 to the top of the script.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
som3onenooned1
Highly Voted 1 year, 7 months ago
Selected Answer: B
this whole script is messed up, brackets are wrong etc. Even though perl is procedural, you can call a function before its declaration. Look at Finding Files script on this: https://www.asc.ohio-state.edu/lewis.239/Class/Perl/perl.html Example script: #!/usr/bin/perl $ip=$argv[1]; attack($ip); sub attack { print("x"); } I will go with B
upvoted 7 times
...
Manzer
Highly Voted 1 year, 7 months ago
Selected Answer: B
You're not going to find something called switchtest.
upvoted 7 times
...
TiredOfTests
Most Recent 7 months, 1 week ago
Selected Answer: B
None of the given options seem to address the core issues of the script. However, if the sole focus is to make the script "work as intended" based on the given choices, removing lines 3, 5, and 6 (Option B) would at least let the attack($ip); method run, even though the issues with fetching command-line arguments and other syntax issues would remain unaddressed.
upvoted 3 times
...
bieecop
9 months, 3 weeks ago
Selected Answer: A
#!/usr/bin/perl $ip = "10.192.168.254"; if ($hostname eq "switchtest") { attack($ip); } else { exit 0; } sub attack { # Rest of the script here # ... }
upvoted 2 times
...
KingIT_ENG
1 year, 2 months ago
B is correct answer
upvoted 1 times
...
nickwen007
1 year, 3 months ago
$ip=argv[1] is a PHP script that can be used to define the IP address of a target system as an argument. It can be used to specify the IP address of a host when communicating with a server.
upvoted 2 times
[Removed]
1 year, 2 months ago
Yes B is the answer
upvoted 2 times
...
...
kloug
1 year, 3 months ago
aaaaaaaa
upvoted 1 times
[Removed]
1 year, 3 months ago
B is the correct answer
upvoted 1 times
...
beamage
1 year, 3 months ago
aaaaaaaa
upvoted 1 times
[Removed]
1 year, 3 months ago
B is correct answer
upvoted 2 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...