Deutsch English Français Italiano |
<v8nmtm$3neof$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: vallor <vallor@cultnix.org> Newsgroups: comp.lang.misc,alt.comp.lang.rust Subject: Re: Converted my Go program to Rust Date: Sun, 4 Aug 2024 10:59:02 -0000 (UTC) Organization: A noiseless patient Spider Lines: 66 Message-ID: <v8nmtm$3neof$1@dont-email.me> References: <v8h1ct$1fe39$1@matrix.hispagatos.org> <v8h4gn$2e5g0$3@dont-email.me> <v8hd1g$1fk30$1@matrix.hispagatos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 04 Aug 2024 12:59:03 +0200 (CEST) Injection-Info: dont-email.me; posting-host="313bcd881188dc1d599373ae554c1687"; logging-data="3914511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hjwYw95MrhSQySTSWct97" User-Agent: Pan/0.159 (Vovchansk; 26ff567; Linux-6.11.0-rc1) Cancel-Lock: sha1:fI/swCsK5QKCj52R2h6uHtDo/q4= X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ Bytes: 3713 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