Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-12099-788067
SecMonitor-NYUSH-2288
Commits
2acfa487
Commit
2acfa487
authored
2 years ago
by
Curtis Men
Browse files
Options
Download
Patches
Plain Diff
upd: report mechanism
parent
6ed105bb
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
secmonitor-rust/Cargo.toml
+1
-1
secmonitor-rust/Cargo.toml
secmonitor-rust/src/monitor/mod.rs
+5
-3
secmonitor-rust/src/monitor/mod.rs
with
6 additions
and
4 deletions
+6
-4
secmonitor-rust/Cargo.toml
+
1
−
1
View file @
2acfa487
...
@@ -12,5 +12,5 @@ ctrlc = "3.2.2"
...
@@ -12,5 +12,5 @@ ctrlc = "3.2.2"
tokio
=
"1.19.2"
tokio
=
"1.19.2"
lazy_static
=
"1.4.0"
lazy_static
=
"1.4.0"
serde_json
=
"1.0.82"
serde_json
=
"1.0.82"
reqwest
=
{
version
=
"0.11.11"
,
features
=
[
"blocking"
]}
reqwest
=
{
version
=
"0.11.11"
,
features
=
[
"blocking"
,
"json"
]}
clap
=
{
version
=
"3.2.17"
,
features
=
[
"derive"
]
}
clap
=
{
version
=
"3.2.17"
,
features
=
[
"derive"
]
}
This diff is collapsed.
Click to expand it.
secmonitor-rust/src/monitor/mod.rs
+
5
−
3
View file @
2acfa487
...
@@ -134,7 +134,7 @@ pub(crate) fn dump_result() -> Result<(), std::io::Error>{
...
@@ -134,7 +134,7 @@ pub(crate) fn dump_result() -> Result<(), std::io::Error>{
pub
(
crate
)
fn
report_result
(
master_server
:
&
str
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
pub
(
crate
)
fn
report_result
(
master_server
:
&
str
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
let
client
=
reqwest
::
blocking
::
Client
::
new
();
let
client
=
reqwest
::
blocking
::
Client
::
new
();
let
stats
=
match
File
::
open
(
"secmonitor-stats.json"
)
{
/*
let stats = match File::open("secmonitor-stats.json") {
Ok(file) => file,
Ok(file) => file,
Err(_) => {
Err(_) => {
let mut new_file = File::create("secmonitor-stats.json")?;
let mut new_file = File::create("secmonitor-stats.json")?;
...
@@ -142,10 +142,12 @@ pub (crate) fn report_result(master_server: &str) -> Result<(), Box<dyn Error>>{
...
@@ -142,10 +142,12 @@ pub (crate) fn report_result(master_server: &str) -> Result<(), Box<dyn Error>>{
new_file
new_file
}
}
};
};*/
let
mut
report_body
=
HashMap
::
<
String
,
HashMap
<
u32
,
u64
>>
::
new
();
report_body
.insert
(
"data"
.to_string
(),
SYSCALL_COUNTER
.lock
()
.unwrap
()
.clone
());
let
resp
=
client
.post
(
master_server
)
let
resp
=
client
.post
(
master_server
)
.
body
(
stats
)
.
json
(
&
report_body
)
.send
()
?
.send
()
?
.text
()
?
;
.text
()
?
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets