Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null
- $ErrorActionPreference = "silentlycontinue"
- $results = @()
- foreach($drive in (Get-PSDrive -PSProvider 'FileSystem')) {
- foreach($sourceFile in (Get-Childitem -Path $drive.Root -Include *.jar -File -Recurse)) {
- foreach ($subfile in ([IO.Compression.ZipFile]::OpenRead($sourceFile.FullName).Entries.FullName)){
- if ($subfile.ToLower().EndsWith('jndilookup.class') -or $subfile.ToLower().Contains('log4j-core-2.')){
- $results += $sourceFile.FullName
- }
- }
- }
- }
- if ($results) {
- $postParams = @{
- hostname = $Env:computername;
- results = $results | out-string;
- ip = (Invoke-WebRequest https://ipecho.net/plain -UseBasicParsing).Content;
- email = "__email__";
- }
- Invoke-WebRequest -Uri https://dev.helpdeskbuttons.com/test/log4j_alert -Method POST -Body $postParams -UseBasicParsing
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement