디시인사이드 갤러리

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

갤러리 본문 영역

ㄹㅇ 제미나이 레전드

프갤러(58.226) 2025.07.04 23:17:07
조회 108 추천 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 45204 65
2870022 NFT는 저작권 보호 도구인가 저작권 침해 도구인가 발명도둑잡기(118.216) 00:39 1 0
2870021 트위터 창업자 “모든 지재권 법 없애자” 주장 논란…머스크도 맞장구 발명도둑잡기(118.216) 00:38 1 0
2870020 "GPU는 사면서, 데이터는 왜 훔쳐" 빅테크의 질주, 뒤에서 발명도둑잡기(118.216) 00:33 3 0
2870019 어셈블리어 발명도둑잡기(118.216) 00:22 10 0
2870017 내일까지 이거 끝내고 블로그 글 적고 ㅆㅇㅆ(124.216) 00:15 6 0
2870016 가끔 뜻밖에 행운이 찾아올 때 있지 않음?????????????? ㅇㅅㅇ(117.111) 00:15 10 0
2870015 이 기사 보는 즉시 비번 바꿔라…구글·애플 160억개 개인정보 유출 발명도둑잡기(118.216) 00:09 7 0
2870014 뭐냐 졸다가 점점 세진다. 강도가... 넥도리아(112.170) 00:07 8 0
2870013 C井と書いて [2] 슈퍼막코더(110.133) 00:06 14 0
2870012 고향가면 구축 2억이면 사는데 ㅇㅇ(118.235) 00:01 16 0
2870011 진앙지가 우리집일까 집 군포로 뜨는데 안양시 동안구인데, 넥도리아(112.170) 00:00 9 0
2870009 정크푸드 케이라면 [1] 발명도둑잡기(118.216) 07.05 9 0
2870008 뭐지? 지진? 우리집인가? 40년된 주택 넥도리아(112.170) 07.05 11 0
2870007 피부 건조한 사람들 꼭봐!!! [1] ㅇㅇㅇㅇ(121.126) 07.05 11 0
2870006 고춧가루 ㅇㅇ(117.111) 07.05 11 0
2870004 스마트팜 아두이노로는 턱도 없어서 PLC 해야함 [3] ㅆㅇㅆ(124.216) 07.05 44 0
2870003 나 귀농하려고 스마트팜 아두이노 만들고 있음 [2] 프갤러(14.5) 07.05 29 0
2870002 내얼굴 ㅁㅌㅊ냐 [1] ㅇㅇ(222.108) 07.05 32 0
2870001 다음달에 DPP 먼지 보고싶어요 [4] PyTorch갤로그로 이동합니다. 07.05 33 0
2870000 GPT로 궁합분석하는 웹사이트를 만들었는데 같이 돈벌어볼 사람있나..? 프갤러(218.152) 07.05 19 0
2869999 윤건영, ‘외환죄’ 정조준.. “‘기밀’ 운운하는 자 내란공범” [1] 발명도둑잡기(118.216) 07.05 17 0
2869998 유니티 라이프 사이클은 템플릿 매서드랑 관련해서 설명했음 [1] ㅆㅇㅆ(124.216) 07.05 36 0
2869997 뉴스1의 ‘삼부토건, 유튜브 운영자 고소’ 보도 이상한 이유 [1] 발명도둑잡기(118.216) 07.05 11 0
2869996 나님 목소리 최초 공개❤+ [3/1] ♥냥덩이♥갤로그로 이동합니다. 07.05 29 0
2869995 시간당 13000원에 주 2회 학생 2명 하루 2시간 가르치거든 [2] ㅆㅇㅆ(124.216) 07.05 27 0
2869994 학생한테 zenject를 쓰라고 해야하긴하는데 내 자신이 zenject [2] ㅆㅇㅆ(124.216) 07.05 27 0
2869992 납골공원에 장기두는 할배들이 없구나 [6] 헬마스터갤로그로 이동합니다. 07.05 37 0
2869991 일 존나 빡세게 하니까 벌써 10시고 [2] ㅆㅇㅆ(124.216) 07.05 27 0
2869990 오늘 과외하는 학생에게 가르친것 정리 중 [11] ㅆㅇㅆ(124.216) 07.05 60 0
2869989 원래 병신들이 많은 직업군이냐? [4] ㅇㅇ(218.232) 07.05 38 0
2869988 와근데 이세돌인가 그거하는 애들 해킹 빡고수네 [4] ㅆㅇㅆ(124.216) 07.05 54 0
2869987 오늘 첨 어셈블리봣는데 하나도 이해못햇어요 [20] PyTorch갤로그로 이동합니다. 07.05 77 0
2869986 패킹 된거 스텁 푸는데 [7] 류도그담당(58.239) 07.05 39 0
2869985 dram 계층이 약간 복잡하네여 PyTorch갤로그로 이동합니다. 07.05 21 0
2869984 펌웨어나 장비 개발자 좋은 점 [3] ㅇㅇ(223.38) 07.05 45 0
2869982 늙어서 힘들다 ㅆㅇㅆ(124.216) 07.05 16 0
2869981 나님 누엇어양.. 제발 그만해 [2] ♥냥덩이♥갤로그로 이동합니다. 07.05 19 0
2869980 역류기 ip주소 뭔 원리냐? [1] ㅇㅇ(221.155) 07.05 31 0
2869979 펌웨어 개발자 되고싶은 컴공생인데요 [17] 프갤러(118.235) 07.05 85 0
2869978 행복한 휴가 사용계획 [1] 개멍청한유라갤로그로 이동합니다. 07.05 21 0
2869977 날이 덥다 개멍청한유라갤로그로 이동합니다. 07.05 20 0
2869976 별이 빛나는 밤⭐+ [1] ♥냥덩이♥갤로그로 이동합니다. 07.05 18 0
2869975 부산시민은 25만원 필요 없어 발명도둑잡기(118.216) 07.05 26 1
2869974 아직도 언어타령하네 ㅋ [18] 개멍청한유라갤로그로 이동합니다. 07.05 63 0
2869972 내가 고는 1주일만에 땟거든? 러스트는 1년째 초급수준 프갤러(110.8) 07.05 12 0
2869970 왜 우리는 노무사 노무진에 열광했나? 한국식 사회고발물의 진실 발명도둑잡기(118.216) 07.05 15 0
2869969 몇살부터 백수면 비정상임? [11] 아스카영원히사랑해갤로그로 이동합니다. 07.05 54 0
2869968 갤에서 러스트 어그로 끄는거보다 그냥 겜 하는게 낫다는 전략적 판단 [7] 프갤러(110.8) 07.05 32 0
2869966 Java가 좋아서 하냐 [4] ㅇㅇ(210.178) 07.05 44 0
뉴스 '꼬꼬무', 연쇄살인범 강호순 자백 최초 영상 공개. . . 10명 외 추가 피해자 존재 가능성 충격 보도 디시트렌드 07.04
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2