easyMultiple Choice
PT0-002 Practice Question: Which tool is best for performing static analysis…
Which tool is best for performing static analysis of Python code to find security vulnerabilities?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Bandit
Bandit (option C) is the correct tool because it is a purpose-built static application security testing (SAST) tool that parses Python source code into an AST and flags insecure patterns such as use of eval, weak hashing like MD5, hardcoded passwords, and subprocess shell=True. It integrates directly into Python projects and CI pipelines (e.g., via pip install bandit and running bandit -r .), making it ideal for finding vulnerabilities without executing the code. sqlmap (A) is a dynamic SQL injection exploitation tool, nmap (B) is a network port and service scanner, and Metasploit (D) is an exploitation framework — all operate against running systems rather than analyzing Python source statically.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
sqlmap
Why it's wrong here
sqlmap automates detection and exploitation of SQL injection against live HTTP endpoints; it never parses Python source files. Static analysis requires reading code without execution, which sqlmap cannot do. It would be correct when testing a web application's database layer for injectable parameters during dynamic assessment.
- ✗
nmap
Why it's wrong here
nmap performs network host discovery and port scanning against running systems, producing no inspection of Python source code. Static analysis examines code without executing it, which falls outside nmap's function. nmap would be the right tool when mapping live hosts, open ports and service versions during reconnaissance.
- ✓
Bandit
Why this is correct
Bandit parses Python source into an abstract syntax tree and flags insecure patterns such as eval, weak hashing and shell injection without executing the code, satisfying the static analysis requirement. Generic scanners lack this language-specific depth.
- ✗
Metasploit
Why it's wrong here
Metasploit is an exploitation framework that delivers payloads against live targets, not a static analyser that parses Python source without executing it. It cannot inspect code for flaws such as injection or insecure deserialisation. It would be the right choice when validating an identified vulnerability by actively exploiting a running service.
Go deeper
Related to this question
Learn chapter
Mobile Application Testing
Key term
Metasploit
Metasploit is a powerful penetration testing framework that helps security professionals find and exploit vulnerabilities in computer systems.
Key term
Nmap
Nmap is a network scanning tool used to discover hosts, services, and operating systems on a computer network.
About these practice questions
Courseiva writes every PT0-003 question from scratch — 777 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PT0-003 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PT0-003 exam.