Mazars-Tech / AD_Miner

AD Miner is an Active Directory audit tool that leverages cypher queries to crunch data from the #Bloodhound graph database to uncover security weaknesses
GNU General Public License v3.0
1.01k stars 103 forks source link

rendered html pages with a '/' in name fail to render #140

Closed mti-pwc closed 1 month ago

mti-pwc commented 1 month ago

I run AD_Miner on Windows and everything works, except i got this error and the app stops completely

description: error while running AD_Miner:

[+]Requests finished !
[+]Computing domains objects
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python310\scripts\AD-miner.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python310\lib\site-packages\ad_miner\__main__.py", line 182, in main
    domains = Domains(arguments, neo4j)
  File "C:\Program Files\Python310\lib\site-packages\ad_miner\sources\modules\domains.py", line 255, in __init__
    self.generatePathToOUHandlers(self)
  File "C:\Program Files\Python310\lib\site-packages\ad_miner\sources\modules\domains.py", line 1463, in generatePathToOUHandlers
    inbound_list_page.render()
  File "C:\Program Files\Python310\lib\site-packages\ad_miner\sources\modules\page_class.py", line 38, in render
    with open(
FileNotFoundError: [Errno 2] No such file or directory: './render_test/html/path_objects_to_ou_handlers_inbound_list_WINDOWS 10/11@LOCAL.comany.html'

I changed the source of pageclass.py on line 39 to `"./render%s/html/%s" % (self.renderprefix, (self.name.replace(sep, '')).replace('/', '-')), "w", encoding='utf-8'`

this will replace the '/' with '-' in the title and the code runs successfully now.. not sure if this fix is handled correctly, but it works for me

jmbesnard commented 1 month ago

Hi,

thanks for spotting and reporting this. Not the first time we come across this bug but it was apparently reintroduced in this control. We will fix this in dev and it will hit main on the next release.

snowpeacock commented 1 month ago

Hello @mti-pwc,

Thanks for reporting this. There is indeed a bug, with a different behaviour on windows and on linux machines. You will be able to generate a report with your fix but I believe it will create broken links in this page : html/graph_path_objects_to_ou_handlers.html

We will push a fix soon

snowpeacock commented 1 month ago

Hello again,

141 should fix your bug and will hopefully not generate broken links