Export Tables from Access to PostgreSQL
This article describes how to export a table from Access DB to postgresql via excel and python.
In my previous article, Contiki ve Cooja, I described how to set up Cooja to simulate IoT devices on a virtual computer with the Ubuntu 18.04 operating system. With this virtual computer, we will simulate the data transfer of benign and malicious IoT devices and get network information. Of course, we need ” benign ” and ” malicious ” nodes to do this simulation. I explained how to install the framework that D’Hondt et al. (2015) did under the heading D’Hondt’s RPL Framework to obtain these vulnerable nor normal nodes.
In this article, I will explain how we obtain the weak nodes and normal nodes where “Hello Flood”, “Decreased Rank” and “Version Number Increase” attacks will be made from the work done by D’Hondt and others (2015).
In summary, we have two computers.
In this article, I will explain how to create normal and vulnerable nodes on the other computer where D’Hondt’s RPL Framework is installed and transfer these nodes to the computer where Contiki and Cooja are installed.
In the next stages, the data obtained from the simulation with Cooja will be processed and evaluated.
Here’s a video on how to do this.
The following stages are followed to create the vulnerable and normal nodes:
First, a new terminal opens on the other computer where D’Hondt’s RPL Framework is installed. We must be in the folder where D’Hondt’s RPL Framework is, the previously downloaded vagrant file is run and the virtual computer is expected to open.
-cd rpl-attacks/
-vagrant up
An attacks.json file is created inside the ~/Experiments folder.
{
"BASE": {
"simulation": {
"number-motes": 20,
"target": "z1",
"duration": 120,
"area-square-side":500}},
"hello-flood": {
"simulation": {
"title": "Test hello-flood simulation",
"goal": "Create a new simulation",
"root": "echo"},
"malicious": {
"type": "sensor",
"building-blocks": [
"hello-flood"
]}},
"increased-version": {
"simulation": {
"title": "Test increased-version simulation",
"goal": "Create a new simulation",
"root": "echo"
},
"malicious": {
"type": "sensor",
"building-blocks": [
"increased-version"
]
}
},
"decreased-rank": {
"simulation": {
"title": "Test decreased-rank simulation",
"goal": "Create a new simulation",
"root": "echo"
},
"malicious": {
"type": "sensor",
"building-blocks": [
"decreased-rank" ] } } }
3 attacks are defined in the JSON file above. With this file, the framework will be enabled to create 3 folders.
After creating the JSON file inside the ~/Experiments folder, double-click the “RPL Attacks Framework” shortcut on the desktop. A new terminal will open. make_all command creates nodes and other files.
-make_all attacks.json
The simulation creates folders inside the ~/Experiments folder according to the titles specified in the parameters. Within each of these folders, there are “with-malicious” and “without-malicious” folders.
In the “motes” folder within these folders, attack folders and files are created by the framework according to the parameters determined in the attacks.json file.
When the C codes of the nodes in the framework are examined, it will be understood that the following codes are added to the software of IoT devices to create vulnerable nodes:
{
"hello-flood": {
"RPL_CONF_DIS_INTERVAL": 0,
"RPL_CONF_DIS_START_DELAY": 0,
"rpl-timers.c": ["next_dis++;", "next_dis++; int i=0; while (i<20) {i++; dis_output(NULL);}"]
},
"increased-version": {
"rpl-icmp6.c": ["dag->version;", "dag->version++;"]
},
"decreased-rank": {
"RPL_CONF_MIN_HOPRANKINC": 0,
"rpl-private.h": [
["#define RPL_MAX_RANKINC (7 * RPL_MIN_HOPRANKINC)", "#define RPL_MAX_RANKINC 0"],
["#define INFINITE_RANK 0xffff", "#define INFINITE_RANK 256"]
],
"rpl-timers.c": ["rpl_recalculate_ranks();", null]
}
}
Here
Username of the computer with the Cooja simulator: mukiraz
IP address of the computer with the Cooja simulator: 192.168.1.15
The command structure for sending data via SSH is as follows:
scp -r
According to the configuration we have, the following command is used:
-scp -r /home/user/Experiments mukiraz@192.168.1.15: /home/mukiraz/desktop
You can download Experiments folder here:
SHA 256 Sum : eb806bb959430822e5715f2137518285787bbb4fa8dd4fd9553027b108f6ac09
This article describes how to export a table from Access DB to postgresql via excel and python.
In this blog post, the Flooding Attack, Decreased Rank Attack and Version Number Increase Attack in the RPL protocol were trained and detected by “Decision Tree”, “Logistic Regression”, “Random Forest”, “Naive Bayes”, “K Nearest Neighbor” and “Artificial Neural Networks” algorithms.
The test results for the attacks were compared, as a result of the comparison, the Artificial Neural Networks algorithm with an accuracy rate of 97.2% in the detection of Flooding Attacks, the K Nearest Neighbor algorithm with an accuracy rate of 81% in the detection of Version Number Increase Attacks, and the Artificial Neural Networks with an accuracy rate of 58% in the detection of Decreased Rank attacks algorithm has been found to show success.
I continue to share how I did my master’s thesis titled Comparison of Machine Learning Algorithms for the Detection of Vulnerability of RPL-Based IoT Devices, my experiences in this process, and the codes in this thesis in a series of articles on my blog.
So far, I have provided detailed information about the RPL protocol and the attacks that take place in the RPL protocol. Then, I experimented with Flooding Attacks, Version Number Increased Attack, and Decreased Rank Attack, extracting the raw data and making sense of that raw data. I compared the results of experiments with weak knots with statistical methods.
In this section, I will interpret the numerical results of the attacks we detect with machine learning algorithms.