디시인사이드 갤러리

갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

ㄹㅇ 제미나이 레전드

프갤러(58.226) 2025.07.04 23:17:07
조회 112 추천 0 댓글 4
														

제미나이 이용해서 웹 보안 점검 도구 만들어봄


코드는

<!DOCTYPE html>

<html lang="ko">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>웹 취약점 스캐너 v3.1</title>

    <style>

        @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');


        :root {

            --accent-color: #0d6efd;

            --ok-color: #198754;

            --vuln-color: #dc3545;

            --info-color: #0dcaf0;

            --bg-color: #f8f9fa;

            --text-color: #212529;

            --border-color: #dee2e6;

            --card-bg: #ffffff;

        }


        body {

            background-color: var(--bg-color);

            color: var(--text-color);

            font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;

            padding: 40px 20px;

            margin: 0;

            font-size: 16px;

        }


        .container {

            width: 100%;

            max-width: 800px;

            margin: auto;

        }


        h1 {

            text-align: center;

            color: var(--text-color);

            margin-bottom: 40px;

            font-weight: 700;

        }


        #controls {

            display: flex;

            gap: 10px;

            margin-bottom: 30px;

        }


        #urlInput {

            flex-grow: 1;

            border: 1px solid var(--border-color);

            padding: 12px 16px;

            border-radius: 8px;

            font-family: inherit;

            font-size: 1em;

            transition: border-color 0.2s, box-shadow 0.2s;

        }

        #urlInput:focus {

            outline: none;

            border-color: var(--accent-color);

            box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);

        }

        

        #checkBtn {

            background-color: var(--accent-color);

            border: none;

            color: white;

            padding: 12px 24px;

            font-family: inherit;

            font-weight: 500;

            cursor: pointer;

            border-radius: 8px;

            transition: background-color 0.2s;

        }

        #checkBtn:hover { background-color: #0b5ed7; }

        #checkBtn:disabled { background-color: #6c757d; cursor: not-allowed; }


        #results-container {

            background-color: var(--card-bg);

            border: 1px solid var(--border-color);

            border-radius: 8px;

            padding: 30px;

            opacity: 0;

            transition: opacity 0.5s ease-in-out;

        }

        #results-container.visible { opacity: 1; }

        

        .log-item {

            margin-bottom: 12px;

            display: flex;

            align-items: center;

        }

        .log-prefix {

            font-weight: 700;

            margin-right: 10px;

            min-width: 25px;

        }

        .ok { color: var(--ok-color); }

        .vuln { color: var(--vuln-color); }

        .info { color: var(--info-color); }


        .summary-box {

            border-top: 1px solid var(--border-color);

            padding-top: 30px;

            margin-top: 30px;

        }

        .summary-box h3 { margin-top: 0; }

        .score-display {

            display: flex;

            justify-content: space-between;

            align-items: center;

            font-weight: 700;

            font-size: 1.2em;

            margin-bottom: 10px;

        }

        .progress-bar {

            width: 100%;

            height: 20px;

            background-color: #e9ecef;

            border-radius: 10px;

            overflow: hidden;

        }

        .progress-fill {

            height: 100%;

            background-color: var(--ok-color);

            border-radius: 10px;

            transition: width 1s ease-in-out;

        }

    </style>

</head>

<body>

    <div class="container">

        <h1>웹 취약점 스캐너 v3.1</h1>

        <div id="controls">

            <input type="url" id="urlInput" placeholder="https://example.com">

            <button id="checkBtn">점검 시작</button>

        </div>

        <div id="results-container">

            <div id="results">

                <p>점검할 URL을 입력하고 '점검 시작' 버튼을 눌러주세요.</p>

            </div>

        </div>

    </div>


    <script>

        const PROXY_URL = 'https://corsproxy.io/?';

        const urlInput = document.getElementById('urlInput');

        const checkBtn = document.getElementById('checkBtn');

        const resultsContainer = document.getElementById('results-container');

        const resultsDiv = document.getElementById('results');


        checkBtn.addEventListener('click', async () => {

            const url = urlInput.value.trim();

            if (!url) return;


            checkBtn.disabled = true;

            checkBtn.textContent = '점검 중...';

            resultsContainer.classList.remove('visible');


            try {

                const response = await fetch(`${PROXY_URL}${encodeURIComponent(url)}`);

                if (!response.ok) throw new Error(`서버가 응답하지 않습니다 (상태: ${response.status})`);


                const headers = response.headers;

                const html = await response.text();

                const doc = new DOMParser().parseFromString(html, 'text/html');


                let score = 100;

                let resultsHTML = `<h3>점검 로그: ${escapeHTML(url)}</h3>`;


                const checks = [

                    checkHttps(url),

                    checkHttpHeaders(headers),

                    checkCookieSecurity(headers),

                    checkMixedContent(doc),

                    checkInfoLeakage(html),

                    checkDangerousPatterns(doc),

                ];

                

                checks.forEach(res => {

                    score -= res.deduction;

                    resultsHTML += res.log;

                });

                

                score = Math.max(0, score);

                resultsHTML += generateSummary(score);

                resultsDiv.innerHTML = resultsHTML;

                

                // 점수 프로그레스 바 채우기

                const progressFill = document.querySelector('.progress-fill');

                if(progressFill) {

                   setTimeout(() => { progressFill.style.width = score + '%'; }, 100);

                }


            } catch (e) {

                resultsDiv.innerHTML = `<p class="vuln"><b>점검 실패:</b> ${escapeHTML(e.message)}</p><p>프록시 서버 문제, 네트워크, 또는 잘못된 URL일 수 있습니다.</p>`;

            } finally {

                resultsContainer.classList.add('visible');

                checkBtn.disabled = false;

                checkBtn.textContent = '점검 시작';

            }

        });


        function generateSummary(score) {

            let grade = 'F';

            let color = 'var(--vuln-color)';

            if (score >= 95) { grade = 'S'; color = 'var(--ok-color)'; }

            else if (score >= 90) { grade = 'A'; color = 'var(--ok-color)'; }

            else if (score >= 80) { grade = 'B'; color = '#fd7e14'; }

            else if (score >= 70) { grade = 'C'; color = '#ffc107'; }


            return `

            <div class="summary-box">

                <h3>종합 보안 점수</h3>

                <div class="score-display">

                    <span>등급: ${grade}</span>

                    <span style="color: ${color};">${score} / 100</span>

                </div>

                <div class="progress-bar">

                    <div class="progress-fill" style="width: 0%; background-color: ${color};"></div>

                </div>

            </div>`;

        }

        

        function escapeHTML(str) { return str.replace(/[&<>"']/g, match => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''}[match])); }


        function createLog(cssClass, prefix, text) {

            return `<div class="log-item ${cssClass}"><span class="log-prefix">${prefix}</span>${text}</div>`;

        }


        // 각 점검 함수는 {log: "...", deduction: 점수} 형태의 객체를 반환

        function checkHttps(url) {

            let deduction = 0;

            let log = url.startsWith('https://')

                ? createLog('ok', '[+]', 'HTTPS 프로토콜을 사용합니다.')

                : (deduction = 30, createLog('vuln', '[-]', '<b>[치명적]</b> 암호화되지 않은 HTTP 연결이 사용 중입니다.'));

            return { log, deduction };

        }


        function checkHttpHeaders(headers) {

            let log = '';

            let deduction = 0;

            const checks = {

                'content-security-policy': 15, 'strict-transport-security': 10,

                'x-frame-options': 8, 'x-content-type-options': 5

            };

            Object.entries(checks).forEach(([header, weight]) => {

                if (headers.has(header)) {

                    log += createLog('ok', '[+]', `<b>${header}</b> 헤더가 설정되었습니다.`);

                } else {

                    log += createLog('vuln', '[-]', `<b>${header}</b> 헤더가 누락되었습니다.`);

                    deduction += weight;

                }

            });

            if (headers.has('server') || headers.has('x-powered-by')) {

                log += createLog('vuln', '[-]', '서버 버전 정보가 노출되었습니다.');

                deduction += 5;

            }

            return { log, deduction };

        }

        

        function checkCookieSecurity(headers) {

            const setCookieHeader = headers.get('set-cookie');

            if (!setCookieHeader) return { log: createLog('info', '[*]', '페이지에서 설정하는 쿠키가 없습니다.'), deduction: 0 };

            

            const cookies = setCookieHeader.split(',');

            const insecureCookies = cookies.filter(c => !(/; *secure/i.test(c) && /; *httponly/i.test(c)));

            

            let log = insecureCookies.length > 0

                ? createLog('vuln', '[-]', `<b>${insecureCookies.length}개</b>의 쿠키에 Secure 또는 HttpOnly 속성이 누락되었습니다.`)

                : createLog('ok', '[+]', '모든 쿠키에 보안 속성이 올바르게 적용되었습니다.');

            return { log, deduction: insecureCookies.length > 0 ? 10 : 0 };

        }

        

        function checkMixedContent(doc) {

            const insecureElements = doc.querySelectorAll('img[src^="http://"], script[src^="http://"], link[href^="http://"]');

            let log = insecureElements.length > 0

                ? createLog('vuln', '[-]', `<b>${insecureElements.length}개</b>의 혼합 콘텐츠(Mixed Content)가 발견되었습니다.`)

                : createLog('ok', '[+]', '혼합 콘텐츠가 발견되지 않았습니다.');

            return { log, deduction: insecureElements.length > 0 ? 10 : 0 };

        }


        function checkInfoLeakage(html) {

            const emailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;

            const ipRegex = /\b(192\.168|10\.|172\.(1[6-9]|2[0-9]|3[0-1]))\.\d{1,3}\.\d{1,3}\b/g;

            let deduction = 0;

            let log = '';

            if (emailRegex.test(html)) {

                log += createLog('vuln', '[-]', '소스 코드 내에 이메일 주소가 노출되었습니다.');

                deduction = 5;

            }

            if (ipRegex.test(html)) {

                log += createLog('vuln', '[-]', '소스 코드 내에 내부 IP 주소가 노출되었습니다.');

                deduction = 5;

            }

            if (deduction === 0) {

                log = createLog('ok', '[+]', 'HTML 소스 코드에서 민감 정보가 발견되지 않았습니다.');

            }

            return { log, deduction };

        }

        

        function checkDangerousPatterns(doc) {

            const scripts = doc.querySelectorAll('script');

            const dangerousPatterns = ['.innerHTML', 'document.write', 'eval('];

            let found = false;

            scripts.forEach(script => {

                const code = script.textContent;

                if (dangerousPatterns.some(pattern => code.includes(pattern))) {

                    found = true;

                }

            });

            let log = found

                ? createLog('vuln', '[-]', 'DOM XSS로 이어질 수 있는 위험한 코드 패턴이 발견되었습니다.')

                : createLog('ok', '[+]', '스크립트에서 잠재적으로 위험한 패턴이 발견되지 않았습니다.');

            return { log, deduction: found ? 10 : 0 };

        }

    </script>

</body>

</html>


이렇게 나옴 결과는?



24b0d121e09c28a8699fe8b115ef046a7865e2c4

이렇게 나옴 ㄷㄷ 

와중에 네이버 실화냐;;;; 심지어 구글은 분석조차 안됨. 자동화 접근 막아놓은듯....

추천 비추천

0

고정닉 0

0

원본 첨부파일 1

댓글 영역

전체 댓글 0
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 현역으로 군대 안 간게 의아한 스타는? 운영자 25/06/30 - -
AD 휴대폰 바꿀까? 특가 구매 찬스! 운영자 25/07/02 - -
공지 프로그래밍 갤러리 이용 안내 [88] 운영자 20.09.28 45210 65
2870074 위대한 실천가 루비님 발명도둑잡기(118.216) 05:52 2 0
2870072 [박한슬의 숫자 읽기] 토건 보수와 개미 진보 발명도둑잡기(118.216) 05:44 6 0
2870070 현직 개발자의 소개팅 후기 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 발명도둑잡기(118.216) 05:12 16 0
2870069 학생들을 속여 정신대로 보내버린, 선생님이라고 할 수도 없는 파렴치한 친 [1] 발명도둑잡기(118.216) 05:08 11 0
2870068 피부 건조한 사람들 꼭봐!!! ㅇㅇㅇㅇ(125.7) 04:58 9 0
2870067 '케이팝 데몬 헌터스' 그 시작은 제주의 '女神' 이었다. 발명도둑잡기(118.216) 04:56 8 0
2870066 국비지원 들어야하나 진로 상담좀 해줘 프갤러(125.185) 04:45 31 1
2870063 리액트 문서 다 읽어봤는데 왜 당시 혁명이었는지 알겠네 ㅆㅇㅆ(124.216) 04:20 10 0
2870062 정보) 국가별 게임 목록.jpg [2] ㅇㅇ(218.144) 04:06 27 1
2870060 학회지 제 36회 논문 판다. 거래는 알뜰나눔장터 [1] 도리스아(112.170) 03:53 16 0
2870059 위대한 오픈소스와 나르시시즘: 목차 제안 [1] 루비갤로그로 이동합니다. 03:38 24 0
2870056 오늘의 발명 실마리: 디씨에 AI로 힙합 기수 칭찬, 욕하는 자동글 발명도둑잡기(118.216) 03:26 30 0
2870054 AI가 일으킨 첫 번째 전쟁 발명도둑잡기(118.216) 03:05 16 0
2870052 러스트 FFI의 모순 루비갤로그로 이동합니다. 02:42 17 0
2870050 일본 손글씨 기계 [1] 발명도둑잡기(118.216) 02:36 16 0
2870048 러빠 이제 러스트 손절치냐 ㅋㅋ 루비갤로그로 이동합니다. 02:26 25 0
2870046 애드센스 또 거부 당했네 ㅠㅠ 루비갤로그로 이동합니다. 02:17 16 0
2870045 빌보드 핫100 노래 모두 이 노래보다는 사실 얌전한 내용이다 [1] 발명도둑잡기(118.216) 02:16 22 0
2870044 Jpa는 쓰면쓸수록 병신같노 프갤러(118.235) 02:16 22 0
2870042 요즘 아이들의 '친일 혐중', 오늘도 원인을 찾는 중입니다 발명도둑잡기(118.216) 02:12 14 0
2870041 피부 건조한 사람들 꼭봐!!! ㅇㅇㅇㅇ(115.144) 02:12 15 0
2870039 강남 같은 동네 주민들의 닭싸움 케이지 발명도둑잡기(118.216) 01:55 13 0
2870037 우디 거스리 발명도둑잡기(118.216) 01:47 12 0
2870035 RPA취업 프갤러(1.243) 01:43 13 0
2870034 공부하기 좋은 세상이다 [1] 초코냥갤로그로 이동합니다. 01:40 34 0
2870033 오늘한일 [2] PyTorch갤로그로 이동합니다. 01:39 35 0
2870032 이 땅은 너희의 땅 [1] 발명도둑잡기(118.216) 01:29 20 0
2870031 똥양인들은 머리에 번식,동족포식 생각밖에없음?? 뒷통수한방(1.213) 01:29 13 0
2870030 썡노가다 하다보니 IAT 찾았다 [1] 루도그담당(58.239) 01:22 22 0
2870028 What The Fuck Is A Kilometer 발명도둑잡기(118.216) 01:13 14 0
2870027 [로터리] 토지공개념은 '소설'이 아니다. 발명도둑잡기(118.216) 01:06 12 0
2870026 재활용 할가요 도리스아(112.170) 01:01 17 0
2870025 오늘의 소설, 영화 실마리: 거대 닭이 인간에게 복수 발명도둑잡기(118.216) 00:54 11 0
2870024 요즘 자라나는 새싹들 마인드 ) 크게 통수한방치고 해외로 튀기 뒷통수한방(1.213) 00:52 18 0
2870022 NFT는 저작권 보호 도구인가 저작권 침해 도구인가 [1] 발명도둑잡기(118.216) 00:39 18 0
2870021 트위터 창업자 “모든 지재권 법 없애자” 주장 논란…머스크도 맞장구 발명도둑잡기(118.216) 00:38 14 0
2870020 "GPU는 사면서, 데이터는 왜 훔쳐" 빅테크의 질주, 뒤에서 발명도둑잡기(118.216) 00:33 14 0
2870019 어셈블리어 발명도둑잡기(118.216) 00:22 23 0
2870017 내일까지 이거 끝내고 블로그 글 적고 [1] ㅆㅇㅆ(124.216) 00:15 21 1
2870016 가끔 뜻밖에 행운이 찾아올 때 있지 않음?????????????? ㅇㅅㅇ(117.111) 00:15 21 0
2870015 이 기사 보는 즉시 비번 바꿔라…구글·애플 160억개 개인정보 유출 발명도둑잡기(118.216) 00:09 16 0
2870014 뭐냐 졸다가 점점 세진다. 강도가... 넥도리아(112.170) 00:07 14 0
2870013 C井と書いて [3] 슈퍼막코더(110.133) 00:06 27 0
2870012 고향가면 구축 2억이면 사는데 ㅇㅇ(118.235) 00:01 21 0
2870011 진앙지가 우리집일까 집 군포로 뜨는데 안양시 동안구인데, 넥도리아(112.170) 00:00 14 0
2870009 정크푸드 케이라면 [1] 발명도둑잡기(118.216) 07.05 22 0
2870008 뭐지? 지진? 우리집인가? 40년된 주택 넥도리아(112.170) 07.05 19 0
2870007 피부 건조한 사람들 꼭봐!!! [2] ㅇㅇㅇㅇ(121.126) 07.05 20 0
2870006 고춧가루 ㅇㅇ(117.111) 07.05 17 0
뉴스 윤민수X이예준, 17일 듀엣곡 ‘결혼하지 못하는 이유’ 발매! 디시트렌드 07.04
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2