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

Update openvpn configuration parsing #556

Merged
merged 9 commits into from
Mar 14, 2024
Merged

Conversation

Miauwkeru
Copy link
Contributor

@Miauwkeru Miauwkeru linked an issue Feb 27, 2024 that may be closed by this pull request
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 92.53731% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 74.03%. Comparing base (a0c6c9f) to head (7eda0c2).
Report is 1 commits behind head on main.

Files Patch % Lines
dissect/target/plugins/apps/vpn/openvpn.py 92.53% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   74.02%   74.03%   +0.01%     
==========================================
  Files         285      285              
  Lines       23578    23600      +22     
==========================================
+ Hits        17454    17473      +19     
- Misses       6124     6127       +3     
Flag Coverage Δ
unittests 74.03% <92.53%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -228,6 +228,50 @@ def parse_file(self, fh: TextIO) -> None:
self.parsed_data = information_dict


class OpenVPN(Default):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an application specific parser, I'm not sure it belongs in this file. Is there no way to achieve something similar with this being in the openvpn.py file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use that parser directly in that case. I will move it... as it is very specific


def check_compatible(self) -> None:
if not self.configs:
raise UnsupportedPluginError("No OpenVPN configuration files found")

@export(record=[OpenVPNServer, OpenVPNClient])
def config(self) -> Iterator[Union[OpenVPNServer, OpenVPNClient]]:
@arg("--export-key", action="store_true")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm divided on whether this is necessary. Maybe poll this within the (FIR) team?

@@ -15,6 +18,7 @@
("string", "ca"),
("string", "cert"),
("string", "key"),
("boolean", "redacted"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("boolean", "redacted"),
("boolean", "key_redacted"),

Maybe makes it a little bit clearer?

@Miauwkeru Miauwkeru requested a review from Schamper March 11, 2024 08:56
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 92.53731% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 74.53%. Comparing base (a0c6c9f) to head (ba54507).
Report is 10 commits behind head on main.

Files Patch % Lines
dissect/target/plugins/apps/vpn/openvpn.py 92.53% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   74.02%   74.53%   +0.50%     
==========================================
  Files         285      286       +1     
  Lines       23578    23673      +95     
==========================================
+ Hits        17454    17644     +190     
+ Misses       6124     6029      -95     
Flag Coverage Δ
unittests 74.53% <92.53%> (+0.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

from os.path import basename
from typing import Iterator, Union
from itertools import product
from typing import Iterable, Iterator, Union
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from typing import Iterable, Iterator, Union
from typing import Iterable, Iterator, Optional, Union

@Miauwkeru Miauwkeru force-pushed the update-openvpn-configuration branch from 1746a40 to 6b2d528 Compare March 14, 2024 09:54
@Miauwkeru Miauwkeru merged commit 3256046 into main Mar 14, 2024
16 checks passed
@Miauwkeru Miauwkeru deleted the update-openvpn-configuration branch March 14, 2024 11:44
Zawadidone pushed a commit to Zawadidone/dissect.target that referenced this pull request Apr 5, 2024
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.

OpenVPN plugin issues with parsing
3 participants