Crates.io | get_local_info |
lib.rs | get_local_info |
version | 0.2.4 |
source | src |
created_at | 2023-12-28 08:15:04.867302 |
updated_at | 2024-01-15 09:26:13.725161 |
description | Getlocalinfo is a Rust crate that obtains local information |
homepage | https://github.com/daijianshusheng/rs_libGetDeviceInfo |
repository | https://github.com/daijianshusheng/rs_libGetDeviceInfo |
max_upload_size | |
id | 1082241 |
size | 18,730 |
1.Network function
1.1 Obtain network interface information
1.2 Obtain activity network card information:
2.Get system version
3.System function
4.Security information detection
5.File Info
extra features
1.cargo add get_local_info
2.Import into your project
extern crate get_local_info;
fn main() {
println!("{}", get_local_info::get_pc_net_card_name());
println!("{}", get_local_info::get_pc_ipv4());
println!("{}", get_local_info::get_pc_ipv6());
println!("{}", get_local_info::get_pc_mac());
println!("{:?}", get_local_info::get_pc_net_card_info());
// osname: ubuntu or uos or kylin
let osname = "uos";
println!("{}", get_local_info::get_pc_system_ver(osname));
//check proccess name
let pname = "gnome";
println!("{}", get_local_info::get_pc_system_check_pname(pname));
// flase is Real machine, true is vm
println!("Running in VM:{}", get_local_info::get_pc_system_is_vm());
// true is multi os
println!("multi os:{}", get_local_info::get_pc_system_is_d_sys());
// Obtain the update time of the antivirus database
let antiname = "topsec";
println!("virus lib time:{}", get_local_info::get_pc_check_antiviruslib(antiname));
//find_peak_element
let nums = [1];
println!("{}", get_local_info::alg::find_peak_element(nums.to_vec()));
//Traverse all files in the specified directory
let idir = "/opt";
println!("files:{:?}", get_local_info::get_dir_filename(idir));
let uri = "https://api.ipify.org/?format=text";
println!("wai wang ip:{}", get_local_info::network::get_ww_ipv4(uri));
let hostname = "www.baidu.com";
let parse_ip = get_local_info::network::get_domain_ip(hostname);
println!("domain parse_ip:{:?}",parse_ip);
}