chore: initialise Go rewrite
This commit is contained in:
parent
90570ab3e1
commit
23b5d00df5
8 changed files with 3 additions and 99 deletions
3
go.mod
Normal file
3
go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module devraza/sage
|
||||
|
||||
go 1.23.3
|
2
justfile
2
justfile
|
@ -1,2 +0,0 @@
|
|||
run:
|
||||
nix-shell --command "cd nurse && cargo run"
|
16
nurse/Cargo.lock
generated
16
nurse/Cargo.lock
generated
|
@ -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",
|
||||
]
|
|
@ -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!
|
|
@ -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.
|
|
@ -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`)
|
|
@ -1,28 +0,0 @@
|
|||
use owo_colors::OwoColorize;
|
||||
use std::fs;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let file: Vec<String> = 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::<Vec<&str>>();
|
||||
if collection[7] == "succeeded!\n" {
|
||||
println!("{} {} {}", "✓".green(), collection[2], collection[4]);
|
||||
} else {
|
||||
println!("{} {} {}", "✕".red(), collection[3], collection[6]);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
11
shell.nix
11
shell.nix
|
@ -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
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue