Esempio n. 1
0
 def get_protocols(self):
     for service_name in self.gBServices:
         if service_name in LEA_NUM.keys():
             for address in self.gBServices[service_name]:
                 ea = address
                 lea_counter = 0
                 while (True):
                     ea = idc.prev_head(ea)
                     if (idc.GetMnem(ea) == "lea"):
                         lea_counter += 1
                         if (lea_counter == LEA_NUM[service_name]):
                             break
                 for xref in idautils.DataRefsFrom(ea):
                     if (idc.GetMnem(xref) == ""):
                         CurrentGUID = utils.get_guid(xref)
                         protocol_record = {}
                         protocol_record["address"] = xref
                         protocol_record["service"] = service_name
                         protocol_record["guid"] = CurrentGUID
                         if self.Protocols["All"].count(
                                 protocol_record) == 0:
                             self.Protocols["All"].append(protocol_record)
Esempio n. 2
0
 def get_protocols(self):
     """
     found UEFI protocols information in idb
     """
     for service_name in self.gBServices:
         for address in self.gBServices[service_name]:
             ea, found = 0, False
             if self.arch == "x86":
                 for i in range(1, 25):
                     ea = address - i
                     if (idc.get_operand_value(ea, 0) > self.base
                             and idc.GetMnem(ea) == "push"):
                         found = True
                         break
             if self.arch == "x64":
                 for i in range(1, 16):
                     ea = address - i
                     if (idc.get_operand_value(ea, 1) > self.base
                             and idc.GetMnem(ea) == "lea"):
                         found = True
                         break
             if not found:
                 continue
             for xref in idautils.DataRefsFrom(ea):
                 if (idc.GetMnem(xref) == ""):
                     cur_guid = utils.get_guid(xref)
                     if cur_guid != [0] * 11:
                         record = {
                             "address": xref,
                             "service": service_name,
                             "guid": cur_guid,
                         }
                         record["address"] = xref
                         record["service"] = service_name
                         record["guid"] = cur_guid
                         if not self.Protocols["All"].count(record):
                             self.Protocols["All"].append(record)
Esempio n. 3
0
 def serialize(self):
     msg = struct.pack("%(GUID_STR_LEN)ss" % globals(),
                       get_guid(self.InterfaceIdGuid))
     return msg
Esempio n. 4
0
 def serialize(self):
     msg = struct.pack("%(GUID_STR_LEN)ss" % globals(), get_guid(self.guid))
     msg += struct.pack(">H", self.major_ver)
     msg += struct.pack(">H", self.minor_ver)
     return msg
Esempio n. 5
0
	def serialize(self):
		msg = struct.pack("%(GUID_STR_LEN)ss" % globals(), get_guid(self.InterfaceIdGuid))
		return msg
Esempio n. 6
0
	def serialize(self):
		msg = struct.pack("%(GUID_STR_LEN)ss" % globals(), get_guid(self.guid))
		msg += struct.pack(">H", self.major_ver)
		msg += struct.pack(">H", self.minor_ver)
		return msg