summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README5
-rwxr-xr-xcompile.sh36
-rwxr-xr-xrunme.sh3
-rw-r--r--scripts/command3
-rw-r--r--scripts/rawcommand3
-rw-r--r--scripts/startup4
-rwxr-xr-xsegfaultbin26200 -> 0 bytes
-rw-r--r--segfault.c10
-rwxr-xr-xshell10
9 files changed, 26 insertions, 48 deletions
diff --git a/README b/README
index 6d0b047..0f43982 100644
--- a/README
+++ b/README
@@ -1,4 +1 @@
-test
-merp
-more derp
-just double-checking again.
+This bot expects a homedir and a user account just like any other person.
diff --git a/compile.sh b/compile.sh
index a920ae2..6c17703 100755
--- a/compile.sh
+++ b/compile.sh
@@ -1,33 +1,5 @@
#!/bin/sh
-#clean it out so I quit restarting after a failed compile. >.<
-INSTALL_DIR="/home/segfault/"
-rm segfault
-echo '#!/bin/sh' > shell
-echo '# this file is generated by compile.sh. do not edit directly' >> shell
-echo 'cd "'`pwd`'"' >> shell
-echo 'kill `pgrep -P 1 -f "tail -f ./files/cmd_in"`' >> shell
-echo 'setuidgid segfault tail -f ./files/cmd_in | setuidgid segfault su -l segfault > ./files/cmd_out 2>&1' >> shell
-chmod +x shell
-echo '#define CHDIR "'`pwd`'"' > config.h
-
-#if [ -e /usr/lib/libirc.so ]; then
-# gcc -Wall -o segfault segfault.c -lirc
-# rm -r /var/www/source/segfault/*
-# cd /home/epoch/projects/c_/wargaming-libirc
-# ./compile.sh
-# cd /root/services/segfault
-# cp * /var/www/source/segfault/
-# mkdir /var/www/source/segfault/scripts
-# cp scripts/* /var/www/source/segfault/scripts/
-# cd /var/www/source/
-# tar -czf segfault.tgz segfault
-
- mkdir $INSTALL_DIR/files
- mkfifo $INSTALL_DIR/files/cmd_in
- mkfifo $INSTALL_DIR/files/cmd_out
- cd libirc
- ./compile.sh
- cd ..
- gcc -Wall -o segfault segfault.c -lirc -Llibirc -Ilibirc
-
-rm config.h
+cd libirc
+./compile.sh
+cd ..
+gcc -Wall -o segfault segfault.c -lirc -Llibirc -Ilibirc
diff --git a/runme.sh b/runme.sh
index bd434d4..649ec36 100755
--- a/runme.sh
+++ b/runme.sh
@@ -1,4 +1,5 @@
#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/libirc
./shell&
-./segfault bot_$$
+./segfault SegFault$$
+wait
diff --git a/scripts/command b/scripts/command
new file mode 100644
index 0000000..adc0860
--- /dev/null
+++ b/scripts/command
@@ -0,0 +1,3 @@
+!leetuntail * /home/segfault/files/cmd_out
+!leettail 56/home/segfault/files/cmd_out
+!leetappend /home/segfault/files/cmd_in 10 %s
diff --git a/scripts/rawcommand b/scripts/rawcommand
new file mode 100644
index 0000000..130a4af
--- /dev/null
+++ b/scripts/rawcommand
@@ -0,0 +1,3 @@
+!leetuntail * /home/segfault/files/cmd_out
+!rawtail /home/segfault/files/cmd_out
+!leetappend /home/segfault/files/cmd_in 10 %s
diff --git a/scripts/startup b/scripts/startup
new file mode 100644
index 0000000..28aeb10
--- /dev/null
+++ b/scripts/startup
@@ -0,0 +1,4 @@
+!alias !rc !eval /home/segfault/scripts/rawcommand %s
+!alias !eval !leettail 22%s
+!alias !c !eval /home/segfault/scripts/command %s
+!raw join #default
diff --git a/segfault b/segfault
deleted file mode 100755
index a94eb6d..0000000
--- a/segfault
+++ /dev/null
Binary files differ
diff --git a/segfault.c b/segfault.c
index b98973c..2e8060c 100644
--- a/segfault.c
+++ b/segfault.c
@@ -8,7 +8,6 @@
#include <fcntl.h>
#include <irc.h>
#include <time.h>
-#include "config.h"
#define SERVER "192.168.0.2"
#define PORT "6667"
@@ -22,10 +21,6 @@
#define RAWLOG "./files/rawlog"
#define LOG "./files/log"
-#define NEWS_PIPE "./files/news"
-#define LINKS_FILE "/var/www/docs/IRClinks.txt"
-#define NEWS_FILE "/var/www/cgi-bin/info/news.html"
-#define PID_FILE "./files/my.pid"
#define MAXTAILS 400 //just to have it more than the system default.
@@ -62,7 +57,7 @@ void mywrite(int fd,char *b) {
void ircmode(int fd,char *channel,char *mode,char *nick) {
int sz=5+strlen(channel)+1+strlen(mode)+1+strlen(nick)+3;//"MODE ", " ", " ","\r\n\0"
char *hrm=malloc(sz+1);
- if(!hrm) return (void)mywrite(fd,"QUIT :malloc error 1! holy shit!\r\n");
+ if(!hrm) return mywrite(fd,"QUIT :malloc error 1! holy shit!\r\n");
snprintf(hrm,sz,"MODE %s %s %s\r\n",channel,mode,nick);
write(fd,hrm,strlen(hrm));
free(hrm);
@@ -163,11 +158,13 @@ char *format_magic(int fd,char *from,char *nick,char *orig_fmt,char *arg) {
notargs[c]=strdup(fmt+j);
sz+=strlen(notargs[c]);
output=malloc(sz+1);
+ output[0]=0;
for(i=0;i<c;i++) {
strcat(output,notargs[i]);
strcat(output,args[i]);
}
strcat(output,notargs[i]);
+ output[sz]=0;
free(fmt);
return output;
}
@@ -1044,7 +1041,6 @@ void line_handler(int fd,char *line) {//this should be built into the libary?
int main(int argc,char *argv[]) {
int fd;
int c;
- chdir("/home/segfault");
redirect_to_fd=-1;
debug=0;
lines_sent=0;
diff --git a/shell b/shell
index 582bd88..f493979 100755
--- a/shell
+++ b/shell
@@ -1,5 +1,7 @@
#!/bin/sh
-# this file is generated by compile.sh. do not edit directly
-cd "/root/services/segfault"
-kill `pgrep -P 1 -f "tail -f ./files/cmd_in"`
-setuidgid segfault tail -f ./files/cmd_in | setuidgid segfault su -l segfault > ./files/cmd_out 2>&1
+#this is to keep stale tails from hanging around...
+kill `pgrep -P 1 -f "tail -f /home/segfault/files/cmd_in"`
+mkdir -p /home/segfault/files
+mkfifo /home/segfault/files/cmd_in
+mkfifo /home/segfault/files/cmd_out
+tail -f /home/segfault/files/cmd_in | su -l segfault > /home/segfault/files/cmd_out 2>&1