Skip to content

Instantly share code, notes, and snippets.

@mrrootsec
Last active September 1, 2024 03:57
Show Gist options
  • Save mrrootsec/37d02065689a2677944aebc803e728ea to your computer and use it in GitHub Desktop.
Save mrrootsec/37d02065689a2677944aebc803e728ea to your computer and use it in GitHub Desktop.
https://x.com/renniepak/status/1780916964925345916 - credit to Renniepak - generate wordlist from current page - Added save & close button
javascript:(function() { const e = document.documentElement.innerText.match(/[a-zA-Z_\-]+/g), n = [...new Set(e)].sort(), popup = document.createElement('div'); popup.style.position = 'fixed'; popup.style.top = '10%'; popup.style.left = '10%'; popup.style.width = '80%'; popup.style.height = '80%'; popup.style.backgroundColor = 'black'; popup.style.color = 'white'; popup.style.zIndex = '10000'; popup.style.padding = '20px'; popup.style.overflowY = 'scroll'; popup.style.border = '2px solid green'; popup.style.borderRadius = '10px'; const title = document.createElement('h1'); title.innerText = 'Current page wordlist'; title.style.color = 'green'; popup.appendChild(title); const wordList = document.createElement('div'); wordList.innerHTML = n.join('<br>'); popup.appendChild(wordList); const closeButton = document.createElement('button'); closeButton.innerText = 'Close'; closeButton.style.position = 'absolute'; closeButton.style.top = '10px'; closeButton.style.right = '10px'; closeButton.style.backgroundColor = 'black'; closeButton.style.color = 'white'; closeButton.style.border = 'solid'; closeButton.style.padding = '10px'; closeButton.style.cursor = 'pointer'; closeButton.onclick = function() { document.body.removeChild(popup); }; const saveButton = document.createElement('button'); saveButton.innerText = 'Save'; saveButton.style.position = 'absolute'; saveButton.style.top = '10px'; saveButton.style.right = '80px'; saveButton.style.backgroundColor = 'black'; saveButton.style.color = 'white'; saveButton.style.border = 'solid'; saveButton.style.padding = '10px'; saveButton.style.cursor = 'pointer'; saveButton.onclick = function() { const currentURI = window.location.href.replace(/[^a-z0-9]/gi, '_'); const now = new Date(); const timestamp = `${now.getDate()}_${now.getMonth()+1}_${now.getFullYear()}_${now.getHours()}:${now.getMinutes()}`; const filename = `${currentURI}_${timestamp}.txt`; const blob = new Blob([n.join('\n')], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; popup.appendChild(closeButton); popup.appendChild(saveButton); document.body.appendChild(popup); document.addEventListener('keydown', function(event) { if (event.key === 'Escape') { document.body.removeChild(popup); } }); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment