0125: Particle Generator
Writeup for the Intigriti January 2025 challenge 💥
Name
Authors
Category
Video Walkthrough
Challenge Description
Useful Resources
Solution
source.js
function XSS() {
return (
decodeURIComponent(window.location.search).includes("<") ||
decodeURIComponent(window.location.search).includes(">") ||
decodeURIComponent(window.location.hash).includes("<") ||
decodeURIComponent(window.location.hash).includes(">")
);
}
function getParameterByName(name) {
var url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Function to redirect on form submit
function redirectToText(event) {
event.preventDefault();
const inputBox = document.getElementById("inputBox");
const text = encodeURIComponent(inputBox.value);
window.location.href = `/challenge?text=${text}`;
}
// Function to display modal if 'text' query param exists
function checkQueryParam() {
const text = getParameterByName("text");
if (text && XSS() === false) {
const modal = document.getElementById("modal");
const modalText = document.getElementById("modalText");
modalText.innerHTML = `Welcome, ${text}!`;
textForm.remove();
modal.style.display = "flex";
}
}
// Function to close the modal
function closeModal() {
location.replace("/challenge");
}
window.onload = function () {
checkQueryParam();
};Community Writeups
Last updated
