-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml.cs
51 lines (42 loc) · 1.59 KB
/
MainPage.xaml.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using MailKit.Net.Smtp;
using MimeKit;
namespace no_bueno;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
async void fireBANG(object sender, EventArgs args)
{
MimeMessage email = generateEmail();
using var client = new SmtpClient();
String address = Preferences.Default.Get("smtpAddress", "");
String username = Preferences.Default.Get("smtpUsername", "");
String password = Preferences.Default.Get("smtpPassword", "");
Int32 port = Int32.Parse(Preferences.Default.Get("smtpPort", ""));
// Attempt to connect
if (port == 587) client.Connect(address, port, MailKit.Security.SecureSocketOptions.StartTls);
if (port == 465) client.Connect(address, port, MailKit.Security.SecureSocketOptions.StartTls);
client.Authenticate(username, password);
client.Send(email);
client.Disconnect(true);
}
private MimeMessage generateEmail()
{
var email = new MimeMessage();
Guid messageGUID = Guid.NewGuid();
String modifiedMessageGuid = messageGUID.ToString();
modifiedMessageGuid.Replace("-", "").ToUpper();
email.MessageId = modifiedMessageGuid;
email.From.Add(new MailboxAddress(kImpersonated.Text, "[email protected]"));
email.To.Add(new MailboxAddress(kVictimDisplayName.Text, kVictimEmail.Text));
email.Subject = kSubjectLine.Text;
// Setting Body Content
var builder = new BodyBuilder();
builder.TextBody = kEditor.Text;
email.Body = builder.ToMessageBody();
return email;
}
}