This commit is contained in:
randomuser 2021-04-02 03:19:01 +00:00
parent 0ac618d467
commit e9fd366397
1 changed files with 63 additions and 20 deletions

57
main.c
View File

@ -8,17 +8,14 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <string.h> #include <string.h>
#include "messages.h"
#define CBSIZE 2048 #define CBSIZE 2048
const char *blocked[] = { const char *blocked[] = {
"MIF",
"attack",
"unexpectedEOF",
"jan3",
"c-69-255-237-187.hsd1.md.comcast.net"
}; };
const char *blockmsg = "Error 404: no"; const char *kickonjoin[] = {
};
const char *floodmsg = "HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK HONK";
const char *blockmsg = "Error 418: no";
const char *username = "guest_03384"; const char *username = "guest_03384";
const char *channel = "#chaos"; const char *channel = "#chaos";
const char *topic = "rule one: you are now a duck. ・゜゜・。。・゜゜\\_o< QUACK!"; const char *topic = "rule one: you are now a duck. ・゜゜・。。・゜゜\\_o< QUACK!";
@ -76,6 +73,7 @@ int main()
const char host[] = "localhost"; const char host[] = "localhost";
const int port = 6667; const int port = 6667;
char *ip; char *ip;
int autokick = 1;
if(!(h = gethostbyname(host))) { if(!(h = gethostbyname(host))) {
perror("gethostbyname"); perror("gethostbyname");
@ -122,6 +120,12 @@ int main()
write(cbuf->fd, buf, strlen(buf)); write(cbuf->fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "PRIVMSG %s :someone called me loser :(\r\n", owner, host); snprintf(buf, sizeof(buf), "PRIVMSG %s :someone called me loser :(\r\n", owner, host);
write(cbuf->fd, buf, strlen(buf)); write(cbuf->fd, buf, strlen(buf));
}
if((strstr(buf, "stop autokicking") != NULL) && (strstr(buf, owner) != NULL)) {
autokick = 0;
}
if((strstr(buf, "start autokicking") != NULL) && (strstr(buf, owner) != NULL)) {
autokick = 1;
} }
if(strstr(buf, "PING") != NULL ) { if(strstr(buf, "PING") != NULL ) {
snprintf(buf, sizeof(buf), "PONG :club.tilde.chat\r\n", host); snprintf(buf, sizeof(buf), "PONG :club.tilde.chat\r\n", host);
@ -132,12 +136,51 @@ int main()
write(cbuf->fd, buf, strlen(buf)); write(cbuf->fd, buf, strlen(buf));
} }
if(strstr(buf, "JOIN") != NULL) { if(strstr(buf, "JOIN") != NULL) {
if(autokick == 1) {
for(int i = 0; i <= sizeof(blocked)/sizeof(blocked[0]); i++) { for(int i = 0; i <= sizeof(blocked)/sizeof(blocked[0]); i++) {
if(strstr(buf, blocked[i]) != NULL) { if(strstr(buf, blocked[i]) != NULL) {
snprintf(buf, sizeof(buf), "KICK %s %s :%s\r\n", channel, blocked[i], blockmsg, host); snprintf(buf, sizeof(buf), "KICK %s %s :%s\r\n", channel, blocked[i], blockmsg, host);
write(cbuf->fd, buf, strlen(buf)); write(cbuf->fd, buf, strlen(buf));
} }
} }
}
}
if((strstr(buf, "initiate honkage") != NULL) && (strstr(buf, owner) != NULL)) {
for(int i = 0; i < 41; i++) {
snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", channel, floodmsg, host);
write(cbuf->fd, buf, strlen(buf));
}
}
if((strstr(buf, "xfnwcool") != NULL) && (strstr(buf, owner) != NULL)) {
for(int i = 0; i < 41; i++) {
snprintf(buf, sizeof(buf), "MODE #chaos lock set -euaoq *!*@* julian julian julian\r\n", host);
write(cbuf->fd, buf, strlen(buf));
}
}
if((strstr(buf, "space space") != NULL) && (strstr(buf, owner) != NULL)) {
for(int i = 0; i < 41; i++) {
snprintf(buf, sizeof(buf), "PRIVMSG %s : \r\n", channel, floodmsg, host);
write(cbuf->fd, buf, strlen(buf));
}
}
if(strstr(buf, "ping hell") != NULL) {
snprintf(buf, sizeof(buf), "INVITE tildebot %s\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
sleep(5);
snprintf(buf, sizeof(buf), "PRIVMSG %s :,c c op-ping yes\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
for(int i = 0; i < 20; i++) {
snprintf(buf, sizeof(buf), "PRIVMSG %s :,ops\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "PRIVMSG %s :,more\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "PRIVMSG %s :,more\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "PRIVMSG %s :,more\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "PRIVMSG %s :,more\r\n", channel, host);
write(cbuf->fd, buf, strlen(buf));
}
} }
if(strstr(buf, "ban") != NULL) { if(strstr(buf, "ban") != NULL) {
snprintf(buf, sizeof(buf), "PRIVMSG ChanServ :unban %s %s\r\n", channel, username, host); snprintf(buf, sizeof(buf), "PRIVMSG ChanServ :unban %s %s\r\n", channel, username, host);