From 23b5d00df5c378522d85bd2521e5fcd49d04cf31 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Fri, 13 Dec 2024 10:24:51 +0000 Subject: [PATCH] chore: initialise Go rewrite --- go.mod | 3 +++ justfile | 2 -- nurse/Cargo.lock | 16 ---------------- nurse/Cargo.toml | 14 -------------- nurse/LICENSE | 21 --------------------- nurse/README.md | 7 ------- nurse/src/main.rs | 28 ---------------------------- shell.nix | 11 ----------- 8 files changed, 3 insertions(+), 99 deletions(-) create mode 100644 go.mod delete mode 100644 justfile delete mode 100644 nurse/Cargo.lock delete mode 100644 nurse/Cargo.toml delete mode 100644 nurse/LICENSE delete mode 100644 nurse/README.md delete mode 100644 nurse/src/main.rs delete mode 100644 shell.nix diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..52f0fb7 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module devraza/sage + +go 1.23.3 diff --git a/justfile b/justfile deleted file mode 100644 index fbd617c..0000000 --- a/justfile +++ /dev/null @@ -1,2 +0,0 @@ -run: - nix-shell --command "cd nurse && cargo run" diff --git a/nurse/Cargo.lock b/nurse/Cargo.lock deleted file mode 100644 index 7116db2..0000000 --- a/nurse/Cargo.lock +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "owo-colors" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" - -[[package]] -name = "sage" -version = "0.1.0" -dependencies = [ - "owo-colors", -] diff --git a/nurse/Cargo.toml b/nurse/Cargo.toml deleted file mode 100644 index 8b61a68..0000000 --- a/nurse/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "sage" -version = "0.1.0" -edition = "2021" - -[dependencies] -owo-colors = "4.0.0" - -[profile.release] -strip = true # Strip debug symbols -opt-level = "z" # Optimise for size -lto = true # Enable link type optimisation -codegen-units = 1 # Reduce parallel code generation units -panic = "abort" # Abort on panic! diff --git a/nurse/LICENSE b/nurse/LICENSE deleted file mode 100644 index 7c11ef2..0000000 --- a/nurse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Muhammad Nauman Raza - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/nurse/README.md b/nurse/README.md deleted file mode 100644 index 2b4c426..0000000 --- a/nurse/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# sage - -A collection of utilities for home labs. - -## Dependencies -You'll need the following installed for `sage` to function properly -- netcat (`nc`) diff --git a/nurse/src/main.rs b/nurse/src/main.rs deleted file mode 100644 index 3b204ee..0000000 --- a/nurse/src/main.rs +++ /dev/null @@ -1,28 +0,0 @@ -use owo_colors::OwoColorize; -use std::fs; -use std::process::Command; - -fn main() -> std::io::Result<()> { - let file: Vec = fs::read_to_string("../nurse.txt") - .unwrap() - .lines() - .map(String::from) - .collect(); - - for port in &file[1..file.len()] { - let netcat = Command::new("nc") - .arg("-vz") - .arg(&file[0]) - .arg(port) - .output()?; - - let splitted = std::str::from_utf8(&netcat.stderr[..]).unwrap().split(" "); - let collection = &splitted.collect::>(); - if collection[7] == "succeeded!\n" { - println!("{} {} {}", "✓".green(), collection[2], collection[4]); - } else { - println!("{} {} {}", "✕".red(), collection[3], collection[6]); - } - } - Ok(()) -} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 439ef82..0000000 --- a/shell.nix +++ /dev/null @@ -1,11 +0,0 @@ -let - nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05"; - pkgs = import nixpkgs { config = {}; overlays = []; }; -in -pkgs.mkShellNoCC { - packages = with pkgs; [ - hping - tcpdump - netcat - ]; -}