results sorting
parent
197aff4402
commit
8640a29b3b
|
@ -49,6 +49,9 @@ class _CapstoneBase:
|
|||
def __len__(self) -> int:
|
||||
return len(self.disassembly)
|
||||
|
||||
def __lt__(self, other):
|
||||
return len(self) < len(other)
|
||||
|
||||
@property
|
||||
def objdump(self) -> str:
|
||||
opcodes = str()
|
||||
|
|
|
@ -28,6 +28,12 @@ class Disassembly(Base):
|
|||
def __repr__(self):
|
||||
return f"<Disassembly {json.dumps(self.values, indent=1)}>"
|
||||
|
||||
def __len__(self) -> int:
|
||||
return self.count
|
||||
|
||||
def __lt__(self, other):
|
||||
return len(self) < len(other)
|
||||
|
||||
@property
|
||||
def values(self) -> dict:
|
||||
values_dict = {
|
||||
|
|
|
@ -116,13 +116,18 @@ def subdisassem_script():
|
|||
|
||||
session.commit()
|
||||
|
||||
count = session.query(Disassembly).order_by(desc("count")).first()
|
||||
tops = (
|
||||
tops = list()
|
||||
|
||||
for arch in archs:
|
||||
top = (
|
||||
session.query(Disassembly)
|
||||
.filter(Disassembly.count == count.count)
|
||||
.order_by(desc("size"))
|
||||
.all()
|
||||
.filter(Disassembly.arch == arch.__name__)
|
||||
.order_by(desc("count"))
|
||||
.first()
|
||||
)
|
||||
tops.append(top)
|
||||
|
||||
tops = sorted(tops, key=len, reverse=True)
|
||||
|
||||
for top in tops[:3]:
|
||||
logging.info(top)
|
||||
|
|
Loading…
Reference in New Issue