Skip to content

Commit 90620ba

Browse files
fix the issue of multi-platform compatibility
1 parent 9b258c8 commit 90620ba

16 files changed

Lines changed: 292 additions & 252 deletions

File tree

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Therefore, we have developed and implemented StarPerf, a mega-constellation performance simulation platform that enables constellation manufacturers and content providers to estimate and understand the achievable performance under a variety of constellation options. The proposed platform integrates three key techniques: (1) performance simulation for mega-constellation, which captures the impact of the inherent high mobility in satellite networks and profiles the area-to-area attainable network performance; (2) constellation scaling, which synthesizes various topological options by scaling the space resource (e.g. number of satellite, link availability and capacity), and enables exploration on multiple operating conditions that can not be easily reproduced; (3) security simulation for LEO satellite networks, which is based on attack modeling and numerical simulation. We have added traffic plugins and communication energy consumption plugins to StarPerf, and used it to reproduce the link flooding attack proposed in [Time-varying Bottleneck Links in LEO Satellite Networks: Identification, Exploits, and Countermeasures](https://www.ndss-symposium.org/ndss-paper/time-varying-bottleneck-links-in-leo-satellite-networks-identification-exploits-and-countermeasures/)(NDSS 25) and the energy drain attack proposed in [Energy Drain Attack in Satellite Internet Constellations](https://ieeexplore.ieee.org/document/10188709)(IWQoS 23).
66

7-
This page introduces the basic usage of our StarPerf tool. If you have any questions on StarPerf, please do not hesitate to contact us. (Email: [houyn24@mails.tsinghua.edu.cn](mailto:houyn24@mails.tsinghua.edu.cn), [zeqilai@tsinghua.edu.cn](mailto:zeqilai@tsinghua.edu.cn), [lijh19@mails.tsinghua.edu.cn](mailto:lijh19@mails.tsinghua.edu.cn))
7+
This page introduces the basic usage of our StarPerf tool. If you have any questions on StarPerf, please do not hesitate to contact us. (Email: [houyn24@mails.tsinghua.edu.cn](mailto:houyn24@mails.tsinghua.edu.cn), [ZhifengHan.mail@gmail.com](mailto:Zhifenghan.mail@gmail.com), [zeqilai@tsinghua.edu.cn](mailto:zeqilai@tsinghua.edu.cn), [lijh19@mails.tsinghua.edu.cn](mailto:lijh19@mails.tsinghua.edu.cn))
88

99
Happy benchmarking your constellation!
1010

@@ -19,7 +19,16 @@ In the original version of StarPerf, it is mainly built upon Python. In addition
1919

2020
Now, we have made a major upgrade to StarPerf, extending its usability and enriching its functionality, and we call it "StarPerf 2.0". Accordingly, the initial version is called "StarPerf 1.0".
2121

22-
Compared with StarPerf 1.0, StarPerf 2.0 is completely based on Python and does not require any third-party orbit analysis/computation tools. Therefore, just make sure you have a Python3.10 or above environment installed on your computer and the following Python libraries installed to ensure the system is running properly:
22+
Compared with StarPerf 1.0, StarPerf 2.0 is fully implemented in Python and no longer depends on any third-party orbit analysis or computation tools. You only need to ensure that **Python 3.10** or above is installed on your system.
23+
24+
You can install all required dependencies at once using the following commands:
25+
26+
```bash
27+
cd StarPerf_Simulator
28+
pip install -r requirements.txt
29+
```
30+
31+
This will automatically install all necessary libraries to ensure the system runs properly. Specifically, we used the following packages to support the simulation:
2332

2433
- h3==4.0.0b2
2534
- h5py==3.10.0
@@ -38,7 +47,13 @@ Compared with StarPerf 1.0, StarPerf 2.0 is completely based on Python and does
3847

3948
# StarPerf overview and processing flow
4049

41-
see [interface\_convention](./docs/interface_convention.pdf).
50+
You can directly run our simulation example using the following command:
51+
52+
```bash
53+
python3 StarPerf.py
54+
```
55+
56+
Of course, you can also write your own simulation scripts. For specific guidelines and important notes, please refer to [interface\_convention](./docs/interface_convention.pdf).
4257

4358
# Contributors are more than welcome
4459

requirements.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
h3==4.0.0b2
2+
h5py==3.10.0
3+
numpy==1.24.4
4+
openpyxl==3.1.2
5+
importlib-metadata==6.8.0
6+
skyfield==1.46
7+
sgp4==2.22
8+
pandas==2.1.0
9+
poliastro==0.17.0
10+
astropy==5.3.3
11+
networkx==3.1
12+
requests==2.31.0
13+
jenkspy==0.4.0
14+
pyecharts==2.0.4

samples/attack/ICARUS/mul_link.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ def multi_link_attack():
4141
attackPluginManage.execute_icarus_attack(constellation, t, ratio, traffic)
4242
print("Finished calculating malicious terminals deployment and generating " + str(traffic) + " Mbps malicious traffic at timeslot " + str(t) + " with ratio " + str(ratio))
4343

44-
45-
os.system('mkdir -p data/' + cons_name + '_icarus/results')
44+
output_path = os.path.join("data", f"{cons_name}_icarus", "results")
45+
os.makedirs(output_path, exist_ok=True)
4646

4747
legal_traffic = []
48-
for subdir in os.listdir('data/' + cons_name + "_link_traffic_data"):
49-
subdir_path = os.path.join('data/' + cons_name + "_link_traffic_data", subdir)
48+
traffic_data_root = os.path.join("data", f"{cons_name}_link_traffic_data")
49+
for subdir in os.listdir(traffic_data_root):
50+
subdir_path = os.path.join(traffic_data_root, subdir)
5051
if os.path.isdir(subdir_path):
5152
# background traffic
5253
downlink_traffic_file_path = os.path.join(subdir_path, 'downlink_traffic.txt')
@@ -56,12 +57,15 @@ def multi_link_attack():
5657
total = sum(values)
5758
legal_traffic.append(total / 1024)
5859

59-
output_file = 'data/' + cons_name + '_icarus/results/background_traffic_without_attack.txt'
60+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", "background_traffic_without_attack.txt")
6061
with open(output_file, 'w') as file:
6162
for value in legal_traffic:
6263
file.write(str(value) + '\n')
6364

64-
folder_path = 'data/' + cons_name + "_icarus/attack_traffic_data_land_only_bot/0.5-300000-" + str(traffic_thre) + "-" + str(sat_per_cycle) + "-" + str(GSL_capacity) + "-" + str(unit_traffic)
65+
folder_path = os.path.join(
66+
"data", f"{cons_name}_icarus", "attack_traffic_data_land_only_bot",
67+
f"0.5-300000-{traffic_thre}-{sat_per_cycle}-{GSL_capacity}-{unit_traffic}"
68+
)
6569
icarus_traffic = []
6670
traffic_ratios = []
6771
gsl_ratios = []
@@ -89,26 +93,27 @@ def multi_link_attack():
8993
gsl_ratios.append(0)
9094
time_slot += 1
9195

92-
output_file = 'data/' + cons_name + '_icarus/results/ratio_of_reduced_background_traffic_by_icarus.txt'
96+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", "ratio_of_reduced_background_traffic_by_icarus.txt")
9397
with open(output_file, 'w') as file:
9498
for value in traffic_ratios:
9599
file.write(str(value) + '\n')
96-
output_file = 'data/' + cons_name + '_icarus/results/ratio_of_attacked_GSLs_by_icarus.txt'
100+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", "ratio_of_attacked_GSLs_by_icarus.txt")
97101
with open(output_file, 'w') as file:
98102
for value in gsl_ratios:
99103
file.write(str(value) + '\n')
100104
actual_throughput_icarus = [a - b for a, b in zip(legal_traffic, icarus_traffic)]
101-
output_file = 'data/' + cons_name + '_icarus/results/actual_throughput_icarus.txt'
105+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", "actual_throughput_icarus.txt")
102106
with open(output_file, 'w') as file:
103107
for value in actual_throughput_icarus:
104108
file.write(str(value) + '\n')
105109

106110
for traffic in target_affected_traffic:
107111
botnet_size_for_icarus = []
108112
for ratio in ratios:
109-
icarus_folder_path = 'data/' + cons_name + "_icarus/attack_traffic_data_land_only_bot/" + str(
110-
ratio) + "-" + str(traffic) + "-" + str(traffic_thre) + "-" + str(
111-
sat_per_cycle) + "-" + str(GSL_capacity) + "-" + str(unit_traffic)
113+
icarus_folder_path = os.path.join(
114+
"data", f"{cons_name}_icarus", "attack_traffic_data_land_only_bot",
115+
f"{ratio}-{traffic}-{traffic_thre}-{sat_per_cycle}-{GSL_capacity}-{unit_traffic}"
116+
)
112117
# icarus bot_num
113118
icarus_bot_size = []
114119
for subdir in os.listdir(icarus_folder_path):
@@ -122,17 +127,17 @@ def multi_link_attack():
122127
icarus_bot_size.append(values[0])
123128
botnet_size_for_icarus.append(int(sum(icarus_bot_size) / len(icarus_bot_size)))
124129

125-
output_file = 'data/' + cons_name + '_icarus/results/' + str(
126-
traffic) + '_botnet_size_for_icarus.txt'
130+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", f"{traffic}_botnet_size_for_icarus.txt")
127131
with open(output_file, 'w') as file:
128132
for i in range(len(ratios)):
129133
file.write(str(round(1 - ratios[i], 1)) + ": " + str(botnet_size_for_icarus[i]) + '\n')
130134

131135
number_blocks_icarus = []
132136
for index, ratio in enumerate(ratios):
133-
icarus_folder_path = 'data/' + cons_name + "_icarus/attack_traffic_data_land_only_bot/" + str(
134-
ratio) + "-" + str(traffic) + "-" + str(traffic_thre) + "-" + str(
135-
sat_per_cycle) + "-" + str(GSL_capacity) + "-" + str(unit_traffic)
137+
icarus_folder_path = os.path.join(
138+
"data", f"{cons_name}_icarus", "attack_traffic_data_land_only_bot",
139+
f"{ratio}-{traffic}-{traffic_thre}-{sat_per_cycle}-{GSL_capacity}-{unit_traffic}"
140+
)
136141
# icarus block_num
137142
icarus_block_num = []
138143
for subdir in os.listdir(icarus_folder_path):
@@ -145,8 +150,7 @@ def multi_link_attack():
145150
icarus_block_num.append(values[0])
146151
number_blocks_icarus.append(int(sum(icarus_block_num) / len(icarus_block_num)))
147152

148-
output_file = 'data/' + cons_name + '_icarus/results/' + str(
149-
target_affected_traffic[2]) + '_number_blocks_icarus.txt'
153+
output_file = os.path.join("data", f"{cons_name}_icarus", "results", f"{target_affected_traffic[2]}_number_blocks_icarus.txt")
150154
with open(output_file, 'w') as file:
151155
for i in range(len(ratios)):
152156
file.write(str(round(1 - ratios[i], 1)) + ": " + str(number_blocks_icarus[i]) + '\n')

samples/attack/ICARUS/single_link.py

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,37 @@
1111
from src.constellation_generation.by_duration.constellation_configuration import constellation_configuration
1212
import src.XML_constellation.constellation_attack.attack_plugin_manager as attack_plugin_manager
1313
import numpy as np
14+
import os
1415

1516

1617
def gather_delay(cons_name, src_lat, src_lon, dst_lat, dst_lon, link_num, rate, duration):
1718
ori_delay = []
1819
load_delay = []
19-
file_path = "data/" + cons_name + "_icarus/single_link_attack/" + str(link_num * rate) + "_" + str(src_lat) \
20-
+ "_" + str(src_lon) + "_" + str(dst_lat) + "_" + str(dst_lon)
20+
file_path = os.path.join(
21+
"data", f"{cons_name}_icarus", "single_link_attack",
22+
f"{link_num * rate}_{src_lat}_{src_lon}_{dst_lat}_{dst_lon}"
23+
)
2124

2225
for t in range(1, duration + 1):
23-
path = file_path + "/" + str(t)
24-
ori = np.loadtxt(path + '/ori_delay.txt')
26+
path = os.path.join(file_path, str(t))
27+
28+
ori = np.loadtxt(os.path.join(path, 'ori_delay.txt'))
2529
ori = float(ori)
2630
if ori > 1:
2731
ori = 1
2832
ori_delay.append(ori)
2933

30-
load = np.loadtxt(path + '/load_delay.txt')
34+
load = np.loadtxt(os.path.join(path, 'load_delay.txt'))
3135
load = float(load)
3236
if load > 1:
3337
load = 1
3438
load_delay.append(load)
3539

3640
ori_delay = np.array(ori_delay)
37-
np.savetxt(file_path + '/attack_delays.txt', ori_delay, fmt='%.3f')
41+
np.savetxt(os.path.join(file_path, 'attack_delays.txt'), ori_delay, fmt='%.3f')
3842

3943
load_delay = np.array(load_delay)
40-
np.savetxt(file_path + '/load_delays.txt', load_delay, fmt='%.3f')
44+
np.savetxt(os.path.join(file_path, 'load_delays.txt'), load_delay, fmt='%.3f')
4145

4246

4347
def gather_throughput(cons_name, src_lat, src_lon, dst_lat, dst_lon, link_num, rate, duration, capacity):
@@ -46,19 +50,21 @@ def gather_throughput(cons_name, src_lat, src_lon, dst_lat, dst_lon, link_num, r
4650
load_traffics = []
4751
attack_left_traffics = []
4852
load_left_traffics = []
49-
file_path = "data/" + cons_name + "_icarus/single_link_attack/" + str(link_num * rate) + "_" + str(src_lat) \
50-
+ "_" + str(src_lon) + "_" + str(dst_lat) + "_" + str(dst_lon)
53+
file_path = os.path.join(
54+
"data", f"{cons_name}_icarus", "single_link_attack",
55+
f"{link_num * rate}_{src_lat}_{src_lon}_{dst_lat}_{dst_lon}"
56+
)
5157

5258
for t in range(1, duration + 1):
53-
path = file_path + "/" + str(t)
59+
path = os.path.join(file_path, str(t))
5460

55-
ori_traffic = np.loadtxt(path + '/origin_path_traffic.txt')
61+
ori_traffic = np.loadtxt(os.path.join(path, 'origin_path_traffic.txt'))
5662
ori_traffic = list(map(int, ori_traffic))
5763
ori_traffic = ori_traffic[1:-1]
5864
max_traffic = max(ori_traffic)
5965
ori_traffics.append(max_traffic)
6066

61-
attack_traffic = np.loadtxt(path + '/attack_path_traffic.txt')
67+
attack_traffic = np.loadtxt(os.path.join(path, 'attack_path_traffic.txt'))
6268
attack_traffic = list(map(int, attack_traffic))
6369
attack_traffic = attack_traffic[1:-1]
6470
max_traffic = max(attack_traffic)
@@ -67,7 +73,7 @@ def gather_throughput(cons_name, src_lat, src_lon, dst_lat, dst_lon, link_num, r
6773
attack_traffics.append(max_traffic)
6874
attack_left_traffics.append(capacity - max_traffic)
6975

70-
load_traffic = np.loadtxt(path + '/load_path_traffic.txt')
76+
load_traffic = np.loadtxt(os.path.join(path, 'load_path_traffic.txt'))
7177
load_traffic = list(map(int, load_traffic))
7278
load_traffic = load_traffic[1:-1]
7379
max_traffic = max(load_traffic)
@@ -77,15 +83,19 @@ def gather_throughput(cons_name, src_lat, src_lon, dst_lat, dst_lon, link_num, r
7783
load_left_traffics.append(capacity - max_traffic)
7884

7985
ori_traffics = np.array(ori_traffics)
80-
np.savetxt(file_path + '/origin_traffics.txt', ori_traffics, fmt='%d')
86+
np.savetxt(os.path.join(file_path, 'origin_traffics.txt'), ori_traffics, fmt='%d')
87+
8188
attack_traffics = np.array(attack_traffics)
82-
np.savetxt(file_path + '/attack_traffics.txt', attack_traffics, fmt='%d')
89+
np.savetxt(os.path.join(file_path, 'attack_traffics.txt'), attack_traffics, fmt='%d')
90+
8391
load_traffics = np.array(load_traffics)
84-
np.savetxt(file_path + '/load_traffics.txt', load_traffics, fmt='%d')
92+
np.savetxt(os.path.join(file_path, 'load_traffics.txt'), load_traffics, fmt='%d')
93+
8594
attack_left_traffics = np.array(attack_left_traffics)
86-
np.savetxt(file_path + '/attack_left_traffics.txt', attack_left_traffics, fmt='%d')
95+
np.savetxt(os.path.join(file_path, 'attack_left_traffics.txt'), attack_left_traffics, fmt='%d')
96+
8797
load_left_traffics = np.array(load_left_traffics)
88-
np.savetxt(file_path + '/load_left_traffics.txt', load_left_traffics, fmt='%d')
98+
np.savetxt(os.path.join(file_path, 'load_left_traffics.txt'), load_left_traffics, fmt='%d')
8999

90100

91101
def single_link_attack():

samples/attack/StarMelt/energy_drain.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import src.XML_constellation.constellation_traffic.traffic_plugin_manager as traffic_plugin_manager
1212
import src.XML_constellation.constellation_attack.attack_plugin_manager as attack_plugin_manager
1313
import numpy as np
14+
import os
1415

1516
def energy_drain():
1617
duration = 5731
@@ -42,22 +43,22 @@ def energy_drain():
4243
addbase_ori_laser_energy = [0] * 1584
4344

4445
for t in range(1, time_slot + 1):
45-
path = "data/" + cons_name + "_energy_drain/energy_" + str(bot_num) + '/' + str(t)
46-
attack_laser = np.loadtxt(path + '/attack_laser_energy.txt')
46+
path = os.path.join("data", f"{cons_name}_energy_drain", f"energy_{bot_num}", str(t))
47+
attack_laser = np.loadtxt(os.path.join(path, 'attack_laser_energy.txt'))
4748
attack_laser = list(map(int, attack_laser))
48-
attack_radio = np.loadtxt(path + '/attack_radio_energy.txt')
49+
attack_radio = np.loadtxt(os.path.join(path, 'attack_radio_energy.txt'))
4950
attack_radio = list(map(int, attack_radio))
50-
attack_all_radio_energy = np.loadtxt(path + '/attack_all_radio_energy.txt')
51+
attack_all_radio_energy = np.loadtxt(os.path.join(path, 'attack_all_radio_energy.txt'))
5152
attack_all_radio_energy = list(map(int, attack_all_radio_energy))
52-
attack_all_laser_energy = np.loadtxt(path + '/attack_all_laser_energy.txt')
53+
attack_all_laser_energy = np.loadtxt(os.path.join(path, 'attack_all_laser_energy.txt'))
5354
attack_all_laser_energy = list(map(int, attack_all_laser_energy))
54-
ori_laser = np.loadtxt(path + '/ori_laser_energy.txt')
55+
ori_laser = np.loadtxt(os.path.join(path, 'ori_laser_energy.txt'))
5556
ori_laser = list(map(int, ori_laser))
56-
ori_radio = np.loadtxt(path + '/ori_radio_energy.txt')
57+
ori_radio = np.loadtxt(os.path.join(path, 'ori_radio_energy.txt'))
5758
ori_radio = list(map(int, ori_radio))
58-
ori_all_radio_energy = np.loadtxt(path + '/ori_all_radio_energy.txt')
59+
ori_all_radio_energy = np.loadtxt(os.path.join(path, 'ori_all_radio_energy.txt'))
5960
ori_all_radio_energy = list(map(int, ori_all_radio_energy))
60-
ori_all_laser_energy = np.loadtxt(path + '/ori_all_laser_energy.txt')
61+
ori_all_laser_energy = np.loadtxt(os.path.join(path, 'ori_all_laser_energy.txt'))
6162
ori_all_laser_energy = list(map(int, ori_all_laser_energy))
6263

6364
for sat in range(1584):
@@ -70,21 +71,21 @@ def energy_drain():
7071
addbase_ori_radio_energy[sat] += ori_all_radio_energy[sat]
7172
addbase_ori_laser_energy[sat] += ori_all_laser_energy[sat]
7273

73-
path = "data/" + cons_name + "_energy_drain/energy_" + str(bot_num)
74+
path = os.path.join("data", f"{cons_name}_energy_drain", f"energy_{bot_num}")
7475
ori_radio_energy = np.array(ori_radio_energy)
75-
np.savetxt(path + '/all_ori_radio_energy.txt', ori_radio_energy, fmt='%.3f')
76+
np.savetxt(os.path.join(path, 'all_ori_radio_energy.txt'), ori_radio_energy, fmt='%.3f')
7677
ori_laser_energy = np.array(ori_laser_energy)
77-
np.savetxt(path + '/all_ori_laser_energy.txt', ori_laser_energy, fmt='%.3f')
78+
np.savetxt(os.path.join(path, 'all_ori_laser_energy.txt'), ori_laser_energy, fmt='%.3f')
7879
attack_radio_energy = np.array(attack_radio_energy)
79-
np.savetxt(path + '/all_attack_radio_energy.txt', attack_radio_energy, fmt='%.3f')
80+
np.savetxt(os.path.join(path, 'all_attack_radio_energy.txt'), attack_radio_energy, fmt='%.3f')
8081
attack_laser_energy = np.array(attack_laser_energy)
81-
np.savetxt(path + '/all_attack_laser_energy.txt', attack_laser_energy, fmt='%.3f')
82+
np.savetxt(os.path.join(path, 'all_attack_laser_energy.txt'), attack_laser_energy, fmt='%.3f')
8283
addbase_attack_radio_energy = np.array(addbase_attack_radio_energy)
83-
np.savetxt(path + '/addbase_attack_radio_energy.txt', addbase_attack_radio_energy, fmt='%.3f')
84+
np.savetxt(os.path.join(path, 'addbase_attack_radio_energy.txt'), addbase_attack_radio_energy, fmt='%.3f')
8485
addbase_attack_laser_energy = np.array(addbase_attack_laser_energy)
85-
np.savetxt(path + '/addbase_attack_laser_energy.txt', addbase_attack_laser_energy, fmt='%.3f')
86+
np.savetxt(os.path.join(path, 'addbase_attack_laser_energy.txt'), addbase_attack_laser_energy, fmt='%.3f')
8687
addbase_ori_radio_energy = np.array(addbase_ori_radio_energy)
87-
np.savetxt(path + '/addbase_ori_radio_energy.txt', addbase_ori_radio_energy, fmt='%.3f')
88+
np.savetxt(os.path.join(path, 'addbase_ori_radio_energy.txt'), addbase_ori_radio_energy, fmt='%.3f')
8889
addbase_ori_laser_energy = np.array(addbase_ori_laser_energy)
89-
np.savetxt(path + '/addbase_ori_laser_energy.txt', addbase_ori_laser_energy, fmt='%.3f')
90+
np.savetxt(os.path.join(path, 'addbase_ori_laser_energy.txt'), addbase_ori_laser_energy, fmt='%.3f')
9091

Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)