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

fix: Better success messages for pyrdp-convert #369

Merged
merged 23 commits into from
Jan 6, 2022

Conversation

alxbl
Copy link
Collaborator

@alxbl alxbl commented Oct 27, 2021

While making my other PRs, I noticed that the pyrdp-convert success message was not very consistent, so I wrote a bit of code to make it consistent.

It will print the filename when outputting to the same folder, or the absolute file path if a prefix is specified. For multiple streams, each file will be printed after its conversion.

The way this was done was by exposing the output filename to the RDPReplayer via a property that gets it from the transport layer (either a ConversionLayer or a FileLayer)

We could make this a bit sturdier by having a common base class for both ConversionLayer and FileLayer that enforces the presence of a filename member, but for now both have it, so it works.

@obilodeau
Copy link
Collaborator

Tested this but I stumble upon the same problems as #366. Moving to the next one.

@obilodeau
Copy link
Collaborator

obilodeau commented Dec 29, 2021

Now that #366 is merged. I started to look into this one tonight. Unfortunately, this PR doesn't work with the replay handler because, in it, it says:

TODO: Returning None if the format is replay is kind of janky. This could use a refactor to handle replays and other formats differently.

Since handler is None in that case, then calling .cleanup on it throws an exception.

This should have been caught by tests. I'll rework them to make sure it is.

@obilodeau
Copy link
Collaborator

The error should trigger with tests now. I added nice little JSON tests while we are at it.

The history is a bit of a mess because I pulled this PR in my master back in November so when I pushed back a lot of things went up with it. That said, the GitHub diff is clean so I'm leaving this that way. In any case, I'll probably squash-merge.

@obilodeau
Copy link
Collaborator

Ok, so all errors were swallowed so adding tests didn't help. Now I'm adjusting exit codes but this will make existing tests fail I think. I'll see what I do about that tomorrow. Zzz

@obilodeau
Copy link
Collaborator

Ohh, actually this seems to be exactly what I wanted!

image

Now time to fix that missing handler problem and it is ready for merge.

@obilodeau obilodeau merged commit aaf781f into GoSecure:master Jan 6, 2022
obilodeau added a commit that referenced this pull request Jan 17, 2022
* fix: make conversion success message uniform
* fix: typo in conversion layer sink
* Added pcap to json tests, removed worthless Windows test
* Added CI/CD tests for pyrdp-convert JSON and replay outputs
* pyrdp-convert: Added some exit code propagation on exceptions

Co-authored-by: Olivier Bilodeau <obilodeau@gosecure.net>
Co-authored-by: Alexandre Beaulieu <alex@segfault.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants