Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- /**
- * Recode from alfa shell
- * Only work in localhost
- * @package PHP PORT SCANNER
- * @link https://fb.com/aardzz
- *
- */
- $green = "\e[1;92m";
- $cyan = "\e[1;36m";
- $normal = "\e[0m";
- $blue = "\e[34m";
- $green1 = "\e[0;92m";
- $yellow = "\e[93m";
- $red = "\e[1;91m";
- function banner(){
- $green = "\e[1;92m";
- $cyan = "\e[1;36m";
- $normal = "\e[0m";
- $blue = "\e[1;34m";
- $green1 = "\e[0;92m";
- $yellow = "\e[93m";
- $red = "\e[1;91m";
- $banner = $cyan."
- ▄███████▄ ▀████ ▐████▀
- ██▀ ▄██ ███▌ ████▀
- ▄███▀ ███ ▐███
- ▀█▀▄███▀▄▄ ▀███▄███▀
- ▄███▀ ▀ ████▀██▄
- ▄███▀ ▐███ ▀███
- ███▄ ▄█ ▄███ ███▄
- ▀████████▀ ████ ███▄
- ".$normal.$red."Z0NK3X".$normal."
- [".date("Y-m-d H:i:s")."]
- ".$yellow."╔═╗╔═╗╦═╗╔╦╗ ".$normal.$red."┌─┐┌─┐┌─┐┌┐┌┌┐┌┌─┐┬─┐
- ".$yellow."╠═╝║ ║╠╦╝ ║ ".$normal.$red."└─┐│ ├─┤││││││├┤ ├┬┘
- ".$yellow."╩ ╚═╝╩╚═ ╩ ".$normal.$red."└─┘└─┘┴ ┴┘└┘┘└┘└─┘┴└─
- \n".$normal;
- echo $banner;
- }
- $host = "127.0.0.1";
- banner()."\n";
- echo " [+] Default Hostname : ".php_uname("n")."\n";
- echo " [+] Using Host : ".$cyan.$host.$normal."\n";
- $start = readline(" [?] Port Start : ");
- $end = readline(" [?] Port End : ");
- $packetContent = "GET / HTTP/1.1\r\n\r\n";
- if (!is_numeric($start) | !is_numeric($end)) {
- exit();
- }
- echo "\r\n\r\n";
- if (ctype_xdigit($packetContent)) $packetContent = @pack("H*", $packetContent);
- else {
- $packetContent = str_replace(array(
- "\r",
- "\n"
- ) , "", $packetContent);
- $packetContent = str_replace(array(
- "\\r",
- "\\n"
- ) , array(
- "\r",
- "\n"
- ) , $packetContent);
- }
- //echo "---------------------------------------------------~\n";
- echo " ~:———————————————————————————————————————————————————:~\n";
- for ($i = $start; $i <= $end; $i++) {
- $sock = @fsockopen($host, $i, $errno, $errstr, 3);
- if ($sock) {
- stream_set_timeout($sock, 5);
- fwrite($sock, $packetContent . "\r\n\r\n\x00");
- $counter = 0;
- $maxtry = 1;
- $bin = "";
- do {
- $line = fgets($sock, 1024);
- if (trim($line) == "") $counter++;
- $bin.= $line;
- }
- while ($counter < $maxtry);
- fclose($sock);
- echo $green1." [*] Port $i Is Open!\n".$normal;
- if (!empty($bin)) {
- $str = str_replace("\r\n\r\n", PHP_EOL, $bin);
- echo " ".implode(PHP_EOL." ",explode("\r\n", $str));
- }else{
- echo $red." [!] Response is empty!\n".$normal;
- }
- echo " ~:———————————————————————————————————————————————————~\n";
- }
- flush();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement