MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / load_config

Method load_config

shared.py:1521–1550  ·  view source on GitHub ↗

Load the configuration from the shared configuration JSON file.

(self)

Source from the content-addressed store, hash-verified

1519 self._update_gamification_state()
1520 self.save_gamification_data()
1521 logger.info(
1522 f"Awarded {points_awarded} points for {new_mac_count} new MAC address(es). "
1523 f"Level {prev_level} -> {self.levelnbr}"
1524 )
1525
1526 return new_mac_count, points_awarded
1527
1528 def delete_webconsolelog(self):
1529 """Delete the web console log file."""
1530 try:
1531 if os.path.exists(self.webconsolelog):
1532 os.remove(self.webconsolelog)
1533 logger.info(f"Deleted web console log file at {self.webconsolelog}")
1534 #recreate the file
1535
1536 else:
1537 logger.info(f"Web console log file not found at {self.webconsolelog} ...")
1538
1539 except OSError as e:
1540 logger.error(f"OS error occurred while deleting web console log file: {e}")
1541 except Exception as e:
1542 logger.error(f"Unexpected error occurred while deleting web console log file: {e}")
1543
1544 def create_livestatusfile(self):
1545 """Create the live status file, it will be used to store the current status of the scan."""
1546 try:
1547 if not os.path.exists(self.livestatusfile):
1548 with open(self.livestatusfile, 'w', newline='') as csvfile:
1549 csvwriter = csv.writer(csvfile)
1550 csvwriter.writerow(['Total Open Ports', 'Alive Hosts Count', 'All Known Hosts Count', 'Vulnerabilities Count'])
1551 csvwriter.writerow([0, 0, 0, 0])
1552 logger.info(f"Created live status file at {self.livestatusfile}")
1553 else:

Callers 4

__init__Method · 0.95
headlessRagnar.pyFile · 0.80
save_configurationMethod · 0.80
Ragnar.pyFile · 0.80

Calls 9

save_configMethod · 0.95
infoMethod · 0.80
warningMethod · 0.80
errorMethod · 0.80
updateMethod · 0.45
itemsMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected