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

rita returns "error: -13" when the next program in a pipeline closes and it can't write a line of output. #803

Open
william-stearns opened this issue Jun 8, 2023 · 0 comments

Comments

@william-stearns
Copy link
Contributor

william-stearns commented Jun 8, 2023

when piping rita command to grep or any other command, get some bug

What error message do you get? Is it something about pipe error or some issue about writing? Does the error go away if you put “| tac | tac |” in between the Rita command and the next command in the pipeline?

rita show-beacons-sni -H dnscat2-ja3 | grep 10.55.100.111 | head -5
Creating achunter_api_run ... done
| 0.995 | 10.55.100.111 | tile-service.weather.microsoft.com | 48 | 5128 | 246155 | 1 | 0.998 | 0.979 | 1 | 1800 |
| 0.995 | 10.55.100.111 | cdn.content.prod.cms.msn.com | 48 | 2154 | 103411 | 1 | 0.998 | 0.98 | 1 | 1800 |
| 0.994 | 10.55.100.111 | cdn.onenote.net | 47 | 7743 | 363957 | 1 | 0.996 | 0.98 | 1 | 1800 |
| 0.992 | 10.55.100.111 | v10.vortex-win.data.microsoft.com | 68 | 6889 | 468457 | 1 | 0.988 | 0.98 | 1 | 1800 |
| 0.946 | 10.55.100.111 | p.rfihub.com | 32 | 6464 | 206851 | 0.827 | 0.984 | 0.973 | 1 | 1 |
ERROR: -13

And the ERROR -13 disapeared when i do “| tac | tac |”

I believe this is an issue that shows up when you have a pipeline where one of the commands after the first (in this case "head -5") finishes before the first does ("rita..."). When head closes, it closes the connection to "grep", so grep can no longer write to its output, and grep closes. Likewise, the connection between grep and rita closes. After that happens, rita tries to write to that connection and the write fails; rita doesn't understand why and spits out a cryptic "Error -13". The "tac" command reverses all the lines, so it must read all of rita's output before sending anything on to grep. By using "| tac | tac |" in the middle you pull in all the lines, reversing them twice, so they end up identical to the original. That buffering means that rita has a chance to generate all its output before anything arrives at grep or head, so rita never has to complain about it's output being unexpectedly closed. In short - this is a cosmetic error only because rita's confused about why its output handle closes during mid-write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant