Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
wydadforever  
#1 Posted : Tuesday, November 3, 2015 2:48:16 AM(UTC)
wydadforever

Rank: Newbie

Groups: Registered
Joined: 9/4/2015(UTC)
Posts: 0

Thanks: 1 times
I am currently developing an application in c# using easendmail, all is working fine , i work with the socks. this is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EASendMail;
using System.IO;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Collections.Concurrent;
using System.Net.Sockets;
using System.Net;


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EASendMail;
using System.IO;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Collections.Concurrent;
using System.Net.Sockets;
using System.Net;


namespace ApplicationHJ
{
public class Sender
{
public string Socksl;
public string Letter;



public Sender(string socks, string letter)
{
Socksl = socks;
Letter = letter;
}


public List<ServerSocks> loadSocks()
{
var result = new List<ServerSocks>();
string fileSocks = Path.GetFullPath(Path.Combine(Application.StartupPath, this.Socksl));
var input = File.ReadAllText(fileSocks);
var r = new Regex(@"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})");
foreach (Match match in r.Matches(input))
{
string ip = match.Groups[1].Value;
int port = Convert.ToInt32(match.Groups[2].Value);

ServerSocks bi = new ServerSocks();
bi.IpAddress = IPAddress.Parse(ip);
bi.Port = port;
result.Add(bi);
}
return result;
}
public void Exploit()
{
List<string> arRcpt = new List<string>();
Console.ReadLine();
string fileName;
OpenFileDialog fd = new OpenFileDialog();
fd.ShowDialog();
fileName = fd.FileName;
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
var logFile = File.ReadAllLines(fileName);
file.Close();
arRcpt = new List<string>(logFile);
int nRcpt = arRcpt.Count;
SmtpMail[] arMail = new SmtpMail[nRcpt];
SmtpClient[] arSmtp = new SmtpClient[nRcpt];
SmtpClientAsyncResult[] arResult = new SmtpClientAsyncResult[nRcpt];
List<ServerSocks> list = loadSocks();
var oServer = new SmtpServer("");
for (int i = 0; i < nRcpt; i++)
{
arMail[i] = new SmtpMail("try it");
arSmtp[i] = new SmtpClient();
}
for (int i = 0; i < nRcpt; i++)
{
oServer.SocksProxyServer = list[i % list.Count].IpAddress.ToString();
oServer.SocksProxyPort = list[i % list.Count].Port;
oServer.ProxyProtocol = SocksProxyProtocol.Socks5;
oServer.SocksProxyUser = "login";
oServer.SocksProxyPassword = "password";
SmtpMail oMail = arMail[i];
oMail.SMIMERFCCompatibility = true;
oMail.From = new MailAddress("", "");
oMail.Subject = "Bonjour tous le monde";
oServer.HeloDomain = "";
oMail.ReplyTo = "";
oMail.Style = MailStyle.EASendMailStyle;
oMail.Priority = MailPriority.High;
oMail.EncryptionAlgorithm = EncryptionAlgorithmType.ENCRYPTION_ALGORITHM_RC2;
//the message will be send to this email
oMail.To = new AddressCollection(arRcpt[i]);
oMail.HeaderEncoding = HeaderEncodingType.EncodingBase64;
oMail.TextBody = "";
oMail.AutoTextBody = false;
try
{
string fileHtml = Path.GetFullPath(Path.Combine(Application.StartupPath, "Exploit1/lettercmb.html"));
//fileHtml = fileHtml.Replace("{random}", NumberOf7.ToString());
oMail.ImportHtmlBody(fileHtml, ImportHtmlBodyOptions.NoOptions);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
SmtpClient oSmtp = arSmtp[i];
arResult[i] = oSmtp.BeginSendMail(oServer, oMail, (AsyncCallback)null, (object)null);
Console.WriteLine(String.Format("Start to send email to {0} ...",
arRcpt[i] + i));

}
int nSent = 0;
while (nSent < nRcpt)
{
for (int i = 0; i < nRcpt; i++)
{
// this email has been sent
if (arResult[i] == null)
continue;

// wait for specified email ...
if (!arResult[i].AsyncWaitHandle.WaitOne(10, false))
{
continue;
}

try
{
// this email is finished, using EndSendMail to get result

arSmtp[i].EndSendMail(arResult[i]);
System.Threading.Thread.Sleep(1000 * 1);
Console.WriteLine(String.Format("Send email to {0} successfully", arRcpt[i]));

}
catch (Exception ep)
{
Console.WriteLine(
String.Format("Failed to send email to {0} with error {1}: ",
arRcpt[i] + i, ep.Message));
Console.ReadLine();
}
// Set this email result to null, then it won't be processed again
arResult[i] = null;
nSent++;
}
}
}

}
}


he send email then she take 3 second than he send another email.

i want if i have 4 socks for exemple he send 4 email in the same time , each email with a differentsocks, then he pause one second and send another 4 emails.

what i should do please ?

Edited by user Thursday, November 5, 2015 1:48:08 AM(UTC)  | Reason: Not specified

ivan  
#2 Posted : Wednesday, November 4, 2015 4:07:59 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,154

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
Hi, you should not use oResult.AsyncWaitHandle.WaitOne after just sent one email, you should send all emails at first, then use AsyncWaitHandle.

Please have a look at this example:

https://www.emailarchite...il/kb/csharp.aspx?cat=13

You can also refer to mass.csharp sample project in EASendMail installation path.
wydadforever  
#3 Posted : Thursday, November 5, 2015 1:50:52 AM(UTC)
wydadforever

Rank: Newbie

Groups: Registered
Joined: 9/4/2015(UTC)
Posts: 0

Thanks: 1 times
Originally Posted by: ivan Go to Quoted Post
Hi, you should not use oResult.AsyncWaitHandle.WaitOne after just sent one email, you should send all emails at first, then use AsyncWaitHandle.

Please have a look at this example:

https://www.emailarchite...il/kb/csharp.aspx?cat=13

You can also refer to mass.csharp sample project in EASendMail installation path.



Hi evan thanks for your help , i update the code as you can see in my post, but the problem he send all email in one time , what i want that he send 3 email than he make pause one secone than he send 3 other email in the list what i should do
?
ivan  
#4 Posted : Thursday, November 5, 2015 4:02:48 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,154

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)

Then you can call Sleep(1000) after BeginSendMail ...
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.145 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.