index.html 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. <!DOCTYPE html>
  2. <html lang="ru">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Линия под контролем — защита от утечки по проводному каналу</title>
  7. <style>
  8. @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=PT+Serif:wght@400;700&family=Roboto+Mono:wght@400;700&display=swap');
  9. * { box-sizing: border-box; }
  10. html, body {
  11. margin: 0; padding: 0;
  12. background: #efe8d8; color: #1a2744;
  13. font-family: 'PT Serif', Georgia, serif;
  14. font-size: 17px; line-height: 1.55;
  15. -webkit-font-smoothing: antialiased;
  16. }
  17. body {
  18. min-height: 100vh; display: flex; flex-direction: column;
  19. background-image:
  20. linear-gradient(rgba(26,39,68,0.045) 1px, transparent 1px),
  21. linear-gradient(90deg, rgba(26,39,68,0.045) 1px, transparent 1px);
  22. background-size: 28px 28px;
  23. }
  24. header {
  25. position: sticky; top: 0; z-index: 10;
  26. background: #efe8d8; border-bottom: 2px solid #1a2744;
  27. padding: 8px 16px 10px;
  28. }
  29. .progress { height: 4px; background: rgba(26,39,68,0.15); position: relative; overflow: hidden; }
  30. .progress-fill { position: absolute; inset: 0; width: 0%; background: #b02a1e; transition: width 0.3s ease; }
  31. .header-row {
  32. display: flex; justify-content: space-between; align-items: center;
  33. margin-top: 8px;
  34. font-family: 'Oswald', 'Arial Narrow', sans-serif;
  35. font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  36. color: #4a5875;
  37. }
  38. .header-row .brand { color: #b02a1e; font-weight: 700; }
  39. .header-scene { color: #4a5875; }
  40. .header-scene #sceneNum { color: #b02a1e; font-weight: 700; }
  41. main {
  42. flex: 1; max-width: 900px; width: 100%;
  43. margin: 0 auto; padding: 24px 16px 90px;
  44. }
  45. h1, h2, h3 { font-family: 'Oswald', 'Arial Narrow', sans-serif; font-weight: 700; letter-spacing: 0.5px; line-height: 1.15; color: #1a2744; }
  46. h1 { font-size: 30px; margin: 0 0 12px; }
  47. h2 { font-size: 22px; margin: 24px 0 12px; text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 2px solid #1a2744; padding-bottom: 6px; }
  48. h3 { font-size: 17px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: 1px; }
  49. p { margin: 0 0 12px; }
  50. .goal-box { border: 2px solid #1a2744; background: #f6f0df; padding: 16px 18px; margin-bottom: 16px; position: relative; }
  51. .goal-box::before {
  52. content: 'ЦЕЛЬ'; position: absolute; top: -10px; left: 14px;
  53. background: #b02a1e; color: #efe8d8; padding: 2px 10px;
  54. font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 2px;
  55. }
  56. .defs-box { border: 2px dashed #b02a1e; background: #fff8e8; padding: 14px 18px; margin: 16px 0; }
  57. .defs-box::before {
  58. content: 'ЗАПИШИ В ТЕТРАДЬ'; display: block;
  59. font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 2px;
  60. color: #b02a1e; margin-bottom: 10px;
  61. border-bottom: 1px solid #b02a1e; padding-bottom: 6px;
  62. }
  63. .defs-box dt { font-weight: 700; font-family: 'Oswald', sans-serif; font-size: 14px; margin-top: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
  64. .defs-box dd { margin: 2px 0 0; font-size: 15px; }
  65. .controls { background: #f6f0df; border: 1.5px solid #1a2744; padding: 12px 14px; margin: 12px 0; }
  66. .ctrl-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-family: 'Roboto Mono', 'Courier New', monospace; font-size: 13px; }
  67. .ctrl-row label { flex: 0 0 auto; }
  68. .ctrl-row input[type=range] { flex: 1; min-width: 80px; accent-color: #b02a1e; }
  69. .ctrl-row .val { flex: 0 0 85px; text-align: right; color: #b02a1e; font-weight: 700; }
  70. .seg { display: flex; gap: 0; border: 1.5px solid #1a2744; margin: 8px 0; }
  71. .seg button {
  72. flex: 1; padding: 8px 4px; background: #f6f0df;
  73. border: none; border-right: 1px solid #1a2744;
  74. font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 0.3px;
  75. text-transform: uppercase; color: #1a2744; cursor: pointer;
  76. transition: background 0.15s;
  77. }
  78. .seg button:last-child { border-right: none; }
  79. .seg button.active { background: #1a2744; color: #efe8d8; }
  80. .seg button:hover:not(.active) { background: #e5dcc7; }
  81. canvas.viz { display: block; width: 100%; height: 240px; background: #fbf7eb; border: 1.5px solid #1a2744; margin: 8px 0; touch-action: none; }
  82. canvas.viz.tall { height: 340px; }
  83. .readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
  84. .readout .item { background: #f6f0df; border: 1px solid #1a2744; padding: 6px 8px; font-family: 'Roboto Mono', monospace; font-size: 12px; }
  85. .readout .item .lbl { color: #4a5875; text-transform: uppercase; letter-spacing: 0.5px; font-size: 10px; }
  86. .readout .item .val { font-size: 16px; font-weight: 700; color: #1a2744; word-break: break-word; }
  87. .readout .item .val.warn { color: #b02a1e; }
  88. .readout .item .val.ok { color: #2d5a3d; }
  89. .feedback { border-left: 4px solid #b02a1e; background: #fbf3e0; padding: 10px 14px; margin: 12px 0; font-size: 15px; }
  90. .feedback strong { color: #b02a1e; }
  91. .triad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
  92. .triad .card { border: 1.5px solid #1a2744; background: #f6f0df; padding: 12px; cursor: pointer; transition: all 0.15s; }
  93. .triad .card:hover { background: #ece2c8; }
  94. .triad .card.active { background: #1a2744; color: #efe8d8; }
  95. .triad .card h4 { margin: 0 0 6px; font-family: 'Oswald', sans-serif; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
  96. .triad .card p { margin: 0; font-size: 13px; line-height: 1.4; }
  97. .triad .card .icon { font-size: 24px; display: block; margin-bottom: 4px; }
  98. .btn { font-family: 'Oswald', sans-serif; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; padding: 10px 20px; background: #1a2744; color: #efe8d8; border: none; cursor: pointer; transition: background 0.15s; }
  99. .btn:hover { background: #2d3a5a; }
  100. .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  101. .btn.ghost { background: transparent; color: #1a2744; border: 1.5px solid #1a2744; }
  102. .btn.ghost:hover { background: #f6f0df; }
  103. footer {
  104. position: fixed; bottom: 0; left: 0; right: 0;
  105. background: #efe8d8; border-top: 2px solid #1a2744;
  106. padding: 10px 16px;
  107. display: flex; justify-content: space-between; align-items: center;
  108. font-family: 'Oswald', sans-serif; font-size: 13px; letter-spacing: 1px;
  109. }
  110. footer .counter { color: #4a5875; }
  111. .test-item { border: 1.5px solid #1a2744; background: #f6f0df; padding: 14px; margin: 12px 0; }
  112. .test-item .q { font-weight: 700; margin-bottom: 10px; }
  113. .test-item .opts { display: flex; flex-direction: column; gap: 6px; }
  114. .test-item .opt { padding: 8px 12px; border: 1px solid #4a5875; background: #fbf7eb; cursor: pointer; font-size: 14px; transition: all 0.15s; }
  115. .test-item .opt:hover { background: #ece2c8; }
  116. .test-item .opt.correct { background: #d8e8d0; border-color: #2d5a3d; }
  117. .test-item .opt.wrong { background: #f0d0c8; border-color: #b02a1e; }
  118. .test-item .opt.disabled { cursor: default; pointer-events: none; }
  119. .test-item .explain { display: none; margin-top: 10px; padding: 10px; background: #fff8e8; border-left: 3px solid #2d5a3d; font-size: 14px; }
  120. .test-item .explain.visible { display: block; }
  121. .checklist { border: 2px solid #2d5a3d; background: #f0f6ec; padding: 16px 18px; margin: 16px 0; }
  122. .checklist h3 { color: #2d5a3d; border: none; margin-top: 0; }
  123. .checklist ul { margin: 0; padding-left: 20px; }
  124. .checklist li { margin: 4px 0; }
  125. @media (max-width: 600px) {
  126. h1 { font-size: 22px; } h2 { font-size: 17px; }
  127. .readout { grid-template-columns: 1fr 1fr; }
  128. .triad { grid-template-columns: 1fr; }
  129. canvas.viz { height: 200px; }
  130. canvas.viz.tall { height: 300px; }
  131. main { padding: 16px 10px 90px; }
  132. .ctrl-row .val { flex: 0 0 70px; font-size: 12px; }
  133. }
  134. </style>
  135. </head>
  136. <body>
  137. <header>
  138. <div class="progress"><div class="progress-fill" id="progressFill"></div></div>
  139. <div class="header-row">
  140. <span class="brand">Заслон · Тема 4.2</span>
  141. <span class="header-scene"><span id="sceneNum">Сцена 1 из 9</span> · <span id="sceneTitle">Цель</span></span>
  142. </div>
  143. </header>
  144. <main id="main"></main>
  145. <footer>
  146. <button class="btn ghost" id="prevBtn">← Назад</button>
  147. <span class="counter" id="counter">1 / 9</span>
  148. <button class="btn" id="nextBtn">Далее →</button>
  149. </footer>
  150. <script>
  151. 'use strict';
  152. /* ---------- общие утилиты ---------- */
  153. let currentRender = null;
  154. function stopAnim() { /* заглушка под будущие анимации */ }
  155. function setupCanvas(canvas) {
  156. const dpr = window.devicePixelRatio || 1;
  157. let rect = canvas.getBoundingClientRect();
  158. if (rect.width < 10) {
  159. const pw = canvas.parentElement ? canvas.parentElement.getBoundingClientRect().width : 0;
  160. rect = { width: pw || 600, height: canvas.offsetHeight || 240 };
  161. }
  162. canvas.width = Math.max(1, Math.floor(rect.width)) * dpr;
  163. canvas.height = Math.max(1, Math.floor(rect.height)) * dpr;
  164. const ctx = canvas.getContext('2d');
  165. ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
  166. return { ctx, w: rect.width, h: rect.height };
  167. }
  168. function setTitle(t) { document.getElementById('sceneTitle').textContent = t; }
  169. /* ---------- Сцена 1. Цель ---------- */
  170. function scene0(container) {
  171. setTitle('Цель');
  172. container.innerHTML = `
  173. <h1>Линия под контролем</h1>
  174. <p style="font-size:16px;color:#4a5875;margin-bottom:20px;">Тема 4.2. Системы защиты от утечки информации по проводному каналу</p>
  175. <div class="goal-box">
  176. <p style="margin-bottom:8px;"><strong>После прохождения вы сможете:</strong></p>
  177. <ul style="margin:0;padding-left:20px;">
  178. <li>Для каждой из трёх угроз ИБ — конфиденциальности, целостности, доступности — назвать способ атаки на проводную линию.</li>
  179. <li>Для каждой угрозы назвать средство защиты, которое её закрывает.</li>
  180. <li>Объяснить, почему один и тот же прибор может обслуживать две разные угрозы.</li>
  181. </ul>
  182. </div>
  183. <p>Проводной канал — телефонная линия, радиовещательная сеть, силовая проводка, линии сигнализации — остаётся важным, даже когда вокруг цифра. Именно поэтому его защита — отдельная тема, а не приложение к акустике или электромагнетизму.</p>
  184. <p>Разберём три угрозы по очереди, потом сведём их в одну таблицу. В конце — тест на понимание.</p>
  185. <div class="controls" style="margin-top:24px;">
  186. <div style="font-family:'Oswald',sans-serif;font-size:12px;letter-spacing:1px;color:#4a5875;text-transform:uppercase;margin-bottom:8px;">Что впереди</div>
  187. <div style="font-family:'Roboto Mono',monospace;font-size:13px;line-height:1.8;">
  188. 1. Зачем линии, когда есть цифра<br>
  189. 2. Определения для тетради<br>
  190. 3. Угроза конфиденциальности: подключение<br>
  191. 4. Угроза целостности: подмена сигнала<br>
  192. 5. Угроза доступности: обрыв и подавление<br>
  193. 6. Применение: средства защиты по триаде<br>
  194. 7. Проверка понимания<br>
  195. 8. Итог
  196. </div>
  197. </div>`;
  198. }
  199. /* ---------- Сцена 2. Актуализация ---------- */
  200. function scene1(container) {
  201. setTitle('Зачем линии, когда есть цифра');
  202. container.innerHTML = `
  203. <h2>Зачем линии, когда есть цифра</h2>
  204. <p>Проводное радиовещание и линии оповещения сохраняют и развивают, потому что они <strong>энергонезависимы</strong>: питаются от самой линии, а не от розетки, и работают, когда легла сотовая сеть и отключили свет. Но та же энергонезависимость означает, что провод физически доступен.</p>
  205. <div class="controls">
  206. <div class="ctrl-row">
  207. <label>Расстояние до щитка:</label>
  208. <input type="range" id="s1-dist" min="0" max="1000" step="10" value="0">
  209. <span class="val" id="s1-dist-val">0 м</span>
  210. </div>
  211. </div>
  212. <canvas class="viz" id="s1-canvas" style="height:220px;"></canvas>
  213. <div class="feedback" id="s1-feedback">Проведите ползунок вправо — на линии появятся точки возможного доступа.</div>
  214. <div class="triad">
  215. <div class="card"><span class="icon">👁</span><h4>Конфиденциальность</h4><p>Сигнал прочитан тем, кому не предназначен.</p></div>
  216. <div class="card"><span class="icon">✎</span><h4>Целостность</h4><p>Сигнал изменён или подменён по пути.</p></div>
  217. <div class="card"><span class="icon">⛓</span><h4>Доступность</h4><p>Сигнал не доходит до получателя.</p></div>
  218. </div>
  219. <p>Линия, которую берегут именно за надёжность, становится мишенью по всем трём осям. Дальше — по одной.</p>`;
  220. const canvas = container.querySelector('#s1-canvas');
  221. const slider = container.querySelector('#s1-dist');
  222. const lbl = container.querySelector('#s1-dist-val');
  223. const fb = container.querySelector('#s1-feedback');
  224. function render() {
  225. const dist = parseInt(slider.value);
  226. lbl.textContent = dist + ' м';
  227. drawScene1(canvas, dist);
  228. if (dist === 0) fb.innerHTML = 'Проведите ползунок вправо — появятся точки доступа.';
  229. else if (dist < 300) fb.innerHTML = 'Открыт щиток в подъезде. Злоумышленник уже может подключиться.';
  230. else if (dist < 600) fb.innerHTML = '<strong>Подвал.</strong> Ещё одна точка доступа. Контроль только квартиры не спасает — нужен контроль всей длины.';
  231. else if (dist < 900) fb.innerHTML = '<strong>Чердак.</strong> Чем длиннее линия, тем больше физических точек.';
  232. else fb.innerHTML = '<strong>Кабельная трасса.</strong> Вся линия открыта. Защита начинается с контроля всей длины, а не только квартиры.';
  233. }
  234. slider.addEventListener('input', render);
  235. currentRender = render;
  236. render();
  237. requestAnimationFrame(render);
  238. }
  239. function drawScene1(canvas, dist) {
  240. const { ctx, w, h } = setupCanvas(canvas);
  241. ctx.clearRect(0, 0, w, h);
  242. const pad = 30, lineY = h * 0.55;
  243. const lineLeft = pad, lineRight = w - pad;
  244. const lineLen = lineRight - lineLeft;
  245. const mToPx = (m) => lineLeft + (m / 1000) * lineLen;
  246. // дома
  247. [0, 200, 400, 700, 950].forEach(m => {
  248. const x = mToPx(m);
  249. ctx.fillStyle = '#1a2744';
  250. ctx.fillRect(x - 12, lineY - 26, 24, 20);
  251. ctx.beginPath();
  252. ctx.moveTo(x - 14, lineY - 26); ctx.lineTo(x, lineY - 36); ctx.lineTo(x + 14, lineY - 26);
  253. ctx.closePath(); ctx.fill();
  254. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 1.5;
  255. ctx.beginPath(); ctx.moveTo(x, lineY - 36); ctx.lineTo(x, lineY - 44); ctx.stroke();
  256. });
  257. // линия
  258. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  259. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  260. // точки доступа
  261. [{ m: 100, name: 'щиток' }, { m: 300, name: 'подвал' }, { m: 600, name: 'чердак' }, { m: 900, name: 'трасса' }].forEach(ap => {
  262. if (dist >= ap.m - 50) {
  263. const x = mToPx(ap.m);
  264. ctx.save(); ctx.translate(x, lineY); ctx.rotate(Math.PI / 4);
  265. ctx.fillStyle = '#b02a1e'; ctx.fillRect(-8, -8, 16, 16); ctx.restore();
  266. ctx.fillStyle = '#b02a1e'; ctx.font = 'bold 11px "Roboto Mono", monospace';
  267. ctx.textAlign = 'center'; ctx.fillText(ap.name, x, lineY + 32);
  268. }
  269. });
  270. ctx.fillStyle = '#4a5875'; ctx.font = '11px "Roboto Mono", monospace';
  271. ctx.textAlign = 'left'; ctx.fillText('0 м', lineLeft, lineY + 55);
  272. ctx.textAlign = 'right'; ctx.fillText('1000 м', lineRight, lineY + 55);
  273. }
  274. /* ---------- Сцена 3. Определения ---------- */
  275. function scene2(container) {
  276. setTitle('Определения для тетради');
  277. container.innerHTML = `
  278. <h2>Определения для тетради</h2>
  279. <p>Коротко, чтобы записать и дальше опираться.</p>
  280. <div class="defs-box">
  281. <dl>
  282. <dt>Проводной канал утечки</dt>
  283. <dd>Канал, в котором информативный сигнал распространяется по проводной линии: телефонной, радиовещательной, силовой, сигнализационной.</dd>
  284. <dt>Конфиденциальность</dt>
  285. <dd>Сигнал прочитан тем, кому не предназначен.</dd>
  286. <dt>Целостность</dt>
  287. <dd>Сигнал изменён или подменён по пути.</dd>
  288. <dt>Доступность</dt>
  289. <dd>Сигнал не доходит до получателя.</dd>
  290. <dt>Параллельное подключение</dt>
  291. <dd>Устройство съёма подключается к линии как дополнительная нагрузка. Меняет ток и импеданс линии.</dd>
  292. <dt>Последовательное подключение</dt>
  293. <dd>Устройство съёма разрывает линию и включается в разрыв. Меняет сопротивление участка.</dd>
  294. <dt>Рефлектометрия (TDR)</dt>
  295. <dd>Метод обнаружения неоднородностей в линии по отражённому импульсу. Позволяет найти место подключения или обрыва.</dd>
  296. </dl>
  297. </div>
  298. <p style="color:#4a5875;font-size:14px;">Дальше — по одной угрозе. Сначала конфиденциальность: подключение к линии.</p>`;
  299. }
  300. /* ---------- хелперы отрисовки схемы ---------- */
  301. function drawLabel(ctx, text, x, y, align, size, color) {
  302. align = align || 'center'; size = size || 13; color = color || '#1a2744';
  303. ctx.font = 'bold ' + size + 'px "Roboto Mono", monospace';
  304. const w = ctx.measureText(text).width;
  305. let bx = x;
  306. if (align === 'center') bx = x - w / 2;
  307. else if (align === 'right') bx = x - w;
  308. ctx.fillStyle = 'rgba(251,247,235,0.92)';
  309. ctx.fillRect(bx - 4, y - size + 1, w + 8, size + 5);
  310. ctx.fillStyle = color;
  311. ctx.textAlign = 'left';
  312. ctx.fillText(text, bx, y);
  313. }
  314. function drawDevice(ctx, cx, cy, w, h, label, color) {
  315. ctx.fillStyle = color;
  316. ctx.fillRect(cx - w / 2, cy - h / 2, w, h);
  317. ctx.strokeStyle = '#1a2744';
  318. ctx.lineWidth = 2;
  319. ctx.strokeRect(cx - w / 2, cy - h / 2, w, h);
  320. ctx.fillStyle = '#efe8d8';
  321. ctx.font = 'bold 12px "Oswald", sans-serif';
  322. ctx.textAlign = 'center';
  323. ctx.textBaseline = 'middle';
  324. ctx.fillText(label, cx, cy);
  325. ctx.textBaseline = 'alphabetic';
  326. }
  327. function drawSourceBox(ctx, x, y, w, h, label) {
  328. ctx.fillStyle = '#1a2744';
  329. ctx.fillRect(x, y, w, h);
  330. ctx.fillStyle = '#efe8d8';
  331. ctx.font = 'bold 12px "Oswald", sans-serif';
  332. ctx.textAlign = 'center';
  333. ctx.textBaseline = 'middle';
  334. ctx.fillText(label, x + w / 2, y + h / 2);
  335. ctx.textBaseline = 'alphabetic';
  336. }
  337. /* ---------- Сцена 4. Конфиденциальность ---------- */
  338. function scene3(container) {
  339. setTitle('Угроза конфиденциальности');
  340. container.innerHTML = `
  341. <h2>Угроза конфиденциальности: подключение к линии</h2>
  342. <p>Злоумышленник подключается к линии, чтобы читать сигнал. Есть два способа: <strong>параллельно</strong> (дополнительная нагрузка) и <strong>последовательно</strong> (разрыв с вставкой). Каждый меняет параметры линии по-своему.</p>
  343. <div class="controls">
  344. <div class="seg" id="s3-type">
  345. <button data-val="none" class="active">Нет</button>
  346. <button data-val="parallel">Параллельное</button>
  347. <button data-val="serial">Последовательное</button>
  348. </div>
  349. <div class="ctrl-row">
  350. <label>R злоумышленника:</label>
  351. <input type="range" id="s3-R" min="1" max="1000" step="1" value="1000">
  352. <span class="val" id="s3-R-val">1000 Ом</span>
  353. </div>
  354. <div class="ctrl-row">
  355. <label>Удалённость:</label>
  356. <input type="range" id="s3-dist" min="50" max="950" step="10" value="300">
  357. <span class="val" id="s3-dist-val">300 м</span>
  358. </div>
  359. </div>
  360. <canvas class="viz tall" id="s3-canvas"></canvas>
  361. <div class="readout">
  362. <div class="item"><div class="lbl">Ток в линии</div><div class="val" id="s3-I">—</div></div>
  363. <div class="item"><div class="lbl">Импеданс</div><div class="val" id="s3-Z">—</div></div>
  364. <div class="item"><div class="lbl">Отражение Γ</div><div class="val" id="s3-G">—</div></div>
  365. </div>
  366. <div class="feedback" id="s3-feedback">Выберите тип подключения и двигайте ползунки.</div>`;
  367. const st = { type: 'none', R: 1000, dist: 300 };
  368. const canvas = container.querySelector('#s3-canvas');
  369. function render() {
  370. st.R = parseInt(container.querySelector('#s3-R').value);
  371. st.dist = parseInt(container.querySelector('#s3-dist').value);
  372. container.querySelector('#s3-R-val').textContent = st.R + ' Ом';
  373. container.querySelector('#s3-dist-val').textContent = st.dist + ' м';
  374. const Z0 = 100, U = 60;
  375. let Z, I, Gamma;
  376. const I0 = U / (2 * Z0);
  377. if (st.type === 'none') {
  378. Z = 2 * Z0; I = I0; Gamma = 0;
  379. } else if (st.type === 'parallel') {
  380. const Zt = (st.R * Z0) / (st.R + Z0);
  381. Z = Z0 + Zt; I = U / Z;
  382. Gamma = (Zt - Z0) / (Zt + Z0);
  383. } else {
  384. const Zt = Z0 + st.R;
  385. Z = Z0 + Zt; I = U / Z;
  386. Gamma = (Zt - Z0) / (Zt + Z0);
  387. }
  388. const dI = ((I - I0) / I0) * 100;
  389. const iEl = container.querySelector('#s3-I');
  390. iEl.textContent = I.toFixed(2) + ' А';
  391. iEl.className = 'val' + (Math.abs(dI) > 5 ? ' warn' : '');
  392. container.querySelector('#s3-Z').textContent = Z.toFixed(1) + ' Ом';
  393. container.querySelector('#s3-G').textContent = Gamma.toFixed(3);
  394. drawScene3(canvas, st, Gamma);
  395. const fb = container.querySelector('#s3-feedback');
  396. if (st.type === 'none') {
  397. fb.innerHTML = 'Линия чистая. Параметры в норме.';
  398. } else if (st.type === 'parallel') {
  399. if (st.R < 5) {
  400. fb.innerHTML = '<strong>Короткое замыкание.</strong> Сопротивление почти нулевое — это уже не скрытый съём, а авария. Система контроля должна сработать и на это.';
  401. } else if (Math.abs(dI) < 5) {
  402. fb.innerHTML = '<strong>Подключение маскируется.</strong> Сопротивление велико, ток изменился меньше чем на 5% — на глаз не заметить. Нужен точный контроль импеданса или рефлектометрия.';
  403. } else {
  404. fb.innerHTML = `<strong>Параллельное подключение.</strong> Линия шунтируется: сопротивление падает, ток растёт на ${Math.abs(dI).toFixed(1)}%. Если сравнивать с эталоном — заметно.`;
  405. }
  406. } else {
  407. if (Math.abs(dI) < 5) {
  408. fb.innerHTML = '<strong>Вставка почти невидима по току.</strong> Маленькое сопротивление в разрыве почти не меняет ток. Но рефлектометр видит неоднородность.';
  409. } else {
  410. fb.innerHTML = `<strong>Последовательное подключение.</strong> В линии появился разрыв с сопротивлением ${st.R} Ом. Ток упал на ${Math.abs(dI).toFixed(1)}%, рефлектограмма показывает отражение на расстоянии ${st.dist} м.`;
  411. }
  412. }
  413. }
  414. container.querySelectorAll('#s3-type button').forEach(btn => {
  415. btn.addEventListener('click', () => {
  416. container.querySelectorAll('#s3-type button').forEach(b => b.classList.remove('active'));
  417. btn.classList.add('active');
  418. st.type = btn.dataset.val;
  419. render();
  420. });
  421. });
  422. container.querySelector('#s3-R').addEventListener('input', render);
  423. container.querySelector('#s3-dist').addEventListener('input', render);
  424. currentRender = render;
  425. render();
  426. requestAnimationFrame(render);
  427. }
  428. function drawScene3(canvas, st, Gamma) {
  429. const { ctx, w, h } = setupCanvas(canvas);
  430. ctx.clearRect(0, 0, w, h);
  431. const padL = 36, padR = 36;
  432. const lineLeft = padL, lineRight = w - padR;
  433. const lineLen = lineRight - lineLeft;
  434. const lineY = h * 0.26;
  435. const mToPx = (m) => lineLeft + (m / 1000) * lineLen;
  436. // источник и нагрузка
  437. drawSourceBox(ctx, lineLeft - 26, lineY - 15, 26, 30, 'И');
  438. drawSourceBox(ctx, lineRight, lineY - 15, 26, 30, 'Н');
  439. // линия (с разрывом при последовательном)
  440. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  441. if (st.type === 'serial') {
  442. const tx = mToPx(st.dist);
  443. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(tx - 24, lineY); ctx.stroke();
  444. ctx.beginPath(); ctx.moveTo(tx + 24, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  445. } else {
  446. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  447. }
  448. // точка подключения
  449. if (st.type === 'parallel') {
  450. const tx = mToPx(st.dist);
  451. const tx1 = tx - 32, tx2 = tx + 32;
  452. const yBot = lineY + 52;
  453. // параллельный контур: два отвода вниз + перемычка с устройством
  454. ctx.strokeStyle = '#b02a1e'; ctx.lineWidth = 2.5;
  455. ctx.beginPath();
  456. ctx.moveTo(tx1, lineY); ctx.lineTo(tx1, yBot);
  457. ctx.lineTo(tx - 24, yBot); ctx.stroke();
  458. ctx.beginPath();
  459. ctx.moveTo(tx2, lineY); ctx.lineTo(tx2, yBot);
  460. ctx.lineTo(tx + 24, yBot); ctx.stroke();
  461. // устройство злоумышленника в перемычке
  462. drawDevice(ctx, tx, yBot, 48, 24, 'ЗЛ', '#b02a1e');
  463. // подписи: удалённость над линией, сопротивление под устройством
  464. drawLabel(ctx, st.dist + ' м', tx, lineY - 16, 'center', 13, '#b02a1e');
  465. drawLabel(ctx, 'R = ' + st.R + ' Ом', tx, yBot + 30, 'center', 13, '#b02a1e');
  466. } else if (st.type === 'serial') {
  467. const tx = mToPx(st.dist);
  468. // устройство в разрыве линии
  469. drawDevice(ctx, tx, lineY, 48, 28, 'ЗЛ', '#b02a1e');
  470. drawLabel(ctx, st.dist + ' м', tx, lineY - 28, 'center', 13, '#b02a1e');
  471. drawLabel(ctx, 'R = ' + st.R + ' Ом', tx, lineY + 40, 'center', 13, '#b02a1e');
  472. }
  473. // рефлектограмма
  474. const roY0 = h * 0.60, roH = h * 0.36;
  475. ctx.fillStyle = '#fbf7eb'; ctx.fillRect(lineLeft, roY0, lineLen, roH);
  476. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 1; ctx.strokeRect(lineLeft, roY0, lineLen, roH);
  477. ctx.strokeStyle = 'rgba(26,39,68,0.1)'; ctx.lineWidth = 0.5;
  478. for (let i = 1; i < 10; i++) {
  479. const x = lineLeft + (i / 10) * lineLen;
  480. ctx.beginPath(); ctx.moveTo(x, roY0); ctx.lineTo(x, roY0 + roH); ctx.stroke();
  481. }
  482. const midY = roY0 + roH / 2;
  483. ctx.strokeStyle = 'rgba(26,39,68,0.35)'; ctx.lineWidth = 1;
  484. ctx.beginPath(); ctx.moveTo(lineLeft, midY); ctx.lineTo(lineRight, midY); ctx.stroke();
  485. if (st.type !== 'none' && Math.abs(Gamma) > 0.01) {
  486. const px = mToPx(st.dist);
  487. const amp = Math.abs(Gamma) * roH * 0.42;
  488. const sign = Gamma < 0 ? -1 : 1;
  489. const pw = Math.max(10, lineLen * 0.02);
  490. ctx.fillStyle = Gamma < 0 ? '#b02a1e' : '#2d5a3d';
  491. ctx.beginPath();
  492. ctx.moveTo(px - pw, midY);
  493. ctx.lineTo(px, midY + sign * amp);
  494. ctx.lineTo(px + pw, midY);
  495. ctx.lineTo(px, midY + sign * amp * 0.4);
  496. ctx.closePath(); ctx.fill();
  497. drawLabel(ctx, 't = ' + (2 * st.dist / 2e8 * 1e9).toFixed(0) + ' нс', px, roY0 - 8, 'center', 11);
  498. }
  499. drawLabel(ctx, 'Рефлектограмма', lineLeft + lineLen / 2, roY0 - 8, 'center', 12, '#4a5875');
  500. drawLabel(ctx, '0 м', lineLeft + 4, roY0 + roH + 16, 'left', 12, '#4a5875');
  501. drawLabel(ctx, '1000 м', lineRight - 4, roY0 + roH + 16, 'right', 12, '#4a5875');
  502. }
  503. /* ---------- Сцена 5. Целостность ---------- */
  504. function scene4(container) {
  505. setTitle('Угроза целостности');
  506. container.innerHTML = `
  507. <h2>Угроза целостности: подмена сигнала</h2>
  508. <p>Злоумышленник может не только слушать, но и <strong>говорить в линию</strong>. Для сети оповещения это худший сценарий: люди получают ложную команду. Сигнал в линии — суперпозиция полезного и постороннего.</p>
  509. <div class="controls">
  510. <div class="ctrl-row">
  511. <label>Амплитуда врезки:</label>
  512. <input type="range" id="s4-A" min="0" max="200" step="5" value="0">
  513. <span class="val" id="s4-A-val">0 %</span>
  514. </div>
  515. <div class="ctrl-row">
  516. <label>Частота врезки:</label>
  517. <input type="range" id="s4-f" min="300" max="2000" step="10" value="1000">
  518. <span class="val" id="s4-f-val">1000 Гц</span>
  519. </div>
  520. <div class="ctrl-row">
  521. <label>Точка врезки:</label>
  522. <input type="range" id="s4-dist" min="0" max="1000" step="10" value="500">
  523. <span class="val" id="s4-dist-val">500 м</span>
  524. </div>
  525. <div class="seg" id="s4-auth">
  526. <button data-val="off" class="active">Аутентификация выкл.</button>
  527. <button data-val="on">Аутентификация вкл.</button>
  528. </div>
  529. </div>
  530. <canvas class="viz" id="s4-canvas" style="height:300px;"></canvas>
  531. <div class="readout">
  532. <div class="item"><div class="lbl">Сигнал в приёмнике</div><div class="val" id="s4-state">ОПОВЕЩЕНИЕ</div></div>
  533. <div class="item"><div class="lbl">A врезки / A полезного</div><div class="val" id="s4-snr">0.00</div></div>
  534. <div class="item"><div class="lbl">Решение приёмника</div><div class="val" id="s4-dec">—</div></div>
  535. </div>
  536. <div class="feedback" id="s4-feedback">Увеличьте амплитуду врезки и посмотрите, что произойдёт.</div>`;
  537. const st = { A2: 0, f2: 1000, dist: 500, auth: false };
  538. const canvas = container.querySelector('#s4-canvas');
  539. const A1 = 100, f1 = 1000;
  540. function render() {
  541. st.A2 = parseInt(container.querySelector('#s4-A').value);
  542. st.f2 = parseInt(container.querySelector('#s4-f').value);
  543. st.dist = parseInt(container.querySelector('#s4-dist').value);
  544. container.querySelector('#s4-A-val').textContent = st.A2 + ' %';
  545. container.querySelector('#s4-f-val').textContent = st.f2 + ' Гц';
  546. container.querySelector('#s4-dist-val').textContent = st.dist + ' м';
  547. const ratio = st.A2 / A1;
  548. const sameFreq = Math.abs(st.f2 - f1) < 50;
  549. let stateText, decision, cls = '';
  550. let rejected = false;
  551. if (st.A2 === 0) {
  552. stateText = 'ОПОВЕЩЕНИЕ'; decision = '—';
  553. } else if (st.auth) {
  554. if (sameFreq && ratio < 1) { stateText = 'ОПОВЕЩЕНИЕ'; decision = 'ПРИНЯТ'; }
  555. else { stateText = 'ОТКЛОНЁН'; decision = 'КОД НЕ СОВПАЛ'; rejected = true; }
  556. } else {
  557. if (ratio >= 1) { stateText = 'ЛОЖНЫЙ СИГНАЛ'; decision = '—'; cls = 'warn'; }
  558. else if (ratio >= 0.3) { stateText = 'ИСКАЖЁН'; decision = '—'; cls = 'warn'; }
  559. else { stateText = 'ОПОВЕЩЕНИЕ'; decision = '—'; }
  560. }
  561. const stEl = container.querySelector('#s4-state');
  562. stEl.textContent = stateText;
  563. stEl.className = 'val ' + (cls || (stateText === 'ОПОВЕЩЕНИЕ' ? 'ok' : ''));
  564. container.querySelector('#s4-snr').textContent = ratio.toFixed(2);
  565. const decEl = container.querySelector('#s4-dec');
  566. decEl.textContent = decision;
  567. decEl.className = 'val ' + (decision === 'ПРИНЯТ' ? 'ok' : (decision === 'КОД НЕ СОВПАЛ' ? 'warn' : ''));
  568. const fb = container.querySelector('#s4-feedback');
  569. if (st.A2 === 0) {
  570. fb.innerHTML = 'Врезки нет, сигнал чистый. Приёмник видит только полезный сигнал.';
  571. } else if (st.auth) {
  572. if (stateText === 'ОПОВЕЩЕНИЕ') {
  573. fb.innerHTML = '<strong>Аутентификация пропускает сигнал.</strong> Частота совпадает с ожидаемой, врезка слабее полезного сигнала. Приёмник не видит подмены.';
  574. } else if (sameFreq) {
  575. fb.innerHTML = '<strong>Аутентификация отклонила сигнал.</strong> Амплитуда врезки больше полезного сигнала — доминирующая частота изменилась. Приёмник это распознал.';
  576. } else {
  577. fb.innerHTML = '<strong>Аутентификация отклонила сигнал.</strong> В линии появилась посторонняя частота, отличная от ожидаемой. Приёмник проверяет код и не пропускает чужой сигнал.';
  578. }
  579. } else {
  580. if (ratio >= 1) {
  581. fb.innerHTML = '<strong>Полная маскировка.</strong> Амплитуда врезки больше полезного сигнала — приёмник «слышит» только злоумышленника. Люди получают ложное оповещение.';
  582. } else if (ratio >= 0.3) {
  583. fb.innerHTML = '<strong>Сигнал искажён.</strong> Врезка заметна, но не заглушает полезный сигнал. Приёмник видит смесь двух частот, разобрать трудно.';
  584. } else {
  585. fb.innerHTML = '<strong>Врезка мала.</strong> Она есть, но не влияет на приём. Приёмник не отличает её от шума.';
  586. }
  587. }
  588. drawScene4(canvas, st, A1, f1, rejected);
  589. }
  590. container.querySelectorAll('#s4-auth button').forEach(btn => {
  591. btn.addEventListener('click', () => {
  592. container.querySelectorAll('#s4-auth button').forEach(b => b.classList.remove('active'));
  593. btn.classList.add('active');
  594. st.auth = btn.dataset.val === 'on';
  595. render();
  596. });
  597. });
  598. container.querySelector('#s4-A').addEventListener('input', render);
  599. container.querySelector('#s4-f').addEventListener('input', render);
  600. container.querySelector('#s4-dist').addEventListener('input', render);
  601. currentRender = render;
  602. render();
  603. requestAnimationFrame(render);
  604. }
  605. function drawScene4(canvas, st, A1, f1, rejected) {
  606. const { ctx, w, h } = setupCanvas(canvas);
  607. ctx.clearRect(0, 0, w, h);
  608. const padX = 40, gw = w - 2 * padX;
  609. const rowH = (h - 10) / 3;
  610. const A_total = A1 + st.A2;
  611. const rows = [
  612. { label: 'Полезный сигнал', color: '#2d5a3d', kind: 'u' },
  613. { label: 'Врезка злоумышленника', color: '#b02a1e', kind: 'n' },
  614. { label: 'Сигнал в приёмнике', color: '#1a2744', kind: 's' }
  615. ];
  616. rows.forEach((row, idx) => {
  617. const top = idx * rowH;
  618. const centerY = top + rowH / 2;
  619. const amp = rowH * 0.38;
  620. ctx.fillStyle = idx === 2 ? '#f3ecd8' : '#fbf7eb';
  621. ctx.fillRect(padX, top, gw, rowH - 4);
  622. ctx.strokeStyle = 'rgba(26,39,68,0.2)'; ctx.lineWidth = 1;
  623. ctx.strokeRect(padX, top, gw, rowH - 4);
  624. ctx.strokeStyle = 'rgba(26,39,68,0.3)';
  625. ctx.beginPath(); ctx.moveTo(padX, centerY); ctx.lineTo(padX + gw, centerY); ctx.stroke();
  626. ctx.fillStyle = row.color;
  627. ctx.font = 'bold 10px "Oswald", sans-serif';
  628. ctx.textAlign = 'left';
  629. ctx.fillText(row.label, padX + 6, top + 14);
  630. if (idx === 1 && st.A2 === 0) return;
  631. const tx = padX + (st.dist / 1000) * gw;
  632. const periods = 3;
  633. const samples = 300;
  634. const scale = amp / Math.max(1, A_total);
  635. ctx.strokeStyle = row.color; ctx.lineWidth = 1.5;
  636. ctx.beginPath();
  637. let started = false;
  638. for (let i = 0; i <= samples; i++) {
  639. const x = padX + (i / samples) * gw;
  640. const t = (i / samples) * periods / f1;
  641. if (row.kind === 'u') {
  642. const val = A1 * Math.sin(2 * Math.PI * f1 * t);
  643. const y = centerY - val * scale;
  644. if (!started) { ctx.moveTo(x, y); started = true; }
  645. else ctx.lineTo(x, y);
  646. } else if (row.kind === 'n') {
  647. if (x < tx) continue;
  648. const val = st.A2 * Math.sin(2 * Math.PI * st.f2 * t);
  649. const y = centerY - val * scale;
  650. if (!started) { ctx.moveTo(x, y); started = true; }
  651. else ctx.lineTo(x, y);
  652. } else {
  653. // s
  654. if (x < tx) {
  655. const val = A1 * Math.sin(2 * Math.PI * f1 * t);
  656. const y = centerY - val * scale;
  657. if (!started) { ctx.moveTo(x, y); started = true; }
  658. else ctx.lineTo(x, y);
  659. } else {
  660. if (rejected) {
  661. if (!started) { ctx.moveTo(x, centerY); started = true; }
  662. else ctx.lineTo(x, centerY);
  663. } else {
  664. const val = A1 * Math.sin(2 * Math.PI * f1 * t) + st.A2 * Math.sin(2 * Math.PI * st.f2 * t);
  665. const y = centerY - val * scale;
  666. if (!started) { ctx.moveTo(x, y); started = true; }
  667. else ctx.lineTo(x, y);
  668. }
  669. }
  670. }
  671. }
  672. ctx.stroke();
  673. });
  674. // вертикальная отметка точки врезки
  675. if (st.A2 > 0) {
  676. const tx = padX + (st.dist / 1000) * gw;
  677. ctx.strokeStyle = 'rgba(176,42,30,0.5)'; ctx.lineWidth = 1;
  678. ctx.setLineDash([4, 4]);
  679. ctx.beginPath(); ctx.moveTo(tx, 0); ctx.lineTo(tx, h); ctx.stroke();
  680. ctx.setLineDash([]);
  681. }
  682. // надпись "ОТКЛОНЁН" при отклонении
  683. if (rejected) {
  684. const tx = padX + (st.dist / 1000) * gw;
  685. const rowTop = 2 * rowH;
  686. ctx.fillStyle = '#b02a1e';
  687. ctx.font = 'bold 12px "Oswald", sans-serif';
  688. ctx.textAlign = 'left';
  689. ctx.fillText('ОТКЛОНЁН', tx + 8, rowTop + 20);
  690. }
  691. }
  692. /* ---------- Сцена 6. Доступность ---------- */
  693. function scene5(container) {
  694. setTitle('Угроза доступности');
  695. container.innerHTML = `
  696. <h2>Угроза доступности: обрыв и подавление</h2>
  697. <p>Линию берегут именно за доступность — и её проще всего уничтожить физически. Обрыв, короткое замыкание или мощная помеха прерывают связь. Один и тот же рефлектометр видит и подключение (К), и обрыв (Д).</p>
  698. <div class="controls">
  699. <div class="seg" id="s5-type">
  700. <button data-val="none" class="active">Нет</button>
  701. <button data-val="break">Обрыв</button>
  702. <button data-val="short">КЗ</button>
  703. <button data-val="interf">Помеха</button>
  704. </div>
  705. <div class="ctrl-row">
  706. <label>Точка воздействия:</label>
  707. <input type="range" id="s5-dist" min="0" max="1000" step="10" value="500">
  708. <span class="val" id="s5-dist-val">500 м</span>
  709. </div>
  710. <div class="seg" id="s5-backup">
  711. <button data-val="off" class="active">Без резерва</button>
  712. <button data-val="on">С резервом</button>
  713. </div>
  714. </div>
  715. <canvas class="viz" id="s5-canvas" style="height:240px;"></canvas>
  716. <div class="readout">
  717. <div class="item"><div class="lbl">Доступность линии</div><div class="val" id="s5-state">НОРМА</div></div>
  718. <div class="item"><div class="lbl">Абонентов без сигнала</div><div class="val" id="s5-affected">0</div></div>
  719. </div>
  720. <div class="feedback" id="s5-feedback">Выберите тип воздействия.</div>`;
  721. const st = { type: 'none', dist: 500, backup: false };
  722. const canvas = container.querySelector('#s5-canvas');
  723. const houses = [50, 200, 350, 500, 650, 800, 950];
  724. function render() {
  725. st.dist = parseInt(container.querySelector('#s5-dist').value);
  726. container.querySelector('#s5-dist-val').textContent = st.dist + ' м';
  727. let affected = 0, stateText, cls = '';
  728. if (st.type === 'none') { affected = 0; stateText = 'НОРМА'; cls = 'ok'; }
  729. else if (st.type === 'break') {
  730. if (st.backup) { affected = 0; stateText = 'ОБХОД'; cls = 'ok'; }
  731. else { affected = houses.filter(m => m > st.dist).length; stateText = 'ОБРЫВ'; cls = 'warn'; }
  732. } else if (st.type === 'short') { affected = houses.length; stateText = 'КЗ'; cls = 'warn'; }
  733. else { affected = houses.filter(m => m > st.dist).length; stateText = 'ПОМЕХА'; cls = 'warn'; }
  734. const stEl = container.querySelector('#s5-state');
  735. stEl.textContent = stateText;
  736. stEl.className = 'val ' + cls;
  737. container.querySelector('#s5-affected').textContent = affected;
  738. const fb = container.querySelector('#s5-feedback');
  739. if (st.type === 'none') fb.innerHTML = 'Все абоненты получают сигнал. Линия в норме.';
  740. else if (st.type === 'break') {
  741. if (st.backup) fb.innerHTML = '<strong>Резервный маршрут сработал.</strong> Сигнал обошёл место обрыва. Резервирование — единственное средство, которое работает против обрыва. Обнаружение обрыва — не защита, а сигнал к действию.';
  742. else fb.innerHTML = `<strong>Обрыв на ${st.dist} м.</strong> Абоненты дальше точки обрыва потеряли сигнал: их ${affected}. В линейной топологии один разрез убивает часть сети.`;
  743. } else if (st.type === 'short') {
  744. fb.innerHTML = '<strong>Короткое замыкание.</strong> Линия «села», сигнал пропал у всех абонентов. Это не съём, а авария — но система контроля должна её видеть. Резерв не спасает от КЗ.';
  745. } else {
  746. fb.innerHTML = `<strong>Мощная помеха на ${st.dist} м.</strong> Сигнал есть, но разобрать его нельзя. Абонентов после точки помехи без связи: ${affected}. Против помехи работает не резервирование, а помехоустойчивость.`;
  747. }
  748. drawScene5(canvas, st, houses);
  749. }
  750. container.querySelectorAll('#s5-type button').forEach(btn => {
  751. btn.addEventListener('click', () => {
  752. container.querySelectorAll('#s5-type button').forEach(b => b.classList.remove('active'));
  753. btn.classList.add('active');
  754. st.type = btn.dataset.val;
  755. render();
  756. });
  757. });
  758. container.querySelectorAll('#s5-backup button').forEach(btn => {
  759. btn.addEventListener('click', () => {
  760. container.querySelectorAll('#s5-backup button').forEach(b => b.classList.remove('active'));
  761. btn.classList.add('active');
  762. st.backup = btn.dataset.val === 'on';
  763. render();
  764. });
  765. });
  766. container.querySelector('#s5-dist').addEventListener('input', render);
  767. currentRender = render;
  768. render();
  769. requestAnimationFrame(render);
  770. }
  771. function drawScene5(canvas, st, houses) {
  772. const { ctx, w, h } = setupCanvas(canvas);
  773. ctx.clearRect(0, 0, w, h);
  774. const padL = 30, padR = 30;
  775. const lineLeft = padL, lineRight = w - padR;
  776. const lineLen = lineRight - lineLeft;
  777. const lineY = h * 0.55;
  778. const mToPx = (m) => lineLeft + (m / 1000) * lineLen;
  779. // резерв
  780. if (st.backup) {
  781. ctx.strokeStyle = '#2d5a3d'; ctx.lineWidth = 2; ctx.setLineDash([5, 3]);
  782. ctx.beginPath();
  783. ctx.moveTo(lineLeft, lineY);
  784. ctx.bezierCurveTo(lineLeft + lineLen * 0.3, lineY - 50, lineRight - lineLen * 0.3, lineY - 50, lineRight, lineY);
  785. ctx.stroke();
  786. ctx.setLineDash([]);
  787. ctx.fillStyle = '#2d5a3d'; ctx.font = '10px "Roboto Mono", monospace';
  788. ctx.textAlign = 'center';
  789. ctx.fillText('резервный маршрут', (lineLeft + lineRight) / 2, lineY - 55);
  790. }
  791. // линия
  792. if (st.type === 'break') {
  793. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  794. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(mToPx(st.dist) - 8, lineY); ctx.stroke();
  795. ctx.beginPath(); ctx.moveTo(mToPx(st.dist) + 8, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  796. ctx.strokeStyle = '#b02a1e'; ctx.lineWidth = 3;
  797. const bx = mToPx(st.dist);
  798. ctx.beginPath(); ctx.moveTo(bx - 8, lineY - 10); ctx.lineTo(bx - 8, lineY + 10); ctx.stroke();
  799. ctx.beginPath(); ctx.moveTo(bx + 8, lineY - 10); ctx.lineTo(bx + 8, lineY + 10); ctx.stroke();
  800. } else if (st.type === 'short') {
  801. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  802. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  803. const x = mToPx(st.dist);
  804. ctx.strokeStyle = '#b02a1e'; ctx.lineWidth = 2;
  805. ctx.beginPath(); ctx.moveTo(x, lineY); ctx.lineTo(x, lineY + 25); ctx.stroke();
  806. ctx.beginPath(); ctx.moveTo(x - 10, lineY + 25); ctx.lineTo(x + 10, lineY + 25); ctx.stroke();
  807. ctx.fillStyle = '#b02a1e'; ctx.font = 'bold 11px "Roboto Mono", monospace';
  808. ctx.textAlign = 'center'; ctx.fillText('КЗ', x, lineY + 42);
  809. } else if (st.type === 'interf') {
  810. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  811. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(mToPx(st.dist), lineY); ctx.stroke();
  812. ctx.strokeStyle = '#b02a1e'; ctx.lineWidth = 2;
  813. ctx.beginPath();
  814. const x0 = mToPx(st.dist), x1 = lineRight;
  815. for (let i = 0; i <= 100; i++) {
  816. const x = x0 + (i / 100) * (x1 - x0);
  817. const y = lineY + Math.sin(i * 0.6) * 3;
  818. if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);
  819. }
  820. ctx.stroke();
  821. } else {
  822. ctx.strokeStyle = '#1a2744'; ctx.lineWidth = 3;
  823. ctx.beginPath(); ctx.moveTo(lineLeft, lineY); ctx.lineTo(lineRight, lineY); ctx.stroke();
  824. }
  825. // дома
  826. houses.forEach(m => {
  827. const x = mToPx(m);
  828. const afterBreak = st.type === 'break' && m > st.dist;
  829. const afterShort = st.type === 'short';
  830. const afterInterf = st.type === 'interf' && m > st.dist;
  831. const bad = (afterBreak || afterShort || afterInterf) && !(st.backup && st.type === 'break');
  832. ctx.fillStyle = bad ? '#b02a1e' : '#1a2744';
  833. ctx.fillRect(x - 10, lineY - 24, 20, 16);
  834. ctx.beginPath();
  835. ctx.moveTo(x - 12, lineY - 24); ctx.lineTo(x, lineY - 33); ctx.lineTo(x + 12, lineY - 24);
  836. ctx.closePath(); ctx.fill();
  837. if (bad) {
  838. ctx.strokeStyle = '#b02a1e'; ctx.lineWidth = 2;
  839. ctx.beginPath(); ctx.moveTo(x - 5, lineY - 45); ctx.lineTo(x + 5, lineY - 35);
  840. ctx.moveTo(x + 5, lineY - 45); ctx.lineTo(x - 5, lineY - 35); ctx.stroke();
  841. } else {
  842. ctx.strokeStyle = '#2d5a3d'; ctx.lineWidth = 1.5;
  843. ctx.beginPath(); ctx.arc(x, lineY - 45, 4, -Math.PI, 0); ctx.stroke();
  844. ctx.beginPath(); ctx.arc(x, lineY - 45, 8, -Math.PI, 0); ctx.stroke();
  845. }
  846. });
  847. ctx.fillStyle = '#4a5875'; ctx.font = '11px "Roboto Mono", monospace';
  848. ctx.textAlign = 'left'; ctx.fillText('0 м', lineLeft, lineY + 60);
  849. ctx.textAlign = 'right'; ctx.fillText('1000 м', lineRight, lineY + 60);
  850. ctx.textAlign = 'center'; ctx.fillText('Линейная топология' + (st.backup ? ' + кольцевой резерв' : ''), (lineLeft + lineRight) / 2, 20);
  851. }
  852. /* ---------- Сцена 7. Применение ---------- */
  853. function scene6(container) {
  854. setTitle('Средства защиты по триаде');
  855. container.innerHTML = `
  856. <h2>Применение: средства защиты по триаде</h2>
  857. <p>Один и тот же инструмент может закрывать разные угрозы. Нажмите на угрозу — раскроются средства защиты.</p>
  858. <div class="triad" id="s6-triad">
  859. <div class="card active" data-key="k"><span class="icon">👁</span><h4>Конфиденциальность</h4><p>Найти подключение и не дать ему работать</p></div>
  860. <div class="card" data-key="c"><span class="icon">✎</span><h4>Целостность</h4><p>Отличить «свой» сигнал от «чужого»</p></div>
  861. <div class="card" data-key="d"><span class="icon">⛓</span><h4>Доступность</h4><p>Сохранить путь сигнала или восстановить</p></div>
  862. </div>
  863. <div id="s6-content"></div>`;
  864. const data = {
  865. k: {
  866. title: 'Конфиденциальность',
  867. items: [
  868. ['Рефлектометрия (TDR)', 'Находит неоднородность в линии: параллельное подключение даёт отрицательное отражение.'],
  869. ['Контроль импеданса и тока', 'Сравнение с эталоном выявляет подключение: импеданс падает, ток растёт.'],
  870. ['«Выжигание»', 'Высоковольтный импульс в линию выводит из строя параллельно подключённое устройство.'],
  871. ['Пломбирование и контроль трасс', 'Не даёт физически добраться до линии — организационная защита.']
  872. ]
  873. },
  874. c: {
  875. title: 'Целостность',
  876. items: [
  877. ['Аутентификация сигнала', 'Тональный код, последовательность посылок — приёмник проверяет «тот или не тот» сигнал.'],
  878. ['Контроль уровня', 'Слишком сильный сигнал, доминирующая посторонняя частота — признаки врезки.'],
  879. ['Проверка на посторонние несущие', 'В линии не должно быть частот, отличных от рабочих.'],
  880. ['Организационный контроль', 'Если злоумышленник знает код — это утечка регламента, а не техники.']
  881. ]
  882. },
  883. d: {
  884. title: 'Доступность',
  885. items: [
  886. ['Резервирование маршрутов', 'Кольцевая топология: при обрыве сигнал идёт в обход.'],
  887. ['Мониторинг целостности', 'Рефлектометр видит обрыв так же, как и подключение.'],
  888. ['Автономное питание', 'Линия питается от самой себя — уже часть защиты доступности.'],
  889. ['Обходы и патрулирование', 'Организационная защита трасс от физического обрыва.']
  890. ]
  891. }
  892. };
  893. const content = container.querySelector('#s6-content');
  894. function show(key) {
  895. const d = data[key];
  896. let html = `<h3>${d.title}: средства защиты</h3><ul style="padding-left:20px;">`;
  897. d.items.forEach(([name, desc]) => { html += `<li style="margin:8px 0;"><strong>${name}.</strong> ${desc}</li>`; });
  898. html += '</ul>';
  899. if (key === 'k' || key === 'd') {
  900. html += `<div class="feedback"><strong>Обрати внимание:</strong> рефлектометр стоит в двух строках. Для конфиденциальности он ищет подключение, для доступности — обрыв. Инструмент один, угрозы разные.</div>`;
  901. }
  902. if (key === 'd') {
  903. html += `<div class="feedback"><strong>Связь с новостью:</strong> проводную сеть оповещения сохраняют именно за доступность. Но та же сеть физически доступна — значит, доступность защищают не только от аварий, но и от намеренного обрыва.</div>`;
  904. }
  905. content.innerHTML = html;
  906. }
  907. container.querySelectorAll('#s6-triad .card').forEach(card => {
  908. card.addEventListener('click', () => {
  909. container.querySelectorAll('#s6-triad .card').forEach(c => c.classList.remove('active'));
  910. card.classList.add('active');
  911. show(card.dataset.key);
  912. });
  913. });
  914. show('k');
  915. }
  916. /* ---------- Сцена 8. Тест ---------- */
  917. function scene7(container) {
  918. setTitle('Проверка понимания');
  919. const questions = [
  920. {
  921. q: 'Параллельное подключение изменило ток в линии на 6%. Что нарушено?',
  922. opts: ['Конфиденциальность', 'Целостность', 'Доступность', 'Ничего'],
  923. correct: 0,
  924. explain: 'Параллельное подключение = кто-то читает сигнал. Сигнал доходит до получателя неизменным (целостность цела), доступность не нарушена. Нарушена конфиденциальность.'
  925. },
  926. {
  927. q: 'В линию внедрён сигнал с посторонней частотой. Аутентификация включена. Что произойдёт?',
  928. opts: ['Сигнал будет отклонён как чужой', 'Сигнал пройдёт без изменений', 'Линия оборвётся', 'Приёмник сгорит'],
  929. correct: 0,
  930. explain: 'Аутентификация проверяет код (частоту, последовательность). Посторонняя частота — отклонение.'
  931. },
  932. {
  933. q: 'Аутентификация не спасла от врезки, потому что злоумышленник знал код. Это…',
  934. opts: ['Техническая уязвимость', 'Утечка регламента', 'Отказ оборудования', 'Ошибка проектирования'],
  935. correct: 1,
  936. explain: 'Если код известен — защита переносится в организационную плоскость. Это уже не техника, а регламент доступа к документации.'
  937. },
  938. {
  939. q: 'Рефлектометр показывает неоднородность на 300 м. Это…',
  940. opts: ['Только подключение', 'Только обрыв', 'И подключение, и обрыв', 'Ошибка прибора'],
  941. correct: 2,
  942. explain: 'Метод видит любую неоднородность. Характер отражения (положительное или отрицательное) и дополнительные измерения помогают различить.'
  943. },
  944. {
  945. q: 'Какое средство работает против обрыва, а какое — только сообщает о нём?',
  946. opts: ['Резервирование работает, мониторинг сообщает', 'Мониторинг работает, резервирование сообщает', 'Оба работают', 'Оба только сообщают'],
  947. correct: 0,
  948. explain: 'Резервирование сохраняет связь (обходит обрыв). Мониторинг только обнаруживает — это сигнал к действию, не защита.'
  949. },
  950. {
  951. q: 'Почему проводное радиовещание устойчиво к кибератакам, но уязвимо по всем трём осям ИБ?',
  952. opts: ['Не зависит от цифровых сетей и электричества, но физически доступно', 'Оно не использует электричество', 'В нём нет информации', 'Оно защищено государством'],
  953. correct: 0,
  954. explain: 'Энергонезависимость — защита от кибератак и аварий электросети. Но провод физически доступен: можно подслушать (К), подменить сигнал (Ц), оборвать (Д).'
  955. }
  956. ];
  957. container.innerHTML = `
  958. <h2>Проверка понимания</h2>
  959. <p>Шесть вопросов по трём угрозам. После ответа — пояснение.</p>
  960. <div id="s7-questions"></div>
  961. <div class="checklist" id="s7-checklist" style="display:none;">
  962. <h3>Чек-лист конспекта</h3>
  963. <ul>
  964. <li>Определения: проводной канал, конфиденциальность, целостность, доступность, параллельное/последовательное подключение, рефлектометрия.</li>
  965. <li>Формула: L = v · t / 2, Γ = (Z_н − Z₀) / (Z_н + Z₀).</li>
  966. <li>Таблица «угроза → средство».</li>
  967. <li>Три крайних случая: короткое замыкание (К), совпадение кода (Ц), обрыв в начале линии (Д).</li>
  968. </ul>
  969. </div>`;
  970. const qs = container.querySelector('#s7-questions');
  971. let answered = 0;
  972. questions.forEach((q, qi) => {
  973. const item = document.createElement('div');
  974. item.className = 'test-item';
  975. item.innerHTML = `<div class="q">${qi + 1}. ${q.q}</div><div class="opts">${q.opts.map((opt, oi) => `<div class="opt" data-oi="${oi}">${opt}</div>`).join('')}</div><div class="explain">${q.explain}</div>`;
  976. qs.appendChild(item);
  977. let done = false;
  978. item.querySelectorAll('.opt').forEach(opt => {
  979. opt.addEventListener('click', () => {
  980. if (done) return;
  981. done = true;
  982. const oi = parseInt(opt.dataset.oi);
  983. item.querySelectorAll('.opt').forEach((o, idx) => {
  984. o.classList.add('disabled');
  985. if (idx === q.correct) o.classList.add('correct');
  986. else if (idx === oi) o.classList.add('wrong');
  987. });
  988. item.querySelector('.explain').classList.add('visible');
  989. answered++;
  990. if (answered === questions.length) {
  991. container.querySelector('#s7-checklist').style.display = 'block';
  992. }
  993. });
  994. });
  995. });
  996. }
  997. /* ---------- Сцена 9. Итог ---------- */
  998. function scene8(container) {
  999. setTitle('Итог');
  1000. container.innerHTML = `
  1001. <h2>Итог</h2>
  1002. <p>Линия под контролем — это не один прибор, а система. У каждой угрозы своё средство, и часто они пересекаются.</p>
  1003. <div class="checklist">
  1004. <h3>Что вы теперь умеете</h3>
  1005. <ul>
  1006. <li>Объяснять, почему проводной канал важен даже в цифровую эпоху: энергонезависимость и независимость от цифровых сетей.</li>
  1007. <li>Различать три угрозы ИБ применительно к проводной линии — конфиденциальность, целостность, доступность.</li>
  1008. <li>Для каждой угрозы называть способ атаки и средство защиты.</li>
  1009. <li>Объяснять, что один инструмент (рефлектометр) может закрывать разные угрозы.</li>
  1010. </ul>
  1011. </div>
  1012. <div class="defs-box">
  1013. <dl>
  1014. <dt>Главное различие</dt>
  1015. <dd><strong>К:</strong> сигнал прочитан. <strong>Ц:</strong> сигнал изменён. <strong>Д:</strong> сигнал не дошёл. Одно подключение — это К. Врезка с подменой — это Ц. Обрыв — это Д. Три разных средства, три разных метода обнаружения.</dd>
  1016. </dl>
  1017. </div>
  1018. <p style="margin-top:24px;color:#4a5875;font-size:14px;">Тема 4.2, ПМ.03.01. Интерактив собран по методике «Заслон»: спецификация → генерация → верификация → защита. Модель не заменяет реальный прибор: она показывает физику, с которой прибор работает.</p>`;
  1019. }
  1020. /* ---------- Навигация ---------- */
  1021. const scenes = [scene0, scene1, scene2, scene3, scene4, scene5, scene6, scene7, scene8];
  1022. let current = 0;
  1023. function showScene(i) {
  1024. stopAnim();
  1025. currentRender = null;
  1026. current = Math.max(0, Math.min(scenes.length - 1, i));
  1027. const main = document.getElementById('main');
  1028. main.innerHTML = '';
  1029. scenes[current](main);
  1030. // нумерация в шапке
  1031. document.getElementById('sceneNum').textContent = 'Сцена ' + (current + 1) + ' из ' + scenes.length;
  1032. // префикс "Сцена N." к заголовку h2 (кроме сцены 0, где h1)
  1033. const h2 = main.querySelector('h2');
  1034. if (h2 && !/^Сцена\s/.test(h2.textContent)) {
  1035. h2.textContent = 'Сцена ' + (current + 1) + '. ' + h2.textContent;
  1036. }
  1037. document.getElementById('counter').textContent = (current + 1) + ' / ' + scenes.length;
  1038. document.getElementById('prevBtn').disabled = current === 0;
  1039. document.getElementById('nextBtn').disabled = current === scenes.length - 1;
  1040. document.getElementById('progressFill').style.width = ((current + 1) / scenes.length * 100) + '%';
  1041. window.scrollTo(0, 0);
  1042. }
  1043. document.getElementById('prevBtn').addEventListener('click', () => showScene(current - 1));
  1044. document.getElementById('nextBtn').addEventListener('click', () => showScene(current + 1));
  1045. let resizeTimer;
  1046. window.addEventListener('resize', () => {
  1047. clearTimeout(resizeTimer);
  1048. resizeTimer = setTimeout(() => { if (currentRender) currentRender(); }, 150);
  1049. });
  1050. showScene(0);
  1051. </script>
  1052. </body>
  1053. </html>