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…
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)- A4% (1)
- B4% (1)
- C12% (3)
- D80% (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
Community Discussion
No community discussion yet for this question.