server
├── bat_generator.py # used for data collection
├── collect_data.py # used for data collection
├── evaluation # reproduce the results in paper
├── raw_data # raw data collected from devices
├── readme.md
├── requirements.txt
└── tasks # used for data collection
Before you start collecting data, make sure you have installed the programs in "../../Device-porting" and connected the device to your PC.
If you only want to reproduce the results in the paper, go to the next section.
1.Connect PINs with dupont wire as below:
esp32s2
P5 -- P1
P16 -- P17
P18 -- P19
STM32F103
PA2 -- PB5
STM32F429
PA5 -- PC7
2.Bat generate
$ pip install -r requirements.txt
$ python bat_generator.py --device_number n1 n2 n3 --port COMx1 COMx2 COMx3 --only_sram 1
Replace COMxi
with your serial port number,and ni
is the device number.
3.Run the shell
$ run_get_dataset_*.bat
If you want to collect all types of fingerprints, replace --only_sram 1
with --only_sram 0
.
Python: 3.8
1.Install the requirements.
$ pip install -r requirements.txt
$ cd evaluation
The file tree of "./evaluation" is as below:
evaluation
├── plot # generate tables and figures in the paper
├── picture
├── result # logs used in the paper
├── result_cmp # logs generated by you
├── *.bat # shells for generating logs
├── ...
├── *.py
└── sh_bat_convert.py # a tool for converting shell types
2.Repeat the results in the paper.
We provide the logs used to generate the results in the paper and you can repeat the results without re-running the programs.
Run the python files in "./plot", such as
$ cd plot
$ python Fig-2_plot.py
For table VI, the raw log is an excel and you should read it directly.
3.Generate the logs by yourself.
We provide shells to generate logs, you can run these shells and check if their output is similar or the same as the logs we provide.
For simplify, you can run the shell 0_generate_ref_log.bat
as
# windows
$ call 0_generate_ref_log.bat
# linux
$ sh 0_generate_ref_log.sh
Also, you can generate results as you want, here is an example
# convert shell types
$ python sh_bat_convert.py
# windows
$ call 1_Fig-2.bat
# linux
$ sh 1_Fig-2.sh
# The output is similar to "./result/Fig-2_log"
In the file directory ./result_cmp
there are logs that you have generated, which correspond exactly to those in ./result
.
Some tips:
-
To save your testing time, we reduce our data set, which may result in results that are not exactly the same as the original protocol, but are acceptable. (important)
- The
7_Fig-9* && 8_Fig-10*
shells are very time consuming, you can use the shells we provide to check if the format of the data is correct or not. However, the results may be distorted. You can replace--reduction 1
with--reduction 0
to get results similar to those in the paper and choose--reduction 1
to save your test time. Here we provide8_Fig-10a_partdata.bat
(whose log isFig-10a_log
) as an example.
- The
-
There are some special shells, explained below.
- 5_Tab-4.bat : The filename in
./result/Tab-4_log
corresponds to thesource_device
parameter in the shell.esp32_*
is the result ifsource_device==esp32
,f429_*
corresponds tostm32
andf103_*
corresponds tostm32f103
. - 10_Fig-11.bat: The filename in
./result/Fig-11_log
is formatted asresult_{out_len}_{test_type}
. - 8_Fig-10a_partdata.bat : shells for generating
Fig-10a_log
using part of the results (which can reduce the testing time but impact the results). - 2_Tab-3_*_ensemble : display the results of the last two rows of Table III.
- 5_Tab-4.bat : The filename in
-
If you want to use the full data set for testing, there are parameters we have used.
1_Fig-2: --repeat_time 100 2_Tab-3_*_*: --reduction 0 --repeat_time 400 4_Fig-7*: --repeat_time 400 5_Tab-4: --repeat_time 400 6_Fig-8: --reduction 0 --repeat_time 400 7_Fig-9* && 8_Fig-10*: --reduction 0 --device_number 18 --test_time 1000 9_Tab-5: --reduction 0 10_Fig-11: --test_type 1 # 1/3/12/123 --out_len 5000 # 1000/5000/15000/20000