xnLinkFinder icon indicating copy to clipboard operation
xnLinkFinder copied to clipboard

Incompatibility with `tee -a` and `>>` when using `-o cli`, and Need for Direct Stream to Output File Without Filtering

Open Nishantbhagat57 opened this issue 7 months ago • 13 comments

Issue

The -o cli option doesn't work properly with tee -a and >>

I am using xnLinkFinder with axiom-scan with 20 fleets/servers. Sometimes, the input file is so large that a full scan can take an entire day. To manage this, I use -o cli | tee -a output.txt so the results are directly streamed to the terminal and appended to a file using tee -a. This allows me to terminate the scan using Ctrl+C if it takes too long while still preserving the partial results.

However, this approach no longer seems to work. The results are not being saved when I use tee -a or >>. I haven't changed my xnLinkFinder axiom module; it worked before. I think that since the last 2-3 updates, it no longer functions as expected—or maybe it never worked, and I hadn't noticed.

Also, I think there should a flag to directly stream/yield/write result to output file without doing filtering when using -o output.txt. This way I can kill axiom-scan and the partial result will still be saved, something is better than nothing. I know if I use xnLinkFinder with -o output.txt flag, the default behavior is to save the partial result if the user interrupts with Ctrl+C. However, this process takes some time and doesn't work with axiom-scan. If a user interrupts axiom-scan with Ctrl+C, it terminates the running module and saves the results to the output file. But xnLinkFinder only saves the output file after the scan is fully completed, or if the user interrupts the program with Ctrl+C.

Example

Normal -o cli Screenshot 2024-07-11 154922

-o cli with tee -a xntest.txt Screenshot 2024-07-11 155033

xntest.txt is empty Screenshot 2024-07-11 155048

@xnl-h4ck3r

Nishantbhagat57 avatar Jul 11 '24 10:07 Nishantbhagat57