Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-kali-team committed Jul 25, 2023
1 parent e0c8844 commit 1c40a59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions examples/cpe.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use cpe::dictionary::CPEList;
use std::fs::File;
use std::io::BufReader;
use cpe::dictionary::CPEList;
// https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.zip
// https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz
fn main() {
let gz_open_file = File::open("/home/kali-team/IdeaProjects/nvd-rs/official-cpe-dictionary_v2.3.xml.gz").unwrap();
let gz_decoder =flate2::read::GzDecoder::new(gz_open_file);
let gz_open_file =
File::open("/home/kali-team/IdeaProjects/nvd-rs/official-cpe-dictionary_v2.3.xml.gz").unwrap();
let gz_decoder = flate2::read::GzDecoder::new(gz_open_file);
let file = BufReader::new(gz_decoder);
let c: CPEList = quick_xml::de::from_reader(file).unwrap();
// let zip_open_file = File::open("/home/kali-team/IdeaProjects/nvd-rs/cpe.xml").unwrap();
Expand All @@ -15,5 +16,6 @@ fn main() {
// let c: CPEList = quick_xml::de::from_reader(file).unwrap();
for cpe_item in c.cpe_item {
println!("{:#?}", &cpe_item);
break;
}
}
10 changes: 5 additions & 5 deletions examples/cve.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use cve::CVEContainer;
use std::fs::File;
use std::io::BufReader;
use cve::CVEContainer;

// https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.zip
// https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz
// 下载数据
// curl -o- -s -k -v https://nvd.nist.gov/vuln/data-feeds >data-feeds.html
// cat data-feeds.html|grep -Eo '(/feeds/[^"]*\.gz)'|xargs -I % wget -c https://nvd.nist.gov%
fn main() {
let open_file = File::open("/home/kali-team/IdeaProjects/nvd-rs/nvdcve-1.1-recent.json").unwrap();
let file = BufReader::new(open_file);
let c: CVEContainer = serde_json::from_reader(file).unwrap();
println!("{:#?}",c.CVE_data_timestamp);
println!("{:#?}", c.CVE_data_timestamp);
for cve_item in c.CVE_Items {
println!("{:#?}", &cve_item);
break;
Expand Down

0 comments on commit 1c40a59

Please sign in to comment.