| |
---|
| | //echo $toReturn; // DEBUG |
---|
| | $toReturn = substr($toReturn, -32); |
---|
| | return $toReturn; |
---|
| | } |
---|
| | function short_code($code){ |
---|
| | $fixedCode = substr($code, 0, 2); |
---|
| | $fixedCode .= "0"; |
---|
| | $fixedCode .= substr($code, 2); |
---|
| | $fixedCode .= substr($code, 4, 4); |
---|
| | $fixedCode .= substr($code, 3); |
---|
| | $fixedCode .= substr($code, 8); |
---|
| | $fixedCode .= substr($code, 10, 6); |
---|
| | $fixedCode .= substr($code, 9); |
---|
| | $fixedCode .= substr($code, 16, strlen($code)); |
---|
| | return $fixedCode; |
---|
| | } |
---|
| | |
---|
| | $rand = substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil(8/strlen($x)) )),1,8); |
---|
| | |
---|
| | // announce self to channel |
---|
| | $myCode = get_own_code(); |
---|
| | $myCode = (strlen($myCode) == 31) ? short_code($myCode) : $myCode; |
---|
| | if(!isset($myCode) || $myCode == "") |
---|
| | die("Please contact 0xRoM on discord for help fixing this issue!"); |
---|
| | |
---|
| | $socket = fsockopen("ice.uplinkcorp.net", 6667); |
---|
| |
---|
| | |
---|
| | // Force an endless while |
---|
| | while (1) { |
---|
| | // Continue the rest of the script here |
---|
| | while ($data = fgets($socket, 128)) { |
---|
| | while ($data = fgets($socket, 256)) { |
---|
| | echo $data; |
---|
| | flush(); |
---|
| | |
---|
| | // Separate all data |
---|
| |
---|
| | if ($command == ":!req") { |
---|
| | if(isset($ex[4]) && $ex[4] <> ""){ // bot name |
---|
| | if(isset($ex[5]) && $ex[5] <> ""){ // code |
---|
| | if(!in_array($ex[4], $collected)){ // not already added this bot |
---|
| | |
---|
| | $response = get_code($ex[5]); |
---|
| | $response = (strlen($response) == 31) ? short_code($response) : $response; |
---|
| | |
---|
| | if(preg_match("/^[0-9A-Fa-f]{32}/", $response)){ // valid code back |
---|
| | echo "[+] computing for ".$ex[4]."\n"; |
---|
| | fputs($socket, "PRIVMSG #theSignal :!rsp " . $ex[4] . " " . $response . "\n"); |
---|
| | array_push($collected, $ex[4]); // add to replied array |
---|
| | |
---|
| | $myCode = get_own_code(); |
---|
| | $myCode = (strlen($myCode) == 31) ? short_code($myCode) : $myCode; |
---|
| | |
---|
| | fputs($socket, "PRIVMSG #theSignal :!req " . $rand . " " . $myCode . "\n"); |
---|
| | echo "[+] replied to ".$ex[4]."\n"; |
---|
| | }else{echo "[-] invalid code\n";} |
---|
| | }else{echo "[-] already exchanged\n";} |
---|
| |
---|
| | } |
---|
| | } |
---|
| | ?> |
---|
| | |
---|
| | |
---|
| | |