Re: Converted my Go program to Rust

Liste des GroupesRevenir à cl misc 
Sujet : Re: Converted my Go program to Rust
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.lang.misc alt.comp.lang.rust
Date : 04. Aug 2024, 12:59:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8nmtm$3neof$1@dont-email.me>
References : 1 2 3
User-Agent : Pan/0.159 (Vovchansk; 26ff567; Linux-6.11.0-rc1)
On Fri, 2 Aug 2024 01:33:36 -0000 (UTC), rek2 hispagatos
<rek2@hispagatos.org.invalid> wrote in
<v8hd1g$1fk30$1@matrix.hispagatos.org>:

On 2024-08-01, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Thu, 1 Aug 2024 22:14:53 -0000 (UTC), rek2 hispagatos wrote:
>
Last year I made a small Go program to automatize some of the first
steps I do when participating on HackTheBox, I decided to migrate it
to rust, this is the result, free software GPLv3
 
https://git.sr.ht/~rek2/rek2htb-rust
>
I assume you are munging the hosts file just so your web client will
pass the right “Host:” header line. There should be easier (i.e. less
intrusive) ways of doing that: for example, in wget you can add the
option “--header="Host: «hostname»"”, and there should be something
similar in whatever HTTP client you are using.
 
Actually I found a couple bugs that I fixed related to ffuf one of them
was missing flag to add the Host header -H "Host: FFUZ.{}.htb" as it was
before it was just passing the site -s other issue was the output,
also I have fixed it.
 
Thanks, I will had read your msg and found out as well even if I had not
noticed it before, so thank you for the reply, good to know someone is
reading.
 
Happy Hacking ReK2

Hello,

I don't know Rust, so your program is a bit of an introduction.

With that in mind, I wonder if this wouldn't be a little bit
better:

 - -%<- cut here - -
--- main.rs~ 2024-08-04 03:44:07.000000000 -0700
+++ main.rs 2024-08-04 03:45:19.824804343 -0700
@@ -106,7 +106,7 @@
     }
 
     // If the entry does not exist, append it to the file using SUPERUSER_CMD
-    let update_hosts_command = format!("echo {} {}.htb | tee -a /etc/hosts", ip_address, box_name);
+    let update_hosts_command = format!("echo {} | tee -a /etc/hosts", entry);
     let mut command = Command::new(SUPERUSER_CMD);
     command
         .arg("sh")
 - -%<- cut here - -

Would that work?  If so, it would let you change the entry format
in "entry" in only one place, if you decide to do so.

(Also, was intrigued by how "let" seems to work, if I understand it correctly.
Will have to take a look at Rust!)

Finally, I've long been disappointed that git doesn't preserve
timestamps on files.  Does anyone know of any discussion about
why that is, and perhaps changing git to have that capability?

[ sorry about not honoring your fu2, my server doesn't seem to
have alt.comp.lang.rust. ]

--
-v

Date Sujet#  Auteur
2 Aug 24 * Converted my Go program to Rust6rek2 hispagatos
2 Aug 24 `* Re: Converted my Go program to Rust5Lawrence D'Oliveiro
2 Aug 24  `* Re: Converted my Go program to Rust4rek2 hispagatos
4 Aug 24   `* Re: Converted my Go program to Rust3vallor
4 Aug 24    +- Re: Converted my Go program to Rust1rek2 hispagatos
5 Aug 24    `- Re: Converted my Go program to Rust1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal