simnet
Class WormModel

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

public class WormModel
extends Application
implements BPFConsumer, Pluggable

An application which models worms in a subnet.


Nested Class Summary
private  class WormModel.Subnet
          A /24 subnet for modeling worm propagation.
 
Field Summary
(package private)  AggregateRouter ar
           
(package private)  BPF bpf
           
(package private)  int exist
           
(package private) static boolean globalInit
          Global Lookup Tables
(package private)  int infected
           
static byte INFECTED
           
(package private) static int infectionSource
           
private static java.lang.Object LOCK
           
static byte NON_EXISTENT
           
static byte NOT_VULNERABLE
           
(package private)  int packets
           
static double PROBE_IN_A
           
static double PROBE_IN_B
          Rate to send a probe within the class B and A.
(package private)  java.util.Random random
           
static double RATE
          Probes to send (RATE probes per WINDOW ms per infected host; window is automaticallty adjusted as needed).
protected static int round_counter
           
protected static java.lang.Object ROUND_LOCK
           
 boolean showInfo
           
static boolean slowDown
          Should global slowdown be used?
(package private) static long startTime
           
(package private)  WormModel.Subnet[] subnets
          A Note about verbosity levels: 0 = core info (infections at time t) 1 = new infections (specific ips) [commented out] 2 = worm probes [commented out]
(package private) static int T_ASexist
           
(package private) static int T_ASinfected
           
(package private) static java.util.Vector targets
           
(package private)  java.util.Vector targetsInA
          Local lookup Tables
(package private) static int Texist
           
(package private) static int Tinfected
           
(package private) static int Tpackets
           
(package private) static int Tvulnerable
           
(package private)  java.util.Vector victims
           
(package private)  int vulnerable
           
static byte VULNERABLE
           
 
Fields inherited from class simnet.Application
appid, appstart, frame, initialized, node, NODE_ID, pid, sim, win
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WormModel()
           
 
Method Summary
 void customInit()
          This is where an application can do any application-specific initializeation it requires.
 void disableSlowDown()
           
 void enableSlowDown()
           
protected  double getCost_A()
          Return the cost in "credits" of sending a probe to a victim in this class A (including us)
protected  double getCost_B()
          Return the cost in "credits" of sending a probe to a victim in this class B (us)
protected  double getCost_X()
          Return the cost in "credits" of sending a probe to a victim the address space of existing class B's
protected  double getCost(double p)
           
 void hideWormInfo()
           
 void inBPF(int bpf_id, IP_Packet ip_packet)
          Look at incoming traffic for worms.
 boolean infect(int ip)
          Attempt to infect the specified IP.
protected  int pickIP_A()
           
protected  int pickIP_B()
           
protected  int pickIP_X()
           
 boolean prePlugout(java.lang.Object replacement)
          WormModel can be removed by getting rid of the bpf rule, or replaced by transferring the BPF rule.
 void run()
          Wait for the first infection, and then keep going...
 void sendProbe(int ip, java.lang.String desc)
          Send a probe packet to the specified IP (with short circuting).
 void setTargetA(java.lang.Integer p)
           
 void setTargetB(java.lang.Integer p)
           
 void setTargetRate(java.lang.Integer r)
           
 void showWormInfo()
           
 void startWorm()
          Start a worm by randomly infecting a vulnerable host.
 void WaitForNearCompletion()
           
 void WormStatus()
          Print out the worm's status - add a check if we haven't yet started (don't print out time).
 
Methods inherited from class simnet.Application
closeWindow, finalize, getTitleString, initialize, plugoutNotification, printout, printout, processWindowCommand, rawOut, 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

NON_EXISTENT

public static final byte NON_EXISTENT
See Also:
Constant Field Values

NOT_VULNERABLE

public static final byte NOT_VULNERABLE
See Also:
Constant Field Values

VULNERABLE

public static final byte VULNERABLE
See Also:
Constant Field Values

INFECTED

public static final byte INFECTED
See Also:
Constant Field Values

RATE

public static double RATE
Probes to send (RATE probes per WINDOW ms per infected host; window is automaticallty adjusted as needed).


PROBE_IN_B

public static double PROBE_IN_B
Rate to send a probe within the class B and A.


PROBE_IN_A

public static double PROBE_IN_A

slowDown

public static boolean slowDown
Should global slowdown be used?


ar

AggregateRouter ar

bpf

BPF bpf

random

java.util.Random random

globalInit

static boolean globalInit
Global Lookup Tables


targets

static java.util.Vector targets

targetsInA

java.util.Vector targetsInA
Local lookup Tables


victims

java.util.Vector victims

ROUND_LOCK

protected static java.lang.Object ROUND_LOCK

round_counter

protected static int round_counter

subnets

WormModel.Subnet[] subnets
A Note about verbosity levels: 0 = core info (infections at time t) 1 = new infections (specific ips) [commented out] 2 = worm probes [commented out]


exist

int exist

vulnerable

int vulnerable

infected

int infected

packets

int packets

showInfo

public boolean showInfo

LOCK

private static java.lang.Object LOCK

startTime

static long startTime

infectionSource

static int infectionSource

Tpackets

static int Tpackets

Texist

static int Texist

Tvulnerable

static int Tvulnerable

Tinfected

static int Tinfected

T_ASexist

static int T_ASexist

T_ASinfected

static int T_ASinfected
Constructor Detail

WormModel

public WormModel()
Method Detail

customInit

public void customInit()
Description copied from class: Application
This is where an application can do any application-specific initializeation it requires.

Overrides:
customInit in class Application

setTargetRate

public void setTargetRate(java.lang.Integer r)

setTargetB

public void setTargetB(java.lang.Integer p)

setTargetA

public void setTargetA(java.lang.Integer p)

WormStatus

public void WormStatus()
Print out the worm's status - add a check if we haven't yet started (don't print out time).


startWorm

public void startWorm()
Start a worm by randomly infecting a vulnerable host.


infect

public boolean infect(int ip)
Attempt to infect the specified IP. Return if a new infection occured.


showWormInfo

public void showWormInfo()

hideWormInfo

public void hideWormInfo()

enableSlowDown

public void enableSlowDown()

disableSlowDown

public void disableSlowDown()

getCost

protected double getCost(double p)

pickIP_B

protected int pickIP_B()

getCost_B

protected double getCost_B()
Return the cost in "credits" of sending a probe to a victim in this class B (us)


pickIP_A

protected int pickIP_A()

getCost_A

protected double getCost_A()
Return the cost in "credits" of sending a probe to a victim in this class A (including us)


pickIP_X

protected int pickIP_X()

getCost_X

protected double getCost_X()
Return the cost in "credits" of sending a probe to a victim the address space of existing class B's


run

public void run()
Wait for the first infection, and then keep going...

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class Application

WaitForNearCompletion

public void WaitForNearCompletion()

sendProbe

public void sendProbe(int ip,
                      java.lang.String desc)
Send a probe packet to the specified IP (with short circuting).


inBPF

public void inBPF(int bpf_id,
                  IP_Packet ip_packet)
Look at incoming traffic for worms.

Specified by:
inBPF in interface BPFConsumer
Parameters:
bpf_id - the ID of the BPF rule that the ip_packet matched
ip_packet - incoming ip_packet from BPF

prePlugout

public boolean prePlugout(java.lang.Object replacement)
WormModel can be removed by getting rid of the bpf rule, or replaced by transferring the BPF rule.

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