### Hardcoded sensitive information Service configuration files ```powershell Get-ChildItem -Path c:\\<directory>\\ -Recurse -Include *.ini,*.config,*.xml -ErrorAction SilentlyContinue | Select-String -Pattern 'passw' -CaseSensitive:$false | Group-Object Path | ForEach-Object { "[+] Potential plaintext creds: $($_.Name)" } --- # 특정 디렉토리를 재귀적으로 탐색하여 ini, config, xml등의 확장자를 가진 파일들 출력 Get-ChildItem -Path C:\\<directory> -Recurse -Include *.ini,*.config,*.xml ErrorAction SilentlyContinue # 출력한 파일들의 내용 중 passw 라는 비밀번호와 관련된 문자열을 대/소문자 구분없이 가져옴 Select-String -Pattern 'passw' -CaseSensitive:$false # passw 문자열이 들어간 파일이 있다면 Path로 오브젝트들을 그룹화 한 뒤, 해당 파일의 Name 특성 출력 Group-Object Path | ForEach-Object { "[+] Potential plaintext creds: $($_.Name)" } ``` User files ```powershell Get-ChildItem -Path c:\\Users\\ -Recurse -Include *.ini,*.config,*.xml,*.txt,*.md,*.csv -ErrorAction SilentlyContinue | Select-String -Pattern 'passw|secret' -CaseSensitive:$false | Group-Object Path | ForEach-Object { "[+] Potential plaintext creds: $($_.Name)" } ``` PowerShell history file ```powershell # Locate powershell history file (Get-PSReadLineOption).HistorySavePath ```