Giter Site home page Giter Site logo

acceis / bqm Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 4.0 117 KB

Deduplicate custom BloudHound queries from different datasets and merge them in one customqueries.json file.

Home Page: https://acceis.github.io/bqm/

License: MIT License

Ruby 100.00%
bloodhound bloodhound-queries bloodhound-json-files bloodhoundad-cypher-queries

bqm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bqm's Issues

Commandline wishes

Hello @noraj,

thank you for the version 1.4.0 of bqm as we can now merge local files \o/. Well done.

I have some suggestions/whishes in order to address ThePorgs/Exegol-images#163

1/ When starting the Exegol container, we only need to manipulate local files (Exegol's and the user's) and the version 1.4.0 pulls remote files by default. This means that implementing the PR in the current state of bqm still implies to empty temporarily the file query-sets.json as a workaround to disable remote sources. Something we agreed is not a good idea.

Hence my whish: could you add a CLI option to disable the pulling of remote sources ?

2/ Still for the same Exegol PR, rather than setting local files with -i /tmp/a.json,/tmp/b.json, could you support either:

  • -i /tmp/directory -i /tmp/a.json -i /tmp/b.json
  • or -d /tmp/directory -i /tmp/a.json -i /tmp/b.json

This would add support for directories. Bqm could autodetect the .json files in the folders.
In the first case, the folder is included with the argument -i (as of version 1.4.0), second case with a new argument -d. I don't know what you may prefer, these are suggestions, my favorite is the one with -d.

Having an option to include directories means that in Exegol, we would not need to have a wrapper around bqm to detect the files from a folder and dynamically construct the argument to pass to bqm.
Plus, in both cases, I found the comma separator to break bqm if the user's file contains the character ,. This is why I suggest to have support for multiple -d and -i arguments.

3/ To expand a bit my thoughts above the above 1/, I think that bqm could be started a bit differently.

Rather than pulling remote sources by default and optionnally merge them with local files, bqm could start as an empty shell.
Then, the sources are enabled one by one on command-line:

  • -r [data-sets.json]: to pull the remote sources for the optional file data-sets.json. If the switch is set and without a file, then the default dataset file is chosen. I think it may intereset users to set their own data-sets file if they want custom remote sources (for example: a remote file on an intranet).
  • -d <directory>: to include one local set directory.
  • -i <file>: to include one local set file.

All three switches could be set several times, as there could be several remote sources, several directories, and several individual files.

Best

Compass security repos broken.

The compass security repository is broken into data/query-sets.json.

https://raw.githubusercontent.com/CompassSecurity/BloodHoundQueries/master/customqueries.json
need to be replaced by :
https://raw.githubusercontent.com/CompassSecurity/BloodHoundQueries/master/BloodHound_Custom_Queries/customqueries.json

disable remote file pulling

Asked by @gbe in #25

1/ When starting the Exegol container, we only need to manipulate local files (Exegol's and the user's) and the version 1.4.0 pulls remote files by default. This means that implementing the PR in the current state of bqm still implies to empty temporarily the file query-sets.json as a workaround to disable remote sources. Something we agreed is not a good idea.

Hence my whish: could you add a CLI option to disable the pulling of remote sources ?

Add exegol dataset

Add exegol dataset: https://github.com/ThePorgs/Exegol-images/blob/main/sources/bloodhound/customqueries.json

Argument duplicate support and local directory support

Asked by @gbe in #25

2/ Still for the same Exegol PR, rather than setting local files with -i /tmp/a.json,/tmp/b.json, could you support either:

* `-i /tmp/directory -i /tmp/a.json -i /tmp/b.json`

* or `-d /tmp/directory -i /tmp/a.json -i /tmp/b.json`

This would add support for directories. Bqm could autodetect the .json files in the folders. In the first case, the folder is included with the argument -i (as of version 1.4.0), second case with a new argument -d. I don't know what you may prefer, these are suggestions, my favorite is the one with -d.

Having an option to include directories means that in Exegol, we would not need to have a wrapper around bqm to detect the files from a folder and dynamically construct the argument to pass to bqm. Plus, in both cases, I found the comma separator to break bqm if the user's file contains the character ,. This is why I suggest to have support for multiple -d and -i arguments.

Merge with target queries file

@ShutdownRepo suggestion

I think it would be nice to have bqm check if the file indicated in the path already exist, and use it’s content as part of the dataset. This would allow, whether it’s Exegol or somethings else, to always sync with what’s already there locally

  • check if the target file already exists
  • if yes, ask user if it should be included in the merge

Defaults and architecture

Asked by @gbe in #25

3/ To expand a bit my thoughts above the above 1/, I think that bqm could be started a bit differently.

Rather than pulling remote sources by default and optionnally merge them with local files, bqm could start as an empty shell.
Then, the sources are enabled one by one on command-line:

-r [data-sets.json]: to pull the remote sources for the optional file data-sets.json. If the switch is set and without a file, then the default dataset file is chosen. I think it may intereset users to set their own data-sets file if they want custom remote sources (for example: a remote file on an intranet).
-d <directory>: to include one local set directory.
-i <file>: to include one local set file.

All three switches could be set several times, as there could be several remote sources, several directories, and several individual files.

Cannot run in Ubuntu 20.04 with ruby 2.7.0p0

$ ruby bin/bqm -l
[+] Available datasets:
Traceback (most recent call last):
1: from bin/bqm:84:in <main>
bin/bqm:62:in get_datasets: undefined method load_file for JSON:Module (NoMethodError)
$
$ ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.