Foro de elhacker.net

Programación => Java => Mensaje iniciado por: BigBear en 15 Abril 2016, 21:26 pm



Título: [Java] ClapTrap IRC Bot 0.5
Publicado por: BigBear en 15 Abril 2016, 21:26 pm
Traduccion a Java de mi IRC Bot , tiene las siguientes opciones :

  • Scanner SQLI
  • Scanner LFI
  • Buscador de panel de administracion
  • Localizador de IP
  • Buscador de DNS
  • Buscador de SQLI y RFI en google
  • Crack para hashes MD5
  • Cortador de URL usando tinyurl
  • HTTP FingerPrinting
  • Codificador base64,hex y ASCII 

Unas imagenes :

(http://doddyhackman.webcindario.com/images/claptrap_irc_bot_java_1.jpg)

(http://doddyhackman.webcindario.com/images/claptrap_irc_bot_java_2.jpg)

El codigo :

Código
  1. // ClapTrap IRC Bot 0.5
  2. // (C) Doddy Hackman 2015
  3. package claptrap.irc.bot;
  4.  
  5. import java.io.IOException;
  6. import java.util.regex.Matcher;
  7. import java.util.regex.Pattern;
  8. import java.io.*;
  9. import java.net.*;
  10. import java.util.Scanner;
  11. import java.util.logging.Level;
  12. import java.util.logging.Logger;
  13.  
  14. /**
  15.  *
  16.  * @author Doddy
  17.  */
  18. public class ClapTrapIRCBot {
  19.  
  20.    /**
  21.      * @param args the command line arguments
  22.      */
  23.    public static String servidor;
  24.    public static int puerto;
  25.    public static String nick;
  26.    public static String admin;
  27.  
  28.    public static String canal;
  29.    public static int tiempo;
  30.  
  31.    public static Socket conexion;
  32.    public static BufferedWriter escribir;
  33.    public static BufferedReader leer;
  34.  
  35.    public static void responder(String contenido) {
  36.        try {
  37.            String[] textos = contenido.split("\n");
  38.            for (String texto : textos) {
  39.                if (!"".equals(texto)) {
  40.                    escribir.write("PRIVMSG " + admin + " : " + texto + "\r\n");
  41.                    escribir.flush();
  42.                    try {
  43.                        Thread.sleep(tiempo * 1000);
  44.                    } catch (InterruptedException ex) {
  45.                        Logger.getLogger(ClapTrapIRCBot.class.getName()).log(Level.SEVERE, null, ex);
  46.                    }
  47.                }
  48.            }
  49.        } catch (IOException e) {
  50.            //
  51.        }
  52.    }
  53.  
  54.    public static void main(String[] args) {
  55.  
  56.        Scanner input = new Scanner(System.in);
  57.  
  58.        System.out.println("\n-- == ClapTrap IRC Bot 0.5 == --\n\n");
  59.        System.out.println("[+] Hostname : ");
  60.        String hostname_value = input.nextLine();
  61.        System.out.println("\n[+] Port : ");
  62.        Integer port_value = Integer.parseInt(input.nextLine());
  63.        System.out.println("\n[+] Channel : ");
  64.        String channel_value = input.nextLine();
  65.        System.out.println("\n[+] Nickname Admin : ");
  66.        String admin_value = input.nextLine();
  67.  
  68.        servidor = hostname_value;
  69.        puerto = port_value;
  70.        nick = "ClapTrap";
  71.        admin = admin_value;
  72.        canal = channel_value;
  73.        tiempo = 3;
  74.  
  75.        try {
  76.  
  77.            conexion = new Socket(servidor, puerto);
  78.            escribir = new BufferedWriter(
  79.                    new OutputStreamWriter(conexion.getOutputStream()));
  80.            leer = new BufferedReader(
  81.                    new InputStreamReader(conexion.getInputStream()));
  82.  
  83.            escribir.write("NICK " + nick + "\r\n");
  84.            escribir.write("USER " + nick + " 1 1 1 1\r\n");
  85.            escribir.flush();
  86.  
  87.            String contenido = null;
  88.  
  89.            escribir.write("JOIN " + canal + "\r\n");
  90.            escribir.flush();
  91.  
  92.            System.out.println("\n[+] Online");
  93.  
  94.            funciones funcion = new funciones();
  95.  
  96.            while ((contenido = leer.readLine()) != null) {
  97.  
  98.                Pattern search = null;
  99.                Matcher regex = null;
  100.  
  101.                search = Pattern.compile("^PING(.*)$");
  102.                regex = search.matcher(contenido);
  103.                if (regex.find()) {
  104.                    escribir.write("PONG " + regex.group(1) + "\r\n");
  105.                    escribir.flush();
  106.                }
  107.  
  108.                search = Pattern.compile(":(.*)!(.*) PRIVMSG (.*) :(.*)");
  109.                regex = search.matcher(contenido);
  110.                if (regex.find()) {
  111.                    String control_admin = regex.group(1);
  112.                    String text = regex.group(4);
  113.                    if (control_admin.equals(admin)) {
  114.  
  115.                        //
  116.                        search = Pattern.compile("!sqli (.*)$");
  117.                        regex = search.matcher(text);
  118.                        if (regex.find()) {
  119.                            String target = regex.group(1);
  120.                            String code = funcion.SQLI_Scanner(target);
  121.                            responder(code);
  122.                        }
  123.  
  124.                        search = Pattern.compile("!lfi (.*)$");
  125.                        regex = search.matcher(text);
  126.                        if (regex.find()) {
  127.                            String target = regex.group(1);
  128.                            String code = funcion.scan_lfi(target);
  129.                            responder(code);
  130.                        }
  131.  
  132.                        search = Pattern.compile("!panel (.*)$");
  133.                        regex = search.matcher(text);
  134.                        if (regex.find()) {
  135.                            String target = regex.group(1);
  136.                            String code = funcion.panel_finder(target);
  137.                            responder(code);
  138.                        }
  139.  
  140.                        search = Pattern.compile("!fuzzdns (.*)$");
  141.                        regex = search.matcher(text);
  142.                        if (regex.find()) {
  143.                            String target = regex.group(1);
  144.                            String code = funcion.fuzz_dns(target);
  145.                            responder(code);
  146.                        }
  147.  
  148.                        search = Pattern.compile("!locateip (.*)$");
  149.                        regex = search.matcher(text);
  150.                        if (regex.find()) {
  151.                            String target = regex.group(1);
  152.                            String code = funcion.locate_ip(target);
  153.                            responder(code);
  154.                        }
  155.  
  156.                        search = Pattern.compile("!sqlifinder (.*) (.*) (.*)$");
  157.                        regex = search.matcher(text);
  158.                        if (regex.find()) {
  159.                            String dork = regex.group(1);
  160.                            int cantidad = Integer.parseInt(regex.group(2));
  161.                            String buscador = regex.group(3);
  162.                            String code = funcion.find_sqli(dork, cantidad, buscador);
  163.                            responder(code);
  164.                        }
  165.  
  166.                        search = Pattern.compile("!rfifinder (.*) (.*) (.*)$");
  167.                        regex = search.matcher(text);
  168.                        if (regex.find()) {
  169.                            String dork = regex.group(1);
  170.                            int cantidad = Integer.parseInt(regex.group(2));
  171.                            String buscador = regex.group(3);
  172.                            String code = funcion.find_rfi(dork, cantidad, buscador);
  173.                            responder(code);
  174.                        }
  175.  
  176.                        search = Pattern.compile("!crackit (.*)$");
  177.                        regex = search.matcher(text);
  178.                        if (regex.find()) {
  179.                            String md5 = regex.group(1);
  180.                            String code = funcion.crack_md5(md5);
  181.                            responder(code);
  182.                        }
  183.  
  184.                        search = Pattern.compile("!tinyurl (.*)$");
  185.                        regex = search.matcher(text);
  186.                        if (regex.find()) {
  187.                            String url = regex.group(1);
  188.                            String code = funcion.tiny_url(url);
  189.                            responder(code);
  190.                        }
  191.  
  192.                        search = Pattern.compile("!httpfinger (.*)$");
  193.                        regex = search.matcher(text);
  194.                        if (regex.find()) {
  195.                            String page = regex.group(1);
  196.                            String code = funcion.http_finger(page);
  197.                            responder(code);
  198.                        }
  199.  
  200.                        search = Pattern.compile("!md5 (.*)$");
  201.                        regex = search.matcher(text);
  202.                        if (regex.find()) {
  203.                            String texto = regex.group(1);
  204.                            String code = "[+] MD5 : " + funcion.md5_encode(texto);
  205.                            responder(code);
  206.                        }
  207.  
  208.                        search = Pattern.compile("!base64 (.*) (.*)$");
  209.                        regex = search.matcher(text);
  210.                        if (regex.find()) {
  211.                            String option = regex.group(1);
  212.                            String texto = regex.group(2);
  213.                            String code = "";
  214.                            if ("encode".equals(option)) {
  215.                                code = "[+] Base64 : " + funcion.encode_base64(texto);
  216.                            }
  217.                            if ("decode".equals(option)) {
  218.                                code = "[+] Text : " + funcion.decode_base64(texto);
  219.                            }
  220.                            responder(code);
  221.                        }
  222.  
  223.                        search = Pattern.compile("!ascii (.*) (.*)$");
  224.                        regex = search.matcher(text);
  225.                        if (regex.find()) {
  226.                            String option = regex.group(1);
  227.                            String texto = regex.group(2);
  228.                            String code = "";
  229.                            if ("encode".equals(option)) {
  230.                                code = "[+] ASCII : " + funcion.encode_ascii(texto);
  231.                            }
  232.                            if ("decode".equals(option)) {
  233.                                code = "[+] Text : " + funcion.decode_ascii(texto);
  234.                            }
  235.                            responder(code);
  236.                        }
  237.  
  238.                        search = Pattern.compile("!hex (.*) (.*)$");
  239.                        regex = search.matcher(text);
  240.                        if (regex.find()) {
  241.                            String option = regex.group(1);
  242.                            String texto = regex.group(2);
  243.                            String code = "";
  244.                            if ("encode".equals(option)) {
  245.                                code = "[+] Hex : " + funcion.encode_hex(texto);
  246.                            }
  247.                            if ("decode".equals(option)) {
  248.                                code = "[+] Text : " + funcion.decode_hex(texto);
  249.                            }
  250.                            responder(code);
  251.                        }
  252.  
  253.                        search = Pattern.compile("!help");
  254.                        regex = search.matcher(text);
  255.                        if (regex.find()) {
  256.                            String code = "";
  257.                            code = code + "Hi , I am ClapTrap an assistant robot programmed by Doddy Hackman in the year 2015" + "\n";
  258.                            code = code + "[++] Commands" + "\n";
  259.                            code = code + "[+] !help" + "\n";
  260.                            code = code + "[+] !locateip <web>" + "\n";
  261.                            code = code + "[+] !sqlifinder <dork> <count pages> <google/bing>" + "\n";
  262.                            code = code + "[+] !rfifinder <dork> <count pages> <google/bing>" + "\n";
  263.                            code = code + "[+] !panel <page>" + "\n";
  264.                            code = code + "[+] !fuzzdns <domain>" + "\n";
  265.                            code = code + "[+] !sqli <page>" + "\n";
  266.                            code = code + "[+] !lfi <page>" + "\n";
  267.                            code = code + "[+] !crackit <hash>" + "\n";
  268.                            code = code + "[+] !tinyurl <page>" + "\n";
  269.                            code = code + "[+] !httpfinger <page>" + "\n";
  270.                            code = code + "[+] !md5 <text>" + "\n";
  271.                            code = code + "[+] !base64 <encode/decode> <text>" + "\n";
  272.                            code = code + "[+] !ascii <encode/decode> <text>" + "\n";
  273.                            code = code + "[+] !hex <encode/decode> <text>" + "\n";
  274.                            code = code + "[++] Enjoy this IRC Bot" + "\n";
  275.                            responder(code);
  276.                        }
  277.  
  278.                        //
  279.                    }
  280.                }
  281.            }
  282.        } catch (IOException e) {
  283.            System.out.println("\n[-] Error connecting");
  284.        }
  285.  
  286.    }
  287.  
  288. }
  289.  
  290. // The End ?
  291.  

Si quieren bajar el programa lo pueden hacer de aca :

SourceForge (https://sourceforge.net/projects/claptrapircbot/).
Github (https://github.com/DoddyHackman/ClapTrap_IRC_Bot).

Eso seria todo.