File size: 5,364 Bytes
443f404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>COMP3142 A3 Q5 — Coverage-Guided Fuzzing</title>

<!-- CodeMirror (editor) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/theme/idea.min.css" />
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/mode/python/python.min.js"></script>

<style>
  :root { --bg:#0f1420; --panel:#171d2b; --ink:#e6e9ef; --muted:#93a0b5; --accent:#4ea1ff; --ok:#37d67a; --bad:#ff5c6c; --edge:#26304a; }
  * { box-sizing: border-box; }
  body { margin:0; font:14px/1.5 -apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--ink); }
  header { padding:14px 20px; border-bottom:1px solid #222c40; display:flex; align-items:center; gap:16px; flex-wrap:wrap;}
  header h1 { font-size:16px; margin:0; font-weight:600; }
  header .status { color:var(--muted); font-size:13px; }
  main { display:grid; grid-template-columns: 1fr; gap:14px; padding:14px 20px; align-items:start; }
  .panel { background:var(--panel); border:1px solid #222c40; border-radius:10px; overflow:hidden; }
  .panel h2 { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:0; padding:10px 14px; border-bottom:1px solid #222c40; }
  .toolbar { display:flex; gap:8px; padding:10px 14px; align-items:center; flex-wrap:wrap; }
  button { background:var(--accent); color:#04121f; border:0; border-radius:7px; padding:8px 14px; font-weight:600; cursor:pointer; }
  button.ghost { background:#243049; color:var(--ink); }
  button:disabled { opacity:.5; cursor:not-allowed; }
  .CodeMirror { height:460px; font-size:13px; }
  .dash { display:grid; grid-template-columns: repeat(2,1fr); gap:10px; padding:14px; }
  .stat { background:#111726; border:1px solid #222c40; border-radius:8px; padding:10px 12px; }
  .stat .k { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
  .stat .v { font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; }
  .edges { display:flex; gap:6px; padding:0 14px 14px; flex-wrap:wrap; }
  .edge { width:34px; height:34px; border-radius:6px; background:var(--edge); display:flex; align-items:center; justify-content:center; font-size:12px; color:#6b7897; border:1px solid #2c3855; transition:background .15s; }
  .edge.hit { background:var(--ok); color:#04121f; border-color:var(--ok); font-weight:700; }
  .banner { margin:0 14px 14px; padding:12px 14px; border-radius:8px; display:none;
            background:rgba(255,92,108,.14); border:1px solid var(--bad); color:#ffd4d8; }
  .banner .hex { font-family:ui-monospace,Menlo,monospace; word-break:break-all; margin:6px 0; }
  #console { font-family:ui-monospace,Menlo,monospace; font-size:12px; white-space:pre-wrap; padding:12px 14px; height:150px; overflow:auto; color:#cbd5e6; }
  a.dl { color:var(--accent); }
  code { background:#111726; padding:1px 5px; border-radius:4px; }
  .hint { display:none; margin:0 14px; padding:12px 14px; background:#111726; border:1px solid #2c3855;
          border-radius:8px; font-family:ui-monospace,Menlo,monospace; font-size:12.5px; white-space:pre-wrap; color:#cbd5e6; }
  .hint b { color:var(--accent); }
</style>
</head>
<body>
<header>
  <h1>COMP3142 · Assignment 3 · Q5 — Coverage-Guided Fuzzing</h1>
  <span class="status" id="status">loading Python runtime…</span>
</header>

<main>
  <!-- LEFT: editor -->
  <section class="panel">
    <h2>fuzz.py — your fuzzer</h2>
    <div class="toolbar">
      <button id="run" disabled>▶ Run</button>
      <button id="stop" class="ghost" disabled>■ Stop</button>
      <button id="reset" class="ghost">⤺ Reset code</button>
      <button id="hint-btn" class="ghost">💡 Hint</button>
      <span class="status">edit → Run. Target &amp; coverage API are provided.</span>
    </div>
    <pre id="hint" class="hint"></pre>
    <textarea id="code"></textarea>
  </section>

  <!-- RIGHT: dashboard -->
  <section class="panel">
    <h2>fuzzing dashboard</h2>
    <div class="dash">
      <div class="stat"><div class="k">executions</div><div class="v" id="s-execs">0</div></div>
      <div class="stat"><div class="k">exec / sec</div><div class="v" id="s-eps">0</div></div>
      <div class="stat"><div class="k">corpus size</div><div class="v" id="s-corpus">0</div></div>
      <div class="stat"><div class="k">coverage</div><div class="v" id="s-cov">0 / 0</div></div>
    </div>
    <h2>edge coverage map</h2>
    <div class="edges" id="edges"></div>
    <div class="banner" id="crash-bug1">
      <strong>💥 Bug 1 FOUND.</strong>
      <div class="hex" id="crash-bug1-hex"></div>
      <a class="dl" id="crash-bug1-dl" download="crash_bug1.bin">⬇ download crash_bug1.bin</a>
    </div>
    <div class="banner" id="crash-bug2">
      <strong>💥 Bug 2 FOUND.</strong>
      <div class="hex" id="crash-bug2-hex"></div>
      <a class="dl" id="crash-bug2-dl" download="crash_bug2.bin">⬇ download crash_bug2.bin</a>
    </div>
    <h2>console</h2>
    <div id="console"></div>
  </section>
</main>

<script src="app.js"></script>
</body>
</html>