1
0

some renaming, and adding chatgpt readme

This commit is contained in:
2024-12-31 13:28:54 +01:00
parent b736875510
commit ed4e83a0d2
3 changed files with 182 additions and 9 deletions

View File

@ -3,18 +3,18 @@ use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "martillo_maldito", about = "A IPTables wrapper")]
pub enum Cli {
#[structopt(about = "List all banned ips")]
#[structopt(about = "Get all banned ips")]
GetBannedIps {
#[structopt(name = "Docker", short = "d", long = "docker")]
docker: bool,
},
#[structopt(about = "List all secured ports")]
ListSecuredPorts {
#[structopt(about = "Get all secured ports")]
GetSecuredPorts {
#[structopt(name = "Docker", short = "d", long = "docker")]
docker: bool,
},
#[structopt(about = "Map secured ports to allowed ips")]
MapSecuredPortsAllowedIps {
#[structopt(about = "Get all secured ports with allowed ips")]
GetSecuredPortsWithAllowedIps {
#[structopt(name = "Docker", short = "d", long = "docker")]
docker: bool,
},
@ -41,7 +41,7 @@ pub enum Cli {
#[structopt(name = "Docker", short = "d", long = "docker")]
docker: bool,
},
#[structopt(about = "Allow an IP for port")]
#[structopt(about = "Allow an IP for a port")]
AllowIpForPort {
#[structopt(name = "IP to allow", short = "i", long = "ip")]
ip: String,
@ -61,6 +61,6 @@ pub enum Cli {
#[structopt(name = "Docker", short = "d", long = "docker")]
docker: bool,
},
#[structopt(about = "Saves the configuration")]
#[structopt(about = "Saves the rules")]
SaveRules,
}

View File

@ -10,11 +10,11 @@ fn main() {
let banned_ips = MartilloMaldito::ipv4(docker).get_banned_ips();
println!("{}", serde_json::to_string(&banned_ips).unwrap());
}
Cli::ListSecuredPorts { docker } => {
Cli::GetSecuredPorts { docker } => {
let secured_ports = MartilloMaldito::ipv4(docker).get_secured_ports();
println!("{}", serde_json::to_string(&secured_ports).unwrap());
}
Cli::MapSecuredPortsAllowedIps { docker } => {
Cli::GetSecuredPortsWithAllowedIps { docker } => {
let secured_ports_with_allowed_ips =
MartilloMaldito::ipv4(docker).get_secured_ports_with_allowed_ips();
println!(