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

Add .md5 extension between URL's filename and its parameters #81

Closed
petiepooo opened this issue Feb 18, 2021 · 1 comment
Closed

Add .md5 extension between URL's filename and its parameters #81

petiepooo opened this issue Feb 18, 2021 · 1 comment

Comments

@petiepooo
Copy link
Contributor

The function below blindly adds a ".md5" to the end of the URL, assuming it has no parameters:

def check_checksum(self, tmp_filename, url):
try:
checksum_url = url + ".md5"

However, some URLs require parameters, like an oinkcode. It makes sense for the filename extension to be after the filename, but before the question mark character that signifies the start of the parameters. Eg. if the URL is hxxps://example.com/download/rules.gz?oinkcode=g1ty0ur0wn the URL for the hash would be hxxps://example.com/download/rules.gz.md5?oinkcode=g1ty0ur0wn

If there are no parameters specified in the URL, then the .md5 extension should be appended to the end as it is.

@jasonish
Copy link
Owner

Great, thanks for the PR. Tested with a Snort registered rule set.

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

No branches or pull requests

2 participants