회원가입∴아이디/비번찾기
홈으로


웹 포트 모니터링 툴
19년 전
<?
// 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;
        }

?>
추천추천 : 360 추천 목록
번호 제목
2,891
입력 필드에서 특정단어(예:#err)가 포함되었을 때 실시간 감지 및 경고창 띄우기
2,890
데이터베이스 최적화와 쿼리 효율성을 높이 검색 성능을 개선하는 방법
2,889
간단한 게시판 만들기
2,888
PHP의 php.ini 파일에서 설정할 수 있는 주요 항목들을 카테고리별로 정리
2,887
유튜브 동영상의 썸네일 이미지를 체크하여 유효한 영상이아닐때 연결된 체크박스를 자동으로 체크
2,886
이미지 URL이 유효하지 않을 때, 해당 이미지와 연결된 체크박스를 자동으로 체크
2,885
HTTPS로 접속한 사용자를 강제로 HTTP로 리디렉션 하려면
2,884
PHP에서 MP3 파일을 직접 읽고 스트리밍 하기
2,883
현재 페이지가 location.reload()에 의해 새로고침되었는지
2,882
텍스트 파일을 읽고, 각 줄의 끝에서 6글자를 삭제한 후, 결과를 새로운 파일에 저장합니다.
2,881
cURL을 사용하여 리다이렉트를 따라가 최종 URL 가져오기
2,880
[PHP] $_SERVER 환경변수
2,879
10진수 <-> 16진수 변환기 PHP소스
2,878
텍스트에 직접 그라데이션 색상을 적용하려면?
2,877
CSS를 사용하여 요소의 내용물에 따라 width를 조정하는 방법
2,876
웹서버 ip 확인
2,875
웹호스팅의 절대경로를 확인
2,874
input 입력 필드 앞뒤 공백 실시간 제거
2,873
Placeholder 포커스시 감추기
2,872
MySQL 중복된 데이터를 삭제
2,871
MySQL 중복 데이터 확인
2,870
sessionStorage.getItem 와 sessionStorage.setItem
2,869
제이쿼리 랜덤으로 배경색 변경
2,868
preg match에 관한 정규식
2,867
Stream an audio file with MediaPlayer 오디오 파일 스트리밍 하기
2,866
Audio Streaming PHP Code
2,865
PHP $ SERVER 환경 변수 정리
2,864
Vimeo (비메오) API 를 사용하여 플레이어 컨트롤하기
2,863
iframe 사용시 하단에 발생하는 공백 제거방법
2,862
아이프레임(iframe) 전체화면 가능하게 하기
목록
뮤직트로트 부산광역시 부산진구 가야동 ㅣ 개인정보취급방침ㅣ모바일버전
Copyright ⓒ musictrot All rights reserved.