-
Notifications
You must be signed in to change notification settings - Fork 0
/
DumpTrack.cs
44 lines (36 loc) · 1.28 KB
/
DumpTrack.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
using System;
using System.IO;
using System.Collections.Generic;
namespace dumptrack
{
public class DumpTrack
{
private List<IDumpTrackModule> modules = null;
public DumpTrack ()
{
modules = new List<IDumpTrackModule> ();
//modules.Add (new GoogleCustomSearchModule ());
modules.Add (new GitHubSearchModule ());
}
public List<Offence> FindDumps(){
List<Offence> offences = new List<Offence>();
modules.ForEach (x => offences.AddRange(x.FindOffences ()));
return offences;
}
public void Notify(){
if (File.Exists("offencelist-" + DateTime.Now.ToString ("yyyy-MM-dd") + ".txt")){
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage ();
mm.Subject = "Monitored paste found on the web - " + DateTime.Now.ToString ("yyyy-MM-dd");
mm.From = new System.Net.Mail.MailAddress(Config.getInstance().FromAddress);
string toEmailString = Config.getInstance ().ToEmailString;
string[] emails = toEmailString.Split (';');
foreach (string email in emails) {
mm.To.Add (email);
}
mm.Attachments.Add (new System.Net.Mail.Attachment ("offencelist-" + DateTime.Now.ToString ("yyyy-MM-dd") + ".txt"));
System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient (Config.getInstance().SMTPServer);
sc.Send (mm);
}
}
}
}