MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / run

Method run

Scripts/Developer Base/File Type Checker.py:325–362  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

323 self.warnings.append(f"Quarantine Failed: {e}")
324
325 def run(self):
326 # Size Check: Only if strictly greater than limit, but we set limit to 50GB
327 if self.size > MAX_FILE_SIZE_LIMIT:
328 console.print(f"[red]Skipping {self.filename}: Too massive (>50GB)[/]")
329 return
330
331 sha256 = self.get_hashes()
332 console.print(f"[cyan]>> Analyzing {escape(self.filename)}...[/cyan]")
333
334 self.check_virustotal(sha256)
335 mime, desc = get_file_mime(self.filepath, self.data)
336 entropy = self.calculate_entropy()
337
338 if entropy > 7.4 and "zip" not in mime and "image" not in mime:
339 self.warnings.append(f"High Entropy ({entropy:.2f}): Likely Packed/Encrypted payload.")
340 self.risk_score += 3
341
342 # Run Modules
343 self.analyze_metadata()
344 self.analyze_steganography_overlay(mime)
345 self.analyze_archives()
346 self.analyze_strings()
347 self.analyze_pdf_structure()
348 self.analyze_office_macros()
349 self.analyze_pe_header()
350
351 if any(x in mime for x in ["dosexec", "executable", "x-elf"]):
352 self.risk_score += 5
353 self.warnings.append(f"File is an Executable Binary ({mime})")
354
355 if re.search(r'\.(exe|bat|sh|vbs|apk)\.[a-z]{3}$', self.filename.lower()):
356 self.risk_score += 8
357 self.warnings.append("Double Extension Spoofing Detected")
358
359 if self.risk_score >= QUARANTINE_THRESHOLD:
360 self.quarantine_file()
361
362 self.print_report(sha256, mime, desc, entropy)
363
364 def print_report(self, sha256, mime, desc, entropy):
365 if self.risk_score >= 7:

Callers 15

runFunction · 0.45
ensure_storage_accessFunction · 0.45
handle_av_conversionFunction · 0.45
run_rcFunction · 0.45
runFunction · 0.45
ensure_logged_inFunction · 0.45
delete_repoFunction · 0.45
capture_video_camFunction · 0.45
mainFunction · 0.45
install_dependencyFunction · 0.45

Calls 13

get_hashesMethod · 0.95
check_virustotalMethod · 0.95
calculate_entropyMethod · 0.95
analyze_metadataMethod · 0.95
analyze_archivesMethod · 0.95
analyze_stringsMethod · 0.95
analyze_pdf_structureMethod · 0.95
analyze_office_macrosMethod · 0.95
analyze_pe_headerMethod · 0.95
quarantine_fileMethod · 0.95
print_reportMethod · 0.95

Tested by

no test coverage detected