Initial import.

This commit is contained in:
Jan Philipp Timme
2010-11-21 22:13:54 +00:00
parent 85f7da38b6
commit 6b39d44754
52 changed files with 1395 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "away" "prefix" "2"
$this -> call("away", $this -> protocol -> getArgs(1, $recv));
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
#BOT_INCLUDE "checkips" "global" "0"
if($recv["msgarr"][1] == "add"){
$ip = $recv["msgarr"][2];
$this -> ipcs[$ip]["lastcheck"] = 0;
$this -> ipcs[$ip]["status"] = null;
}
if($recv["msgarr"][1] == "del"){
$ip = $this -> protocol -> getArgs(2, $recv);
unset($this -> ipcs[$ip]);
}
if($recv["msgarr"][1] == "list"){
if(count($this -> ipcs) < 1){
$this -> call("notice", $recv["nick"], "Bisher keine IPs zu checken.");
}
else{
foreach($this -> ipcs AS $ip => $data){
$status = ($data["status"]) ? "Online" : "Offline";
$line = "[".$ip."] Status: ".$status;
$this -> call("notice", $recv["nick"], $line);
}
}
}
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
#BOT_INCLUDE "clist" "prefix" "3"
$chans = implode(", ", $this -> channels);
$this -> call("privmsg", $recv["origin"], "current channels: ".$chans);
?>
+6
View File
@@ -0,0 +1,6 @@
<?php
#BOT_INCLUDE "cycle" "prefix" "1"
$this -> call("part", $recv["origin"], "cycling...");
sleep(1);
$this -> call("join", $recv["origin"]);
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
#BOT_INCLUDE "dns" "prefix" "1"
$data = $this -> protocol -> getArgs(1, $recv);
if(trim($data) == "") $data = $recv["iphost"];
$host = gethostbyaddr($data);
if($host == $data || $host == "") $this -> call("privmsg", $recv["origin"], $recv["nick"].", your ip could not be resolved.");
else $this -> call("privmsg", $recv["origin"], $recv["nick"].", your host is: ".$host);
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
#BOT_INCLUDE "floodtest" "prefix" "3"
$max = $this -> protocol -> getArgs(1, $recv);
$i = 0;
while($i < $max){
$text[] = md5(rand());
$i++;
}
foreach($text as $line) $this -> call("privmsg", $recv["origin"], $line);
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
#BOT_INCLUDE "help" "global" "0"
$help[] = "Commands available for your level (".$recv["level"]."):";
$help[] = $this -> commands -> getList($recv["level"]);
$help[] = "*=These commands have to be used in query only. (no need to use the prefix there)";
$help[] = "#=These commands have to be used in channel only.";
if(!$this -> userdb -> isUser($recv["nick"])) $help[] = "In order to gain a higher level ask the owner to create an account for you.";
elseif(!$this -> userdb -> isActive($recv["nick"])) $help[] = "In order to gain access, identify yourself by typing: /msg ".$this -> nick." identify <password>";
elseif($this -> userdb -> isActive($recv["nick"])) $help[] = "In order to change your password, type /msg ".$this -> nick." password <new password>";
foreach($help as $line) $this -> call("notice", $recv["nick"], $line);
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
#BOT_INCLUDE "ip" "prefix" "1"
$data = $this -> protocol -> getArgs(1, $recv);
if(trim($data) == "") $data = $recv["iphost"];
$ip = gethostbyname($data);
if($ip == $data) $this -> call("privmsg", $recv["origin"], $recv["nick"].", your dns could not be resolved.");
else $this -> call("privmsg", $recv["origin"], $recv["nick"].", your ip is: ".$ip);
?>
View File
View File
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "join" "prefix" "3"
$this -> addChannels(array($this -> protocol -> getArgs(1, $recv)));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "kick" "prefix" "4"
$this -> call("kick", $recv["origin"], $recv["msgarr"][1], $this -> protocol -> getArgs(2, $recv));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "level" "prefix" "0"
$this -> call("privmsg", $recv["origin"], $recv["nick"].", your level is: ".$this -> userdb -> getLevel($recv["nick"]));
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
#BOT_INCLUDE "logout" "prefix" "0"
$this -> userdb -> logout($recv["nick"]);
$this -> call("notice", $recv["nick"], "You are now logged out. Your level: ".$this -> userdb -> getLevel($recv["nick"]));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "m" "prefix" "3"
$this -> call("mode", $recv["origin"], $this -> protocol -> getArgs(1, $recv));
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
#BOT_INCLUDE "masterlogout" "prefix" "3"
$this -> userdb -> logoutAll();
$this -> call("privmsg", $recv["origin"], "Masterlogout done.");
?>
+6
View File
@@ -0,0 +1,6 @@
<?php
#BOT_INCLUDE "md5" "global" "0"
$value = trim($this -> protocol -> getArgs(1, $recv));
if($value != "") $this -> call("privmsg", $recv["origin"], $recv["nick"].", your md5-hash: ".md5($value));
else $this -> call("privmsg", $recv["origin"], $recv["nick"].": Syntax: ".$this -> prefix."md5 <value>");
?>
+13
View File
@@ -0,0 +1,13 @@
<?php
#BOT_INCLUDE "mods" "global" "0"
if(is_numeric($level = $this -> protocol -> getArgs(1, $recv))){
$text[] = "Commands for level ".$level.": (example: command(level) (*=query command, #=channel command))";
$text[] = $this -> commands -> getList($level);
foreach($text as $line) $this -> call("notice", $recv["nick"], $line);
}
else{
$text[] = "Installed commands: (example: command(level) (*=query command, #=channel command))";
$text[] = $this -> commands -> getList(9);
foreach($text as $line) $this -> call("notice", $recv["origin"], $line);
}
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "nick" "prefix" "3"
$this -> setNick($this -> protocol -> getArgs(1, $recv));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "part" "prefix" "3"
$this -> removeChannels(array($this -> protocol -> getArgs(1, $recv)));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "php" "global" "9"
eval($this -> protocol -> getArgs(1, $recv));
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
#BOT_INCLUDE "phpdump" "global" "9"
$r = $this -> eval_php($this -> protocol -> getArgs(1, $recv));
if(trim($r) != ""){
$lines = explode("\n", $r);
foreach($lines as $line) $this -> call("privmsg", $recv["origin"], $line);
}
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "quit" "prefix" "3"
$this -> call("quit", $this -> protocol -> getArgs(1, $recv));
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "raw" "prefix" "3"
$this -> send($this -> protocol -> getArgs(1, $recv));
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
#BOT_INCLUDE "reload" "prefix" "2"
$this -> commands -> update();
$this -> call("privmsg", $recv["origin"], "commands reloaded.");
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "say" "prefix" "1"
$this -> call("privmsg", $recv["origin"], $this -> protocol -> getArgs(1, $recv));
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
#BOT_INCLUDE "stats" "prefix" "0"
$total = $this -> eval_sys("find * | grep -i php | xargs cat | wc -l");
$stats = "";
$stats .= "Memory: ".number_format(memory_get_usage(true) / 1024)."KB ";
$stats .= "(Peak: ".number_format(memory_get_peak_usage(true) / 1024)."KB)";
$stats .= " - Code: ".number_format($total[0])." lines";
$this -> call("privmsg", $recv["origin"], $stats);
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
#BOT_INCLUDE "stfu" "prefix" "0"
if($recv["level"] >= 3) $this -> call("privmsg", $recv["origin"], "aye sir!");
else $this -> call("kick", $recv["target"], $recv["nick"], "dann fang mal an!");
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
#BOT_INCLUDE "stop" "prefix" "3"
$this -> alive = 0;
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
#BOT_INCLUDE "sys" "query" "9"
$cmd = $this -> protocol -> getArgs(1, $recv);
$result = $this -> eval_sys($cmd);
$this -> call("privmsg", $recv["nick"], $cmd);
foreach($result as $line) $this -> call("privmsg", $recv["nick"], $line);
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
#BOT_INCLUDE "uptime" "prefix" "2"
$cmd = "uptime";
$p = popen($cmd, "r");
while($data = fgets($p, 8192)){
$result[] = $data;
}
pclose($p);
foreach($result as $line) $this -> call("privmsg", $recv["origin"], trim($line));
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
#BOT_INCLUDE "identify" "query" "0"
/*
* This file contains code for the query-based user-command "identify"
*/
include("#BOT_PATHuser.query.inc.php");
if($this -> userdb -> checkPw($nick, $pw)){
$this -> userdb -> update($nick);
$this -> call("notice", $nick, "You are now identified.");
}
else{
$this -> call("notice", $nick, "Wrong password or you have no account with this nickname.");
}
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
#BOT_INCLUDE "password" "query" "0"
/*
* This file contains code for the query-based user-command "password"
*/
include("#BOT_PATHuser.query.inc.php");
if($this -> userdb -> isActive($nick)){
$this -> userdb -> updatePW($nick, $pw);
$this -> call("notice", $nick, "Your new pw is now: ".$pw);
}
else{
$this -> call("notice", $nick, "You are not identified. Type /msg ".$this -> nick." identify <password> in order to identify yourself");
}
?>
+45
View File
@@ -0,0 +1,45 @@
<?php
#BOT_INCLUDE "user" "prefix" "3"
/*
* This file contains code for the prefix-based user-command
*/
$nick = $recv["msgarr"][2];
switch($recv["msgarr"][1]){
case "add":
$pw = md5(rand().time().md5(time()));
$this -> userdb -> addUser($nick, $pw);
$this -> userdb -> setLevel($nick, 1);
$this -> call("notice", $nick, "Your current password: ".$pw);
$this -> call("notice", $nick, "Your current level: 1");
$this -> call("notice", $nick, "In order to change your password, type: /msg ".$this -> nick." identify ".$pw." and /msg ".$this -> nick." password <new password>");
break;
case "del":
$this -> userdb -> delUser($nick);
$this -> call("privmsg", $recv["origin"], "User '".$nick."' deleted.");
break;
case "level":
$this -> userdb -> setLevel($nick, $recv["msgarr"][3]);
$this -> call("notice", $nick, "Your new level: ".$recv["msgarr"][3]);
break;
case "list":
$list = $this -> userdb -> listUsers();
foreach($list as $user => $level){
$users[] = $user."(".$level.")";
}
$this -> call("notice", $recv["nick"], "Users: ".implode(", ", $users));
break;
case "help":
$this -> call("notice", $recv["nick"], "Available commands: list, add <nick>, level <nick> <new level>, del <nick>, help (level 3+)");
break;
default:
$this -> call("notice", $recv["nick"], "Unknown user command! Type ".$this -> prefix."user help for further information");
break;
}
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
/*
* This file contains code to be included.
*/
$nick = $recv["nick"];
$pw = $recv["msgarr"][1];
?>