Sh1Yo/x8

Output is not saved sometimes

Closed this issue · 5 comments

I noticed that the output is not saved to the file from time to time when using --output <file> param (but the discovered query-param is printed to STDOUT). Also this depends on URL being tested. For the provided URL, I noticed that on the second-third run the output file gets empty.

OS: Amazon Linux

Steps to reproduce:

$ ./x8 -u "https://manage.nba.com/wp-login.php" --learn-requests 1  --output temp.txt
urls:         https://manage.nba.com/wp-login.php
methods:      GET
wordlist len: 0

GET https://manage.nba.com/wp-login.php?%s (200) [45359] {0}
[~] The page is not stable (body)
reflects: redirect_to

GET https://manage.nba.com/wp-login.php % redirect_to

$ cat temp.txt 
GET https://manage.nba.com/wp-login.php % redirect_to

$ ./x8 -u "https://manage.nba.com/wp-login.php" --learn-requests 1  --output temp.txt
urls:         https://manage.nba.com/wp-login.php
methods:      GET
wordlist len: 0

GET https://manage.nba.com/wp-login.php?%s (200) [45360] {0}
[~] The page is not stable (body)
reflects: redirect_to

GET https://manage.nba.com/wp-login.php % redirect_to

$ cat temp.txt 
# empty. 
Sh1Yo commented

Hi,

Thanks for the issue, I'll check it. There's also a few questions:

Is it happening for you with every url or only with some of them?
Is it happening when you use unique filenames for the output?

Hi,

It happens with some of URLs. One of such URL I mentioned in the previous message.

I'm rewriting the same existing file. However, I remember seeing the same issue with a fresh new file (there was --output temp.txt, the file didn't exist yet. And when I ran the command, it was created but was empty).

0xAW commented

I seemed to be having the same issue when constructing the request without the url at the end.
i,.e. this was creating a file, but not writing the output.

x8 -w /words/params.txt -u "$url" --append -o output.txt

Converting it to the following worked and wrote output successfully.

x8 -w /words/params.txt --append -o output.txt -u "$url"
Sh1Yo commented

I have some ideas what can it be. I will look into it and return to you

Sh1Yo commented

Apparently, tokio crate didn't flush output despite the used .await (tokio-rs/tokio#5531). I pushed the fix. You can build the fixed version from the sources or wait for a new release.