Initialize the paths used by the application.
(self)
| 387 | if entry in (default_slug, 'default'): |
| 388 | continue |
| 389 | count += 1 |
| 390 | |
| 391 | logger.info(f"SCANNED_NETWORKS: Calculated count {count} (excluding {default_slug})") |
| 392 | return count |
| 393 | |
| 394 | def initialize_paths(self): |
| 395 | """Initialize the paths used by the application.""" |
| 396 | """Folders paths""" |
| 397 | self.currentdir = os.path.dirname(os.path.abspath(__file__)) |
| 398 | # Directories directly under currentdir |
| 399 | self.configdir = os.path.join(self.currentdir, 'config') |
| 400 | self.datadir = os.path.join(self.currentdir, 'data') |
| 401 | self.actions_dir = os.path.join(self.currentdir, 'actions') |
| 402 | self.webdir = os.path.join(self.currentdir, 'web') |
| 403 | self.resourcesdir = os.path.join(self.currentdir, 'resources') |
| 404 | self.backupbasedir = os.path.join(self.currentdir, 'backup') |
| 405 | # Directories under backupbasedir |
| 406 | self.backupdir = os.path.join(self.backupbasedir, 'backups') |
| 407 | self.upload_dir = os.path.join(self.backupbasedir, 'uploads') |
| 408 | |
| 409 | # Directories under datadir |
| 410 | self.logsdir = os.path.join(self.datadir, 'logs') |
| 411 | self.output_dir = os.path.join(self.datadir, 'output') |
| 412 | self.input_dir = os.path.join(self.datadir, 'input') |
| 413 | # Directories under output_dir |
| 414 | self._default_crackedpwddir = os.path.join(self.output_dir, 'crackedpwd') |
| 415 | self._default_datastolendir = os.path.join(self.output_dir, 'data_stolen') |
| 416 | self.crackedpwddir = self._default_crackedpwddir |
| 417 | self.datastolendir = self._default_datastolendir |
| 418 | self.zombiesdir = os.path.join(self.output_dir, 'zombies') |
| 419 | self._default_vulnerabilities_dir = os.path.join(self.output_dir, 'vulnerabilities') |
| 420 | self._default_scan_results_dir = os.path.join(self.output_dir, "scan_results") |
| 421 | self.vulnerabilities_dir = self._default_vulnerabilities_dir |
| 422 | self.scan_results_dir = self._default_scan_results_dir |
| 423 | # Directories under resourcesdir |
| 424 | self.picdir = os.path.join(self.resourcesdir, 'images') |
| 425 | self.fontdir = os.path.join(self.resourcesdir, 'fonts') |
| 426 | self.commentsdir = os.path.join(self.resourcesdir, 'comments') |
| 427 | # Directories under picdir |
| 428 | self.statuspicdir = os.path.join(self.picdir, 'status') |
| 429 | self.staticpicdir = os.path.join(self.picdir, 'static') |
| 430 | # Directory under input_dir |
| 431 | self.dictionarydir = os.path.join(self.input_dir, "dictionary") |
| 432 | """Files paths""" |
| 433 | # Files directly under configdir |
| 434 | self.shared_config_json = os.path.join(self.configdir, 'shared_config.json') |
| 435 | self.actions_file = os.path.join(self.configdir, 'actions.json') |
| 436 | # Files directly under resourcesdir |
| 437 | self.commentsfile = os.path.join(self.commentsdir, 'comments.json') |
| 438 | # Files directly under datadir |
| 439 | self.netkbfile = os.path.join(self.datadir, "netkb.csv") |
| 440 | self.livestatusfile = os.path.join(self.datadir, 'livestatus.csv') |
| 441 | self.gamification_file = os.path.join(self.datadir, 'gamification.json') |
| 442 | self.pwnagotchi_status_file = os.path.join(self.datadir, 'pwnagotchi_status.json') |
| 443 | # Files directly under vulnerabilities_dir (kept in sync via _update_output_paths) |
| 444 | self.vuln_summary_file = os.path.join(self.vulnerabilities_dir, 'vulnerability_summary.csv') |
| 445 | self.vuln_scan_progress_file = os.path.join(self.vulnerabilities_dir, 'scan_progress.json') |
| 446 | # Files directly under dictionarydir |
no test coverage detected