nerdexam
CompTIA

PT0-003 · Question #298

After obtaining a reverse shell, a penetration tester identifies a locally cloned Git repository that contains thousands of files and directories on a Windows machine. The tester suspects there…

The correct answer is D. gci -Path . -Recurse | Select-String -Pattern "ProjectX". On Windows PowerShell, gci is an alias for Get-ChildItem. To search recursively through all files and return matches for the string "ProjectX", the combination gci -Path . -Recurse | Select-String - Pattern "ProjectX" is efficient and returns file paths and matching lines. This…

Submitted by paula_co· Mar 6, 2026Post-exploitation and lateral movement

Question

After obtaining a reverse shell, a penetration tester identifies a locally cloned Git repository that contains thousands of files and directories on a Windows machine. The tester suspects there could be sensitive information related to "ProjectX." Which of the following commands should the tester use in a script to identify potential files to produce the best results?

Options

  • Agc * | select "ProjectX"
  • Bdir /R | findstr "ProjectX"
  • CGet-ChildItem * | Select-String "ProjectX"
  • Dgci -Path . -Recurse | Select-String -Pattern "ProjectX"

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    12% (3)
  • D
    80% (20)

Explanation

On Windows PowerShell, gci is an alias for Get-ChildItem. To search recursively through all files and return matches for the string "ProjectX", the combination gci -Path . -Recurse | Select-String - Pattern "ProjectX" is efficient and returns file paths and matching lines. This handles large repositories and searches file contents rather than just file names.

Topics

#PowerShell#file system enumeration#data discovery#post-exploitation

Community Discussion

No community discussion yet for this question.

Full PT0-003 Practice