The video explains and showcases what the program can do.
This project simulates random walks on graphs and incorporates a Man-in-the-Middle (MitM) attack simulator targeting the nodes within the graph. The graphs have been produced by Dr Mark Grechanik's NetGameSim repository. The project aims to shed light on the potential vulnerabilities and robustness of networks against MitM attacks. Utilizing Apache Spark and GraphX, the simulator provides insights into how successful or failed attacks transpire based on the network's structure and nodes' properties.
The linked file contains a detailed overview of the algorithms used in this project for:
- Random Walk
- MitM Attack
- Apache Spark
- GraphX library for Spark
- Typesafe Config library
- Clone the repository:
git clone
- Build the project:
This will create a jar file in the
sbt clean compile assembly
target/scala-2.12
directory. - Run Tests:
This will run the tests in the
sbt test
src/test/scala
directory.
-
Configuration:
- Use the
ConfigFactory
to load configurations regarding the simulation settings such as walk length, initial nodes percentage, and simulation iterations.
- Use the
-
Execution:
# Using spark-submit spark-submit --class Main [path_to_jar] <nodeFileOG> <nodeFilePath> <edgeFilePath> <outputFilePath>
Arguments:
nodeFileOG
: Original graph's node file path.nodeFilePath
: Perturbed graph's node file path.edgeFilePath
: Perturbed graph's edge file path.outputFilePath
: Path where the output stats will be saved.
example run instructions:
spark-submit --class Main ./target/scala-2.12/CS441HW2MitM-assembly-0.1.0-SNAPSHOT.jar ./input/NodesOut.txt ./input/NodesPerturbedOut.txt ./input/EdgesPerturbedOut.txt ./output/sparkS
- Output:
- The results include the number of successful, failed, misidentified, and uneventful attacks.
- These stats are saved to the specified output file for further analysis.
The repo is accompanied by a submodule capabale of visualising the random walks made during a run. The project produces a logs file in the log directory that log file can be processed by the LogViz module accompanied by the project. It will take input the log file and produce log file for each iteration such that it can be uploaded and visualised by the Visualiser. Example of the visualisation is shown below.
For initial graph (red nodes are initial nodes, blue are the ones that were walked).
This is how the walk progresses
Some examples of the log files which can be visualised are placed in Example Vis Logs directory. These can be uploaded to Visualiser to see the visualisation live.
-
Graph Construction:
- Parses nodes and edges from input files to create a graph representation.
- Allows dynamic linking of nodes and their respective edges for flexibility.
-
Random Walk:
- Simulates random walks on the graph, starting from a subset of nodes.
- The walks are directed based on the neighbors of the current node.
-
Man-in-the-Middle Attack:
- For each node visited during the random walk, the simulator attempts a MitM attack.
- Tracks successful, failed, misidentified, and uneventful attacks for analysis.
-
Configurable Parameters:
- Enables configuration of the walk length, initial node percentages, and number of iterations for simulation.
- Provides flexibility for research experiments.
-
Logging & Output:
- Offers comprehensive logging for tracking the flow and results of the simulations.
- Saves summarized statistics to an output file.