firmex/bin/detect.ml
2024-08-18 09:10:24 +07:00

28 lines
628 B
OCaml

(** detection module
detect a given file for formats or ISA
*)
open Firmex
open Printf
let try_unarchive (archive : Archive.t) : unit =
printf "archive file=%s type=%s" archive.file archive.typ
let try_detect file =
printf "detect file %s" file
let runner isa file =
if isa then
()
else
(* assume file exists *)
(* check if file is an archive, else try analyze as a firmware
for now, let's use binwalk result
in the future, finding for signatures inside the file
*)
match Archive.from file with
| Some archive -> try_unarchive archive
| None -> try_detect file