회원가입아이디/비번찾기
실시간 TV
홈으로
웹 포트 모니터링 툴
16년 전
<?
// 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;
        }

?>
추천추천 : 171 추천 목록
번호 제목
2,885
 input 입력 필드 앞뒤 공백 실시간 제거
2,884
 Placeholder 포커스시 감추기
2,883
 MySQL 중복된 데이터를 삭제
2,882
 MySQL 중복 데이터 확인
2,881
 sessionStorage.getItem 와 sessionStorage.setItem
2,880
 제이쿼리 랜덤으로 배경색 변경
2,879
 preg match에 관한 정규식
2,878
 Stream an audio file with MediaPlayer 오디오 파일 스트리밍 하기
2,877
 Audio Streaming PHP Code
2,876
 PHP $ SERVER 환경 변수 정리
2,875
 Vimeo (비메오) API 를 사용하여 플레이어 컨트롤하기
2,874
 iframe 사용시 하단에 발생하는 공백 제거방법
2,873
 아이프레임(iframe) 전체화면 가능하게 하기
2,872
 부트스트랩(bootstrapk)에서 사용하는 class명 정리
2,871
 부트스트랩 CSS
2,870
 크롬에서 마진 조절
2,869
 PHP 현재 페이지의 도메인명이나 url등의 정보 알아오기
2,868
 PHP preg match all()
2,867
 PHP 로 웹페이지 긁어오기 모든 방법 총정리!
2,866
 [PHP] 원격지 파일 주소 노출 안하고 curl로 다운로드 받기
2,865
 PHP 함수 정리
2,864
 아이프레임(iframe) 비율 유지하면서 크기 조절하는 방법
2,863
 PHP 배열에서 무작위로 하나 뽑아주는 array rand() 함수
2,862
 PHP 정규식 정리
2,861
 PHP 정규식을 활용한 태그 및 특정 문자열 제거 및 추출 방법
2,860
 php 크롤링 또는 파싱 함수, 정규식 모음
2,859
 제이쿼리 기본 명령어
2,858
 웹페이지 가로 모드세로 모드 인식하기
2,857
 모바일 웹 화면 강제 회전(가로모드 고정)
2,856
 [HTML5]에서 frameset 대체 방법과 iframe 속성
목록
뮤직트로트 부산광역시 부산진구 가야동 ㅣ 개인정보취급방침
Copyright ⓒ musictrot All rights reserved.