Advertisement
Guest User

Mozilla Firefox JS Fuzzer

a guest
Aug 4th, 2014
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.38 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <div id="playground"></div>
  5. <script language="javascript">
  6. // Disclaimer: This piece of code is for educational purposes only and you take full responsibility for using it.
  7. // Description: This fuzzer creates lots of paragraphs which contain a certain string with random colors and size.
  8. // Author: Alexandru Cuciureanu
  9. // Web: http://www.techtipsforsmartchicks.com
  10. //
  11. // Let's crash Firefox
  12.  
  13. // This is a custom contructor
  14. function Element(element) {
  15.     this.element = element;
  16. }
  17.  
  18. // Generate a random color
  19. Element.prototype.randomColor = function() {
  20.     var randomColor = Math.floor(Math.random()*16777215).toString(16);
  21.     return randomColor;
  22. }
  23.  
  24. // Generate a random integer value between min and max
  25. Element.prototype.randomInt = function(min, max) {
  26.     this.min = min;
  27.     this.max = max;
  28.     var randomFontSize = Math.floor(Math.random() * (max - min) + 1);
  29.     return randomFontSize;
  30. }
  31.  
  32. // Create a DOM element where:
  33. // element = the type of html DOM element (eg: div, paragraph, etc.)
  34. // appentToElement = the parent DOM element (eg: in this example the parent is the div
  35. //                   identified as "playground"
  36. // content = the text content of the child DOM element
  37. Element.prototype.createElement = function(element, appendToElement, content) {
  38.     this.appendToElement = appendToElement;
  39.     this.content = content;
  40.    
  41.     var create = document.createElement(this.element);
  42.     // set the content of the DOM element
  43.     create.innerHTML = this.content;
  44.     // set color as random
  45.     create.style.color = this.randomColor();
  46.     // set the fontSize as a random value between 1 and 80
  47.     create.style.fontSize = this.randomInt(1,80);
  48.     // create the child element into the parent element
  49.     document.getElementById(appendToElement).appendChild(create);
  50. }
  51.  
  52. // This is the main function where the magic happens.
  53. function main(numberOfElements) {
  54. this.numberOfElements = numberOfElements;
  55. // Create a div object
  56. var div = new Element('div');
  57.     try {
  58.         // Keep creating DOM elements until their number reach the numberofElements
  59.         for (var i=0; i < numberOfElements; i++) {
  60.         div.createElement(div.element, "playground", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
  61.         }
  62.     }
  63.     catch(e) {
  64.         // Throw an exception if something goes wrong
  65.         alert(e);
  66.     }
  67. }
  68.  
  69. // Set this to a higher value such as 1,000,000,000 if you intend to crash Firefox.
  70. main(1000000000);
  71.  
  72. </script>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement