• 8 years ago
Cyber Secrets Quick Tip

# Problem: I need a script to download files from the internet and if they are programs, run them.

# Solution: Either Powershell's Invoke-WebRequest or Curl

$source = "https://www.informationwarfarecenter.com/images/ATC-Web20-Logo.png"
$source2 = "https://www.informationwarfarecenter.com/images/Jeremy-Martin.jpg"
$destination = "$env:TEMP\ATC-Web20-Logo.png"
$destination2 = "$env:TEMP\Jeremy-Martin.jpg"

#download with invoke-webrequest
Invoke-WebRequest $source -OutFile $destination -ErrorAction Stop

#download a file with curl
curl $source2 -OutFile $destination2

#run the program Invoke-Item
Invoke-Item $destination

#run the program with Start-Process
Start-Process -FilePath $destination2 -PassThru

#Add a registry key
new-itemproperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -name StartMe -value $destination -ErrorAction SilentlyContinue

----

# IWC Custom PortableApps Builder
# Author: Jeremy Martin
# jeremy@informationwarfarecenter.com

# Download PortableApps and install
# Ask for where the PortableApps is installed
clear
$source = "https://portableapps.com/redirect/?a=PAcPlatform&t=http%3A%2F%2Fdownloads.portableapps.com%2Fportableapps%2Fpacplatform%2FPortableApps.com_Platform_Setup_14.4.1.paf.exe"
$destination = "$env:TEMP\installer.exe"
Invoke-WebRequest $source -OutFile $destination
Start-Process -FilePath "$destination" -PassThru
$PA = Read-Host -Prompt "Where did you install PortableApps (Example d:\PortableApps)"

# IWC Extra files
echo "Downloading IWC Extra Apps"
$Source2 = "https://www.informationwarfarecenter.com/files/IWC-Extra-Apps.zip"
$destination2 = "$env:TEMP\IWC-Extras.zip"
curl $Source2 -OutFile $destination2
Expand-Archive –Path $destination2 -DestinationPath "$PA\PortableApps" -Force
Start-Process -FilePath "$PA\Start.exe" -PassThru

Category

🤖
Tech

Recommended