Smalls1652

Parse Download

Apr 29th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $scriptpath = $MyInvocation.MyCommand.Path
  2. $storageDir = Split-Path $scriptpath
  3.  
  4. $downloadlinks = @(
  5.             "http://www.bleepingcomputer.com/download/combofix/dl/12/",
  6.             "http://www.bleepingcomputer.com/download/adwcleaner/dl/125/",
  7.             "http://www.bleepingcomputer.com/download/rkill/dl/10/",
  8.             "http://www.bleepingcomputer.com/download/minitoolbox/dl/65/"
  9.         )
  10.                    
  11. $downloadparse = @(
  12.             's@^.*<a href=\x27\(http://download[.]bleepingcomputer[.]com/dl/[0-9A-Fa-f]\+/[0-9A-Fa-f]\+/windows/security/anti[-]virus/c/combofix/ComboFix[.]exe\)\x27>.*$@\1@p',
  13.             's@^.*<a href=\x27\(http://download[.]bleepingcomputer[.]com/dl/[0-9A-Fa-f]\+/[0-9A-Fa-f]\+/windows/security/security[-]utilities/a/adwcleaner/adwcleaner[_][0-9A-Fa-f]\+[.][0-9A-Fa-f]\+[.]exe\)\x27>.*$@\1@p',
  14.             's@^.*<a href=\x27\(http://download[.]bleepingcomputer[.]com/dl/[0-9A-Fa-f]\+/[0-9A-Fa-f]\+/windows/security/security[-]utilities/r/rkill/rkill[.]exe\)\x27>.*$@\1@p',
  15.             's@^.*<a href=\x27\(http://download[.]bleepingcomputer[.]com/dl/[0-9A-Fa-f]\+/[0-9A-Fa-f]\+/windows/security/security[-]utilities/m/minitoolbox/MiniToolBox[.]exe\)\x27>.*$@\1@p'
  16.         )
  17.  
  18. $downloadname = @(
  19.             "ComboFix",
  20.             "ADWCleaner",
  21.             "rkill",
  22.             "MiniToolBox"
  23.         )
  24.  
  25. $dlinksarraylength = $downloadlinks.length
  26. $dlinksarraylength--
  27.  
  28. $i = 0
  29.  
  30. while ($i -le $dlinksarraylength)
  31.     {
  32.         $dlink = $downloadlinks[$i]
  33.         $dname = $downloadname[$i]
  34.         $dparse = $downloadparse[$i]
  35.        
  36.         $webclient = New-Object System.Net.WebClient
  37.         $htmlfile = "$storageDir\Download.html"
  38.         $webclient.DownloadFile($dlink,$htmlfile)
  39.        
  40.         $purl= $(.\sed.exe -ne $dparse $storageDir\Download.html)
  41.        
  42.         Write-host "Downloading $dname"
  43.         Write-host "-------------------"
  44.        
  45.         $dfilename = "$storageDir\files\$dname.exe"
  46.         $webclient.DownloadFile($purl,$dfilename)
  47.         Remove-Item "$storageDir\Download.html"
  48.        
  49.         $i++
  50.     }
Add Comment
Please, Sign In to add comment