Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-u When scanning some sites, there may be a problem with output without line breaks. #5122

Open
King-Mr opened this issue Apr 30, 2024 · 7 comments
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@King-Mr
Copy link

King-Mr commented Apr 30, 2024

When I use the -u parameter to scan a single site, I will find that the output of some sites does not wrap.

n1
n2

@King-Mr King-Mr added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Apr 30, 2024
@King-Mr
Copy link
Author

King-Mr commented Apr 30, 2024

I'm not sure if it has something to do with the odd-even character length. When I executed a scan task and the output was abnormal, I ended the task and re-executed it, and added an extra space to the command. Miraculously, the output was normal this time.
n3
n4

@reewardius
Copy link

Same issue

Platform:

image

Nuclei version:

[INF] Nuclei Engine Version: v3.2.1

Output:

image

@King-Mr
Copy link
Author

King-Mr commented Apr 30, 2024

Same issue

Platform:

image

Nuclei version:

[INF] Nuclei Engine Version: v3.2.1

Output:

image

My system version is 10.0.22631.3447. I am not sure whether this is a problem with the Windows system or with Nuclei. I tried running nuclei on other windows computers and there was no such problem.

@zadjii-msft
Copy link

In microsoft/terminal#17159 @King-Mr helped confirm that this isn't exclusive to the Windows Terminal, but also repros in conhost.exe too.

This looks to me like either a newline mode not being set right, or someone only emitting \n and not \r\n, or something like that. Note how each line starts directly below the end of the previous one. That's a telltale sign of doing a \n (newline, to move the cursor down a line), without the \r (carriage-return, to move the cursor to the start of the row). That's usually something that should be handled by a lower-level console handling / logging lib, rather than any code you'd write yourself. Admittedly, I don't know enough about how this project works to be able to be more help - just trying to share some console expertise ☺️

@King-Mr
Copy link
Author

King-Mr commented Apr 30, 2024

In microsoft/terminal#17159 @King-Mr helped confirm that this isn't exclusive to the Windows Terminal, but also repros in conhost.exe too.

This looks to me like either a newline mode not being set right, or someone only emitting \n and not \r\n, or something like that. Note how each line starts directly below the end of the previous one. That's a telltale sign of doing a \n (newline, to move the cursor down a line), without the \r (carriage-return, to move the cursor to the start of the row). That's usually something that should be handled by a lower-level console handling / logging lib, rather than any code you'd write yourself. Admittedly, I don't know enough about how this project works to be able to be more help - just trying to share some console expertise ☺️

Thank you for sharing, but I don't understand why everyone would have this problem if it's the situation you described. But it seems that only a very small number of people have this problem. And in my test, it seems to be related to the number of characters in the command line. It seems that when the output is abnormal at a certain time, the same command with a space will output normally.

@j4james
Copy link

j4james commented Apr 30, 2024

I may be completely wrong, but my guess would be that this has something to do with pipes (assuming you're using something like that).

The first program in the pipeline sets some console modes, outputs some content, and then resets the modes back to what they were initially. But part way through that process, the second program starts reading the first one's output, and does its own thing with the content before writing it out again. If the first program ends while the second is still busy, the second one may find itself using console modes that it wasn't expecting.

The exact behavior may depend on things like buffer size, and the load on the system, so that might explain why you don't always see the problem, and it doesn't affect everyone. But note the one screenshot above where the logo is fine, and the first two warnings are fine, and it's only from the third warning onwards that the linefeeds are wrong. The break at that point could be explained by the first program in the pipeline having just closed.

Again this is just a theory, and I'm not positive I've got my facts right regarding Windows console modes in a pipeline, but it's at least a possible explanation for what you're seeing here.

@iknek
Copy link

iknek commented May 14, 2024

I wanted to chip in and say I am not using pipes, but am experiencing the same issue, on Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

5 participants