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

Download only new hash files #242

Merged
merged 2 commits into from
May 23, 2018
Merged

Download only new hash files #242

merged 2 commits into from
May 23, 2018

Conversation

ktneely
Copy link
Contributor

@ktneely ktneely commented May 4, 2018

Modified the download script so it only downloads newly added hash files from virusshare, in order to conserve bandwidth for both sides.

ktneely added 2 commits May 4, 2018 11:07
Checks the specified directory for previously-downloaded hash files and only downloads new ones, conserving virusshare's bandwidth.
check for existing hashfile downloads
@3c7
Copy link
Contributor

3c7 commented May 5, 2018

Hey @ktneely, can you base your PR on the development branch? That would be cool. Thanks for your contribution.

@3c7 3c7 added category:enhancement Issue is related to an existing feature to improve status:pr-submitted labels May 5, 2018
@nadouani nadouani changed the base branch from master to develop May 9, 2018 12:11
@nadouani
Copy link
Contributor

nadouani commented May 9, 2018

@3c7 I've rebased the PR on develop

do
echo $u
wget https://virusshare.com/$u
if [ -e $1/$u ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

As you've disabled commits for members, I cannot change that line. You have to delete $1/ as the scripts cds into the directory before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The script does cd into $1/, but when I'm checking the file names, the update performs two cut commands, lopping off the directory assigned to $1. A little convoluted, but it makes the comparison easier.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's not what I wanted to say. You cutsomething off, that's right but it only affects the filename, after that you still have that commands:

  • cd $1
  • if [ -e $1/$u ]

That leads to "being in" directory $1 and checks if there's an directory $1 with file $u in it. Or I'm completely blind and oversee something. :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

prior to the cd, the script cuts the full path twice, making u only the file name as pulled from the virusshare website, which it then compares to the filenames in directory $1.

See, e.g. | cut -d\" -f2 | cut -d\/ -f2 in the update as opposed to only cut -d\" -f2 in the original.

The first cuts down to e.g. "hashes/VirusShare_00049.md5", the second lops off the directory on the hosting server and leaves only e.g. "VirusShare_00049.md5", which is then compared to the filename in $1.

@3c7 3c7 merged commit 46d23b7 into TheHive-Project:develop May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:enhancement Issue is related to an existing feature to improve status:pr-submitted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants