honoki / bbrf-client

The Bug Bounty Reconnaissance Framework (BBRF) can help you coordinate your reconnaissance workflows across multiple devices
MIT License
613 stars 90 forks source link

enhancement for #84 #91

Closed 0xblackbird closed 2 years ago

0xblackbird commented 2 years ago

I've created a new function for this to not mess up with the other (search_tags). The way this works is it queries couchdb and filters the keys and values needed. It then checks if both of the values and keys are in the tags. If so, it returns the document id. Unsure if this is the most efficient way to do this (I couldn't find a way to implement this via views on couchdb). Please do test the this and see if it works for you, thanks! Have a nice day!

honoki commented 2 years ago

I just realized I overlooked one of the instructions that filters out only matching documents. Apologies!

So that means your code will work in the provided example. (I still think there may be some edge casss where couchdb is tricky.)

My other main concern is performance, as in my previous example the second request takes ~20 seconds. I'm wondering if a client-side implementation will always beat Couchdb's query or if we may need to take some hybrid approach.

Food for thought!

0xblackbird commented 2 years ago

Yeah, I was wondering the same, after hours spent on searching in couchdb docs and just on the internet in general, it doesn't seem that there's a way to do this with couchdb. That's why I thought of using a workaround for this, same steps just like you mentioned. However, you could also go for another approach by sending 2 (or more) different requests to the search_tags view each with a key and value and retrieve these results and individually check if each of the results have the same tags. I guess that this would be more inefficient than this approach.

I also knew from the beginning that it will not be the most efficient way of doing this. But we can always look for other ways of doing this as this is still fairly limited to only match 2 different tags and values.

And as you pointed out, the or operator is indeed easier, you could implement this in the couchdb view like you said by emitting the 2 results of both queries.

honoki commented 2 years ago

Closing this since this is implemented in 1.3.0