Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
goelp14
GitHub Repository: goelp14/easyctf-iv-problems
Path: blob/master/nosource/src/views/jr.mustache
671 views
{{> header}}
<div class="starter-template">
  <h1>Stop looking at the source code</h1>
  <p class="lead">
    Welcome to the problem page! Please enter the flag below.
  </p>
  <form id="flag-form">
    <div class="form-group">
      <input type="text" class="form-control" id="flag" placeholder="easyctf{">
    </div>
    <button type="submit" class="btn btn-success btn-lg">Check</button>
  </form>
</div>

<script>
  function process(a, b) {
    'use strict';
    var len = Math.max(a.length, b.length);
    var out = [];
    for (var i = 0, ca, cb; i < len; i++) {
      ca = a.charCodeAt(i % a.length);
      cb = b.charCodeAt(i % b.length);
      out.push(ca ^ cb);
    }
    return String.fromCharCode.apply(null, out);
  }

  (function (global) {
    'use strict';
    var formEl = document.getElementById('flag-form');
    var inputEl = document.getElementById('flag');
    var flag = 'Fg4GCRoHCQ4TFh0IBxENAE4qEgwHMBsfDiwJRQImHV8GQAwBDEYvV11BCA==';
    formEl.addEventListener('submit', function (e) {
      e.preventDefault();
      if (btoa(process(inputEl.value, global.encryptionKey)) === flag) {
        alert('Your flag is correct!');
      } else {
        alert('Incorrect, try again.');
      }
    });
  })(window);
</script>

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=g=g.slice(7);a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-108453250-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

{{> footer}}