// ClapTrap IRC Bot 0.5
// (C) Doddy Hackman 2015
package claptrap.irc.bot;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
import java.net.*;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Doddy
*/
public class ClapTrapIRCBot {
/**
* @param args the command line arguments
*/
public static String servidor
; public static int puerto;
public static int tiempo;
public static Socket conexion
;
public static void responder
(String contenido
) { try {
String[] textos
= contenido.
split("\n"); if (!"".equals(texto)) {
escribir.write("PRIVMSG " + admin + " : " + texto + "\r\n");
escribir.flush();
try {
Logger.getLogger(ClapTrapIRCBot.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
//
}
}
public static void main
(String[] args
) {
Scanner input
= new Scanner
(System.
in);
System.
out.
println("\n-- == ClapTrap IRC Bot 0.5 == --\n\n"); System.
out.
println("[+] Hostname : "); String hostname_value
= input.
nextLine(); System.
out.
println("\n[+] Port : "); System.
out.
println("\n[+] Channel : "); String channel_value
= input.
nextLine(); System.
out.
println("\n[+] Nickname Admin : "); String admin_value
= input.
nextLine();
servidor = hostname_value;
puerto = port_value;
nick = "ClapTrap";
admin = admin_value;
canal = channel_value;
tiempo = 3;
try {
conexion
= new Socket(servidor, puerto
);
escribir.write("NICK " + nick + "\r\n");
escribir.write("USER " + nick + " 1 1 1 1\r\n");
escribir.flush();
escribir.write("JOIN " + canal + "\r\n");
escribir.flush();
System.
out.
println("\n[+] Online");
funciones funcion = new funciones();
while ((contenido = leer.readLine()) != null) {
Pattern search = null;
Matcher regex = null;
search = Pattern.compile("^PING(.*)$");
regex = search.matcher(contenido);
if (regex.find()) {
escribir.write("PONG " + regex.group(1) + "\r\n");
escribir.flush();
}
search = Pattern.compile(":(.*)!(.*) PRIVMSG (.*) :(.*)");
regex = search.matcher(contenido);
if (regex.find()) {
String control_admin
= regex.
group(1); if (control_admin.equals(admin)) {
//
search = Pattern.compile("!sqli (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String target
= regex.
group(1); String code
= funcion.
SQLI_Scanner(target
); responder(code);
}
search = Pattern.compile("!lfi (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String target
= regex.
group(1); String code
= funcion.
scan_lfi(target
); responder(code);
}
search = Pattern.compile("!panel (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String target
= regex.
group(1); String code
= funcion.
panel_finder(target
); responder(code);
}
search = Pattern.compile("!fuzzdns (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String target
= regex.
group(1); String code
= funcion.
fuzz_dns(target
); responder(code);
}
search = Pattern.compile("!locateip (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String target
= regex.
group(1); String code
= funcion.
locate_ip(target
); responder(code);
}
search = Pattern.compile("!sqlifinder (.*) (.*) (.*)$");
regex = search.matcher(text);
if (regex.find()) {
int cantidad
= Integer.
parseInt(regex.
group(2)); String buscador
= regex.
group(3); String code
= funcion.
find_sqli(dork, cantidad, buscador
); responder(code);
}
search = Pattern.compile("!rfifinder (.*) (.*) (.*)$");
regex = search.matcher(text);
if (regex.find()) {
int cantidad
= Integer.
parseInt(regex.
group(2)); String buscador
= regex.
group(3); String code
= funcion.
find_rfi(dork, cantidad, buscador
); responder(code);
}
search = Pattern.compile("!crackit (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String code
= funcion.
crack_md5(md5
); responder(code);
}
search = Pattern.compile("!tinyurl (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String code
= funcion.
tiny_url(url
); responder(code);
}
search = Pattern.compile("!httpfinger (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String code
= funcion.
http_finger(page
); responder(code);
}
search = Pattern.compile("!md5 (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String texto
= regex.
group(1); String code
= "[+] MD5 : " + funcion.
md5_encode(texto
); responder(code);
}
search = Pattern.compile("!base64 (.*) (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String option
= regex.
group(1); String texto
= regex.
group(2); if ("encode".equals(option)) {
code = "[+] Base64 : " + funcion.encode_base64(texto);
}
if ("decode".equals(option)) {
code = "[+] Text : " + funcion.decode_base64(texto);
}
responder(code);
}
search = Pattern.compile("!ascii (.*) (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String option
= regex.
group(1); String texto
= regex.
group(2); if ("encode".equals(option)) {
code = "[+] ASCII : " + funcion.encode_ascii(texto);
}
if ("decode".equals(option)) {
code = "[+] Text : " + funcion.decode_ascii(texto);
}
responder(code);
}
search = Pattern.compile("!hex (.*) (.*)$");
regex = search.matcher(text);
if (regex.find()) {
String option
= regex.
group(1); String texto
= regex.
group(2); if ("encode".equals(option)) {
code = "[+] Hex : " + funcion.encode_hex(texto);
}
if ("decode".equals(option)) {
code = "[+] Text : " + funcion.decode_hex(texto);
}
responder(code);
}
search = Pattern.compile("!help");
regex = search.matcher(text);
if (regex.find()) {
code = code + "Hi , I am ClapTrap an assistant robot programmed by Doddy Hackman in the year 2015" + "\n";
code = code + "[++] Commands" + "\n";
code = code + "[+] !help" + "\n";
code = code + "[+] !locateip <web>" + "\n";
code = code + "[+] !sqlifinder <dork> <count pages> <google/bing>" + "\n";
code = code + "[+] !rfifinder <dork> <count pages> <google/bing>" + "\n";
code = code + "[+] !panel <page>" + "\n";
code = code + "[+] !fuzzdns <domain>" + "\n";
code = code + "[+] !sqli <page>" + "\n";
code = code + "[+] !lfi <page>" + "\n";
code = code + "[+] !crackit <hash>" + "\n";
code = code + "[+] !tinyurl <page>" + "\n";
code = code + "[+] !httpfinger <page>" + "\n";
code = code + "[+] !md5 <text>" + "\n";
code = code + "[+] !base64 <encode/decode> <text>" + "\n";
code = code + "[+] !ascii <encode/decode> <text>" + "\n";
code = code + "[+] !hex <encode/decode> <text>" + "\n";
code = code + "[++] Enjoy this IRC Bot" + "\n";
responder(code);
}
//
}
}
}
System.
out.
println("\n[-] Error connecting"); }
}
}
// The End ?