engine type stored in db

master
JoYo 2022-01-24 13:47:31 -05:00
parent 8cb6a2f393
commit 2ad8d47d3a
2 changed files with 8 additions and 6 deletions

View File

@ -20,12 +20,13 @@ class Disassembly(Base):
arch = Column(String, nullable=False) arch = Column(String, nullable=False)
checksum = Column(String, nullable=False) checksum = Column(String, nullable=False)
count = Column(Integer, nullable=False) count = Column(Integer, nullable=False)
engine = Column(String, nullable=False)
mnemonic_rates = Column(String, nullable=False) mnemonic_rates = Column(String, nullable=False)
ret_rates = Column(String, nullable=False)
size = Column(Integer, nullable=False)
offset = Column(Integer, nullable=False) offset = Column(Integer, nullable=False)
opcodes = Column(String, nullable=False) opcodes = Column(String, nullable=False)
path = Column(String, nullable=False) path = Column(String, nullable=False)
ret_rates = Column(String, nullable=False)
size = Column(Integer, nullable=False)
def __repr__(self): def __repr__(self):
return f"<Disassembly {json.dumps(self.values, indent=1)}>" return f"<Disassembly {json.dumps(self.values, indent=1)}>"
@ -41,11 +42,11 @@ class Disassembly(Base):
values_dict = { values_dict = {
"id": self.id, "id": self.id,
"arch": self.arch, "arch": self.arch,
"engine": self.engine,
"count": self.count, "count": self.count,
"size": self.size,
"mnemonic_rates": self.mnemonic_rates, "mnemonic_rates": self.mnemonic_rates,
"ret_rates": self.ret_rates, "ret_rates": self.ret_rates,
"size": self.size,
"offset": self.offset,
} }
return values_dict return values_dict

View File

@ -95,12 +95,13 @@ def subdisassem_script():
row.arch = disasembler.arch row.arch = disasembler.arch
row.checksum = checksum row.checksum = checksum
row.count = len(disasembler) row.count = len(disasembler)
row.engine = str(arch.__bases__)
row.mnemonic_rates = str(disasembler.mnemonic_rates[:5]) row.mnemonic_rates = str(disasembler.mnemonic_rates[:5])
row.ret_rates = str(disasembler.ret_rates[:5])
row.size = len(raw_bytes) - offset
row.offset = offset row.offset = offset
row.opcodes = disasembler.objdump row.opcodes = disasembler.objdump
row.path = str(args.bin_path.absolute()) row.path = str(args.bin_path.absolute())
row.ret_rates = str(disasembler.ret_rates[:5])
row.size = len(raw_bytes) - offset
session.add(row) session.add(row)
session.commit() session.commit()