Skip to content

Commit 8359b6f

Browse files
committed
rename folders, amend code structure
1 parent 6cf4984 commit 8359b6f

27 files changed

+1049
-3702
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ A research project on the simulation and evaluation of moving target defense in
5757

5858
6. implement three [MTD Schemes](https://github.com/MoeBuTa/MTDSimTime/tree/main/mtdnetwork/network/mtd_scheme): simultaneously, randomly, alternatively.
5959

60-
7. implement Mean Time to Compromise metric.
60+
7. implement Mean Time to Compromise.
61+
62+
8. implement MTD Execute Frequency.
6163

6264

6365
## Todos / Future works

docs/notes.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Network Notes
2+
3+
4+
1. generate services
5+
6+
2. setup users
7+
8+
3. generate graph
9+
10+
4. setup network
11+
12+
13+
vulnerabilities
14+
services
15+
hosts & compromised hosts
16+
users:
17+
18+
19+
20+
21+
Graph Neural Network (GNN):
22+
https://www.datacamp.com/tutorial/comprehensive-introduction-graph-neural-networks-gnns-tutorial
23+
24+
Special types of neural networks capable of working with a graph data structure.
25+
26+
Typical tasks:
27+
- graph classification: classify graphs into various categories
28+
- **node classification**: use neighboring node labels to predict missing node labels in a graph
29+
- edge prediction: predict edge between a pair of nodes with an incomplete adjacency matrix
30+
- cluster detection: divide nodes into various clusters based on edge structure
31+
- graph embedding: map graphs into vectors, preserving the relevant information on nodes, edges, structure
32+
- graph generation: learns from sample graph distribution to generate a new but similar graph structure
33+
File renamed without changes.

mtdnetwork/network/adversary.py mtdnetwork/component/adversary.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from mtdnetwork.statistics.attack_statistics import AttackStatistics
2+
from mtdnetwork.statistic.attack_statistics import AttackStatistics
33
from mtdnetwork.data.constants import HACKER_ATTACK_ATTEMPT_MULTIPLER
44

55

mtdnetwork/network/copynetwork.py mtdnetwork/component/copynetwork.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy as np
44
import random
55
import mtdnetwork.data.constants as constants
6-
import mtdnetwork.network.services as services
7-
from mtdnetwork.statistics.scorer import Scorer
6+
import mtdnetwork.component.services as services
7+
from mtdnetwork.statistic.scorer import Scorer
88

99

1010
class Network:
File renamed without changes.

mtdnetwork/network/mtd_scheme.py mtdnetwork/component/mtd_scheme.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def __init__(self, scheme: str, network, alter_strategies=None):
2424
OSDiversity,
2525
PortShuffle,
2626
ServiceDiversity,
27-
UserShuffle]
27+
# UserShuffle
28+
]
2829
self._mtd_alter_strategies = alter_strategies
2930
self.network = network
3031
self._init_mtd_scheme(scheme)
File renamed without changes.

mtdnetwork/network/targetnetwork.py mtdnetwork/component/targetnetwork.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import numpy as np
55
import random
66
import mtdnetwork.data.constants as constants
7-
import mtdnetwork.network.services as services
8-
from mtdnetwork.network.host import Host
9-
from mtdnetwork.statistics.scorer import Scorer
7+
import mtdnetwork.component.services as services
8+
from mtdnetwork.component.host import Host
9+
from mtdnetwork.statistic.scorer import Scorer
1010

1111

1212
class TargetNetwork:
File renamed without changes.

mtdnetwork/component/time_network.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from mtdnetwork.component.copynetwork import Network
2+
from mtdnetwork.statistic.mtd_statistics import MTDStatistics
3+
from mtdnetwork.component.targetnetwork import TargetNetwork
4+
5+
6+
class TimeNetwork(Network):
7+
8+
def __init__(self, graph, pos, colour_map, total_nodes, total_endpoints, total_subnets, total_layers,
9+
node_per_layer, users_list, users_per_host):
10+
# default parameters
11+
self._mtd_stats = MTDStatistics()
12+
self._mtd_queue = []
13+
self._suspended_mtd = dict()
14+
self._unfinished_mtd = dict()
15+
super().__init__(graph, pos, colour_map, total_nodes, total_endpoints, total_subnets,
16+
total_layers, node_per_layer, users_list, users_per_host)
17+
18+
@staticmethod
19+
def create_network():
20+
target_network = TargetNetwork(total_nodes=200, total_endpoints=20, total_subnets=20, total_layers=5,
21+
target_layer=2)
22+
graph = target_network.get_graph_copy()
23+
colour_map = target_network.get_colourmap()
24+
pos = target_network.get_pos()
25+
node_per_layer = target_network.get_node_per_layer()
26+
users_list = target_network.get_users_list()
27+
users_per_host = target_network.get_users_per_host()
28+
time_network = TimeNetwork(graph, pos, colour_map, 200, 20, 20, 5, node_per_layer, users_list,
29+
users_per_host)
30+
return time_network
31+
32+
def is_compromised(self, compromised_hosts):
33+
# TODO: refactor terminating condition
34+
super().is_compromised(compromised_hosts)
35+
pass
36+
37+
def get_mtd_stats(self):
38+
return self._mtd_stats
39+
40+
def get_mtd_queue(self):
41+
return self._mtd_queue
42+
43+
def get_suspended_mtd(self):
44+
return self._suspended_mtd
45+
46+
def get_unfinished_mtd(self):
47+
return self._unfinished_mtd
48+
49+
def set_unfinished_mtd(self, mtd):
50+
self._unfinished_mtd[mtd.get_resource_type()] = mtd

mtdnetwork/data/constants.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@
140140
'ENUM_HOST': 15,
141141
'SCAN_NEIGHBOR': 10,
142142
'SCAN_PORT': 20,
143-
'EXPLOIT_VULN_MEAN': 25,
144-
'EXPLOIT_VULN_STD': 0.8,
143+
'EXPLOIT_VULN': (25, 0.8),
145144
'BRUTE_FORCE': 15,
146-
'PENALTY': 2,
145+
'PENALTY': 10,
147146
}

mtdnetwork/mtd/ipshuffle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from mtdnetwork.mtd import MTD
2-
from mtdnetwork.network import host
2+
from mtdnetwork.component import host
33

44

55
class IPShuffle(MTD):

mtdnetwork/mtd/portshuffle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from mtdnetwork.mtd import MTD
2-
from mtdnetwork.network import host
2+
from mtdnetwork.component import host
33

44

55
class PortShuffle(MTD):

mtdnetwork/network/network.md

-33
This file was deleted.

mtdnetwork/network/time_network.py

-97
This file was deleted.

0 commit comments

Comments
 (0)