Advertisement
Guest User

Untitled

a guest
Dec 13th, 2021
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null
  2. $ErrorActionPreference = "silentlycontinue"
  3.  
  4. $results = @()
  5.  
  6. foreach($drive in (Get-PSDrive -PSProvider 'FileSystem')) {
  7. foreach($sourceFile in (Get-Childitem -Path $drive.Root -Include *.jar -File -Recurse)) {
  8. foreach ($subfile in ([IO.Compression.ZipFile]::OpenRead($sourceFile.FullName).Entries.FullName)){
  9. if ($subfile.ToLower().EndsWith('jndilookup.class') -or $subfile.ToLower().Contains('log4j-core-2.')){
  10. $results += $sourceFile.FullName
  11. }
  12. }
  13. }
  14. }
  15.  
  16. if ($results) {
  17. $postParams = @{
  18. hostname = $Env:computername;
  19. results = $results | out-string;
  20. ip = (Invoke-WebRequest https://ipecho.net/plain -UseBasicParsing).Content;
  21. email = "__email__";
  22. }
  23. Invoke-WebRequest -Uri https://dev.helpdeskbuttons.com/test/log4j_alert -Method POST -Body $postParams -UseBasicParsing
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement