nerdexam
CompTIACompTIA

PT0-002 · Question #393

PT0-002 Question #393: Real Exam Question with Answer & Explanation

The correct answer is D: Port scan. {"question_number": 8, "question": "What task could be accomplished with the described script?", "correct_answer": "D. Port scan", "explanation": "A port scanning script typically uses socket programming to attempt TCP connections (or send probes) to a range of port numbers on a

Information Gathering and Vulnerability Scanning

Question

Given the following code: Which of the following tasks could be accomplished with the script?

Options

  • AReverse shell
  • BPing sweep
  • CFile download
  • DPort scan

Explanation

{"question_number": 8, "question": "What task could be accomplished with the described script?", "correct_answer": "D. Port scan", "explanation": "A port scanning script typically uses socket programming to attempt TCP connections (or send probes) to a range of port numbers on a target host. In Python, this commonly involves a loop over port numbers, creating a socket, calling connect() or connect_ex(), and checking whether the connection succeeds or fails. If it succeeds, the port is open; if it fails/times out, the port is closed or filtered. This is fundamentally different from a reverse shell (which opens a persistent connection and redirects stdin/stdout), a ping sweep (which uses ICMP across multiple hosts), or a file download (which uses HTTP/FTP protocols to retrieve data). The pattern of iterating ports and testing connectivity is the signature of a port scanner.", "generated_by": "claude-sonnet", "llm_judge_score": 4}

Topics

#Port scanning#Script analysis#Network reconnaissance#Information gathering

Community Discussion

No community discussion yet for this question.

Full PT0-002 PracticeBrowse All PT0-002 Questions