simnet
Class PacketGenerator

java.lang.Object
  extended byjava.lang.Thread
      extended bysimnet.Application
          extended bysimnet.PacketGenerator
All Implemented Interfaces:
Pluggable, PlugoutListener, java.lang.Runnable, SimnetWindowListener

public class PacketGenerator
extends Application
implements Pluggable

An application used to create floods of packets.


Field Summary
 int loaded_ip_percent
          What percent of randomly chosen addresses use ip's of loaded nodes.
 int total_sent
          The total number of packets sent
 
Fields inherited from class simnet.Application
appid, appstart, frame, initialized, node, NODE_ID, pid, random, sim, win
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PacketGenerator()
           
 
Method Summary
 void flood(java.lang.Integer src, java.lang.Integer src_port, java.lang.Integer dest, java.lang.Integer dest_port, java.lang.Integer proto, java.lang.Integer total, java.lang.Integer src_perc, java.lang.Integer dest_perc, java.lang.Integer proto_perc)
          Executes a randomized SYN flood against the specified Node.
 void flood(int src, int src_port, int dest, int dest_port, int proto, int total, int src_perc, int dest_perc, int proto_perc)
          Executes a randomized SYN flood against the specified Node.
 void flood(java.lang.String dest, java.lang.Integer dest_port, java.lang.Integer proto, java.lang.Integer total, java.lang.Integer src_perc, java.lang.Integer dest_perc, java.lang.Integer proto_perc)
          Executes a randomized SYN flood against the specified Node.
 void flood(java.lang.String src, java.lang.Integer src_port, java.lang.String dest, java.lang.Integer dest_port, java.lang.Integer proto, java.lang.Integer total, java.lang.Integer src_perc, java.lang.Integer dest_perc, java.lang.Integer proto_perc)
          Executes a randomized SYN flood against the specified Node.
protected  int getRandomIP(java.util.Vector ips)
          Return a random ip address.
 boolean prePlugout(java.lang.Object replacement)
          No state to maintain, so can always be removed or replaced.
 void setLoadedIPPercent(int nv)
           
 void setLoadedIPPercent(java.lang.Integer nv)
          Sets the percent of randomly chosen addresses that use ip's of loaded nodes.
 void synflood(java.lang.Integer destination, java.lang.Integer destination_port, java.lang.Integer total_packets)
          Executes a SYN flood against the specified Node.
 void synflood(java.lang.Integer source, java.lang.Integer source_port, java.lang.Integer destination, java.lang.Integer destination_port, java.lang.Integer total_packets)
          Executes a SYN flood against the specified Node.
 void synflood(java.lang.String destination, java.lang.Integer destination_port, java.lang.Integer total_packets)
          Executes a SYN flood against the specified Node.
 void synflood(java.lang.String source, java.lang.Integer source_port, java.lang.String destination, java.lang.Integer destination_port, java.lang.Integer total_packets)
          Executes a SYN flood against the specified Node.
 
Methods inherited from class simnet.Application
closeWindow, customInit, finalize, getTitleString, initialize, plugoutNotification, printout, printout, processWindowCommand, rawOut, run, window
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

total_sent

public int total_sent
The total number of packets sent


loaded_ip_percent

public int loaded_ip_percent
What percent of randomly chosen addresses use ip's of loaded nodes.

Constructor Detail

PacketGenerator

public PacketGenerator()
Method Detail

setLoadedIPPercent

public void setLoadedIPPercent(java.lang.Integer nv)
Sets the percent of randomly chosen addresses that use ip's of loaded nodes.


setLoadedIPPercent

public void setLoadedIPPercent(int nv)

flood

public void flood(java.lang.Integer src,
                  java.lang.Integer src_port,
                  java.lang.Integer dest,
                  java.lang.Integer dest_port,
                  java.lang.Integer proto,
                  java.lang.Integer total,
                  java.lang.Integer src_perc,
                  java.lang.Integer dest_perc,
                  java.lang.Integer proto_perc)
Executes a randomized SYN flood against the specified Node. The characteristics of the flood are set according to the specified distributions (in percentage). Same as flood(int, int, int, int, int, int). Called direcly from the UserInterface to provide an flood command.

Parameters:
src - the source of the packets
src_port - the source port of the packets
dest - the destination of the packets
dest_port - the destination port of the packets
proto - the transport protocol of the packets
total - the total number of packets to send
src_perc - the percentage of packets that should have a random source
dest_perc - the percentage of packets that should have a random destination
proto_perc - the percentage of packets that should have a random protocol

flood

public void flood(java.lang.String src,
                  java.lang.Integer src_port,
                  java.lang.String dest,
                  java.lang.Integer dest_port,
                  java.lang.Integer proto,
                  java.lang.Integer total,
                  java.lang.Integer src_perc,
                  java.lang.Integer dest_perc,
                  java.lang.Integer proto_perc)
Executes a randomized SYN flood against the specified Node. The characteristics of the flood are set according to the specified distributions (in percentage). Same as flood(int, int, int, int, int). Called direcly from the UserInterface to provide a version of the flood command that takes Node names as arguments.

Parameters:
src - the source of the packets
src_port - the source port of the packets
dest - the destination of the packets
dest_port - the destination port of the packets
proto - the transport protocol of the packets
total - the total number of packets to send
src_perc - the percentage of packets that should have a random source
dest_perc - the percentage of packets that should have a random destination
proto_perc - the percentage of packets that should have a random protocol

flood

public void flood(java.lang.String dest,
                  java.lang.Integer dest_port,
                  java.lang.Integer proto,
                  java.lang.Integer total,
                  java.lang.Integer src_perc,
                  java.lang.Integer dest_perc,
                  java.lang.Integer proto_perc)
Executes a randomized SYN flood against the specified Node. The characteristics of the flood are set according to the specified distributions (in percentage). Same as flood(int, int, int, int, int). Called direcly from the UserInterface to provide a short version of the flood command that takes Node names as arguments. The source and source port fields are fixed.

Parameters:
dest - the destination of the packets
dest_port - the destination port of the packets
proto - the transport protocol of the packets
total - the total number of packets to send
src_perc - the percentage of packets that should have a random source
dest_perc - the percentage of packets that should have a random destination
proto_perc - the percentage of packets that should have a random protocol

getRandomIP

protected int getRandomIP(java.util.Vector ips)
Return a random ip address. There are loaded_ip_percent chances in 100 to use an ip address from the given list, otherwise, one is chosen at random


flood

public void flood(int src,
                  int src_port,
                  int dest,
                  int dest_port,
                  int proto,
                  int total,
                  int src_perc,
                  int dest_perc,
                  int proto_perc)
Executes a randomized SYN flood against the specified Node. The characteristics of the flood are set according to the specified distributions (in percentage).

Parameters:
src - the source of the packets
src_port - the source port of the packets
dest - the destination of the packets
dest_port - the destination port of the packets
proto - the transport protocol of the packets
total - the total number of packets to send
src_perc - the percentage of packets that should have a random source
dest_perc - the percentage of packets that should have a random destination
proto_perc - the percentage of packets that should have a random protocol

synflood

public void synflood(java.lang.Integer source,
                     java.lang.Integer source_port,
                     java.lang.Integer destination,
                     java.lang.Integer destination_port,
                     java.lang.Integer total_packets)
Executes a SYN flood against the specified Node. Called direcly from the UserInterface to provide an synflood command.

Parameters:
source - the source of the packets
source_port - the source port of the packets
destination - the destination of the packets
destination_port - the destination port of the packets
total_packets - the total number of packets to send

synflood

public void synflood(java.lang.Integer destination,
                     java.lang.Integer destination_port,
                     java.lang.Integer total_packets)
Executes a SYN flood against the specified Node. Same as synflood(node.id, 1024, int, int, int). Called direcly from the UserInterface to provide a version of the synflood command where the packet source information is set by default.

Parameters:
destination - the destination of the packets
destination_port - the destination port of the packets
total_packets - the total number of packets to send

synflood

public void synflood(java.lang.String destination,
                     java.lang.Integer destination_port,
                     java.lang.Integer total_packets)
Executes a SYN flood against the specified Node. Same as synflood(node.id, 1024, int, int, int). Called direcly from the UserInterface to provide a shorter version of the synflood command where the packet source information is set by default and that takes Node names as arguments. The packets' source ID is set to the current Node and the source port is set to 80.

Parameters:
destination - the destination of the packets
destination_port - the destination port of the packets
total_packets - the total number of packets to send

synflood

public void synflood(java.lang.String source,
                     java.lang.Integer source_port,
                     java.lang.String destination,
                     java.lang.Integer destination_port,
                     java.lang.Integer total_packets)
Executes a SYN flood against the specified Node. Same as synflood(int, int, int, int, int). Called direcly from the UserInterface to provide a version of the synflood command that takes Node names as arguments.

Parameters:
source - the source of the packets
source_port - the source port of the packets
destination - the destination of the packets
destination_port - the destination port of the packets
total_packets - the total number of packets to send

prePlugout

public boolean prePlugout(java.lang.Object replacement)
No state to maintain, so can always be removed or replaced.

Specified by:
prePlugout in interface Pluggable
Returns:
if this object can now be removed (was the operation sucessful)