홈으로 | 무료회원가입 | 아이디/비번찾기
추천음악방송
웹 포트 모니터링 툴
15년 전
<?
// indent rule
// vi:ts=4 sts=4 sw=4

        ## 포트모니터링
        ## 2005.03.17  오후 11:48:40 by Ulovem.com


switch ($type)
{
        case "type1":
                        
        if ($cmd == "")
        {
                $par = "$PHP_SELF?type=$type";
        ?>
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ks_c_5601-1987" />
        <link rel=StyleSheet HREF="http://ulovem.com/startpage/style.css" type=text/css title=style>
        <Script Language="JavaScript">
                function fnSubmit(val)
                {
                        if (val == "Start" )
                        {
                                document.q.interval.value = 0;
                        } else if (val == "end" ) {
                                document.q.interval.value = 0;
                                document.all.ifr.src="about:blank";        
                                return;
                        } else if (val == "monitor") {
                                document.all.ifr.src="about:blank";        
                                document.q.remaindtime.value = document.q.interval.value;
                        }
                        document.q.scanning.value = "y";        
                        document.all.ifr.src ="<?=$PHP_SELF?>?type=1&cmd=checkip";
                }
        
                function fnRefresh()
                {
                        if (document.q.scanning.value == "n" && document.q.remaindtime.value == 0 && document.q.interval.value != 0)
                        {
                                document.q.remaindtime.value = document.q.interval.value;
                                fnSubmit("monitor");
                        }
                        setTimeout(fnRefresh, 1000);
                }
        </Script>
        </head>
        <body onLoad="fnRefresh();">
        <table height=100% border=1>
        <tr>
                <Td valign=top height=10 colspan=2 width=100% align=center >
                        Web Port Scanner Ver 1.0 for ulovem.com <a href="<?=$PHP_SELF?>?type=1">TYPE 1</a>  <a href="<?=$PHP_SELF?>?type=2">TYPE 2</a></td>
        </tr>
        <tr>
                <td height=90% valign=top align=left>
                <table valign=top width=300>
                        <form name="q">
                        <tr><td colspan=2 align=center>서버정보</td>
                        </tr>
                        <tr><td width=100 valign=top>IP대역</td><td width=200>
                                <textarea name=serverip style="height:200px;width=100%;" onKeyPress="q.remaindtime.value=q.interval.value;"><?=$serverip?></textarea>
                                192.168.1.1 {ENTER}<BR>192.168.1.50-100{ENTER}
                                </td>
                        <tr><td valign=top>PORT</td><td><input type=text name=serverport value="<?=$serverport?>" onKeyPress="q.remaindtime.value=q.interval.value"><br>
                                25,80,10-20
                        </td>
                        </tr>
                        <tr><td colspan=2>
                                Scanning Status..  <input type=text readonly name="scanning" value="n" size=1 style="border:0;font-size:15px;text-align:right;" class=".td"><BR>
                                Remainding Time To Next Scanning..  <input type=text readonly name="remaindtime" value="0" size=2 style="border:0;font-size:15px;text-valign:center;" class=".td"><BR>
                                <input type=radio name=viewkind value="all" checked onClick="document.q.remaindtime.value=document.q.interval.value;">전체보기
                                <input type=radio name=viewkind value="on" onClick="document.q.remaindtime.value=document.q.interval.value;">On만보기
                                <input type=radio name=viewkind value="off" onClick="document.q.remaindtime.value=document.q.interval.value;">Off만보기<br>
                                Ready Time To Connected <input type=text name="readytime" value="0.005" size=5 style="text-align:right">Sec<br>
                                * 내부서버가 아닌경우 0.5~1 Sec<br>
                                * 0을 사용하면 Fail이 날때 까지 물고있는다.
                                Monitoring Interval Time <input type=text name="interval" value="5" size=5 style="text-align:right" onChange="fnRefresh(this.value);">Sec<br>
                                <input type=button name="start" value="Start" onClick="fnSubmit(this.value);">
                                <input type=button name="end" value="end" onClick="fnSubmit(this.value);">
                                <input type=button name="monitor" value="monitor" onClick="if(document.q.interval.value==0){document.q.interval.value=5};fnSubmit(this.value);"><br>
                        </td></tr>
                        </form>
                </table>
                </td>
                <td valign=top height=100%>
                <iframe id="ifr" name='ifr' width=500 height=100% border=0 frameborder=0 scrolling=auto src="about:blank"></iframe>
                </td>
        </tr>
        </table>
        </body>
        </html>
        <?
        } elseif ( $cmd == "checkip")  {
        ?>
        <html>
        <head>
                <Script Language="JavaScript">
                function fnSubmit()
                {
                        document.q.serverip.value = parent.q.serverip.value;
                        document.q.serverport.value = parent.q.serverport.value;
                        for (i = 0 ; i < parent.q.viewkind.length; i ++)
                        {
                                if ( parent.q.viewkind[i].checked == true)
                                {
                                        document.q.viewkind.value = parent.q.viewkind[i].value;
                                }
                        }
                        document.q.readytime.value = parent.q.readytime.value;
                        document.q.submit();
                
                }
                </Script>
        </head>
        <body>
        <form name="q" action="<?=$PHP_SELF?>" method="post">
        <div style="display:none">
                <input type=hidden name=viewkind >
                <input type=hidden name=cmd value="trace">
                <textarea name=serverip></textarea>
                <input type=hidden name=serverport>
                <input type=hidden name=readytime>
        </div>
        </form>
        </body>
        <Script Lauguage="JavaScript">fnSubmit();</Script>
        </html>
        
        <?
        } elseif ($cmd == "trace") {
        ?>
        <html>
        <head>
        <link rel=StyleSheet HREF="http://ulovem.com/startpage/style.css" type=text/css title=style>
        </head>
        <body onLoad="setTimeout(PrintingRemaindTime,1);">
                        <table border=0>
                                <tr><td height=10 > 현재시간 : <?=date("Y-m-d H:i:s");?></td>
                        </tr></table>
        <?
                if (!$serverip || !$serverport) exit;
                $traceList = getVal($serverip, $serverport);
                foreach($traceList[iplist] as $ipval)
                {
        ?>
                        <table border=0>
                                <tr><td valign=top width=150><?=$ipval[ip]?><br><?=$ipval[name]?></td>
                                        <td valign=top width=300>
        <?
                        foreach($traceList[portlist] as $portval)
                        {
        ?>
                                <Script Language="JavaScript">parent.document.title="Scanning.. <?="$ipval[ip]($ipval[name]):$portval[port]($portval[name])"?>"</Script>
        <?
                                flush();
                                $fp = @fsockopen ($ipval[ip], $portval[port], $errno, $errmsg, $readytime);
                                if ($fp) {
                                        $status = "On";
                                        $msg = "On";
                                        @fclose($fp);
                                } else {
                                        $status = "Off";
                                        $msg = "<label title='$errno($errmsg)' style='cursor:hand;color:red;' >Off</label>";
                                        @fclose($fp);
                                }
                                if ( ($viewkind == "on" && $status == "On") || ($viewkind == "off" && $status=="Off") || $viewkind == "all" )
                                {
        ?>
                                                <table border=0><tr><td width=100><?=$portval[port]?>(<?=$portval[name]?>)</td><td width=200><?=$msg?></td></tr></table>
        <?
                                }
                                flush();
                        }
        ?>
                                        </td>
                                </tr>
                        </table>
        <?
                        flush();
                }
        ?>
                <Script Language="JavaScript">
                        parent.document.title="Scanning Finished...WebPortScan Ver 1.0 Made in Ulovem.com";
                        parent.document.q.scanning.value = "n";
                        var maxLoop = parent.document.q.interval.value;
                        parent.document.q.remaindtime.value = maxLoop;
                        var tout;
                        function PrintingRemaindTime()
                        {
                                if ( parent.document.q.remaindtime.value == 0)
                                {
                                        clearTimeout(tout);
                                        parent.document.q.remaindtime.value --;
                                        return;
                                } else if (parent.document.q.remaindtime.value < 0 )
                                {
                                        return;
                                }
                                
                                
                                parent.document.q.remaindtime.value --;
                                
                                tout = setTimeout(PrintingRemaindTime,1000);
                                
                        }
        
                </Script>
        </body>
        </html>
        <?
        
        }
        

        
                break;
        case "":
        case 2:

        ob_start();
        if ( $savecookie == 1)
        {
                setcookie("ports_ftp",$_POST['ports_ftp'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_ssh",$_POST['ports_ssh'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_telnet",$_POST['ports_telnet'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_smtp",$_POST['ports_smtp'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_dns",$_POST['ports_dns'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_http",$_POST['ports_http'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("ports_pop3",$_POST['ports_pop3'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("serverip",str_replace("\r\n","||",$_POST['serverip']),time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
                setcookie("serverport",$_POST['serverport'],time()+60*60*24*30, "/", $_SERVER[HTTP_HOST]);
        }
        if (!$_POST['serverip'] && !$_POST['serverport'])
        {
                $ports_ftp = $_COOKIE['ports_ftp'];        
                $ports_ssh = $_COOKIE['ports_ssh'];        
                $ports_telnet = $_COOKIE['ports_telnet'];        
                $ports_smtp = $_COOKIE['ports_smtp'];        
                $ports_dns = $_COOKIE['ports_dns'];        
                $ports_http = $_COOKIE['ports_http'];        
                $ports_pop3 = $_COOKIE['ports_pop3'];        
                $serverip = str_replace("||","\r\n",$_COOKIE['serverip']);        
                $serverport = $_COOKIE['serverport'];        
        } else {
                $ports_ftp = $_POST['ports_ftp'];        
                $ports_ssh = $_POST['ports_ssh'];        
                $ports_telnet = $_POST['ports_telnet'];        
                $ports_smtp = $_POST['ports_smtp'];        
                $ports_dns = $_POST['ports_dns'];        
                $ports_http = $_POST['ports_http'];        
                $ports_pop3 = $_POST['ports_pop3'];        
                $serverip = $_POST['serverip'];        
                $serverport = $_POST['serverport'];        
        }
        
        if (!$interval) $interval = 10;
?>
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ks_c_5601-1987" />
        <link rel=StyleSheet HREF="http://ulovem.com/startpage/style.css" type=text/css title=style>
        <Script Language="JavaScript">
                function fnSubmit()
                {
                        var ival = document.q.interval.value;
                        if (ival == 0 || ival == "") return;
                        ival *= 1000;
                        setTimeout(aaSubmit, ival);
                        
                }
                function aaSubmit()
                {
                        document.q.submit();        
                }
                
        </Script>
        <body onLoad="fnSubmit()">
        <Script Type="text/javascript" Language="JavaScript" >
        <!--
        function fnPortToggle(val)
        {
                var frm = document.q;        
                aa = document.q.elements.length;
                for (i = 0; i < aa; i ++)
                {
                        bb = document.q.elements[i];
                        cc = bb.name;
                        dd = cc.split("_");
                        if (dd[0] == "ports")
                        {
                                bb.checked = val;
                        }
                }
            return true;
        }
        -->
        </Script>

                <table width=100%>
                        <form name=q method=POST action="<?=$PHP_SELF?>" >
                        <input type=hidden name=type value=<?=$type?>>
                        <tr><td width=100% >
                                <table border=1>
                                        <tr><td valign=top >IP대역 <textarea name=serverip style="width:200px;height=120px;"><?=$serverip?></textarea></td>
                                                <td valign=top>
                                                        <table><tr><td>Port대역 <input type=checkbox name=all_ports value="all_ports" <?=($all_ports)?"checked":""?>  onClick="fnPortToggle(this.checked);">전체
                                                                        <table><tr><td>
                                                                        <input type=checkbox name=ports_ftp value="21" <?=($ports_ftp||$all_ports)?"checked":""?>>FTP
                                                                        <input type=checkbox name=ports_ssh value="22" <?=($ports_ssh||$all_ports)?"checked":""?>>SSH
                                                                        <input type=checkbox name=ports_telnet value="23" <?=($ports_telnet||$all_ports)?"checked":""?>>TELNET
                                                                        <input type=checkbox name=ports_smtp value="25" <?=($ports_smtp||$all_ports)?"checked":""?>>SMTP
                                                                        <input type=checkbox name=ports_dns value="53" <?=($ports_dns||$all_ports)?"checked":""?>>DNS
                                                                        <input type=checkbox name=ports_http value="80" <?=($ports_http||$all_ports)?"checked":""?>>HTTP
                                                                        <input type=checkbox name=ports_pop3 value="110" <?=($ports_pop3||$all_ports)?"checked":""?>>POP3
                                                                        </td></tr>
                                                                        <tr><td><input type=text name=serverport value="<?=$serverport?>" style="width:300px"></td></tr></table>
                                                                        </td></tr>
                                                                        <tr><td valign=top>Interval <input type=text name=interval value="<?=$interval?>" size="2">
                                                                                쿠키저장<input type=checkbox name="savecookie" value="1" <?=($savecookie)?"checked":""?>>
                                                <input type=button value="취소" onClick="document.q.interval.value=0;document.q.submit();"><input type=submit></td></tr>
                                                        </table>
                                                </td>
                                        </tr>
                                </table>
                                </td>
                        </tr>
                        <tr>
                                <td width=100%>
                                        <table border=0><tr width=100% bgcolor="#f0f8f8">
                                                <td width=200 align=center>IP/PORT</td>
<?
                foreach( $_POST as $key => $val)
                {
                        if (ereg("^ports_",$key)){
                                $serverport .= ",$val";
                        }
                }
                
                if (!$serverip || !$serverport) exit;
                $traceList = getVal($serverip, $serverport);
                foreach($traceList[portlist] as $portval)
                {
?>
                                <Script Language="JavaScript">parent.document.title="Scanning.. <?="$ipval[ip]($ipval[name]):$portval[port]($portval[name])"?>"</Script>

<?
                        echo "                <td align=center width=70>$portval[port]<br>$portval[name]</td>";
                }
                                echo "</tr>";

$cnt = 0;
                foreach($traceList[iplist] as $ipval)
                {
                        $cnt ++;
                        if ( ($cnt % 2) == 0)
                        {                        
                                echo "                        <tr bgcolor=silver><td >$ipval[ip]<br>$ipval[name]</td>";
                        } else{
                                echo "                        <tr bgcolor=#f8f8f8><td >$ipval[ip]<br>$ipval[name]</td>";
                        }
                        foreach($traceList[portlist] as $portlist)
                        {
                        
                                flush();
                                $fp = @fsockopen ($ipval[ip], $portlist[port], $errno, $errmsg, 0.1);
                                if ($fp) {
                                        $status = "On";
                                        $msg = "On";
                                } else {
                                        $status = "Off";
                                        $msg = "<label title='$errno($errmsg)' style='cursor:hand;color:red;' >Off</label>";
                                }
                                @fclose($fp);
                                echo "        <td align=center valign=middle>$msg</td>";
                        
                        
                        
                        }
                echo "        </tr>";
                }
                echo "</form></table></td></tr></table>";
?>
        </body></html>

<?
                break;
        default:
                break;
} // End Of Case

        
        function getKindIP($ipval)
        {
                //$addr = str_replace(".","", $ipval);
                $addr = str_replace(".","",$ipval);
                if ( is_numeric($addr) )
                {
                        // $ipval이 주소
                        $host = gethostbyaddr($ipval);
                }
                else {
                        // $ipval이 도메인
                        $host = $ipval;
                        $ipval = gethostbyname($ipval);
                }
                if ($host == $ipval) $host = "have no domain";
                $iplist = array(
                        "ip" => $ipval,
                        "name" => $host
                );
                return $iplist;
        
        }        
        function getKindPort($portval)
        {
                $portlist = array(
                        port        =>        $portval,
                        name        =>        getservbyport($portval,"tcp")
                );
                return $portlist;
        
        }
        function getVal($serverip, $serverport)
        {
                $arip = explode("\r\n", $serverip);
                $arip = array_unique($arip) ;

                foreach($arip as $val)
                {
                        if (!$val) continue;
                        $val = str_replace(" ","", $val);
                        if ( strstr($val, "-") === false)
                        {
                                $iplist[] = getKindIP($val);
                        } else {
                                $val1 = explode("-", $val);
                                $val2 = explode(".",$val1[0]);        
                                for ($i = $val2[3];  $i <= $val1[1] && $i <= 255; $i ++ )
                                {
                                        $ip = "$val2[0].$val2[1].$val2[2].$i";
                                        $iplist[] = getKindIP($ip);
                                }
                        }
        
                }
        
                $rtn[iplist] = $iplist;
        
                $arport = explode(",", $serverport);
                $arport = array_unique($arport) ;
                foreach($arport as $val)
                {
                        if (!$val) continue;
                        $val = str_replace(" ","", $val);
                        if ( strstr($val, "-") === false)
                        {
                                $portlist[] = getKindPort($val);
                        } else {
                                $val1 = explode("-", $val);
                                for ($i = $val1[0];  $i <= $val1[1] ; $i ++ ) {
                                        $portlist[] = getKindPort($i);
                                }
                        }
                }
                $rtn[portlist] = $portlist;
                asort($rtn[portlist]);
                return $rtn;
        }

?>
추천추천 : 166 추천 목록
번호 제목
3,030
 제이쿼리 기본 명령어
3,029
 웹페이지 가로 모드세로 모드 인식하기
3,028
 모바일 웹 화면 강제 회전(가로모드 고정)
3,027
 [HTML5]에서 frameset 대체 방법과 iframe 속성
3,026
 HTML <Audio> 사용법
3,025
 윈도우10 시스템파일 손상 (초간단 오류 복구방법!!)
3,024
 PHP 파일 존재 여부 파악하기(로컬 파일 존재 및 원격지 파일 존재)
3,023
 [CSS] 박스 세로 가운데 중앙 정렬 6가지
3,022
 CSS Layout 수평 & 수직 정렬
3,021
 여러 도메인들 간 쿠키 공유하기
3,020
 태그 사이에 있는 텍스트를 추출
3,019
 [JQuery] textbox focus on off일때 숫자 콤마 보여주기
3,018
 쿠키 생성,가져오기,삭제
3,017
 사용자 함수 모음
3,016
 마우스,키보드 제한 ( 오른쪽클릭,드래그,영역선택등..)
3,015
 [HTML5] <video> - DOM으로 제어하기
3,014
 HTML5 video 태그에서 영상 좌우반전
3,013
 PHP - 특정 태그 및 문자열 추출, 제거
3,012
 [PHP] define과 defined의 차이
3,011
 우클릭 완벽차단 스크립트
3,010
 iframe 높이 100% 맞추기
3,009
 curl 함수를 이용한 HTTP REFERER 변경
3,008
 윈도우10 시스템 파일 및 Dism 검사
3,007
 텍스트 줄바꿈, 글자자르기 CSS
3,006
 jQuery Mobile에서 유용한 코드 10가지.
목록
뮤직트로트 부산광역시 부산진구 가야동 ㅣ 개인정보취급방침
Copyright (C) musictrot All rights reserved.