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

Method get_loot_data

utils.py:910–942  ·  view source on GitHub ↗

Get stolen/loot data files

(self)

Source from the content-addressed store, hash-verified

908 return credentials
909
910 def get_loot_data(self):
911 """Get stolen/loot data files"""
912 loot = []
913
914 try:
915 if os.path.exists(self.shared_data.datastolendir):
916 for root, dirs, files in os.walk(self.shared_data.datastolendir):
917 for file in files:
918 if file.lower().endswith('.log'):
919 continue
920 filepath = os.path.join(root, file)
921 try:
922 stat = os.stat(filepath)
923 relative_dir = os.path.relpath(root, self.shared_data.datastolendir)
924 if relative_dir.startswith('..'):
925 virtual_dir = '/data_stolen'
926 else:
927 cleaned = '' if relative_dir in {'.', ''} else relative_dir.replace('\\', '/').strip('/')
928 virtual_dir = f"/data_stolen/{cleaned}" if cleaned else '/data_stolen'
929 virtual_path = f"{virtual_dir.rstrip('/')}/{file}".replace('//', '/')
930 loot.append({
931 'filename': file,
932 'size': self._format_bytes(stat.st_size),
933 'source': os.path.basename(root),
934 'timestamp': self._format_timestamp(stat.st_mtime),
935 'path': virtual_path
936 })
937 except Exception as e:
938 self.logger.error(f"Error reading file {file}: {e}")
939 except Exception as e:
940 self.logger.error(f"Error reading loot directory: {e}")
941
942 return loot
943
944 def get_vulnerability_data(self):
945 """Get vulnerability scan results"""

Callers 2

get_lootFunction · 0.80
handle_loot_requestFunction · 0.80

Calls 4

_format_bytesMethod · 0.95
_format_timestampMethod · 0.95
appendMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected