Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 1.16 KB

File metadata and controls

51 lines (41 loc) · 1.16 KB

Windows Commands

{% code title="File Count in C:" %}

dir n: /a-d /s /b | find /c ":\"

{% endcode %}

{% code title="Search for file with a word" %}

dir n:\*cred* /s /b

dir n:\*secret* /s /b

{% endcode %}

{% code title=" specific word within a text file" %}

findstr /s /i cred n:\*.*

{% endcode %}

Powershell

{% code title="Powershell Credential Function" %}

PS C:\htb> $username = 'plaintext'
PS C:\htb> $password = 'Password123'
PS C:\htb> $secpassword = ConvertTo-SecureString $password -AsPlainText -Force
PS C:\htb> $cred = New-Object System.Management.Automation.PSCredential $username, $secpassword
PS C:\htb> New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem" -Credential $cred

{% endcode %}

Get-ChildItem \\192.168.220.129\Finance\

{% code title="File Count" %}

PS C:\htb> N:
PS N:\> (Get-ChildItem -File -Recurse | Measure-Object).Count

{% endcode %}

{% code title="File with string find " %}

Get-ChildItem -Recurse -Path N:\ | Select-String "cred" -List

{% endcode %}