minor fixes and formatting

master
JoYo 2019-02-24 07:38:11 +00:00
parent 8d8df2ab5a
commit ba8d38e56b
3 changed files with 5 additions and 7 deletions

View File

@ -2,3 +2,4 @@
from .run import sins
from .mutation import generation, mutate
from .orm import db_config, ScrapNode
from .disassemble import disasm, objdump

View File

@ -4,7 +4,8 @@ import json
capstone = Cs(CS_ARCH_X86, CS_MODE_64)
def disasm(shellcode: bytes)->list:
def disasm(shellcode: bytes) -> list:
opcodes = list()
for opcode in capstone.disasm(shellcode, 0):
@ -12,7 +13,8 @@ def disasm(shellcode: bytes)->list:
return opcodes
def objdump(shellcode: bytes)->str:
def objdump(shellcode: bytes) -> str:
opcodes = str()
for opcode in capstone.disasm(shellcode, 0):

View File

@ -7,8 +7,6 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, relationship, backref
from sqlalchemy.orm.collections import attribute_mapped_collection
from .disassemble import objdump, disasm
now = '{0:%Y%m%dT%H%M%S}'.format(datetime.utcnow())
Base = declarative_base()
@ -42,14 +40,11 @@ class ScrapNode(Base):
self.image = child
self.length = len(child)
self.sha1sum
self.objdump = objdump(child)
def __repr__(self):
values = {
'checksum': self.checksum,
'length': self.length,
# todo remove for performance
'operations': len(disasm(self.image)),
'parent_id': self.parent_id,
'id': self.id,
}