Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- /**
- *
- */
- class Ipscanner
- {
- var $timeout;
- function banner(){
- echo "------------------------------------\r\n";
- echo "-- SIMPLE IP SCANNER --\r\n";
- echo "------------------------------------\r\n";
- echo "[Scan] ".$this->ip."\r\n\n";
- }
- function pesan($pesan){
- echo "[".date("H:i:s")."] ".$pesan."\r\n";
- }
- function scan($ip)
- {
- $this->ip = $ip;
- $ip = explode("-", $ip);
- $start = explode(".", $ip[0]);
- $this->banner();
- for ($i=0; $i <3; $i++) {
- $ips .= $start[$i].".";
- }
- echo $this->timeout;
- for ($i=$start[3]; $i <$ip[1]+1; $i++) {
- $ch = curl_init($ips.$i);
- curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT ,0);
- curl_setopt ($ch, CURLOPT_TIMEOUT, 2);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- $data = curl_exec($ch);
- $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- curl_close($ch);
- if($httpcode>=200 && $httpcode<300){
- $this->pesan($ips.$i." -> Live");
- $live[] = $ips.$i;
- } else {
- $this->pesan($ips.$i." -> Die");
- $die[] = $ips.$i;
- }
- }
- echo "---- [ IP LIVE ] ----\r\n";
- foreach ($live as $key => $ip) {
- echo " > ".$ip."\r\n";
- }
- }
- }
- $ipscanner = new Ipscanner;
- $ipscanner->scan("192.168.1.1-255");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment