├── Documentation
├── .DS_Store
├── Application-Development.md
├── Defining-a-NLML-Plug-In.md
├── Extending-the-Router.md
├── Frame.md
├── HandlerController.md
├── HandlerDefinition.md
├── Implementing-a-ConfigurationLoader.md
├── Implementing-a-ConfigurationWriter.md
├── Implementing-custom-traffic-handlers.md
├── Layer-Architecture.md
├── Network-Compilation.md
├── Plug-in-Development.md
├── PluginKey.md
├── Ports.md
├── Protocol-Engine.md
├── Traffic-Handler.md
├── Writing-a-Router.md
├── XNL-File.md
├── eEx-NLML.md
├── eEx-NetLab.md
└── images
│ ├── .DS_Store
│ ├── ExtendedRouter.png
│ ├── HandlerController_HandlerController.png
│ ├── HandlerDefinition_HandlerDefinition.png
│ ├── HandlerGraph.png
│ ├── Home_NetLab_AINAC.png
│ ├── NetLab.png
│ ├── OverallArchitecture.png
│ ├── ProtocolProvider.png
│ └── TrafficHandlerPorts.png
├── Examples
├── Extended-Router
│ ├── 2 - ExtendingTheRouter Sourcecode
│ │ ├── ExtendingTheRouter.csproj
│ │ ├── Program.cs
│ │ └── Properties
│ │ │ └── AssemblyInfo.cs
│ ├── 2 - ExtendingTheRouter.pdf
│ └── 2 - ExtendingTheRouter.xnl
├── HandlerPlugInTemplate
│ ├── HandlerTemplate.cs
│ ├── NetLabPluginTemplate.cs
│ └── PluginTemplate.cs
└── Minimal-Router
│ ├── 1 - YourFirstRouter NetLabExample.xnl
│ ├── 1 - YourFirstRouter Sourcecode
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── YourFirstRouter.csproj
│ └── YourFirstRouter.suo
│ └── 1 - YourFirstRouter.pdf
├── README.md
├── eExNLML
├── DefaultControllers
│ ├── APRAttackController.cs
│ ├── ARPScannerController.cs
│ ├── CodeLabController.cs
│ ├── ConditionalTrafficSplitterController.cs
│ ├── DHCPServerController.cs
│ ├── DHCPSpooferController.cs
│ ├── DNSOTFSpooferController.cs
│ ├── DNSQueryLoggerController.cs
│ ├── DirectInterfaceIOController.cs
│ ├── EthernetInterfaceController.cs
│ ├── HTTPMonitorController.cs
│ ├── HTTPStreamModifierController.cs
│ ├── NATHandlerController.cs
│ ├── NetMapController.cs
│ ├── RIPRouterController.cs
│ ├── RouterController.cs
│ ├── SpeedMeterController.cs
│ ├── TextStreamModifierController.cs
│ ├── TrafficDumperController.cs
│ ├── TrafficSplitterController.cs
│ └── WANEmulatorController.cs
├── DefaultDefinitions
│ ├── APRAttackControlDefinition.cs
│ ├── ARPScannerControlDefinition.cs
│ ├── CodeLabControlDefinition.cs
│ ├── ConditionalTrafficSplitterControlDefinition.cs
│ ├── DHCPServerControlDefinition.cs
│ ├── DHCPSpooferControlDefinition.cs
│ ├── DNSOTFSpooferControlDefinition.cs
│ ├── DNSQueryLoggerControlDefinition.cs
│ ├── DirectInterfaceIOControlDefinition.cs
│ ├── EthernetInterfaceControlDefinition.cs
│ ├── HTTPMonitorControlDefinition.cs
│ ├── HTTPStreamModifierControlDefinition.cs
│ ├── NATHandlerControlDefinition.cs
│ ├── NetMapControlDefinition.cs
│ ├── RIPRouterControlDefinition.cs
│ ├── RouterControlDefinition.cs
│ ├── SpeedMeterControlDefinition.cs
│ ├── TextStreamModifierControlDefinition.cs
│ ├── TrafficDumperControlDefinition.cs
│ ├── TrafficSplitterControlDefinition.cs
│ └── WANEmulatorControlDefinition.cs
├── Extensibility
│ ├── ExtensionLoader.cs
│ ├── HTTPModifierActionDefinition.cs
│ ├── HTTPModifierConditionDefinition.cs
│ ├── HandlerController.cs
│ ├── HandlerDefinition.cs
│ ├── IHandlerController.cs
│ ├── IHandlerDefinition.cs
│ ├── IInterfaceDefinition.cs
│ ├── IInterfaceFactory.cs
│ ├── IPlugin.cs
│ ├── IProtocolDefinition.cs
│ ├── ISubPlugInDefinition.cs
│ ├── NetworkLibraryInterfaceExtensionFactory.cs
│ ├── PluginLoader.cs
│ ├── ProtocolDefinition.cs
│ └── TrafficSplitterRuleDefinition.cs
├── IEnvironment.cs
├── IO
│ ├── ConfigurationParser.cs
│ ├── HandlerConfigurationLoader.cs
│ ├── HandlerConfigurationLoaders
│ │ ├── ARPSpooferConfigurationLoader.cs
│ │ ├── ConditionalTrafficSplitterConfigurationLoader.cs
│ │ ├── DHCPServerConfigurationLoader.cs
│ │ ├── DHCPSpooferConfigurationLoader.cs
│ │ ├── DNSOnTheFlySpooferConfigurationLoader.cs
│ │ ├── DumperConfigurationLoader.cs
│ │ ├── HTTPModifierConfigurationLoader.cs
│ │ ├── InterfaceConfigurationLoader.cs
│ │ ├── NATHandlerConfigurationLoader.cs
│ │ ├── RIPRouterConfigurationLoader.cs
│ │ ├── RouterConfigurationLoader.cs
│ │ ├── TextStreamModifierConfigurationLoader.cs
│ │ └── WANEmulatorConfigurationLoader.cs
│ ├── HandlerConfigurationWriter.cs
│ ├── HandlerConfigurationWriters
│ │ ├── ARPSpooferConfigurationWriter.cs
│ │ ├── ConditionalSplitterConfigurationWriter.cs
│ │ ├── DHCPServerConfigurationWriter.cs
│ │ ├── DHCPSpooferConfigurationWriter.cs
│ │ ├── DNSOnTheFlySpooferConfigurationWriter.cs
│ │ ├── DumperConfigurationWriter.cs
│ │ ├── HTTPModifierConfigurationWriter.cs
│ │ ├── InterfaceConfigurationWriter.cs
│ │ ├── NATHandlerConfigurationWriter.cs
│ │ ├── RIPRouterConfigurationWriter.cs
│ │ ├── RouterConfigurationWriter.cs
│ │ ├── TextStreamModifierConfigurationWriter.cs
│ │ └── WANEmulatorConfigurationWriter.cs
│ └── NameValueItem.cs
├── Link.cs
├── NLMLCompilation.xsd
├── NLMLPluginDescription.xsd
├── NetworkCompilation.cs
├── Properties
│ └── AssemblyInfo.cs
├── Repository
│ ├── PlugInDependency.cs
│ ├── PlugInDescription.cs
│ ├── PlugInFile.cs
│ └── PlugInRepository.cs
├── SubPlugInDefinitions
│ ├── IPAddressRuleDefinition.cs
│ ├── ImageFlipperDefinition.cs
│ ├── PortRuleDefinition.cs
│ └── RegexHeaderConditionDefinition.cs
├── Task.cs
├── TrafficHandlerPort.cs
└── eExNLML.csproj
└── eExNetworkLibrary
├── ARP
├── ARPFrame.cs
├── ARPHostEntry.cs
└── HostTable.cs
├── Attacks
├── ARPHostIsolation.cs
├── DoS
│ └── ARPFlood.cs
├── IAttack.cs
├── IMITMAttack.cs
├── INetworkAttack.cs
├── ISingleHostAttack.cs
├── MITMAttackEntry.cs
├── Modification
│ └── DNSOnTheFlySpoofer.cs
├── Scanning
│ ├── ARPNetScan.cs
│ ├── ARPScanTask.cs
│ ├── IScanner.cs
│ └── ScanTask.cs
└── Spoofing
│ ├── APRAttack.cs
│ └── DHCPSpoofer.cs
├── Changelog.txt
├── CodeLab
├── DynamicFunctionCompiler.cs
├── DynamicFunctionHandler.cs
└── IDynamicHandler.cs
├── DHCP
├── DHCPFrame.cs
├── DHCPPool.cs
├── DHCPServer.cs
└── DHCPTLVItem.cs
├── DNS
├── DNSFrame.cs
├── DNSNameEncoder.cs
├── DNSQuestion.cs
└── DNSResourceRecord.cs
├── DirectInterfaceIOHandler.cs
├── Enumerations.cs
├── Ethernet
└── EthernetFrame.cs
├── EthernetInterface.cs
├── Frame.cs
├── FrameTypes.cs
├── HTTP
├── HTTPConversationParser.cs
├── HTTPHeaderCollection.cs
├── HTTPMessage.cs
├── HTTPRequest.cs
└── HTTPResponse.cs
├── ICMP
├── ICMPFrame.cs
├── ICMPv4Frame.cs
└── V6
│ ├── ICMPv6Frame.cs
│ ├── ICMPv6Type.cs
│ ├── NeighborAdvertisment.cs
│ ├── NeighborDiscoveryOption.cs
│ └── NeighborSolicitationMessage.cs
├── IHelperStructure.cs
├── IP
├── IIPFrame.cs
├── IPAddressAnalysis.cs
├── IPFragmenter.cs
├── IPv4Frame.cs
├── IPv4Options.cs
└── V6
│ ├── ExtensionHeader.cs
│ ├── FragmentExtensionHeader.cs
│ ├── IIPHeader.cs
│ ├── IPv6Frame.cs
│ └── RoutingExtensionHeader.cs
├── IPInterface.cs
├── MACAddress.cs
├── Monitoring
├── DNSQueryLogger.cs
├── HTTPMonitor.cs
├── LibPcapDumper.cs
├── NetMap.cs
├── SpeedMeter.cs
├── StreamMonitoring
│ ├── HTTPReaders.cs
│ └── NetworkStreamMonitor.cs
├── TCPStreamMonitor.cs
└── TrafficAnalyzer.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── ProtocolParsing
├── IProtocolProvider.cs
├── ProtocolParser.cs
└── Providers
│ ├── ARPProtocolProvider.cs
│ ├── DHCPProtocolProvider.cs
│ ├── DNSProtocolProvider.cs
│ ├── EthernetProtocolProvider.cs
│ ├── ICMPv4ProtocolProvider.cs
│ ├── ICMPv6ProtocolProvider.cs
│ ├── IPv4ProtocolProvider.cs
│ ├── IPv6ProtocolProvider.cs
│ ├── OSPFProtocolProvider.cs
│ ├── TCPProtocolProvider.cs
│ ├── TrafficDescriptionFrameProtocolProvider.cs
│ └── UDPProtocolProvider.cs
├── RawDataFrame.cs
├── Routing
├── IRouter.cs
├── NetworkAddressTranslationHandler.cs
├── OSPF
│ ├── ASExternalLSA.cs
│ ├── IOSPFRouter.cs
│ ├── LSAHeader.cs
│ ├── LSDatabase.cs
│ ├── NetworkLSA.cs
│ ├── OSPFArea.cs
│ ├── OSPFCommonHeader.cs
│ ├── OSPFDatabaseDescriptionMessage.cs
│ ├── OSPFHelloMessage.cs
│ ├── OSPFLSAAcknowledgementMessage.cs
│ ├── OSPFLSARequestMessage.cs
│ ├── OSPFLSAUpdateMessage.cs
│ ├── OSPFOptionsField.cs
│ ├── OSPFRouter.cs
│ ├── RouterLSA.cs
│ └── SummaryLSA.cs
├── RIP
│ ├── RIPFrame.cs
│ └── RIPRouter.cs
├── Router.cs
├── RoutingEntry.cs
├── RoutingProcess.cs
└── RoutingTable.cs
├── RunningObject.cs
├── Simulation
├── ByteFlipper.cs
├── DelayJitter.cs
├── PackedReorderer.cs
├── PacketCorrupter.cs
├── PacketDropper.cs
├── PacketDuplicator.cs
├── RandomEventTrafficSimulator.cs
├── Simulator.cs
├── SpeedConstrainer.cs
└── WANEmulator.cs
├── Sockets
├── BindingInformation.cs
├── BufferNetworkStream.cs
├── IPSocket.cs
├── ISocket.cs
├── NetworkStream.cs
├── SocketBase.cs
├── SocketNetworkStream.cs
├── TCPIPListenerStack.cs
├── TCPIPStack.cs
├── TCPListenerSocket.cs
├── TCPSocket.cs
└── UDPSocket.cs
├── Subnetmask.cs
├── TCP
├── TCPFrame.cs
└── TCPOptions.cs
├── TLVItem.cs
├── Threading
├── InvocationHelper.cs
└── WorkItem.cs
├── TrafficDescriptionFrame.cs
├── TrafficHandler.cs
├── TrafficModifiers
├── HTTPStreamModifier.cs
├── StreamModification
│ ├── HTTP
│ │ ├── Actions
│ │ │ ├── ImageAction.cs
│ │ │ └── ImageFlipper.cs
│ │ ├── Conditions
│ │ │ └── HeaderCondition.cs
│ │ ├── HTTPStreamModifierAction.cs
│ │ ├── HTTPStreamModifierCondition.cs
│ │ ├── HTTPStreamModifierOperator.cs
│ │ └── HTTPStreamOperator.cs
│ ├── NetworkStreamModifier.cs
│ ├── StreamReplacementOperator.cs
│ └── StreamReplacementRule.cs
├── TCPStreamModifier.cs
├── TextStreamModifier.cs
└── TrafficModifier.cs
├── TrafficSplitting
├── ConditionalTrafficSplitter.cs
├── IPAddressRule.cs
├── PortRule.cs
├── TrafficSplitter.cs
└── TrafficSplitterRule.cs
├── UDP
└── UDPFrame.cs
├── Utilities
├── ChecksumCalculator.cs
├── CompressionHelper.cs
├── InterfaceConfiguration.cs
├── NetDiscovery.cs
├── PacketMonitor.cs
├── Portscan.cs
├── RingBuffer.cs
├── SystemRouteQuery.cs
└── WinPcapDotNet.cs
└── eExNetworkLibrary.csproj
/Documentation/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/.DS_Store
--------------------------------------------------------------------------------
/Documentation/Application-Development.md:
--------------------------------------------------------------------------------
1 | # Developing applications with the Network Library
2 |
3 | This tutorial is split into four parts:
4 |
5 | * [Writing a Router](Writing-a-Router.md) - shows a simple application skeleton capable of receiving and routing packets between interfaces
6 | * [Extending the Router](Extending-the-Router.md) - explains how simple applications can be a extended
7 | * [Implementing own Traffic Handlers](Implementing-own-Traffic-Handlers.md) - explains how own Traffic Handlers can be implemented
--------------------------------------------------------------------------------
/Documentation/HandlerController.md:
--------------------------------------------------------------------------------
1 | # Handler Controllers
2 |
3 | Handler controllers implement the Interface `eExNLML.Extensibility.IHandlerController` and are responsible for managing [Traffic Handlers](Traffic-Hanlder.md) in the [NLML](eEx-NLML.md). The handler controller wraps the Traffic Handler's linking capabilities into [TrafficHandlerPorts](Ports.md). Furthermore, this class manages saving and loading of the TrafficHandlers properties and configuration.
4 |
5 | Handler controllers are in general created by the given [HandlerDefinition](HandlerDefinition.md).
6 |
7 | # General Operation
8 |
9 | 
10 |
11 | Handler controllers provide various methods for managing handlers and to provide default settings and ports. There are also some methods which must be implemented by a deriving class, which are responsible for creating configuration loaders and writers, custom port information or the handler itself.
12 |
13 | All methods which create objects are called once, when the controller is created. A controller is created every time the user gives the command to instantiate a new handler.
14 |
15 | Handler controllers also provide information about the [ports](Ports.md) of a [Traffic Handler](Traffic-Handler.md). Traffic handlers are linked via ports. When a port signals an attach or detach event from another port, the controller checks if the call is valid and applies the action.
16 |
17 | ## Example
18 |
19 | * [Defining a NLML Plug-In](Defining-a-NLML-Plug-In)
--------------------------------------------------------------------------------
/Documentation/HandlerDefinition.md:
--------------------------------------------------------------------------------
1 | # Handler Definitions
2 |
3 | Handler definitions implement the Interface `eExNLML.Extensibility.IHandlerDefinition`, which implements the Interface IPlugin and is responsible for instantiating [HandlerControllers](HandlerController) on demand and providing information about the plug-in.
4 |
5 | In short, handler definitions are plug-ins which instantiate handler controllers which wrap [Traffic Handlers](Traffic-Handler) into a management class.
6 |
7 | ## General Operation
8 |
9 | When loading a PlugIn from a Assembly, which declares itself as HandlerDefinition, the NLML [Compilation](Network-Compilation) checks the type of the plug-in against the type of `eExNLML.Extensibility.IHandlerDefinition`. If the types match, the plug-in is registered.
10 |
11 | When a file is loaded which contains the handler defined in this definition, or a handler is instantiated from this definition, the definition spawns a [HandlerController](HandlerController) which is inserted into the compilation.
12 |
13 | 
14 |
15 | ## Network Interface Definitions
16 |
17 | The `eExNLML.Extensibility.IInterfaceDefinition` is a special interface for creating handler definitions which define network interfaces. It includes the NetworkInterfaceType and the System GUID of the interface.
--------------------------------------------------------------------------------
/Documentation/Layer-Architecture.md:
--------------------------------------------------------------------------------
1 |
2 | # Network Library Layer Architecture
3 |
4 | 
5 |
6 | In the architecture of the eEx Network Library, there are three layers, where each layer adds functionality to the layer below.
7 |
8 | **Layer 1: Network Library**
9 |
10 | The [Network Library](eEx-Network-Library.md) is the core of all networking operations. It provides several ways to modify and analyze network traffic, acessible directly from .NET code. It is important to know that the network library is organized mostly into [Traffic Handlers ](Traffic-Handler.md) or [Frames](Frame.md). They provide a object-oriented and flexible model for performing networking tasks.
11 |
12 | Accessing the Network Library from C# is the most straight-forward way of doing things.
13 |
14 | **Layer 2: NLML**
15 |
16 | The [Network Library Management Layer](eEx-NLML.md) encapsulates objects of the Network Library so that they can be dynamically linked together. It provides provides mechanisms to load and save [network compilations](Network-Compilation) to [xml-based files](XNL-File), which can be shared and copied to other machines. The NLML also provides plug-in capability, and handles setup and shutdown of compilations. For this task, it [HandlerControllers](HandlerController) and [HandlerDefinitions](HandlerDefinition) for wrapping the Traffic Handlers provided by the Network Library.
17 |
18 | **Layer 3: NetLab**
19 |
20 | The [NetLab](eEx-NetLab) is a graphical user interface for the Network Library. It provides an UI to create and configure Traffic Handlers via point and click. All compilations can be saved and loaded into files. The NetLab uses [NetLabHandlerControllers](NetLabHandlerController) and [NetLabHandlerDefinitions](NetLabHandlerDefinition) for wrapping the controllers and definitions from the NLML and adding UI features.
--------------------------------------------------------------------------------
/Documentation/Network-Compilation.md:
--------------------------------------------------------------------------------
1 |
2 | # Network Compilation
3 |
4 | A network compilation is a graph of [Traffic Handlers](Traffic Handler) and their properties. A network compilation can be saved to an [XNL File](XNL-File.md).
--------------------------------------------------------------------------------
/Documentation/Plug-in-Development.md:
--------------------------------------------------------------------------------
1 | # Developing Plug-Ins
2 |
3 | Plug-Ins enable you to bundle Traffic Handlers, so that they can be loaded dynamically by all applications which use the [NetLab](eExNetLab) or the [NLML](eEx-NLML). The NLML provides a lot of base classes for different types of Plug-Ins, which aim to make writing plug-ins as comfortable as possible.
4 |
5 | This is not necassary for using TrafficHandlers from C# code.
6 |
7 | Developing a Handler Plug-In can be split up in the following tasks:
8 |
9 | * [Implementing a Traffic Handler](Implementing-custom-Traffic-Handlers.md)
10 | * [Defining a NLML Plug-In](Defining-a-NLML-Plug-In.md) - don't forget to choose a [PluginKey](PluginKey)
11 | * [Defining a NetLab Plug-In](Defining-a-NetLab-Plug-In.md)
12 |
13 | **Notice**: If you want to implement non-handler plug-ins or need more examples, have a look at the classes in the NLML, especially in the folders `Extensibility`, `DefaultControllers`, `DefaultDefinitions` and `SubPlugInDefinitions`.
--------------------------------------------------------------------------------
/Documentation/PluginKey.md:
--------------------------------------------------------------------------------
1 | # Plug-in Key
2 |
3 | The plug-in key of any plug-in is used for identification when saving and loading. This key should be unique.
4 |
5 | Best practice is to take a few letters which stand for you or your organization and then append a short title.
6 |
7 | Examples:
8 |
9 | ```
10 | eex_router
11 | eex_ip_interface
12 | ```
--------------------------------------------------------------------------------
/Documentation/Ports.md:
--------------------------------------------------------------------------------
1 |
2 | # The eExNLML.TrafficHandlerPort Class
3 |
4 | The [NLML](eEx-NLML.md) uses traffic handler ports to make the various linking capabilities of [Traffic Handlers](Traffic-Handler.md) more dynamically manageable.
5 |
6 | ## General Operation
7 |
8 | Traffic handler ports provide a few properties, for example their name, description and an abbreviation. Furthermore, a port type is defined, which can be Input, Output, InterfaceIO or Interface.
9 | Whenever another port wants to connect to a port, both ports signal an attach event to the [HandlerController](HandlerController.md) which owns the ports. The controller checks whether the connection is valid and configures the traffic handlers. A detach event works the same way. The handlers itself are being connected directly - like as if they had been connected programmatically.
10 |
11 | For usual, you do not need to define your own ports. This is only needed if you want other ports than the default ports (Input, Output, DropAnalyzer, Interface, InterfaceIO) for your handler.
12 |
13 | 
14 |
15 | ## Default Ports
16 |
17 | * **Input** (Traffic Handler in port) Provides capability to link the Traffic Handler to the output port of another Traffic Handler.
18 | * **Output** (Traffic Handler out port) All output traffic is send to the handler connected to this port.
19 | * **DropAnalyzer** (Dropped traffic analyzer port) All frames dropped are send to the handler connected to this port. Only traffic analyzers can connect to this port.
20 | * **Interface** (Interface port) This port can be connected to all other Interface I/O ports and handles sending and receiving of traffic. All frames captured by the interface are sent to the handlers connected to this port. All traffic sent to this port is put on wire by the interface. Multiple handlers can connect to this port. Only Interfaces can create an Interface port.
21 | * **InterfaceIO** (InterfaceIO port) Port to connect interfaces to. Only Traffic Handlers which derive from DirectInterfaceIO can create an InterfaceIO port.
22 |
23 | **Notice**: For more information on specific ports of specific Traffic Handlers provided by the NLML or the NetLab, check the NetLab Wiki on [eex-dev.net](http://network.eex-dev.net/index.php?id=64&L=1)
--------------------------------------------------------------------------------
/Documentation/XNL-File.md:
--------------------------------------------------------------------------------
1 | # XNL Files
2 |
3 | XNL files are XML based files which are used to save and load compilations from and to the NLML and the NetLab. The XML schema for XNL files is included into the [NLML](NLML) and supports custom properties and configuration properties for [HandlerControllers](HandlerController).
--------------------------------------------------------------------------------
/Documentation/eEx-NLML.md:
--------------------------------------------------------------------------------
1 | # Network Library Management Layer
2 |
3 | Also known as *eEx NLML*.
4 |
5 | The [Network Library Management Layer](eEx-NLML.md) encapsulates objects of the Network Library so that they can be dynamically linked together and provides classes to load and save [network compilations](Network-Compilation.md) to [xml-based files](XNL-File.md), which can be shared to other machines. The NLML also provides plug-in capability. Generally speaking, the NLML is the layer which provides flexibility for adding various dynamic UIs at the top of the network library [(Read more about the layer model)](Relations). The NLML uses [HandlerControllers](HandlerController) and [HandlerDefinitions](HandlerDefinition) for wrapping the handlers provided by the network library.
--------------------------------------------------------------------------------
/Documentation/eEx-NetLab.md:
--------------------------------------------------------------------------------
1 | # The eEx NetLab
2 |
3 | 
4 |
5 | NetLab is a tool which enables the compilation of network functions via point and click on a graphical user interface. Drag and drop components like routers, network interface cards, network maps and much more from the toolbox to NetLab's workspace. There, the components can be configured and connected together.
6 | Even complex functions can be arranged and understood this way very easily, because all network traffic flowing through the NetLab is visualized and can be logged. All compilations can be saved to files and shared.
7 |
8 | The NetLab [builds upon](Layer-Architecture.md) the [Network Library](eEx-Network-Library.md) and the [Network Library Management Layer](eEx-NLML.md).
9 |
10 | ## Target audience of the NetLab
11 |
12 | The NetLab was developed primary for educational purposes. It should help students understand network operations. This task is accomplished by visualization and a easy-to use UI, which enables the user to accomplish powerful tasks with ease.
13 |
14 | ## NetLab Wiki
15 |
16 | A wiki page dedicated to the NetLab is provided at [eex-dev.net](http://network.eex-dev.net/index.php?id=64).
--------------------------------------------------------------------------------
/Documentation/images/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/.DS_Store
--------------------------------------------------------------------------------
/Documentation/images/ExtendedRouter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/ExtendedRouter.png
--------------------------------------------------------------------------------
/Documentation/images/HandlerController_HandlerController.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/HandlerController_HandlerController.png
--------------------------------------------------------------------------------
/Documentation/images/HandlerDefinition_HandlerDefinition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/HandlerDefinition_HandlerDefinition.png
--------------------------------------------------------------------------------
/Documentation/images/HandlerGraph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/HandlerGraph.png
--------------------------------------------------------------------------------
/Documentation/images/Home_NetLab_AINAC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/Home_NetLab_AINAC.png
--------------------------------------------------------------------------------
/Documentation/images/NetLab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/NetLab.png
--------------------------------------------------------------------------------
/Documentation/images/OverallArchitecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/OverallArchitecture.png
--------------------------------------------------------------------------------
/Documentation/images/ProtocolProvider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/ProtocolProvider.png
--------------------------------------------------------------------------------
/Documentation/images/TrafficHandlerPorts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Documentation/images/TrafficHandlerPorts.png
--------------------------------------------------------------------------------
/Examples/Extended-Router/2 - ExtendingTheRouter Sourcecode/ExtendingTheRouter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.21022
7 | 2.0
8 | {6171BC92-6D06-4AE5-A779-D0662BAD4633}
9 | Exe
10 | Properties
11 | ExtendingTheRouter
12 | ExtendingTheRouter
13 | v2.0
14 | 512
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | False
36 | ..\..\..\..\eExNetworkLibary\bin\Release\eExNetworkLibrary.dll
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
54 |
--------------------------------------------------------------------------------
/Examples/Extended-Router/2 - ExtendingTheRouter Sourcecode/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("2 - ExtendingTheRouter")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("2 - ExtendingTheRouter")]
13 | [assembly: AssemblyCopyright("Copyright © 2010")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a97aae1b-9238-4ba3-8cb4-c25334df266f")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Examples/Extended-Router/2 - ExtendingTheRouter.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Examples/Extended-Router/2 - ExtendingTheRouter.pdf
--------------------------------------------------------------------------------
/Examples/Extended-Router/2 - ExtendingTheRouter.xnl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Examples/Extended-Router/2 - ExtendingTheRouter.xnl
--------------------------------------------------------------------------------
/Examples/Minimal-Router/1 - YourFirstRouter NetLabExample.xnl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Examples/Minimal-Router/1 - YourFirstRouter NetLabExample.xnl
--------------------------------------------------------------------------------
/Examples/Minimal-Router/1 - YourFirstRouter Sourcecode/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("YourFirstRouter")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("YourFirstRouter")]
13 | [assembly: AssemblyCopyright("Copyright © 2010")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("cca14d86-7732-4a5a-ab5f-45778053a011")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Examples/Minimal-Router/1 - YourFirstRouter Sourcecode/YourFirstRouter.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Examples/Minimal-Router/1 - YourFirstRouter Sourcecode/YourFirstRouter.suo
--------------------------------------------------------------------------------
/Examples/Minimal-Router/1 - YourFirstRouter.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/Examples/Minimal-Router/1 - YourFirstRouter.pdf
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/APRAttackController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary.Attacks.Spoofing;
16 | using eExNLML.Extensibility;
17 | using eExNLML.IO;
18 | using eExNLML.IO.HandlerConfigurationLoaders;
19 | using eExNLML.IO.HandlerConfigurationWriters;
20 | using eExNetworkLibrary;
21 |
22 | namespace eExNLML.DefaultControllers
23 | {
24 | public class APRAttackController : HandlerController
25 | {
26 | public APRAttackController(IHandlerDefinition hbDefinition, IEnvironment env) : base(hbDefinition, env, null)
27 | { }
28 |
29 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
30 | {
31 | return new APRAttack();
32 | }
33 |
34 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
35 | {
36 | return new ARPSpooferConfigurationLoader(h);
37 | }
38 |
39 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
40 | {
41 | return new ARPSpooferConfigurationWriter(h);
42 | }
43 |
44 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
45 | {
46 | return CreateDefaultPorts(h, false, false, true, false, false);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/ARPScannerController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Scanning;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 |
18 | namespace eExNLML.DefaultControllers
19 | {
20 | public class ARPScannerController : HandlerController
21 | {
22 | public ARPScannerController(IHandlerDefinition hbDefinition, IEnvironment env) : base(hbDefinition, env, null)
23 | { }
24 |
25 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
26 | {
27 | return new ARPNetScan();
28 | }
29 |
30 | protected override HandlerConfigurationLoader CreateConfigurationLoader(eExNetworkLibrary.TrafficHandler h, object param)
31 | {
32 | return null;
33 | }
34 |
35 | protected override HandlerConfigurationWriter CreateConfigurationWriter(eExNetworkLibrary.TrafficHandler h, object param)
36 | {
37 | return null;
38 | }
39 |
40 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(eExNetworkLibrary.TrafficHandler h, object param)
41 | {
42 | return CreateDefaultPorts(h, false, false, true, false, false);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/CodeLabController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.CodeLab;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNetworkLibrary;
18 |
19 | namespace eExNLML.DefaultControllers
20 | {
21 | public class CodeLabController : HandlerController
22 | {
23 | public CodeLabController(IHandlerDefinition hbDefinition, IEnvironment env)
24 | : base(hbDefinition, env, null)
25 | { }
26 |
27 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
28 | {
29 | return new DynamicFunctionHandler();
30 | }
31 |
32 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
33 | {
34 | return null;
35 | }
36 |
37 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
38 | {
39 | return null;
40 | }
41 |
42 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
43 | {
44 | return CreateDefaultPorts(h, true, true, false, true, false);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/DHCPServerController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.DHCP;
15 | using eExNLML.IO.HandlerConfigurationLoaders;
16 | using eExNLML.IO.HandlerConfigurationWriters;
17 | using eExNLML.Extensibility;
18 | using eExNetworkLibrary;
19 | using eExNLML.IO;
20 | namespace eExNLML.DefaultControllers
21 | {
22 | public class DHCPServerController : HandlerController
23 | {
24 | public DHCPServerController(IHandlerDefinition hbDefinition, IEnvironment env)
25 | : base(hbDefinition, env, null)
26 | { }
27 |
28 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
29 | {
30 | return new DHCPServer();
31 | }
32 |
33 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
34 | {
35 | return new DHCPServerConfigurationLoader(h);
36 | }
37 |
38 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
39 | {
40 | return new DHCPServerConfigurationWriter(h);
41 | }
42 |
43 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
44 | {
45 | return CreateDefaultPorts(h, false, false, true, false, false);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/DHCPSpooferController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary.Attacks.Spoofing;
16 | using eExNLML.Extensibility;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.IO;
21 |
22 | namespace eExNLML.DefaultControllers
23 | {
24 | public class DHCPSpooferController : HandlerController
25 | {
26 | public DHCPSpooferController(IHandlerDefinition hbDefinition, IEnvironment env)
27 | : base(hbDefinition, env, null)
28 | { }
29 |
30 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
31 | {
32 | return new DHCPSpoofer();
33 | }
34 |
35 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
36 | {
37 | return new DHCPSpooferConfigurationLoader(h);
38 | }
39 |
40 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
41 | {
42 | return new DHCPSpooferConfigurationWriter(h);
43 | }
44 |
45 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
46 | {
47 | return CreateDefaultPorts(h, false, false, true, false, false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/DNSOTFSpooferController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Modification;
15 | using eExNLML.IO.HandlerConfigurationLoaders;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.Extensibility;
19 | using eExNetworkLibrary;
20 |
21 | namespace eExNLML.DefaultControllers
22 | {
23 | public class DNSOTFSpooferController : HandlerController
24 | {
25 | public DNSOTFSpooferController(IHandlerDefinition hbDefinition, IEnvironment env)
26 | : base(hbDefinition, env, null)
27 | { }
28 |
29 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
30 | {
31 | return new DNSOnTheFlySpoofer();
32 | }
33 |
34 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
35 | {
36 | return new DNSOnTheFlySpooferConfigurationLoader(h);
37 | }
38 |
39 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
40 | {
41 | return new DNSOnTheFlySpooferConfigurationWriter(h);
42 | }
43 |
44 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
45 | {
46 | return CreateDefaultPorts(h, true, true, false, false, false);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/DNSQueryLoggerController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.DNS;
15 | using eExNetworkLibrary.Monitoring;
16 | using eExNLML.IO;
17 | using eExNetworkLibrary;
18 | using eExNLML.Extensibility;
19 |
20 | namespace eExNLML.DefaultControllers
21 | {
22 | public class DNSQueryLoggerController : HandlerController
23 | {
24 | public DNSQueryLoggerController(IHandlerDefinition hbDefinition, IEnvironment env)
25 | : base(hbDefinition, env, null)
26 | { }
27 |
28 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
29 | {
30 | return new DNSQueryLogger();
31 | }
32 |
33 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
34 | {
35 | return null;
36 | }
37 |
38 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
39 | {
40 | return null;
41 | }
42 |
43 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
44 | {
45 | return CreateDefaultPorts(h, true, false, false, false, false);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/DirectInterfaceIOController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNLML.IO;
16 | using eExNLML.Extensibility;
17 |
18 | namespace eExNLML.DefaultControllers
19 | {
20 | public class DirectInterfaceIOController : HandlerController
21 | {
22 | public DirectInterfaceIOController(IHandlerDefinition hbDefinition, IEnvironment env)
23 | : base(hbDefinition, env, null)
24 | { }
25 |
26 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
27 | {
28 | return new DirectInterfaceIOHandler();
29 | }
30 |
31 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
32 | {
33 | return null;
34 | }
35 |
36 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
37 | {
38 | return null;
39 | }
40 |
41 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
42 | {
43 | return CreateDefaultPorts(h, true, true, true, true, false);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/EthernetInterfaceController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Utilities;
15 | using eExNetworkLibrary;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.IO.HandlerConfigurationLoaders;
19 | using eExNLML.Extensibility;
20 |
21 | namespace eExNLML.DefaultControllers
22 | {
23 | public class EthernetInterfaceController : HandlerController
24 | {
25 | private WinPcapInterface wpcInt;
26 |
27 | public EthernetInterfaceController(WinPcapInterface wpcInt, IHandlerDefinition hbDefinition, IEnvironment env)
28 | : base(hbDefinition, env, wpcInt)
29 | {
30 | this.wpcInt = wpcInt;
31 | }
32 |
33 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
34 | {
35 | return new EthernetInterface((WinPcapInterface)param);
36 | }
37 |
38 | public string InterfaceGUID
39 | {
40 | get { return wpcInt.Name; }
41 | }
42 |
43 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
44 | {
45 | return new EthernetInterfaceConfigurationLoader((EthernetInterface)h);
46 | }
47 |
48 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
49 | {
50 | return new EthernetInterfaceConfigurationWriter((EthernetInterface)h);
51 | }
52 |
53 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
54 | {
55 | return CreateDefaultPorts(h, false, false, false, true, true);
56 | }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/HTTPMonitorController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 |
19 | namespace eExNLML.DefaultControllers
20 | {
21 | public class HTTPMonitorController : HandlerController
22 | {
23 | public HTTPMonitorController(IHandlerDefinition hbDefinition, IEnvironment env)
24 | : base(hbDefinition, env, null)
25 | { }
26 |
27 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
28 | {
29 | return new HTTPMonitor();
30 | }
31 |
32 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
33 | {
34 | return null;
35 | }
36 |
37 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
38 | {
39 | return null;
40 | }
41 |
42 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
43 | {
44 | return CreateDefaultPorts(h, true, false, false, false, false);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/HTTPStreamModifierController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNetworkLibrary.TrafficModifiers;
21 | using eExNetworkLibrary.TrafficModifiers.StreamModification;
22 |
23 | namespace eExNLML.DefaultControllers
24 | {
25 | public class HTTPStreamModifierController : HandlerController
26 | {
27 | public HTTPStreamModifierController(IHandlerDefinition hbDefinition, IEnvironment env)
28 | : base(hbDefinition, env, null)
29 | { }
30 |
31 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
32 | {
33 | return new HTTPStreamModifier();
34 | }
35 |
36 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
37 | {
38 | return new HTTPModifierConfigurationLoader((HTTPStreamModifier)h);
39 | }
40 |
41 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
42 | {
43 | return new HTTPModifierConfigurationWriter((HTTPStreamModifier)h);
44 | }
45 |
46 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
47 | {
48 | return CreateDefaultPorts(h, true, true, false, false, false);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/NetMapController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 |
19 | namespace eExNLML.DefaultControllers
20 | {
21 | public class NetMapController : HandlerController
22 | {
23 | public NetMapController(IHandlerDefinition hbDefinition, IEnvironment env)
24 | : base(hbDefinition, env, null)
25 | { }
26 |
27 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
28 | {
29 | return new NetMap();
30 | }
31 |
32 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
33 | {
34 | return null;
35 | }
36 |
37 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
38 | {
39 | return null;
40 | }
41 |
42 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
43 | {
44 | return CreateDefaultPorts(h, true, false, false, false, false);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/RIPRouterController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing.RIP;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 |
19 | namespace eExNLML.DefaultControllers
20 | {
21 | public class RIPRouterController : HandlerController
22 | {
23 | public RIPRouterController(IHandlerDefinition hbDefinition, IEnvironment env)
24 | : base(hbDefinition, env, null)
25 | { }
26 |
27 | protected override TrafficHandler Create(object param)
28 | {
29 | return new RIPRouter();
30 | }
31 |
32 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
33 | {
34 | return null;
35 | }
36 |
37 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
38 | {
39 | return null;
40 | }
41 |
42 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
43 | {
44 | return CreateDefaultPorts(h, false, false, true, false, false);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/SpeedMeterController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 |
19 | namespace eExNLML.DefaultControllers
20 | {
21 | public class SpeedMeterController : HandlerController
22 | {
23 | public SpeedMeterController(IHandlerDefinition hbDefinition, IEnvironment env)
24 | : base(hbDefinition, env, null)
25 | { }
26 |
27 | protected override TrafficHandler Create(object param)
28 | {
29 | return new SpeedMeter();
30 | }
31 |
32 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
33 | {
34 | return null;
35 | }
36 |
37 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
38 | {
39 | return null;
40 | }
41 |
42 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
43 | {
44 | return CreateDefaultPorts(h, true, true, false, false, false);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/TextStreamModifierController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNetworkLibrary.TrafficModifiers;
21 |
22 | namespace eExNLML.DefaultControllers
23 | {
24 | public class TextStreamModifierController : HandlerController
25 | {
26 | public TextStreamModifierController(IHandlerDefinition hbDefinition, IEnvironment env)
27 | : base(hbDefinition, env, null)
28 | { }
29 |
30 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
31 | {
32 | return new TextStreamModifier();
33 | }
34 |
35 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
36 | {
37 | return new TextStreamModifierConfigurationLoader(h);
38 | }
39 |
40 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
41 | {
42 | return new TextStreamModifierConfigurationWriter(h);
43 | }
44 |
45 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
46 | {
47 | return CreateDefaultPorts(h, true, true, false, false, false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/TrafficDumperController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.IO.HandlerConfigurationLoaders;
19 | using eExNLML.Extensibility;
20 |
21 | namespace eExNLML.DefaultControllers
22 | {
23 | public class TrafficDumperController : HandlerController
24 | {
25 | public TrafficDumperController(IHandlerDefinition hbDefinition, IEnvironment env) : base(hbDefinition, env, null)
26 | { }
27 |
28 | protected override TrafficHandler Create(object param)
29 | {
30 | return new LibPcapDumper();
31 | }
32 |
33 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
34 | {
35 | return new DumperConfigurationLoader(h);
36 | }
37 |
38 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
39 | {
40 | return new DumperConfigurationWriter(h);
41 | }
42 |
43 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
44 | {
45 | return CreateDefaultPorts(h, true, false, false, false, false);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/eExNLML/DefaultControllers/WANEmulatorController.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 |
21 | namespace eExNLML.DefaultControllers
22 | {
23 | public class WANEmulatorController : HandlerController
24 | {
25 | public WANEmulatorController(IHandlerDefinition hbDefinition, IEnvironment env)
26 | : base(hbDefinition, env, null)
27 | { }
28 |
29 | protected override eExNetworkLibrary.TrafficHandler Create(object param)
30 | {
31 | return new WANEmulator();
32 | }
33 |
34 | protected override HandlerConfigurationLoader CreateConfigurationLoader(TrafficHandler h, object param)
35 | {
36 | return new WANEmulatorConfigurationLoader(h);
37 | }
38 |
39 | protected override HandlerConfigurationWriter CreateConfigurationWriter(TrafficHandler h, object param)
40 | {
41 | return new WANEmulatorConfigurationWriter(h);
42 | }
43 |
44 | protected override TrafficHandlerPort[] CreateTrafficHandlerPorts(TrafficHandler h, object param)
45 | {
46 | return CreateDefaultPorts(h, true, true, false, false, false);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/APRAttackControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary.Attacks.Spoofing;
16 | using eExNLML.Extensibility;
17 | using eExNLML.IO;
18 | using eExNLML.IO.HandlerConfigurationLoaders;
19 | using eExNLML.IO.HandlerConfigurationWriters;
20 | using eExNetworkLibrary;
21 | using eExNLML.DefaultControllers;
22 |
23 | namespace eExNLML.DefaultDefinitions
24 | {
25 | public class APRAttackControlDefinition : HandlerDefinition
26 | {
27 | public APRAttackControlDefinition() : base()
28 | {
29 | Name = "ARP spoofer";
30 | Description = "This traffic handler is capable of initiating an MITM via APR.";
31 | Author = "Emanuel Jöbstl";
32 | WebLink = "http://www.eex-dev.net";
33 | PluginType = PluginTypes.TrafficHandler;
34 | PluginKey = "eex_apr_attack";
35 | }
36 |
37 | public override IHandlerController Create(IEnvironment env)
38 | {
39 | return new APRAttackController(this, env);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/ARPScannerControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Scanning;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.DefaultControllers;
18 |
19 | namespace eExNLML.DefaultDefinitions
20 | {
21 | public class ARPScannerControlDefinition : HandlerDefinition
22 | {
23 | public ARPScannerControlDefinition()
24 | {
25 | Name = "ARP Scanner";
26 | Description = "This traffic handler implements ARP-Scanning for the local subnet.";
27 | Author = "Emanuel Jöbstl";
28 | WebLink = "http://www.eex-dev.net";
29 | PluginType = PluginTypes.TrafficHandler;
30 | PluginKey = "eex_arp_scanner";
31 | }
32 |
33 | public override IHandlerController Create(IEnvironment env)
34 | {
35 | return new ARPScannerController(this, env);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/CodeLabControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.CodeLab;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNetworkLibrary;
18 | using eExNLML.DefaultControllers;
19 |
20 | namespace eExNLML.DefaultDefinitions
21 | {
22 | public class CodeLabControlDefinition : HandlerDefinition
23 | {
24 | public CodeLabControlDefinition()
25 | {
26 | Name = "Code Lab";
27 | Description = "With this traffic handler it is possible to script small traffic modifiers and compile and use them at runtime. Compiling to plug-ins is also supported";
28 | Author = "Emanuel Jöbstl";
29 | WebLink = "http://www.eex-dev.net";
30 | PluginType = PluginTypes.TrafficHandler;
31 | PluginKey = "eex_code_lab";
32 | }
33 |
34 | public override IHandlerController Create(IEnvironment env)
35 | {
36 | return new CodeLabController(this, env);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/ConditionalTrafficSplitterControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.TrafficSplitting;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class ConditionalTrafficSplitterControlDefinition : HandlerDefinition
25 | {
26 | public ConditionalTrafficSplitterControlDefinition()
27 | {
28 | Name = "Conditional Traffic Splitter";
29 | Description = "This traffic handler is capable of seperating traffic streams by given rules. If no rule matches, the frame is forwarded to handler A by default.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_conditional_splitter";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new ConditionalTrafficSplitterController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/DHCPServerControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.DHCP;
15 | using eExNLML.IO.HandlerConfigurationLoaders;
16 | using eExNLML.IO.HandlerConfigurationWriters;
17 | using eExNLML.Extensibility;
18 | using eExNetworkLibrary;
19 | using eExNLML.IO;
20 | using eExNLML.DefaultControllers;
21 | namespace eExNLML.DefaultDefinitions
22 | {
23 | public class DHCPServerControlDefinition : HandlerDefinition
24 | {
25 | public DHCPServerControlDefinition()
26 | {
27 | Name = "DHCP Server";
28 | Description = "This traffic handler acts like a simple DHCP server. It has a pool of addresses and redistributes it to requesting clients.";
29 | Author = "Emanuel Jöbstl";
30 | WebLink = "http://www.eex-dev.net";
31 | PluginType = PluginTypes.TrafficHandler;
32 | PluginKey = "eex_dhcp_server";
33 | }
34 |
35 | public override IHandlerController Create(IEnvironment env)
36 | {
37 | return new DHCPServerController(this, env);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/DHCPSpooferControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary.Attacks.Spoofing;
16 | using eExNLML.Extensibility;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.IO;
21 | using eExNLML.DefaultControllers;
22 |
23 | namespace eExNLML.DefaultDefinitions
24 | {
25 | public class DHCPSpooferControlDefinition : HandlerDefinition
26 | {
27 | public DHCPSpooferControlDefinition()
28 | {
29 | Name = "DHCP Spoofer";
30 | Description = "This traffic handler steals IP-Adresses and redistributes them with spoofed gateways. It also includes the functions of a simple DHCP server.";
31 | Author = "Emanuel Jöbstl";
32 | WebLink = "http://www.eex-dev.net";
33 | PluginType = PluginTypes.TrafficHandler;
34 | PluginKey = "eex_dhcp_spoofer";
35 | }
36 |
37 | public override IHandlerController Create(IEnvironment env)
38 | {
39 | return new DHCPSpooferController(this, env);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/DNSOTFSpooferControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Modification;
15 | using eExNLML.IO.HandlerConfigurationLoaders;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.Extensibility;
19 | using eExNetworkLibrary;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class DNSOTFSpooferControlDefinition : HandlerDefinition
25 | {
26 | public DNSOTFSpooferControlDefinition()
27 | {
28 | Name = "DNS On The Fly Spoofer";
29 | Description = "This traffic modifier is capable of changing DNS replies on the fly.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_dns_otf_spoofer";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new DNSOTFSpooferController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/DNSQueryLoggerControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.DNS;
15 | using eExNetworkLibrary.Monitoring;
16 | using eExNLML.IO;
17 | using eExNetworkLibrary;
18 | using eExNLML.Extensibility;
19 | using eExNLML.DefaultControllers;
20 |
21 | namespace eExNLML.DefaultDefinitions
22 | {
23 | public class DNSQueryLoggerControlDefinition : HandlerDefinition
24 | {
25 | public DNSQueryLoggerControlDefinition()
26 | {
27 | Name = "DNS Query Logger";
28 | Description = "This traffic analyzer creates a small log of all catched DNS queries and their responses.";
29 | Author = "Emanuel Jöbstl";
30 | WebLink = "http://www.eex-dev.net";
31 | PluginType = PluginTypes.TrafficHandler;
32 | PluginKey = "eex_dns_query_log";
33 | }
34 |
35 | public override IHandlerController Create(IEnvironment env)
36 | {
37 | return new DNSQueryLoggerController(this, env);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/DirectInterfaceIOControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNLML.IO;
16 | using eExNLML.Extensibility;
17 | using eExNLML.DefaultControllers;
18 |
19 | namespace eExNLML.DefaultDefinitions
20 | {
21 | public class DirectInterfaceIOControlDefinition : HandlerDefinition
22 | {
23 | public DirectInterfaceIOControlDefinition()
24 | {
25 | Name = "Direct Interface I/O";
26 | Description = "This traffic handler represents a direct link to an IP interface.";
27 | Author = "Emanuel Jöbstl";
28 | WebLink = "http://www.eex-dev.net";
29 | PluginType = PluginTypes.TrafficHandler;
30 | PluginKey = "eex_direct_int_io";
31 | }
32 |
33 | public override IHandlerController Create(IEnvironment env)
34 | {
35 | return new DirectInterfaceIOController(this, env);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/HTTPMonitorControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 | using eExNLML.DefaultControllers;
19 |
20 | namespace eExNLML.DefaultDefinitions
21 | {
22 | public class HTTPMonitorControlDefinition : HandlerDefinition
23 | {
24 | public HTTPMonitorControlDefinition()
25 | {
26 | Name = "HTTP Monitor";
27 | Description = "This Traffic Analyzier is capable of intercepting HTTP-conversations and displaying intercepted site content (This plug-in is experimental).";
28 | Author = "Emanuel Jöbstl";
29 | WebLink = "http://www.eex-dev.net";
30 | PluginType = PluginTypes.TrafficHandler;
31 | PluginKey = "eex_http_monitor";
32 | }
33 |
34 | public override IHandlerController Create(IEnvironment env)
35 | {
36 | return new HTTPMonitorController(this, env);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/HTTPStreamModifierControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class HTTPStreamModifierControlDefinition : HandlerDefinition
25 | {
26 | public HTTPStreamModifierControlDefinition()
27 | {
28 | Name = "HTTP Stream Modifier";
29 | Description = "This traffic handler is capable of changing HTTP content on the fly.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_tcp_http_mod";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new HTTPStreamModifierController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/NATHandlerControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using eExNLML.IO.HandlerConfigurationLoaders;
16 | using eExNLML.IO.HandlerConfigurationWriters;
17 | using eExNetworkLibrary;
18 | using eExNLML.IO;
19 | using eExNLML.Extensibility;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class NATHandlerControlDefinition : HandlerDefinition
25 | {
26 | public NATHandlerControlDefinition()
27 | {
28 | Name = "NAT Handler";
29 | Description = "This traffic handler is capable of performing network address translation (NAT) between internal and external address ranges. Be aware - this component does not work with all other components which rely on IP addressing.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_nat";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new NATHandlerController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/NetMapControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 | using eExNLML.DefaultControllers;
19 |
20 | namespace eExNLML.DefaultDefinitions
21 | {
22 | public class NetMapControlDefinition : HandlerDefinition
23 | {
24 | public NetMapControlDefinition()
25 | {
26 | Name = "Network Map";
27 | Description = "This traffic analyzer parses all incoming traffic and builds a network sketch from it.";
28 | Author = "Emanuel Jöbstl";
29 | WebLink = "http://www.eex-dev.net";
30 | PluginType = PluginTypes.TrafficHandler;
31 | PluginKey = "eex_net_map";
32 | }
33 |
34 | public override IHandlerController Create(IEnvironment env)
35 | {
36 | return new NetMapController(this, env);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/RIPRouterControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing.RIP;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 | using eExNLML.DefaultControllers;
19 |
20 | namespace eExNLML.DefaultDefinitions
21 | {
22 | public class RIPRouterControlDefinition : HandlerDefinition
23 | {
24 | public RIPRouterControlDefinition()
25 | {
26 | Name = "RIP Router";
27 | Description = "This traffic handler represents a simple RIP routing process.";
28 | Author = "Emanuel Jöbstl";
29 | WebLink = "http://www.eex-dev.net";
30 | PluginType = PluginTypes.TrafficHandler;
31 | PluginKey = "eex_rip_router";
32 | }
33 |
34 | public override IHandlerController Create(IEnvironment env)
35 | {
36 | return new RIPRouterController(this, env);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/RouterControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO.HandlerConfigurationLoaders;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.IO;
19 | using eExNetworkLibrary;
20 | using eExNetworkLibrary.Monitoring;
21 | using eExNLML.DefaultControllers;
22 |
23 | namespace eExNLML.DefaultDefinitions
24 | {
25 | public class RouterControlDefinition : HandlerDefinition
26 | {
27 | public RouterControlDefinition()
28 | {
29 | Name = "Router";
30 | Description = "This traffic handler represents a router which is used to route traffic to the correct interfaces";
31 | Author = "Emanuel Jöbstl";
32 | WebLink = "http://www.eex-dev.net";
33 | PluginType = PluginTypes.TrafficHandler;
34 | PluginKey = "eex_router";
35 | }
36 |
37 | public override IHandlerController Create(IEnvironment env)
38 | {
39 | return new RouterController(this, env);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/SpeedMeterControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.Extensibility;
18 | using eExNLML.DefaultControllers;
19 |
20 | namespace eExNLML.DefaultDefinitions
21 | {
22 | public class SpeedMeterControlDefinition : HandlerDefinition
23 | {
24 | public SpeedMeterControlDefinition()
25 | {
26 | Name = "Speed Meter";
27 | Description = "This traffic handler is capable of measuring the throughput datarate. It counts all data as it is on the medium (except ethernet preamble and checksum), not only layer 3 or 4 data.";
28 | Author = "Emanuel Jöbstl";
29 | WebLink = "http://www.eex-dev.net";
30 | PluginType = PluginTypes.TrafficHandler;
31 | PluginKey = "eex_speed_meter";
32 | }
33 |
34 | public override IHandlerController Create(IEnvironment env)
35 | {
36 | return new SpeedMeterController(this, env);
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/TextStreamModifierControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class TextStreamModifierControlDefinition : HandlerDefinition
25 | {
26 | public TextStreamModifierControlDefinition()
27 | {
28 | Name = "Text Stream Modifier";
29 | Description = "This traffic handler is capable of changing ASCII streams on the fly.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_tcp_text_mod";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new TextStreamModifierController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/TrafficDumperControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNLML.IO;
16 | using eExNetworkLibrary;
17 | using eExNLML.IO.HandlerConfigurationWriters;
18 | using eExNLML.IO.HandlerConfigurationLoaders;
19 | using eExNLML.Extensibility;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class TrafficDumperControlDefinition : HandlerDefinition
25 | {
26 | public TrafficDumperControlDefinition()
27 | {
28 | Name = "Dumper";
29 | Description = "This traffic handler dumps all received frames into an file, readable for wireshark and other analyzers.\nIt also supports sending captures to a wireshark instance in realtime. This feature requires wireshark to be installed.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_dumper";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new TrafficDumperController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/TrafficSplitterControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNetworkLibrary.TrafficSplitting;
16 | using eExNLML.IO;
17 | using eExNLML.Extensibility;
18 | using eExNetworkLibrary.Monitoring;
19 | using eExNLML.DefaultControllers;
20 |
21 | namespace eExNLML.DefaultDefinitions
22 | {
23 | public class TrafficSplitterControlDefinition : HandlerDefinition
24 | {
25 | public TrafficSplitterControlDefinition()
26 | {
27 | Name = "Traffic Splitter";
28 | Description = "This traffic handler represents a traffic splitter which clones all incoming frames to a clone port which can be used for analysis.";
29 | Author = "Emanuel Jöbstl";
30 | WebLink = "http://www.eex-dev.net";
31 | PluginType = PluginTypes.TrafficHandler;
32 | PluginKey = "eex_splitter";
33 | }
34 |
35 | public override IHandlerController Create(IEnvironment env)
36 | {
37 | return new TrafficSplitterController(this, env);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/eExNLML/DefaultDefinitions/WANEmulatorControlDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNLML.Extensibility;
16 | using eExNLML.IO;
17 | using eExNLML.IO.HandlerConfigurationLoaders;
18 | using eExNLML.IO.HandlerConfigurationWriters;
19 | using eExNetworkLibrary;
20 | using eExNLML.DefaultControllers;
21 |
22 | namespace eExNLML.DefaultDefinitions
23 | {
24 | public class WANEmulatorControlDefinition : HandlerDefinition
25 | {
26 | public WANEmulatorControlDefinition()
27 | {
28 | Name = "WAN Emulator";
29 | Description = "This traffic handler is capable of emulating WAN phenomena, like speed limitations and traffic jitters.";
30 | Author = "Emanuel Jöbstl";
31 | WebLink = "http://www.eex-dev.net";
32 | PluginType = PluginTypes.TrafficHandler;
33 | PluginKey = "eex_wan_emu";
34 | }
35 |
36 | public override IHandlerController Create(IEnvironment env)
37 | {
38 | return new WANEmulatorController(this, env);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/IHandlerDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | namespace eExNLML.Extensibility
13 | {
14 | ///
15 | /// This interface defines a plug-in
16 | ///
17 | public interface IHandlerDefinition : IPlugin
18 | {
19 | ///
20 | /// This method must create a new HandlerController instance associated with this class.
21 | ///
22 | /// The created HandlerController instance
23 | IHandlerController Create(IEnvironment env);
24 | ///
25 | /// Gets the author of this plug-in
26 | ///
27 | string Author { get; }
28 | ///
29 | /// Gets a simple description of this plug-in
30 | ///
31 | string Description { get; }
32 | ///
33 | /// Gets the name of this plug-in
34 | ///
35 | string Name { get; }
36 | ///
37 | /// Gets an unique key for this plug-in
38 | ///
39 | string PluginKey { get; }
40 | ///
41 | /// Gets the type of the plugin
42 | ///
43 | string PluginType { get; }
44 | ///
45 | /// Gets a web-link for this plug-in
46 | ///
47 | string WebLink { get; }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/IInterfaceDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Net.NetworkInformation;
13 | namespace eExNLML.Extensibility
14 | {
15 | ///
16 | /// This interface defines an network interface.
17 | ///
18 | public interface IInterfaceDefinition : IHandlerDefinition
19 | {
20 | ///
21 | /// Gets the unique GUID for this interface, which is diffrent for each NIC on each host.
22 | ///
23 | string InterfaceGUID { get; }
24 |
25 | ///
26 | /// Gets the interface type for this interface.
27 | ///
28 | NetworkInterfaceType InterfaceType { get; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/IInterfaceFactory.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML.Extensibility
16 | {
17 | ///
18 | /// This interface defines an interface extension factory which is capable of creating and returning more than one extensions at once.
19 | /// This interface makes it possible to create any number of network interface definitions dynamically, for example one for each interface of the computer.
20 | ///
21 | public interface IInterfaceFactory : IPlugin
22 | {
23 | ///
24 | /// Must create and return any number of interface extensions (interface handler definitions).
25 | /// This interface makes it possible to create any number of interface definitions, for example one for each interface of the computer.
26 | ///
27 | /// Some interface extensions
28 | IInterfaceDefinition[] Create();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/IPlugin.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML.Extensibility
16 | {
17 | public interface IPlugin
18 | {
19 | ///
20 | /// Gets the author of this plug-in
21 | ///
22 | string Author { get; }
23 | ///
24 | /// Gets a simple description of this plug-in
25 | ///
26 | string Description { get; }
27 | ///
28 | /// Gets the name of this plug-in
29 | ///
30 | string Name { get; }
31 | ///
32 | /// Gets an unique key for this plug-in
33 | ///
34 | string PluginKey { get; }
35 | ///
36 | /// Gets the type of the plugin
37 | ///
38 | string PluginType { get; }
39 | ///
40 | /// Gets a web-link for this plug-in
41 | ///
42 | string WebLink { get; }
43 | ///
44 | /// Gets the version of this plug-in
45 | ///
46 | Version Version { get; }
47 | }
48 |
49 | public static class PluginTypes
50 | {
51 | public static string TrafficHandler { get { return "TrafficHandler"; } }
52 | public static string InterfaceFactory { get { return "InterfaceFactory"; } }
53 | public static string Interface { get { return "Interface"; } }
54 | public static string SplitterRule { get { return "SplitterRule"; } }
55 | public static string HTTPModifierCondition { get { return "HTTPModifierCondition"; } }
56 | public static string HTTPModifierAction { get { return "HTTPModifierAction"; } }
57 | public static string ProtocolProvider { get { return "ProtocolProvider"; } }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/IProtocolDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML.Extensibility
16 | {
17 | ///
18 | /// Provides an interface for protocol definitions.
19 | ///
20 | public interface IProtocolDefinition : IPlugin
21 | {
22 | ///
23 | /// When implemented by a deriven class, must return an instance of the given protocol provider.
24 | /// This method is called whenever a new traffic handler is instantiated, so that a the provider can be added to the traffic handler.
25 | ///
26 | /// A protocol provider
27 | eExNetworkLibrary.ProtocolParsing.IProtocolProvider Create();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/ISubPlugInDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Reflection;
15 | using eExNetworkLibrary.TrafficSplitting;
16 | using eExNLML.IO;
17 |
18 | namespace eExNLML.Extensibility
19 | {
20 | ///
21 | /// Provides an interface for traffic splitter rule definitions
22 | ///
23 | public interface ISubPlugInDefinition : IPlugin
24 | {
25 | ///
26 | /// Must create a new instance of this sub-plugin
27 | ///
28 | /// A new instance of this sub-plugin
29 | T Create();
30 | ///
31 | /// Must create a new instance of this sub-plugin according to the given nested configuration
32 | ///
33 | /// The configuration as name value items
34 | /// A new instance of this sub-plugin
35 | T Create(NameValueItem nviConfigurationRoot);
36 | ///
37 | /// Returns the name of the sub-plugin which is described by this definition. The name has to be exactly the same as in the name-property of the corresponding sub-plugin.
38 | ///
39 | string Name { get; }
40 | ///
41 | /// Must return the configuration of the given sub-plugin
42 | ///
43 | /// The sub-plugin rule to get the configuration for
44 | /// The configuration of the given sub-plugin as an array of name value items
45 | NameValueItem[] GetConfiguration(T tsrRule);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNLML/Extensibility/PluginLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Reflection;
15 | using System.IO;
16 |
17 | namespace eExNLML.Extensibility
18 | {
19 | public class PluginLoader
20 | {
21 | public T[] LoadPluginsFromDirectory(string strDirectory)
22 | {
23 | List lPlugins = new List();
24 | if (Directory.Exists(strDirectory))
25 | {
26 | string[] strFiles = Directory.GetFiles(strDirectory);
27 |
28 | foreach (string strFile in strFiles)
29 | {
30 | if (strFile.EndsWith(".dll"))
31 | {
32 | try
33 | {
34 | lPlugins.AddRange(LoadPlugins(strFile));
35 | }
36 | catch { }
37 | }
38 | }
39 | }
40 | return lPlugins.ToArray();
41 | }
42 |
43 | public T[] LoadPlugins(string strFilename)
44 | {
45 | List lPlugins = new List();
46 | if (strFilename.EndsWith(".dll"))
47 | {
48 | Assembly pAssemblyToLoad = Assembly.LoadFrom(strFilename);
49 |
50 | foreach (Type tType in pAssemblyToLoad.GetTypes())
51 | {
52 | if (tType.IsPublic && !tType.IsAbstract)
53 | {
54 | Type tPlugin = tType.GetInterface(typeof(T).FullName, true);
55 |
56 | if (tPlugin != null)
57 | {
58 | T dtpPlugin = (T)Activator.CreateInstance(tType);
59 | lPlugins.Add(dtpPlugin);
60 | }
61 | }
62 | }
63 | }
64 | return lPlugins.ToArray();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/ARPSpooferConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary;
16 | using System.Net;
17 | using eExNetworkLibrary.Attacks.Spoofing;
18 | using eExNetworkLibrary.Attacks;
19 | using eExNLML.Extensibility;
20 |
21 | namespace eExNLML.IO.HandlerConfigurationLoaders
22 | {
23 | class ARPSpooferConfigurationLoader : HandlerConfigurationLoader
24 | {
25 | private APRAttack thHandler;
26 |
27 | public ARPSpooferConfigurationLoader(TrafficHandler thHandler)
28 | : base(thHandler)
29 | {
30 | this.thHandler = (APRAttack)thHandler;
31 | }
32 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
33 | {
34 | thHandler.Method = APRAttackMethod.UseReplyPackets.ToString() == ConvertToString(strNameValues["method"])[0] ? APRAttackMethod.UseReplyPackets : APRAttackMethod.UseRequestPackets;
35 | thHandler.SpoofInterval = ConvertToInt(strNameValues["interval"])[0];
36 |
37 | if (strNameValues.ContainsKey("victim"))
38 | {
39 | foreach (NameValueItem nvi in strNameValues["victim"])
40 | {
41 | IPAddress[] ipaAlice = ConvertToIPAddress(nvi.GetChildsByName("alice"));
42 | IPAddress[] ipaBob = ConvertToIPAddress(nvi.GetChildsByName("bob"));
43 |
44 | if (ipaAlice.Length != ipaBob.Length)
45 | {
46 | throw new ArgumentException("Invalid data");
47 | }
48 |
49 | for (int iC1 = 0; iC1 < ipaAlice.Length; iC1++)
50 | {
51 | thHandler.AddToVictimList(new MITMAttackEntry(ipaAlice[iC1], ipaBob[iC1]));
52 | }
53 | }
54 | }
55 | }
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/ConditionalTrafficSplitterConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.TrafficSplitting;
15 | using eExNetworkLibrary;
16 | using eExNLML.Extensibility;
17 |
18 | namespace eExNLML.IO.HandlerConfigurationLoaders
19 | {
20 | class ConditionalSplitterConfigurationLoader : HandlerConfigurationLoader
21 | {
22 | private ConditionalTrafficSplitter thHandler;
23 |
24 | public ConditionalSplitterConfigurationLoader(TrafficHandler thHandler)
25 | : base(thHandler)
26 | {
27 | this.thHandler = (ConditionalTrafficSplitter)thHandler;
28 | }
29 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
30 | {
31 | if (strNameValues.ContainsKey("rule"))
32 | {
33 | foreach (NameValueItem nviRuleItem in strNameValues["rule"])
34 | {
35 | TrafficSplitterRule tsrRule = LoadRule(nviRuleItem, eEnviornment);
36 | if (tsrRule != null)
37 | {
38 | thHandler.AddRule(tsrRule);
39 | }
40 | }
41 | }
42 | }
43 |
44 | private TrafficSplitterRule LoadRule(NameValueItem nviItem, IEnvironment eEnviornment)
45 | {
46 | string strKey = nviItem["ruleKey"][0].Value;
47 | ISubPlugInDefinition ruleDefinition = (ISubPlugInDefinition)eEnviornment.GetPlugInByKey(strKey);
48 |
49 | if (ruleDefinition != null)
50 | {
51 | TrafficSplitterRule tsrRule = ruleDefinition.Create(nviItem);
52 | foreach (NameValueItem nviChild in nviItem["rule"])
53 | {
54 | tsrRule.AddChildRule(LoadRule(nviChild, eEnviornment));
55 | }
56 | return tsrRule;
57 | }
58 |
59 | return null;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/DHCPServerConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.DHCP;
15 | using eExNetworkLibrary;
16 | using eExNLML.Extensibility;
17 |
18 | namespace eExNLML.IO.HandlerConfigurationLoaders
19 | {
20 | class DHCPServerConfigurationLoader : HandlerConfigurationLoader
21 | {
22 | private DHCPServer thHandler;
23 |
24 | public DHCPServerConfigurationLoader(TrafficHandler thHandler)
25 | : base(thHandler)
26 | {
27 | this.thHandler = (DHCPServer)thHandler;
28 | }
29 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
30 | {
31 | if (strNameValues.ContainsKey("gateway"))
32 | {
33 | thHandler.GatewayAddress = ConvertToIPAddress(strNameValues["gateway"])[0];
34 | }
35 | if (strNameValues.ContainsKey("dns"))
36 | {
37 | thHandler.DNSAddress = ConvertToIPAddress(strNameValues["dns"])[0];
38 | }
39 |
40 | thHandler.DHCPInPort = ConvertToInt(strNameValues["inPort"])[0];
41 | thHandler.DHCPOutPort = ConvertToInt(strNameValues["outPort"])[0];
42 | thHandler.LeaseDuration = ConvertToInt(strNameValues["leaseDuration"])[0];
43 |
44 | foreach (NameValueItem nviPool in strNameValues["DHCPPool"])
45 | {
46 | foreach (NameValueItem nvi in nviPool.GetChildsByName("DHCPItem"))
47 | {
48 | DHCPPoolItem dhItem = new DHCPPoolItem(ConvertToIPAddress(nvi.GetChildsByName("Address"))[0],
49 | ConvertToSubnetmask(nvi.GetChildsByName("Netmask"))[0],
50 | ConvertToIPAddress(nvi.GetChildsByName("Gateway"))[0],
51 | ConvertToIPAddress(nvi.GetChildsByName("DNSServer"))[0]);
52 |
53 | thHandler.AddToPool(dhItem);
54 | }
55 | }
56 | }
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/DHCPSpooferConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary;
16 | using eExNetworkLibrary.Attacks.Spoofing;
17 | using eExNLML.Extensibility;
18 | using eExNetworkLibrary.DHCP;
19 |
20 | namespace eExNLML.IO.HandlerConfigurationLoaders
21 | {
22 | class DHCPSpooferConfigurationLoader : DHCPServerConfigurationLoader
23 | {
24 | private DHCPSpoofer thHandler;
25 |
26 | public DHCPSpooferConfigurationLoader(TrafficHandler h)
27 | : base(h)
28 | {
29 | thHandler = (DHCPSpoofer)h;
30 | }
31 |
32 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
33 | {
34 | thHandler.StealAdresses = ConvertToBools(strNameValues["stealAddresses"])[0];
35 | thHandler.RedirectDNSServer = ConvertToBools(strNameValues["redirectDNS"])[0];
36 | thHandler.RedirectGateway = ConvertToBools(strNameValues["redirectGateway"])[0];
37 | thHandler.AnswerARPRequests = ConvertToBools(strNameValues["answerArpRequests"])[0];
38 | thHandler.HostenameToSpoof = ConvertToString(strNameValues["hostnameToSpoof"])[0];
39 | thHandler.RequestInterval = ConvertToInt(strNameValues["requestInterval"])[0];
40 |
41 | base.ParseConfiguration(strNameValues, eEnviornment);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/DNSOnTheFlySpooferConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Modification;
15 | using eExNetworkLibrary;
16 | using System.Net;
17 | using eExNLML.Extensibility;
18 |
19 | namespace eExNLML.IO.HandlerConfigurationLoaders
20 | {
21 | class DNSOnTheFlySpooferConfigurationLoader : HandlerConfigurationLoader
22 | {
23 | private DNSOnTheFlySpoofer thHandler;
24 |
25 | public DNSOnTheFlySpooferConfigurationLoader(TrafficHandler thHandler)
26 | : base(thHandler)
27 | {
28 | this.thHandler = (DNSOnTheFlySpoofer)thHandler;
29 | }
30 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
31 | {
32 | thHandler.DNSPort = ConvertToInt(strNameValues["dnsPort"])[0];
33 |
34 | if (strNameValues.ContainsKey("spoofDefinition"))
35 | {
36 | foreach (NameValueItem nvi in strNameValues["spoofDefinition"])
37 | {
38 | IPAddress[] ipaData = ConvertToIPAddress(nvi.GetChildsByName("address"));
39 | string[] strName = ConvertToString(nvi.GetChildsByName("domainName"));
40 |
41 | if (ipaData.Length != strName.Length)
42 | {
43 | throw new ArgumentException("Invaild data");
44 | }
45 |
46 | for (int iC1 = 0; iC1 < ipaData.Length; iC1++)
47 | {
48 | thHandler.AddDNSSpooferEntry(new DNSSpooferEntry(strName[iC1], ipaData[iC1]));
49 | }
50 | }
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/DumperConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Monitoring;
15 | using eExNetworkLibrary;
16 | using eExNLML.Extensibility;
17 |
18 | namespace eExNLML.IO.HandlerConfigurationLoaders
19 | {
20 | class DumperConfigurationLoader : HandlerConfigurationLoader
21 | {
22 | private LibPcapDumper thHandler;
23 |
24 | public DumperConfigurationLoader(TrafficHandler thHandler)
25 | : base(thHandler)
26 | {
27 | this.thHandler = (LibPcapDumper)thHandler;
28 | }
29 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
30 | {
31 | if (ConvertToBools(strNameValues["dumping"])[0])
32 | {
33 | thHandler.StartLogging(ConvertToString(strNameValues["fileName"])[0], true);
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/NATHandlerConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationLoaders
18 | {
19 | class NATHandlerConfigurationLoader : HandlerConfigurationLoader
20 | {
21 | private NetworkAddressTranslationHandler thHandler;
22 |
23 | public NATHandlerConfigurationLoader(TrafficHandler thHandler)
24 | : base(thHandler)
25 | {
26 | this.thHandler = (NetworkAddressTranslationHandler)thHandler;
27 | }
28 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
29 | {
30 | thHandler.DropNonNATFrames = ConvertToBools(strNameValues["dropNonNATFrames"])[0];
31 | thHandler.NATTimer = ConvertToInt(strNameValues["NATTimer"])[0];
32 | thHandler.PortRangeStart = ConvertToInt(strNameValues["portRangeStart"])[0];
33 | thHandler.PortRangeEnd = ConvertToInt(strNameValues["portRangeEnd"])[0];
34 |
35 | foreach (NameValueItem nvi in strNameValues["externalRangeItem"])
36 | {
37 | NATAddressRange narEntry = new NATAddressRange(ConvertToSubnetmask(nvi.GetChildsByName("subnetMask"))[0] , ConvertToIPAddress(new NameValueItem[] { nvi })[0]);
38 | thHandler.AddToExternalRange(narEntry);
39 | }
40 |
41 | foreach (NameValueItem nvi in strNameValues["internalRangeItem"])
42 | {
43 | NATAddressRange narEntry = new NATAddressRange(ConvertToSubnetmask(nvi.GetChildsByName("subnetMask"))[0], ConvertToIPAddress(new NameValueItem[] { nvi })[0]);
44 | thHandler.AddToInternalRange(narEntry);
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/RIPRouterConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing.RIP;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationLoaders
18 | {
19 | class RIPRouterConfigurationLoader : HandlerConfigurationLoader
20 | {
21 | private RIPRouter thHandler;
22 |
23 | public RIPRouterConfigurationLoader(TrafficHandler thHandler)
24 | : base(thHandler)
25 | {
26 | this.thHandler = (RIPRouter)thHandler;
27 | }
28 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
29 | {
30 | thHandler.RIPPort = ConvertToInt(strNameValues["ripPort"])[0];
31 | thHandler.UpdatePeriod = ConvertToInt(strNameValues["updatePeriod"])[0];
32 | thHandler.Version = ConvertToInt(strNameValues["version"])[0];
33 | thHandler.HoldDownTimer = ConvertToInt(strNameValues["holdDownTimer"])[0];
34 | thHandler.RIPv2Address = ConvertToIPAddress(strNameValues["rip2Address"])[0];
35 | thHandler.RedistributeStatic = ConvertToBools(strNameValues["redistStatic"])[0];
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/RouterConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using System.Net;
16 | using eExNetworkLibrary;
17 |
18 | namespace eExNLML.IO.HandlerConfigurationLoaders
19 | {
20 | class RouterConfigurationLoader : HandlerConfigurationLoader
21 | {
22 | private Router thHandler;
23 |
24 | public RouterConfigurationLoader(TrafficHandler thHandler)
25 | : base(thHandler)
26 | {
27 | this.thHandler = (Router)thHandler;
28 | }
29 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
30 | {
31 | if (strNameValues.ContainsKey("routingEntry"))
32 | {
33 | foreach (NameValueItem nvi in strNameValues["routingEntry"])
34 | {
35 | IPAddress[] ipaDestination = ConvertToIPAddress(nvi.GetChildsByName("destination"));
36 | IPAddress[] ipaNextHop = ConvertToIPAddress(nvi.GetChildsByName("nexthop"));
37 | int[] iMetric = ConvertToInt(nvi.GetChildsByName("metric"));
38 | Subnetmask[] smMasks = ConvertToSubnetmask(nvi.GetChildsByName("mask"));
39 |
40 | if (ipaDestination.Length != ipaNextHop.Length || ipaDestination.Length != iMetric.Length || ipaDestination.Length != smMasks.Length)
41 | {
42 | throw new ArgumentException("Invalid data.");
43 | }
44 |
45 | for (int iC1 = 0; iC1 < ipaDestination.Length; iC1++)
46 | {
47 | thHandler.RoutingTable.AddRoute(new RoutingEntry(ipaDestination[iC1], ipaNextHop[iC1], iMetric[iC1], smMasks[iC1], RoutingEntryOwner.UserStatic));
48 | }
49 | }
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/TextStreamModifierConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary;
16 | using System.Net;
17 | using eExNetworkLibrary.Attacks.Spoofing;
18 | using eExNetworkLibrary.Attacks;
19 | using eExNLML.Extensibility;
20 | using eExNetworkLibrary.TrafficModifiers;
21 |
22 | namespace eExNLML.IO.HandlerConfigurationLoaders
23 | {
24 | class TextStreamModifierConfigurationLoader : HandlerConfigurationLoader
25 | {
26 | private TextStreamModifier thHandler;
27 |
28 | public TextStreamModifierConfigurationLoader(TrafficHandler thHandler)
29 | : base(thHandler)
30 | {
31 | this.thHandler = (TextStreamModifier)thHandler;
32 | }
33 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
34 | {
35 | thHandler.Port = ConvertToInt(strNameValues["Port"])[0];
36 | thHandler.DataToFind = ConvertToString(strNameValues["DataToFind"])[0];
37 | thHandler.DataToReplace = ConvertToString(strNameValues["DataToReplace"])[0];
38 | }
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationLoaders/WANEmulatorConfigurationLoader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationLoaders
18 | {
19 | class WANEmulatorConfigurationLoader : HandlerConfigurationLoader
20 | {
21 | private WANEmulator thHandler;
22 |
23 | public WANEmulatorConfigurationLoader(TrafficHandler thHandler)
24 | : base(thHandler)
25 | {
26 | this.thHandler = (WANEmulator)thHandler;
27 | }
28 | protected override void ParseConfiguration(Dictionary strNameValues, IEnvironment eEnviornment)
29 | {
30 | thHandler.ByteFlipper.MaxErrorCount = ConvertToInt(strNameValues["byteFlipperMaxErrorCount"])[0];
31 | thHandler.ByteFlipper.MinErrorCount = ConvertToInt(strNameValues["byteFlipperMinErrorCount"])[0];
32 | thHandler.ByteFlipper.Probability = ConvertToInt(strNameValues["byteFlipperProbability"])[0];
33 | thHandler.DelayJitter.MaxDelay = ConvertToInt(strNameValues["delayJitterMaxDelay"])[0];
34 | thHandler.DelayJitter.MinDelay = ConvertToInt(strNameValues["delayJitterMinDelay"])[0];
35 | thHandler.PacketDropper.Probability = ConvertToInt(strNameValues["packetDropperProbability"])[0];
36 | thHandler.PacketDuplicator.Probability = ConvertToInt(strNameValues["packetDuplicatorProbability"])[0];
37 | thHandler.PacketReorderer.AccumulationTime = ConvertToInt(strNameValues["packetReordererAccumulationTime"])[0];
38 | thHandler.SpeedConstrainer.Speed = ConvertToInt(strNameValues["speedConstrainerSpeed"])[0];
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/ARPSpooferConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNetworkLibrary.Attacks.MITM;
16 | using eExNetworkLibrary.Attacks.Spoofing;
17 | using eExNetworkLibrary.Attacks;
18 | using eExNetworkLibrary.TrafficModifiers;
19 |
20 | namespace eExNLML.IO.HandlerConfigurationWriters
21 | {
22 | class TextStreamModifierConfigurationWriter : HandlerConfigurationWriter
23 | {
24 | private TextStreamModifier thHandler;
25 |
26 | public TextStreamModifierConfigurationWriter(TrafficHandler thToSave)
27 | : base(thToSave)
28 | {
29 | thHandler = (TextStreamModifier)thToSave;
30 | }
31 |
32 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
33 | {
34 | lNameValueItems.AddRange(ConvertToNameValueItems("DataToFind", thHandler.DataToFind));
35 | lNameValueItems.AddRange(ConvertToNameValueItems("DataToReplace", thHandler.DataToReplace));
36 | lNameValueItems.AddRange(ConvertToNameValueItems("Port", thHandler.Port));
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/DHCPSpooferConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.MITM;
15 | using eExNetworkLibrary;
16 | using eExNetworkLibrary.Attacks.Spoofing;
17 | using eExNetworkLibrary.DHCP;
18 |
19 | namespace eExNLML.IO.HandlerConfigurationWriters
20 | {
21 | class DHCPSpooferConfigurationWriter : DHCPServerConfigurationWriter
22 | {
23 | DHCPSpoofer thHandler;
24 |
25 | public DHCPSpooferConfigurationWriter(TrafficHandler h)
26 | : base(h)
27 | {
28 | thHandler = (DHCPSpoofer)h;
29 | }
30 |
31 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
32 | {
33 | lNameValueItems.AddRange(ConvertToNameValueItems("stealAddresses", thHandler.StealAdresses));
34 | lNameValueItems.AddRange(ConvertToNameValueItems("requestIntervael", thHandler.RequestInterval));
35 | lNameValueItems.AddRange(ConvertToNameValueItems("redirectGateway", thHandler.RedirectGateway));
36 | lNameValueItems.AddRange(ConvertToNameValueItems("redirectDNS", thHandler.RedirectDNSServer));
37 | lNameValueItems.AddRange(ConvertToNameValueItems("hostnameToSpoof", thHandler.HostenameToSpoof));
38 | lNameValueItems.AddRange(ConvertToNameValueItems("answerArpRequests", thHandler.AnswerARPRequests));
39 |
40 | base.AddConfiguration(lNameValueItems, eEnviornment);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/DNSOnTheFlySpooferConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Attacks.Modification;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class DNSOnTheFlySpooferConfigurationWriter : HandlerConfigurationWriter
20 | {
21 | private DNSOnTheFlySpoofer thHandler;
22 |
23 | public DNSOnTheFlySpooferConfigurationWriter(TrafficHandler thToSave)
24 | : base(thToSave)
25 | {
26 | thHandler = (DNSOnTheFlySpoofer)thToSave;
27 | }
28 |
29 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
30 | {
31 | lNameValueItems.AddRange(ConvertToNameValueItems("dnsPort", thHandler.DNSPort));
32 |
33 | foreach (DNSSpooferEntry dnsSpoof in thHandler.GetDNSSpooferEntries())
34 | {
35 | NameValueItem nviSpoofDefinitions = new NameValueItem("spoofDefinition", "");
36 | nviSpoofDefinitions.AddChildRange(ConvertToNameValueItems("address", dnsSpoof.Address));
37 | nviSpoofDefinitions.AddChildRange(ConvertToNameValueItems("domainName", dnsSpoof.Name));
38 | lNameValueItems.Add(nviSpoofDefinitions);
39 | }
40 |
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/DumperConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNetworkLibrary.Monitoring;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class DumperConfigurationWriter : HandlerConfigurationWriter
20 | {
21 | private LibPcapDumper thHandler;
22 |
23 | public DumperConfigurationWriter(TrafficHandler thToSave)
24 | : base(thToSave)
25 | {
26 | thHandler = (LibPcapDumper)thToSave;
27 | }
28 |
29 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
30 | {
31 | lNameValueItems.AddRange(ConvertToNameValueItems("dumping", thHandler.IsDumping));
32 | lNameValueItems.AddRange(ConvertToNameValueItems("fileName", thHandler.FileName));
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/NATHandlerConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class NATHandlerConfigurationWriter : HandlerConfigurationWriter
20 | {
21 | private NetworkAddressTranslationHandler thHandler;
22 |
23 | public NATHandlerConfigurationWriter(TrafficHandler thToSave)
24 | : base(thToSave)
25 | {
26 | thHandler = (NetworkAddressTranslationHandler)thToSave;
27 | }
28 |
29 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
30 | {
31 | lNameValueItems.AddRange(ConvertToNameValueItems("dropNonNATFrames", thHandler.DropNonNATFrames));
32 | lNameValueItems.AddRange(ConvertToNameValueItems("NATTimer", thHandler.NATTimer));
33 | lNameValueItems.AddRange(ConvertToNameValueItems("portRangeStart", thHandler.PortRangeStart));
34 | lNameValueItems.AddRange(ConvertToNameValueItems("portRangeEnd", thHandler.PortRangeEnd));
35 |
36 | foreach (NATAddressRange narEntry in thHandler.GetExternalRange())
37 | {
38 | NameValueItem nviExternalRange = ConvertToNameValueItems("externalRangeItem", narEntry.NetworkAddress)[0];
39 | nviExternalRange.AddChildRange(ConvertToNameValueItems("subnetMask", narEntry.Subnetmask));
40 | lNameValueItems.Add(nviExternalRange);
41 | }
42 |
43 | foreach (NATAddressRange narEntry in thHandler.GetInternalRange())
44 | {
45 | NameValueItem nviInternalRange = ConvertToNameValueItems("internalRangeItem", narEntry.NetworkAddress)[0];
46 | nviInternalRange.AddChildRange(ConvertToNameValueItems("subnetMask", narEntry.Subnetmask));
47 | lNameValueItems.Add(nviInternalRange);
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/RIPRouterConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing.RIP;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class RIPRouterConfigurationWriter: HandlerConfigurationWriter
20 | {
21 | private RIPRouter thHandler;
22 |
23 | public RIPRouterConfigurationWriter(TrafficHandler thToSave)
24 | : base(thToSave)
25 | {
26 | thHandler = (RIPRouter)thToSave;
27 | }
28 |
29 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
30 | {
31 | lNameValueItems.AddRange(ConvertToNameValueItems("ripPort", thHandler.RIPPort));
32 | lNameValueItems.AddRange(ConvertToNameValueItems("rip2Address", thHandler.RIPv2Address));
33 | lNameValueItems.AddRange(ConvertToNameValueItems("updatePeriod", thHandler.UpdatePeriod));
34 | lNameValueItems.AddRange(ConvertToNameValueItems("version", thHandler.Version));
35 | lNameValueItems.AddRange(ConvertToNameValueItems("redistStatic", thHandler.RedistributeStatic));
36 | lNameValueItems.AddRange(ConvertToNameValueItems("holdDownTimer", thHandler.HoldDownTimer));
37 | }
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/RouterConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNetworkLibrary.Routing;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class RouterConfigurationWriter : HandlerConfigurationWriter
20 | {
21 | private Router thHandler;
22 |
23 | public RouterConfigurationWriter(TrafficHandler thToSave) : base(thToSave)
24 | {
25 | thHandler = (Router)thToSave;
26 | }
27 |
28 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
29 | {
30 | foreach(RoutingEntry re in thHandler.RoutingTable.GetRoutes())
31 | {
32 | if(re.Owner == RoutingEntryOwner.UserStatic)
33 | {
34 | NameValueItem nviRoutingEntry = new NameValueItem("routingEntry","");
35 | nviRoutingEntry.AddChildRange(ConvertToNameValueItems("destination", re.Destination));
36 | nviRoutingEntry.AddChildRange(ConvertToNameValueItems("mask", re.Subnetmask));
37 | nviRoutingEntry.AddChildRange(ConvertToNameValueItems("metric", re.Metric));
38 | nviRoutingEntry.AddChildRange(ConvertToNameValueItems("nexthop", re.NextHop));
39 | lNameValueItems.Add(nviRoutingEntry);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/TextStreamModifierConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary;
15 | using eExNetworkLibrary.Attacks.MITM;
16 | using eExNetworkLibrary.Attacks.Spoofing;
17 | using eExNetworkLibrary.Attacks;
18 |
19 | namespace eExNLML.IO.HandlerConfigurationWriters
20 | {
21 | class ARPSpooferConfigurationWriter : HandlerConfigurationWriter
22 | {
23 | private APRAttack thHandler;
24 |
25 | public ARPSpooferConfigurationWriter(TrafficHandler thToSave)
26 | : base(thToSave)
27 | {
28 | thHandler = (APRAttack)thToSave;
29 | }
30 |
31 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
32 | {
33 | lNameValueItems.AddRange(ConvertToNameValueItems("method", thHandler.Method.ToString()));
34 | lNameValueItems.AddRange(ConvertToNameValueItems("interval", thHandler.SpoofInterval));
35 |
36 |
37 | foreach (MITMAttackEntry mitmEntry in thHandler.GetVictims())
38 | {
39 | NameValueItem nviVictims = new NameValueItem("victim", "");
40 | nviVictims.AddChildRange(ConvertToNameValueItems("alice", mitmEntry.VictimAlice));
41 | nviVictims.AddChildRange(ConvertToNameValueItems("bob", mitmEntry.VictimBob));
42 | lNameValueItems.Add(nviVictims);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eExNLML/IO/HandlerConfigurationWriters/WANEmulatorConfigurationWriter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Simulation;
15 | using eExNetworkLibrary;
16 |
17 | namespace eExNLML.IO.HandlerConfigurationWriters
18 | {
19 | class WANEmulatorConfigurationWriter : HandlerConfigurationWriter
20 | {
21 | private WANEmulator thHandler;
22 |
23 | public WANEmulatorConfigurationWriter(TrafficHandler thToSave)
24 | : base(thToSave)
25 | {
26 | thHandler = (WANEmulator)thToSave;
27 | }
28 |
29 | protected override void AddConfiguration(List lNameValueItems, IEnvironment eEnviornment)
30 | {
31 | lNameValueItems.AddRange(ConvertToNameValueItems("byteFlipperMaxErrorCount", thHandler.ByteFlipper.MaxErrorCount));
32 | lNameValueItems.AddRange(ConvertToNameValueItems("byteFlipperMinErrorCount", thHandler.ByteFlipper.MinErrorCount));
33 | lNameValueItems.AddRange(ConvertToNameValueItems("byteFlipperProbability", thHandler.ByteFlipper.Probability));
34 | lNameValueItems.AddRange(ConvertToNameValueItems("delayJitterMaxDelay", thHandler.DelayJitter.MaxDelay));
35 | lNameValueItems.AddRange(ConvertToNameValueItems("delayJitterMinDelay", thHandler.DelayJitter.MinDelay));
36 | lNameValueItems.AddRange(ConvertToNameValueItems("packetDropperProbability", thHandler.PacketDropper.Probability));
37 | lNameValueItems.AddRange(ConvertToNameValueItems("packetDuplicatorProbability", thHandler.PacketDuplicator.Probability));
38 | lNameValueItems.AddRange(ConvertToNameValueItems("packetReordererAccumulationTime", thHandler.PacketReorderer.AccumulationTime));
39 | lNameValueItems.AddRange(ConvertToNameValueItems("speedConstrainerSpeed", thHandler.SpeedConstrainer.Speed));
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eExNLML/Link.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML
16 | {
17 | ///
18 | /// This class defines a link between two traffic handler ports.
19 | ///
20 | public class Link
21 | {
22 | ///
23 | /// The first port this link is connected to.
24 | ///
25 | public TrafficHandlerPort Alice { get; protected set; }
26 | ///
27 | /// The second port this link is connected to.
28 | ///
29 | public TrafficHandlerPort Bob { get; protected set; }
30 |
31 | ///
32 | /// Creates a new instance of this class.
33 | ///
34 | /// The first port this link is connected to
35 | /// The second port this link is connected to
36 | public Link(TrafficHandlerPort pAlice, TrafficHandlerPort pBob)
37 | {
38 | this.Alice = pAlice;
39 | this.Bob = pBob;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eExNLML/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Network Library Management Layer (Beta)")]
9 | [assembly: AssemblyDescription("Network Library Management Layer (Beta)")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("eEx")]
12 | [assembly: AssemblyProduct("eExNLML (Beta)")]
13 | [assembly: AssemblyCopyright("Copyright eEx © 2010")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("dffc2b89-50a7-4c7a-b99c-11db0639f027")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.9.0.1")]
36 | [assembly: AssemblyFileVersion("0.9.0.1")]
37 |
--------------------------------------------------------------------------------
/eExNLML/Repository/PlugInDependency.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace eExNLML.Repository
6 | {
7 | public class PlugInDependency
8 | {
9 | public PlugInDependency(string strName, string strResource, string strLink, DependencyType tType)
10 | {
11 | this.Name = strName;
12 | this.Resource = strResource;
13 | this.Link = strLink;
14 | this.Type = tType;
15 | }
16 |
17 | public string Name{get; protected set;}
18 | public string Resource { get; protected set; }
19 | public string Link { get; protected set; }
20 | public DependencyType Type { get; protected set; }
21 | }
22 |
23 | public enum DependencyType
24 | {
25 | ///
26 | /// Another extension from the eex repository
27 | ///
28 | Extension = 1,
29 | ///
30 | /// A 3rd party software library
31 | ///
32 | Library = 2
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/eExNLML/Repository/PlugInDescription.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML.Repository
16 | {
17 | public class PlugInDescription : eExNLML.Extensibility.IPlugin
18 | {
19 | public PlugInDescription(string strAuthor, string strDescription, string strName, string strPluginKey, string strPluginType, string strWeblink, string strVersion, int iRating, int iDownloads, string[] arFiles, string strLargeIconLocation, string strSmallIconLocation, PlugInDependency[] arDependencies)
20 | {
21 | Author = strAuthor;
22 | Description = strDescription;
23 | Name = strName;
24 | PluginKey = strPluginKey;
25 | PluginType = strPluginType;
26 | WebLink = strWeblink;
27 | LargeIconLocation = strLargeIconLocation;
28 | SmallIconLocation = strSmallIconLocation;
29 | Dependencies = arDependencies;
30 | Rating = iRating;
31 | Downloads = iDownloads;
32 |
33 | if (strVersion != "")
34 | {
35 | Version = new Version(strVersion);
36 | }
37 | else
38 | {
39 | Version = new Version(0, 0);
40 | }
41 |
42 | Files = arFiles;
43 | }
44 |
45 | public string Author { get; protected set; }
46 | public string Description { get; protected set; }
47 | public string Name { get; protected set; }
48 | public string PluginKey { get; protected set; }
49 | public string PluginType { get; protected set; }
50 | public string WebLink { get; protected set; }
51 | public string SmallIconLocation { get; protected set; }
52 | public string LargeIconLocation { get; protected set; }
53 | public Version Version { get; protected set; }
54 | public int Rating { get; protected set; }
55 | public int Downloads { get; protected set; }
56 |
57 | public string[] Files { get; protected set; }
58 | public PlugInDependency[] Dependencies { get; protected set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/eExNLML/Repository/PlugInFile.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNLML.Repository
16 | {
17 | public class PlugInFile
18 | {
19 | public PlugInFile(string strFileName, byte[] bFileContents, string strMimeType)
20 | {
21 | this.FileName = strFileName;
22 | this.FileContents = bFileContents;
23 | this.MimeType = strMimeType;
24 | }
25 |
26 | public string FileName { get; protected set; }
27 | public byte[] FileContents { get; protected set; }
28 | public string MimeType { get; protected set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/eExNLML/SubPlugInDefinitions/ImageFlipperDefinition.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library Management Layer (NLML)
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP.Actions;
15 | using eExNLML.IO;
16 |
17 | namespace eExNLML.SubPlugInDefinitions
18 | {
19 | public class ImageFlipperDefinition : Extensibility.HTTPModifierActionDefinition
20 | {
21 | public ImageFlipperDefinition()
22 | {
23 | Name = "Image Flipper";
24 | Description = "Flips images contained in a HTTP message.";
25 | Author = "Emanuel Jöbstl";
26 | WebLink = "http://www.eex-dev.net";
27 | PluginKey = "eex_http_flipper";
28 | Version = new Version(0, 9);
29 | }
30 |
31 | public override eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP.HTTPStreamModifierAction Create()
32 | {
33 | return new ImageFlipper();
34 | }
35 |
36 | public override eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP.HTTPStreamModifierAction Create(eExNLML.IO.NameValueItem nviConfigurationRoot)
37 | {
38 | ImageFlipper imgFlip = (ImageFlipper)Create();
39 | imgFlip.RotateFlipType = (System.Drawing.RotateFlipType)ConfigurationParser.ConvertToInt(nviConfigurationRoot["imageOperation"])[0];
40 | return imgFlip;
41 | }
42 |
43 | public override eExNLML.IO.NameValueItem[] GetConfiguration(eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP.HTTPStreamModifierAction htCondition)
44 | {
45 | ImageFlipper imgFlip = (ImageFlipper)htCondition;
46 | return new NameValueItem[] { ConfigurationParser.ConvertToNameValueItems("imageOperation", (int)imgFlip.RotateFlipType)[0] };
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/DoS/ARPFlood.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net;
5 | using eExNetworkLibrary.IP;
6 | using System.Timers;
7 | using eExNetworkLibrary.Utilities;
8 | using eExNetworkLibrary.Ethernet;
9 | using eExNetworkLibrary.ARP;
10 |
11 | namespace eExNetworkLibrary.Attacks.DoS
12 | {
13 | ///
14 | /// This class is capable of converting a Switch into a Hub by flooding
15 | /// it with spoofed ARP reply packets and filling its ARP cache.
16 | ///
17 | public class ARPFlood : DirectInterfaceIOHandler
18 | {
19 | public void Attack(uint frameCount)
20 | {
21 | EthernetFrame ethFrame;
22 | ARPFrame arpFrame;
23 |
24 | for (uint i = 0; i < frameCount; i++) {
25 | foreach (EthernetInterface ipi in lInterfaces) {
26 | MACAddress sourceMAC = MACAddress.Random;
27 | ethFrame = new EthernetFrame();
28 | ethFrame.CanocialFormatIndicator = false;
29 | ethFrame.Destination = MACAddress.Broadcast;
30 | ethFrame.Source = sourceMAC;
31 | ethFrame.VlanTagExists = false;
32 | ethFrame.EtherType = EtherType.ARP;
33 |
34 | arpFrame = new ARPFrame();
35 | arpFrame.DestinationIP = new IPAddress(0);
36 |
37 | arpFrame.DestinationMAC = MACAddress.Random;
38 |
39 | arpFrame.SourceIP = IPAddress.Parse("0.0.0.0");
40 | arpFrame.SourceMAC = sourceMAC;
41 | arpFrame.ProtocolAddressType = EtherType.IPv4;
42 | arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;
43 |
44 | arpFrame.Operation = ARPOperation.Reply;
45 | ethFrame.EncapsulatedFrame = arpFrame;
46 |
47 | ipi.Send(ethFrame);
48 | }
49 | }
50 | }
51 |
52 | public void ResumeAttack()
53 | {
54 | throw new Exception("The method or operation is not implemented.");
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/IAttack.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Attacks
16 | {
17 | public interface IAttack
18 | {
19 | ///
20 | /// Returns the name of this attack
21 | ///
22 | string Name { get; }
23 |
24 | ///
25 | /// Pauses the attack until ResumeAttack() is called.
26 | ///
27 | void PauseAttack();
28 |
29 | ///
30 | /// Resumes the attack which was suspended by a previous call to PauseAttack().
31 | ///
32 | void ResumeAttack();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/IMITMAttack.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 |
13 | namespace eExNetworkLibrary.Attacks
14 | {
15 | ///
16 | /// Provides an interface for all kind of man in the middle attacks.
17 | ///
18 | /// When implementing such an attack, please use this interface for enhanced functionality, such as network map integration.
19 | ///
20 | public interface IMITMAttack : IAttack
21 | {
22 | ///
23 | /// Adds a man in the middle attack entry to the victim list of this attack
24 | ///
25 | /// The man in the middle attack entry to add
26 | void AddToVictimList(MITMAttackEntry apreVicim);
27 |
28 | ///
29 | /// Returns all man in the middle attack entries of this attack's victim list
30 | ///
31 | ///
32 | MITMAttackEntry[] GetVictims();
33 |
34 | ///
35 | /// Removes a man in the middle attack entry from the victim list of this attack
36 | ///
37 | /// The man in the middle attack entry to remove
38 | void RemoveFromVictimList(MITMAttackEntry apreVicim);
39 |
40 | ///
41 | /// Checks whether a specific man in the middle attack entry is contained in this attack
42 | ///
43 | /// A specific man in the middle attack entry
44 | /// A bool indicating whether a specific man in the middle attack entry is contained in this attack
45 | bool VictimListContains(MITMAttackEntry apreVicim);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/INetworkAttack.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Net;
15 |
16 | namespace eExNetworkLibrary.Attacks
17 | {
18 | ///
19 | /// Provides an interface for all kinds of attacks against whole networks.
20 | ///
21 | /// When implementing such an attack, please use this interface for enhanced functionality, such as network map integration.
22 | ///
23 | public interface INetworkAttack : IAttack
24 | {
25 | ///
26 | /// Adds the given IPAddress to the attacks victim list, so it will be attacked.
27 | ///
28 | /// The network address of the network to attack
29 | void Attack(IPAddress ipaVictim);
30 |
31 | ///
32 | /// Removes the given IPAddress from the victim list, so attacking will be stopped immediately.
33 | ///
34 | /// The network address of the network to remove from the victim list
35 | void StopAttack(IPAddress ipaVictim);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/ISingleHostAttack.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Net;
15 |
16 | namespace eExNetworkLibrary.Attacks
17 | {
18 | ///
19 | /// Provides an interface for all kinds of attacks against single hosts.
20 | ///
21 | /// When implementing such an attack, please use this interface for enhanced functionality, such as network map integration.
22 | ///
23 | public interface ISingleHostAttack : IAttack
24 | {
25 | ///
26 | /// Adds the given IPAddress to the attacks victim list, so it will be attacked.
27 | ///
28 | /// The IPAddress to attack
29 | void Attack(IPAddress ipaVictim);
30 |
31 | ///
32 | /// Removes the given IPAddress from the victim list, so attacking will be stopped immediately.
33 | ///
34 | /// The IPAddress to remove from the victim list
35 | void StopAttack(IPAddress ipaVictim);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/Scanning/ARPScanTask.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Net;
15 | using System.Threading;
16 | using eExNetworkLibrary.Utilities;
17 | using eExNetworkLibrary.Ethernet;
18 | using eExNetworkLibrary.ARP;
19 | using eExNetworkLibrary.IP;
20 |
21 | namespace eExNetworkLibrary.Attacks.Scanning
22 | {
23 | ///
24 | /// This class represents a scan task for the ARP net scanner
25 | ///
26 | public class ARPScanTask : ScanTask
27 | {
28 | private MACAddress macLocal;
29 |
30 | ///
31 | /// Creates a new instance of this class with the given params
32 | ///
33 | /// The start IP address of the range to scan
34 | /// The end IP address of the range to scan
35 | /// The MAC address to spoof in the ARP frame. This should equal the MAC of the output interface.
36 | /// The IP address which should be spoofed during scanning
37 | /// The traffic handler to which the generated ARP frames should be forwarded. It is wise to assign an ARP net scanner here
38 | public ARPScanTask(IPAddress ipaStart, IPAddress ipaEnd, MACAddress macLocal, IPAddress ipLocal, TrafficHandler thOut) : base(ipaStart, ipaEnd, ipLocal, thOut)
39 | {
40 | this.macLocal = macLocal;
41 | }
42 |
43 | protected override void Scan(IPAddress ipaDestination)
44 | {
45 | ARPFrame arpFrame = new ARPFrame();
46 | arpFrame.DestinationIP = ipaDestination;
47 | arpFrame.SourceIP = SourceAddress;
48 | arpFrame.DestinationMAC = MACAddress.Parse("ff:ff:ff:ff:ff:ff");
49 | arpFrame.SourceMAC = macLocal;
50 | arpFrame.ProtocolAddressType = EtherType.IPv4;
51 | arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;
52 | arpFrame.Operation = ARPOperation.Request;
53 |
54 | OutputHandler.PushTraffic(arpFrame);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Attacks/Scanning/IScanner.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Net;
15 |
16 | namespace eExNetworkLibrary.Attacks.Scanning
17 | {
18 | ///
19 | /// This interface represents a scanner which scans various IP ranges.
20 | ///
21 | /// When implementing such a scanner, please use this interface for enhanced functionality, such as network map integration.
22 | ///
23 | public interface IScanner
24 | {
25 | ///
26 | /// Starts the scan from the given start address to the given end address, including the start and the end address.
27 | ///
28 | /// The address at which scanning starts
29 | /// The address at which scanning ends
30 | void Scan(IPAddress ipaScanStart, IPAddress ipaScanEnd);
31 |
32 | ///
33 | /// Gets the name of the scanner
34 | ///
35 | string Name { get; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Changelog.txt:
--------------------------------------------------------------------------------
1 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 | eEx Network Library and Net Lab Changelog
3 | Author: Emanuel Jöbstl - emi@eex-dev.net
4 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 | Open Targets:
6 | * Extend the WebSurferMonitor
7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 | 2.4.2010
9 | * Implemented asyouncronous reading of HTTP messages
10 | from streams.
11 | * Implemented TCP on-the-fly modification framework,
12 | including sockets and read-only sockets.
13 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 | 7.12.2010
15 | * Implemented HTTP message creation
16 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 | 6.12.2010
18 | * Finished moving the NetLab logic and IO to eExNLML
19 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 | 23.8.2010
21 | * Changed some TrafficHandlers to use System.Timers.Timer
22 | instead of System.Windows.Forms.Timer
23 | 2.10.2010
24 | * Fixed a bug when clearing the document (MITM attacks got not removed)
25 | 3.10.2010
26 | * Changed the handling of IPv4 addresses and address ranges
27 | * Added an ISingleHostAttack interface
28 | * Rewrote plugin architecture to use a seperate in-between layer
29 | to ensure compatibility (eExNLML)
30 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 | 18.7.2010
32 | * Changed the InterfaceConfiguration class to use the
33 | .Net API instead of WMI to increase portability and
34 | speed.
35 | 25.7.2010
36 | * Changed some internal functions of the EthernetInterface
37 | and the Router to prevent RacingConditions and to fix
38 | some bugs concerning flexibility and architecture.
39 |
40 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
41 | 6.7.2010
42 | * Fix of a bug concerning WinPcap Interfaces
43 |
44 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
45 | 2.6.2010
46 | NetLab Version: 1.0.1, NetworkLibrary Version: 1.9.9.1
47 | * Several Minor Bugfixes
48 | * Implementation of WinPcap-Filters
49 | * Release of experimental classes and Plug-Ins
50 | - WebSurferMonitor
51 | - TCPStreamModifier (non-functional)
52 |
53 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 | 9.3.2010
55 | NetLab Version: 1.0.0, NetworkLibrary Version: 1.9.8.1
56 |
57 | Release: Net-Lab 1.0 & Network Library
--------------------------------------------------------------------------------
/eExNetworkLibrary/CodeLab/IDynamicHandler.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.CodeLab
16 | {
17 | ///
18 | /// This interface provides an interface for dynamic handlers which are used by the dynamic function compiler
19 | ///
20 | public interface IDynamicHandler
21 | {
22 | ///
23 | /// Modifies or analyzes the given frame
24 | ///
25 | /// The frame to analyze or modify
26 | /// The modified frame, or null if the frame should be dropped
27 | Frame ModifyTraffic(Frame fInputFrame);
28 |
29 | ///
30 | /// Starts the cleanup process
31 | ///
32 | void Cleanup();
33 |
34 | ///
35 | /// Stops this dynamic handler
36 | ///
37 | void Stop();
38 |
39 | ///
40 | /// Starts this dynamic handler
41 | ///
42 | void Start();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ICMP/V6/ICMPv6Frame.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ICMP.V6
16 | {
17 | ///
18 | /// Represents an ICMPv6 frame
19 | ///
20 | public class ICMPv6Frame : ICMPFrame
21 | {
22 | public static string DefaultFrameType { get { return FrameTypes.ICMPv6; } }
23 |
24 | ///
25 | /// Returns the type of this frame.
26 | ///
27 | public override string FrameType
28 | {
29 | get { return ICMPv6Frame.DefaultFrameType; }
30 | }
31 |
32 | ///
33 | /// Gets or sets the type of this ICMP frame
34 | ///
35 | public ICMPv6Type ICMPv6Type
36 | {
37 | get { return (ICMPv6Type)icmpType; }
38 | set { icmpType = (int)value; }
39 | }
40 |
41 | public ICMPv6Frame(byte[] bData)
42 | : base(bData)
43 | {
44 | Encapsulate(bData, 4);
45 |
46 | //Auto parse ICMP payload
47 |
48 |
49 | }
50 | public ICMPv6Frame() : base() { }
51 |
52 | ///
53 | /// Creates a new identical instance of this class
54 | ///
55 | /// A new identical instance of this class
56 | public override Frame Clone()
57 | {
58 | return new ICMPv6Frame(this.FrameBytes);
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ICMP/V6/NeighborAdvertisment.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ICMP.V6
16 | {
17 | public class NeighborAdvertisment : NeighborSolicitation
18 | {
19 | public static string DefaultFrameType { get { return "ICMPv6NeighborAdvertisment"; } }
20 |
21 | public bool RouterFlag { get; set; }
22 | public bool SolicitedFlag { get; set; }
23 | public bool OverrideFlag { get; set; }
24 |
25 |
26 | public NeighborAdvertisment()
27 | : base()
28 | { }
29 |
30 | public NeighborAdvertisment(byte[] bData) : base(bData)
31 | {
32 | RouterFlag = (bData[0] & 0x80) != 0;
33 | SolicitedFlag = (bData[0] & 0x40) != 0;
34 | OverrideFlag = (bData[0] & 0x20) != 0;
35 | }
36 |
37 | public override byte[] FrameBytes
38 | {
39 | get
40 | {
41 | byte[] bData = base.FrameBytes;
42 |
43 | bData[0] |= (byte)(RouterFlag ? 0x80 : 0);
44 | bData[0] |= (byte)(SolicitedFlag ? 0x40 : 0);
45 | bData[0] |= (byte)(OverrideFlag ? 0x20 : 0);
46 |
47 | return bData;
48 | }
49 | }
50 |
51 | public override string FrameType
52 | {
53 | get { return NeighborAdvertisment.DefaultFrameType; }
54 | }
55 |
56 | public override Frame Clone()
57 | {
58 | return new NeighborAdvertisment(this.FrameBytes);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/IHelperStructure.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary
16 | {
17 | ///
18 | /// Represents a small, frame-like helper structure
19 | ///
20 | public abstract class HelperStructure
21 | {
22 | ///
23 | /// Gets the bytes of this helper structure
24 | ///
25 | public abstract byte[] Bytes { get; }
26 | ///
27 | /// Gets the length of this helper structure
28 | ///
29 | public abstract int Length { get; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/IP/IPAddressAnalysis.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/eExNetworkLibrary/IP/IPAddressAnalysis.cs
--------------------------------------------------------------------------------
/eExNetworkLibrary/IP/IPv4Frame.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/eExNetworkLibrary/IP/IPv4Frame.cs
--------------------------------------------------------------------------------
/eExNetworkLibrary/IP/V6/ExtensionHeader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.IP.V6
16 | {
17 | public abstract class ExtensionHeader : Frame, IIPHeader
18 | {
19 | public IPProtocol NextHeader { get; set; }
20 | public IPProtocol Protocol { get { return NextHeader; } set { NextHeader = value; } }
21 |
22 | protected ExtensionHeader(byte[] bData)
23 | {
24 | NextHeader = (IPProtocol)bData[0];
25 | }
26 |
27 | public override byte[] FrameBytes
28 | {
29 | get
30 | {
31 | byte[] bData = new byte[Length];
32 | bData[0] = (byte)NextHeader;
33 | return bData;
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/IP/V6/IIPHeader.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.IP.V6
16 | {
17 | ///
18 | /// Provides an interface for the smallest common part of all IP headers (including IPv6 special headers): The Payload Protocol (Or Next Header in IPv6) field.
19 | ///
20 | public interface IIPHeader
21 | {
22 | ///
23 | /// Gets or sets the payload protocol of this IP header. This field corresponds to the NextHeader field of the IPv6 frame.
24 | ///
25 | IPProtocol Protocol { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Monitoring/StreamMonitoring/HTTPReaders.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.HTTP;
15 | using eExNetworkLibrary.Sockets;
16 |
17 | namespace eExNetworkLibrary.Monitoring.StreamMonitoring
18 | {
19 | class HTTPRequestReader : StreamMonitoring.NetworkStreamMonitor
20 | {
21 | public override string Description
22 | {
23 | get { return "Reads HTTP Requests"; }
24 | }
25 |
26 | public event EventHandler HTTPRequestCaptured;
27 |
28 | public HTTPRequestReader(NetworkStream nsInput) : base(nsInput)
29 | { }
30 |
31 | protected override void Run()
32 | {
33 | try
34 | {
35 | while (bSouldRun)
36 | {
37 | InvokeExternal(HTTPRequestCaptured, new HTTPReaderEventArgs(new HTTPRequest(InputStream)));
38 | }
39 | }
40 | catch (HTTP.HTTPParserStreamEndedException ex)
41 | { }
42 | }
43 | }
44 |
45 | class HTTPResponseReader : StreamMonitoring.NetworkStreamMonitor
46 | {
47 | public override string Description
48 | {
49 | get { return "Reads HTTP Responses"; }
50 | }
51 |
52 | public event EventHandler HTTPResponseCaptured;
53 |
54 | public HTTPResponseReader(NetworkStream nsInput) : base(nsInput)
55 | { }
56 |
57 | protected override void Run()
58 | {
59 | try
60 | {
61 | while (bSouldRun)
62 | {
63 | InvokeExternal(HTTPResponseCaptured, new HTTPReaderEventArgs(new HTTPResponse(InputStream)));
64 | }
65 | }
66 | catch (HTTP.HTTPParserStreamEndedException ex)
67 | { }
68 | }
69 | }
70 |
71 | class HTTPReaderEventArgs : EventArgs
72 | {
73 | public HTTPMessage HTTPMessage { get; private set; }
74 |
75 | public HTTPReaderEventArgs(HTTPMessage msg)
76 | {
77 | HTTPMessage = msg;
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Monitoring/TrafficAnalyzer.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Monitoring
16 | {
17 | ///
18 | /// This class represents the superclass of all traffic analyzers.
19 | /// Traffic analyzers must not have any output handlers also they must not generate any output and they must not edit any incomin frame
20 | /// The purpose of a traffic analyzer is to provide a stable base for doing multiple, paralell traffic analysis tasks without affecting the original frame.
21 | /// If you want to generate or change traffic on the fly, derive from TrafficModifier or TrafficHandler instead.
22 | ///
23 | public abstract class TrafficAnalyzer: TrafficHandler
24 | {
25 | ///
26 | /// Setting output handlers is not supported by traffic analyzers
27 | ///
28 | public override TrafficHandler OutputHandler
29 | {
30 | get { return null; }
31 | set { throw new InvalidOperationException("Traffic analyzers must not have any output"); }
32 | }
33 |
34 | ///
35 | /// Does nothing
36 | ///
37 | ///
38 | protected override void NotifyNext(Frame fInputFrame)
39 | {
40 | //Do nothing (Discard)
41 | }
42 |
43 | ///
44 | /// Analyzes the given frame
45 | ///
46 | /// The frame to analyze
47 | protected abstract override void HandleTraffic(Frame fInputFrame);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("eExNetworkLibrary v3 (Beta)")]
9 | [assembly: AssemblyDescription("eEx Network Library Version 3 Programmed by Emanuel Jöbstl 2007-2010")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("eEx")]
12 | [assembly: AssemblyProduct("eExNetworkLibrary Version 3")]
13 | [assembly: AssemblyCopyright("Copyright © eEx 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("424f4c1d-05ef-4780-bfe9-83c0b452b923")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("2.9.0.1")]
35 | [assembly: AssemblyFileVersion("2.9.0.1")]
36 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.235
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace eExNetworkLibrary.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/IProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing
16 | {
17 | public interface IProtocolProvider
18 | {
19 | ///
20 | /// Must return the protocol which is associated with this protocol provider.
21 | ///
22 | string Protocol { get; }
23 |
24 | ///
25 | /// Must return an array of strings, filled with the names of all payload protocols known to this provider.
26 | ///
27 | string[] KnownPayloads { get; }
28 |
29 | ///
30 | /// If the given frame is a raw data frame, this protocol provider has to parse the frame.
31 | ///
32 | /// The frame to parse.
33 | /// The parsed frame
34 | Frame Parse(Frame fFrame);
35 |
36 | ///
37 | /// Must return the payload type of the given frame.
38 | /// If the frame is a raw data frame, the protocol provider has to throw an exception.
39 | ///
40 | /// The frame to get the payload type for.
41 | /// The payload type.
42 | string PayloadType(Frame fFrame);
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/ARPProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | class ARPProtocolProvider: IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.ARP; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[] { }; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | if (fFrame.FrameType == this.Protocol)
32 | {
33 | return fFrame;
34 | }
35 |
36 | return new ARP.ARPFrame(fFrame.FrameBytes);
37 | }
38 |
39 | public string PayloadType(Frame fFrame)
40 | {
41 | if (fFrame.FrameType != this.Protocol)
42 | {
43 | fFrame = Parse(fFrame);
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/DHCPProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | class DHCPProtocolProvider : IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.DHCP; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[0]; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | if (fFrame.FrameType == this.Protocol)
32 | {
33 | return fFrame;
34 | }
35 |
36 | return new DHCP.DHCPFrame(fFrame.FrameBytes);
37 | }
38 |
39 | public string PayloadType(Frame fFrame)
40 | {
41 | if (fFrame.FrameType != this.Protocol)
42 | {
43 | fFrame = Parse(fFrame);
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/DNSProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | class DNSProtocolProvider : IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.DNS; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[0]; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | if (fFrame.FrameType == this.Protocol)
32 | {
33 | return fFrame;
34 | }
35 |
36 | return new DNS.DNSFrame(fFrame.FrameBytes);
37 | }
38 |
39 | public string PayloadType(Frame fFrame)
40 | {
41 | if (fFrame.FrameType != this.Protocol)
42 | {
43 | fFrame = Parse(fFrame);
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/EthernetProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Ethernet;
15 |
16 | namespace eExNetworkLibrary.ProtocolParsing.Providers
17 | {
18 | public class EthernetProtocolProvider : IProtocolProvider
19 | {
20 | public string Protocol
21 | {
22 | get { return FrameTypes.Ethernet; }
23 | }
24 |
25 | public string[] KnownPayloads
26 | {
27 | get { return new string[] { FrameTypes.IPv4, FrameTypes.IPv6, FrameTypes.ARP,
28 | FrameTypes.RARP, FrameTypes.IPX, FrameTypes.AppleTalk,
29 | FrameTypes.AARP, FrameTypes.Novell}; }
30 | }
31 |
32 | public Frame Parse(Frame fFrame)
33 | {
34 | if (fFrame.FrameType == this.Protocol)
35 | {
36 | return fFrame;
37 | }
38 |
39 | return new EthernetFrame(fFrame.FrameBytes);
40 | }
41 |
42 | public string PayloadType(Frame fFrame)
43 | {
44 | if (fFrame.FrameType != this.Protocol)
45 | {
46 | fFrame = Parse(fFrame);
47 | }
48 |
49 | switch (((EthernetFrame)fFrame).EtherType)
50 | {
51 | case EtherType.IPv4: return FrameTypes.IPv4;
52 | break;
53 | case EtherType.IPv6: return FrameTypes.IPv6;
54 | break;
55 | case EtherType.ARP: return FrameTypes.ARP;
56 | break;
57 | case EtherType.RARP: return FrameTypes.RARP;
58 | break;
59 | case EtherType.IPX: return FrameTypes.IPX;
60 | break;
61 | case EtherType.AppleTalk: return FrameTypes.AppleTalk;
62 | break;
63 | case EtherType.AARP: return FrameTypes.AARP;
64 | break;
65 | case EtherType.Novell: return FrameTypes.Novell;
66 | break;
67 | }
68 |
69 | return "";
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/ICMPv4ProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | class ICMPv4ProtocolProvider : IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.ICMPv4; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[0]; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | if (fFrame.FrameType == this.Protocol)
32 | {
33 | return fFrame;
34 | }
35 |
36 | return new ICMP.ICMPv4Frame(fFrame.FrameBytes);
37 | }
38 |
39 | public string PayloadType(Frame fFrame)
40 | {
41 | if (fFrame.FrameType != this.Protocol)
42 | {
43 | fFrame = Parse(fFrame);
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/ICMPv6ProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.ICMP.V6;
15 |
16 | namespace eExNetworkLibrary.ProtocolParsing.Providers
17 | {
18 | class ICMPv6ProtocolProvider : IProtocolProvider
19 | {
20 | public string Protocol
21 | {
22 | get { return FrameTypes.ICMPv6; }
23 | }
24 |
25 | public string[] KnownPayloads
26 | {
27 | get
28 | {
29 | return new string[]{
30 | NeighborAdvertisment.DefaultFrameType,
31 | NeighborSolicitation.DefaultFrameType};
32 | }
33 | }
34 |
35 | public Frame Parse(Frame fFrame)
36 | {
37 | if (fFrame.FrameType == this.Protocol)
38 | {
39 | return fFrame;
40 | }
41 |
42 | ICMPv6Frame icmpFrame = new ICMPv6Frame(fFrame.FrameBytes);
43 |
44 | switch (icmpFrame.ICMPv6Type)
45 | {
46 | case ICMPv6Type.NeighborAdvertisement:
47 | icmpFrame.EncapsulatedFrame = new NeighborAdvertisment(icmpFrame.EncapsulatedFrame.FrameBytes);
48 | break;
49 | case ICMPv6Type.NeighborSolicitation:
50 | icmpFrame.EncapsulatedFrame = new NeighborSolicitation(icmpFrame.EncapsulatedFrame.FrameBytes);
51 | break;
52 | }
53 |
54 | return icmpFrame;
55 | }
56 |
57 | public string PayloadType(Frame fFrame)
58 | {
59 | if (fFrame.FrameType != this.Protocol)
60 | {
61 | fFrame = Parse(fFrame);
62 | }
63 |
64 | switch (((ICMPv6Frame)fFrame).ICMPv6Type)
65 | {
66 | case ICMPv6Type.NeighborAdvertisement: return NeighborAdvertisment.DefaultFrameType;
67 | break;
68 | case ICMPv6Type.NeighborSolicitation: return NeighborSolicitation.DefaultFrameType;
69 | break;
70 | }
71 |
72 | return "";
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/IPv6ProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.IP.V6;
15 | using eExNetworkLibrary.IP;
16 |
17 | namespace eExNetworkLibrary.ProtocolParsing.Providers
18 | {
19 | public class IPv6ProtocolProvider : IPv4ProtocolProvider
20 | {
21 | public override string Protocol
22 | {
23 | get
24 | {
25 | return FrameTypes.IPv6;
26 | }
27 | }
28 |
29 | public override Frame Parse(Frame fFrame)
30 | {
31 | IPv6Frame ipFrame = new IPv6Frame(fFrame.FrameBytes);
32 |
33 | //Automatically parse IPv6 headers
34 |
35 | Frame fLastFrame = ipFrame;
36 |
37 | while (fLastFrame.FrameType != RawDataFrame.DefaultFrameType)
38 | {
39 | byte[] bPayload = fLastFrame.EncapsulatedFrame.FrameBytes;
40 |
41 | switch (((IIPHeader)fLastFrame).Protocol)
42 | {
43 | case IPProtocol.IPv6_Frag:
44 | fLastFrame.EncapsulatedFrame = new FragmentExtensionHeader(bPayload);
45 | break;
46 | case IPProtocol.IPv6_Route:
47 | fLastFrame.EncapsulatedFrame = new RoutingExtensionHeader(bPayload);
48 | break;
49 | default:
50 | fLastFrame.EncapsulatedFrame = new RawDataFrame(bPayload);
51 | break;
52 | }
53 |
54 | fLastFrame = fLastFrame.EncapsulatedFrame;
55 | }
56 |
57 | return ipFrame;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/OSPFProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | class OSPFProtocolProvider : IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.OSPF; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[0]; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | if (fFrame.FrameType == this.Protocol)
32 | {
33 | return fFrame;
34 | }
35 |
36 | return new Routing.OSPF.OSPFCommonHeader(fFrame.FrameBytes);
37 | }
38 |
39 | public string PayloadType(Frame fFrame)
40 | {
41 | if (fFrame.FrameType != this.Protocol)
42 | {
43 | fFrame = Parse(fFrame);
44 | }
45 |
46 | return "";
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/TCPProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | ///
18 | /// The TCP protocol provider cannot
19 | /// provide any payload parsing functionality
20 | /// since TCP is stream oriented.
21 | ///
22 | class TCPProtocolProvider : IProtocolProvider
23 | {
24 | public string Protocol
25 | {
26 | get { return FrameTypes.TCP; }
27 | }
28 |
29 | public string[] KnownPayloads
30 | {
31 | get
32 | {
33 | return new string[0];
34 | }
35 | }
36 |
37 | public Frame Parse(Frame fFrame)
38 | {
39 | if (fFrame.FrameType == this.Protocol)
40 | {
41 | return fFrame;
42 | }
43 |
44 | return new TCP.TCPFrame(fFrame.FrameBytes);
45 | }
46 |
47 | public string PayloadType(Frame fFrame)
48 | {
49 | return "";
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/ProtocolParsing/Providers/TrafficDescriptionFrameProtocolProvider.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.ProtocolParsing.Providers
16 | {
17 | public class TrafficDescriptionFrameProtocolProvider : IProtocolProvider
18 | {
19 | public string Protocol
20 | {
21 | get { return FrameTypes.TrafficDescriptionFrame; }
22 | }
23 |
24 | public string[] KnownPayloads
25 | {
26 | get { return new string[]{FrameTypes.Ethernet}; }
27 | }
28 |
29 | public Frame Parse(Frame fFrame)
30 | {
31 | throw new InvalidOperationException("A traffic description frame cannot be parsed.");
32 | }
33 |
34 | public string PayloadType(Frame fFrame)
35 | {
36 | if (fFrame.FrameType == this.Protocol
37 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet
38 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet3Megabit
39 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetT
40 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet
41 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.Wireless80211
42 | && ((TrafficDescriptionFrame)fFrame).SourceInterface.AdapterType == System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetFx)
43 | {
44 | return FrameTypes.Ethernet;
45 | }
46 |
47 | return null;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Routing/IRouter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Routing
16 | {
17 | ///
18 | /// Provides an interface from which all routers must derive.
19 | ///
20 | public interface IRouter
21 | {
22 | ///
23 | /// Gets the routing table of a router.
24 | ///
25 | RoutingTable RoutingTable { get; }
26 | ///
27 | /// Gets the name of a router.
28 | ///
29 | string Name { get; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Routing/OSPF/IOSPFRouter.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | namespace eExNetworkLibrary.Routing.OSPF
13 | {
14 | [Obsolete("This class is marked depreceated in cause of a sloppy implementation and only limited compatibility..", false)]
15 | interface IOSPFRouter
16 | {
17 | int DeadTimer { get; set; }
18 | uint ID { get; set; }
19 | int Priority { get; set; }
20 | System.Net.IPAddress IPAddress { get; set; }
21 | DirectAttachedNetwork AttachedNetwork { get; set; }
22 | OSPFState State { get; set; }
23 | MACAddress MACAddress { get; set; }
24 | OSPFOptionsField Options { get; set; }
25 | bool IsMaster { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Simulation/ByteFlipper.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Simulation
16 | {
17 | ///
18 | /// This simulator item class is capable of flipping bits inside a frame's data.
19 | ///
20 | public class ByteFlipper : PacketCorrupter
21 | {
22 | Random rRandom;
23 |
24 | ///
25 | /// Creates a new instance of this class
26 | ///
27 | public ByteFlipper()
28 | {
29 | rRandom = new Random();
30 | }
31 |
32 | ///
33 | /// Flips a random chosen count of bits inside the given frame
34 | ///
35 | /// The data to corrupt
36 | /// The corrupted data
37 | protected override byte[] DoErrors(byte[] bData)
38 | {
39 | int iErrorCount = rRandom.Next(iMinErrorCount, iMaxErrorCount + 1);
40 | int iErrorIndex;
41 | byte bErrorByte;
42 |
43 | for (int iC1 = 0; iC1 < iErrorCount; iC1++)
44 | {
45 | iErrorIndex = rRandom.Next(0, bData.Length);
46 | bErrorByte = (byte)(1 << rRandom.Next(0, 8));
47 |
48 | bData[iErrorIndex] = (byte)((bData[iErrorIndex] & (~bErrorByte)) | (~(bData[iErrorIndex] & (bErrorByte))));
49 | }
50 |
51 | return bData;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Simulation/PacketDropper.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Simulation
16 | {
17 | ///
18 | /// This class is capable of dropping packets according to a given probability.
19 | ///
20 | public class PacketDropper : RandomEventTrafficSimulatorItem
21 | {
22 | ///
23 | /// Drops the frame
24 | ///
25 | /// The frame to drop
26 | protected override void CaseHappening(Frame f)
27 | {
28 | //Do nothing - Drop
29 | }
30 |
31 | ///
32 | /// Forwards the frame
33 | ///
34 | /// The frame to forward
35 | protected override void CaseNotHappening(Frame f)
36 | {
37 | //Forward
38 | this.Next.Push(f);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Simulation/PacketDuplicator.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Ethernet;
15 |
16 | namespace eExNetworkLibrary.Simulation
17 | {
18 | ///
19 | /// This class is capable of duplicating packets according to a given probability.
20 | ///
21 | public class PacketDuplicator : RandomEventTrafficSimulatorItem
22 | {
23 | ///
24 | /// Duplicates the frame
25 | ///
26 | /// The frame to duplicate
27 | protected override void CaseHappening(Frame f)
28 | {
29 | //Clone the frame
30 | this.Next.Push(f.Clone());
31 | this.Next.Push(f);
32 | }
33 |
34 | ///
35 | /// Forwards the frame
36 | ///
37 | /// the frame to forward
38 | protected override void CaseNotHappening(Frame f)
39 | {
40 | this.Next.Push(f); //Simply forward
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Sockets/NetworkStream.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 |
13 | namespace eExNetworkLibrary.Sockets
14 | {
15 | ///
16 | /// This class represents the base for a network stream which is capable of saving
17 | /// push flags for bytes which are written.
18 | ///
19 | public abstract class NetworkStream : System.IO.Stream
20 | {
21 | ///
22 | /// A bool indicating whether the last bytes which were read last were written with a push flag set.
23 | ///
24 | public abstract bool IsPush { get; }
25 |
26 | ///
27 | /// Writes the given bytes to the network stream.
28 | ///
29 | /// The buffer to write.
30 | /// The offset in buffer where writing starts.
31 | /// The count of bytes to write.
32 | /// A bool indicating whether a push flag should be set for the bites written.
33 | public abstract void Write(byte[] buffer, int offset, int count, bool bPush);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Threading/WorkItem.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Threading;
15 |
16 | namespace eExNetworkLibrary.Threading
17 | {
18 | ///
19 | /// A work item used internally by the ISynchronizeInvoke model
20 | ///
21 | class WorkItem : IAsyncResult
22 | {
23 | object[] aroArgs;
24 | object oAsyncState;
25 | bool bCompleted;
26 | Delegate dTarget;
27 | ManualResetEvent mreDone;
28 | object oMethodReturnValue;
29 |
30 | public WorkItem(object oAsyncState, Delegate dTarget, object[] aroArgs)
31 | {
32 | this.oAsyncState = oAsyncState;
33 | this.dTarget = dTarget;
34 | this.aroArgs = aroArgs;
35 | this.mreDone = new ManualResetEvent(false);
36 | this.bCompleted = false;
37 | }
38 |
39 | public void CallBack()
40 | {
41 | this.oMethodReturnValue = dTarget.DynamicInvoke(aroArgs);
42 | mreDone.Set();
43 | bCompleted = true;
44 | }
45 |
46 | public object MethodReturnValue
47 | {
48 | get { return oMethodReturnValue; }
49 | }
50 |
51 | public object AsyncState
52 | {
53 | get { return oAsyncState; }
54 | }
55 |
56 | public System.Threading.WaitHandle AsyncWaitHandle
57 | {
58 | get { return mreDone; }
59 | }
60 |
61 | public bool CompletedSynchronously
62 | {
63 | get { return false; }
64 | }
65 |
66 | public bool IsCompleted
67 | {
68 | get { return bCompleted; }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/TrafficModifiers/StreamModification/HTTP/Actions/ImageFlipper.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using System.Drawing;
15 |
16 | namespace eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP.Actions
17 | {
18 | public class ImageFlipper : ImageAction
19 | {
20 | public RotateFlipType RotateFlipType
21 | {
22 | get;
23 | set;
24 | }
25 |
26 | public ImageFlipper()
27 | {
28 | RotateFlipType = RotateFlipType.Rotate180FlipNone;
29 | }
30 |
31 | protected override Bitmap ModifyImage(Bitmap bmp)
32 | {
33 | bmp.RotateFlip(RotateFlipType);
34 | return bmp;
35 | }
36 |
37 | public override string Name
38 | {
39 | get { return "Image Flipper"; }
40 | }
41 |
42 | public override string GetLongDescription()
43 | {
44 | return RotateFlipType.ToString();
45 | }
46 |
47 | public override string GetShortDescription()
48 | {
49 | return RotateFlipType.ToString();
50 | }
51 |
52 | public override object Clone()
53 | {
54 | ImageFlipper imgFlipClone = new ImageFlipper();
55 | imgFlipClone.RotateFlipType = this.RotateFlipType;
56 | CloneChildsTo(imgFlipClone);
57 | return imgFlipClone;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/TrafficModifiers/StreamModification/HTTP/HTTPStreamModifierAction.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.HTTP;
15 |
16 | namespace eExNetworkLibrary.TrafficModifiers.StreamModification.HTTP
17 | {
18 | public abstract class HTTPStreamModifierAction : HTTPStreamModifierCondition
19 | {
20 | ///
21 | /// Applys an actions to this HTTP Message
22 | ///
23 | /// The HTTP message to edit
24 | /// The edited HTTP message
25 | public abstract HTTPMessage ApplyAction(HTTPMessage httpMessage);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/TrafficModifiers/StreamModification/StreamReplacementRule.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.TrafficModifiers.StreamModification
16 | {
17 | public class StreamReplacementRule
18 | {
19 | byte[] bDataToFind;
20 | byte[] bDataToReplace;
21 |
22 | public byte[] DataToFind
23 | {
24 | get { return bDataToFind; }
25 | }
26 |
27 | public byte[] DataToReplace
28 | {
29 | get { return bDataToReplace; }
30 | }
31 |
32 | public StreamReplacementRule(byte[] bDataToFind, byte[] bDataToReplace)
33 | {
34 | this.bDataToReplace = bDataToReplace;
35 | this.bDataToFind = bDataToFind;
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/TrafficModifiers/TrafficModifier.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.TrafficModifiers
16 | {
17 | ///
18 | /// This class is used als superclass for all Traffic Handlers which modify traffic
19 | ///
20 | public abstract class TrafficModifier : TrafficHandler
21 | {
22 | ///
23 | /// Receives a frame, calls ModifyTraffic and forwards this frame to the next handler
24 | ///
25 | /// The frame to handle
26 | protected override void HandleTraffic(Frame fInputFrame)
27 | {
28 | fInputFrame = ModifyTraffic(fInputFrame);
29 | if (fInputFrame != null)
30 | {
31 | NotifyNext(fInputFrame);
32 | }
33 | }
34 |
35 | ///
36 | /// A method which is used to modify traffic
37 | ///
38 | /// The frame to handle
39 | /// A bool indicating if the frame should be further forwarded.
40 | protected abstract Frame ModifyTraffic(Frame fInputFrame);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Utilities/ChecksumCalculator.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 |
15 | namespace eExNetworkLibrary.Utilities
16 | {
17 | ///
18 | /// A simple checksum calculator, which can be used to calculate IP checksums and so on.
19 | ///
20 | public static class ChecksumCalculator
21 | {
22 | ///
23 | /// Calculates a checksum from the given data
24 | ///
25 | /// The data to calculate the checksum from
26 | /// The resulting checksum
27 | public static byte[] CalculateChecksum(byte[] bData)
28 | {
29 | if (bData.Length % 2 != 0)
30 | {
31 | throw new ArgumentException("Data to calculate checksum from must be a multiple of two.");
32 | }
33 |
34 | uint iChecksum = 0;
35 | int iIndex = 0;
36 |
37 | while (iIndex < bData.Length)
38 | {
39 | iChecksum += (uint)BitConverter.ToUInt16(bData, iIndex);
40 | iIndex += 2;
41 | }
42 |
43 | iChecksum = (iChecksum >> 16) + (iChecksum & 0xffff);
44 | iChecksum += (iChecksum >> 16);
45 |
46 | return BitConverter.GetBytes((ushort)(~iChecksum));
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/eExNetworkLibrary/Utilities/NetDiscovery.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/eExNetworkLibrary/Utilities/NetDiscovery.cs
--------------------------------------------------------------------------------
/eExNetworkLibrary/Utilities/PacketMonitor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ejoebstl/eexnetworklibrary/47e9b154d16ada12cea56937c3065b727f9fd3a1/eExNetworkLibrary/Utilities/PacketMonitor.cs
--------------------------------------------------------------------------------
/eExNetworkLibrary/Utilities/SystemRouteQuery.cs:
--------------------------------------------------------------------------------
1 | // This source file is part of the eEx Network Library
2 | //
3 | // Author: Emanuel Jöbstl
4 | // Weblink: http://network.eex-dev.net
5 | // http://eex.codeplex.com
6 | //
7 | // Licensed under the GNU Library General Public License (LGPL)
8 | //
9 | // (c) eex-dev 2007-2011
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.Text;
14 | using eExNetworkLibrary.Routing;
15 | using System.Management;
16 | using System.Net;
17 |
18 | namespace eExNetworkLibrary.Utilities
19 | {
20 | ///
21 | /// This class is capable of getting the system's routing table.
22 | ///
23 | public class SystemRouteQuery
24 | {
25 | ///
26 | /// Returns all routes from the operating system
27 | ///
28 | /// All routes from the operating system
29 | public static RoutingEntry[] GetOSRoutes()
30 | {
31 | List lReEntry = new List();
32 |
33 | try
34 | {
35 | ManagementClass mcConf = new ManagementClass("Win32_IP4RouteTable");
36 |
37 | ManagementObjectCollection acConfs = mcConf.GetInstances();
38 |
39 | foreach (ManagementObject moObject in acConfs)
40 | {
41 | lReEntry.Add(new RoutingEntry(IPAddress.Parse((string)moObject["Destination"]), IPAddress.Parse((string)moObject["NextHop"]), (int)moObject["Metric1"], Subnetmask.Parse((string)moObject["Mask"]), RoutingEntryOwner.System));
42 | }
43 | }
44 | catch (Exception) { }
45 |
46 | return lReEntry.ToArray();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------