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