exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 334 discussion

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

Given the following code:



Which of the following tasks could be accomplished with the script?

  • A. Reverse shell
  • B. Ping sweep
  • C. File download
  • D. Port scan
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
throughthefray
7 months, 3 weeks ago
Minor syntax errors but yes this is a port scan made in powershell. Correct syntax would be: $p = @(80, 110, 25) $network = "192.168.0" $range = 1..254 $ErrorActionPreference = 'SilentlyContinue' foreach ($add in $range) { foreach ($x in $p) { $ip = "$network.$add" $socket = New-Object System.Net.Sockets.TcpClient try { $socket.Connect($ip, $x) if ($socket.Connected) { Write-Output "$ip port $x open" } $socket.Close() } catch {} } }
upvoted 4 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 ...