Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

jbgalet/pyadcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

query.py

Like query.rb, with some improvements

Early stage, tests are welcome

Differences

  • Bolt protocol support
  • Neo4j authentication
  • Faster
  • replacement for info, nodes and path arguments of query.rb are not available yet

Install

Only Python3 is supported

python3 -m pip install -r requirements.txt

Usage

Usage: query.py [OPTIONS] COMMAND [ARGS]...

Options:
  --lang TEXT          Language to use
  --maxdepth INTEGER   maximum length for control paths
  --neo4j TEXT         neo4j connection URI
  --workdir DIRECTORY  Root of ADCP dump directory
  -v, --verbose        Increase verbosity (add more to increase)
  -o, --options TEXT   Extra options to tweak behavior
  --noprompt           Disable application prompt (useful for batches)
  --help               Show this message and exit.

Commands:
  full
  graph
  list_aliases
  search
  • lang defaults to en, only en and fr are available
  • neo4j defaults to bolt://localhost
  • maxdepth default to 20 (like query.rb)
  • workdir should be the dump folder named yyyymmdd_domainname
  • options defaults to +deny
    • [+-]deny
      • + produces the full graph with denied nodes (tagged DENY),
      • - remove denied relations and orphan nodes

Commands

  • list_aliases list aliases (like adm_dom or guests)
  • search [needle] return the list of node ids and dn
  • graph [search] [direction] [outfile] produces the control graph in json format (usable by OVALI)
  • full [outdir] produces all graphs in output directory

Examples

query.rb --quick replacement:

python3 query.py --workdir=[path_to dumps] --neo4j=bolt://user:password@localhost graph adm_dom to dump.json

query.rb --full replacement:

python3 query.py --workdir=[path_to dumps] --neo4j=bolt://user:password@localhost full out

Tests

Some tests are available in the tests folder. They are used by test_adcp.py (unittests).

All of these tests use 100 nodes (TEST_0 to TEST_99)

  • 1
    • The nodes TEST_X* are GROUP_MEMBER of TEST_X
  • 2
    • Same as 1
    • TEST_2 has a control link (STAND_RIGHT_WRITE_DAC) to TEST_1
    • All nodes TEST*7_ have a DENY (STAND_RIGHT_WRITE_DAC) to TEST_1
  • 3
    • Same as 2
    • TEST_3 has a control link (STAND_RIGHT_WRITE_DAC) to TEST_2
    • TEST_4 has a control link (STAND_RIGHT_WRITE_DAC) to TEST_3
  • 4
    • Same as 2
    • All TEST_i have a control link (STAND_RIGHT_WRITE_DAC) to TEST_i+1
    • TEST_9 has a control link (STAND_RIGHT_WRITE_DAC) to TEST_1 (loop)
  • 5
    • Same as 1
    • All TEST_i have 5 control links (STAND_RIGHT_WRITE_DAC, STAND_RIGHT_WRITE_OWNER, WRITE_PROP_ALL, FS_RIGHT_WRITEDATA_ADDFILE, FS_RIGHT_APPENDDATA_ADDSUBDIR) to TEST_i+1 (no loop)
    • All nodes TEST*7_ have a DENY (STAND_RIGHT_WRITE_DAC) to TEST_1
    • All nodes TEST*8_ have 5 DENY (same as control links) to TEST_1

Tests can be loaded manually with tests/load_test.py [load|clean] <test_id> (n.b. the script must be run from the root folder)

About

Potential replacement for query.rb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published