Automate the captcha

This commit is contained in:
swag 2023-06-14 18:49:30 -04:00
parent d6e5594395
commit 0a2c198d1b
5 changed files with 21 additions and 8 deletions

View File

@ -3,3 +3,6 @@
< css/elements.css < css/elements.css
< css/simple.css < css/simple.css
< css/nested.css < css/nested.css
! app.js
< js/captcha.js

View File

@ -1,13 +1,20 @@
/*
'use strict'; 'use strict';
document.getElementById('captcha').value = (() => {
*/ let captchaValue = document
'use strict';
let captchaValue =
document
.querySelector('label[for="captcha"]') .querySelector('label[for="captcha"]')
.textContent .textContent
.match(/'(flag|bump)'/)[1]; .match(/'(flag|bump)'/)[1];
let captchaForm = document
.querySelector('form[class="form-body"]');
captchaForm.captcha.value = captchaValue;
// Make 'em work for it
window.crypto.subtle.generateKey({
name: 'RSA-OAEP',
modulusLength: 4096,
publicExponent: new Uint8Array([1, 0, 1]),
hash: 'SHA-512'
}, false, ['encrypt', 'decrypt'])
.finally(() => captchaForm.submit());
})();

View File

@ -10,6 +10,7 @@
<% } =%> <% } =%>
<%= label_for captcha => "Enter the word 'flag' to confirm:" %> <%= label_for captcha => "Enter the word 'flag' to confirm:" %>
<%= text_field captcha => id => 'captcha' %> <%= text_field captcha => id => 'captcha' %>
<%= asset 'app.js' %>
</div> </div>
<button type="submit" class="form-button">Confirm</button> <button type="submit" class="form-button">Confirm</button>
</form> </form>

View File

@ -10,6 +10,7 @@
<% } =%> <% } =%>
<%= label_for captcha => "Enter the word 'bump' to confirm:" %> <%= label_for captcha => "Enter the word 'bump' to confirm:" %>
<%= text_field captcha => id => 'captcha' %> <%= text_field captcha => id => 'captcha' %>
<%= asset 'app.js' %>
</div> </div>
<button type="submit" class="form-button">Confirm</button> <button type="submit" class="form-button">Confirm</button>
</form> </form>

View File

@ -10,6 +10,7 @@
<% } =%> <% } =%>
<%= label_for captcha => "Enter the word 'flag' to confirm:" %> <%= label_for captcha => "Enter the word 'flag' to confirm:" %>
<%= text_field captcha => id => 'captcha' %> <%= text_field captcha => id => 'captcha' %>
<%= asset 'app.js' %>
</div> </div>
<button type="submit" class="form-button">Confirm</button> <button type="submit" class="form-button">Confirm</button>
</form> </form>