MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / EntropyThread

Class EntropyThread

python/examples/triage/entropy.py:10–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8from binaryninja.enums import ThemeColor
9
10class EntropyThread(threading.Thread):
11 def __init__(self, data, image, block_size):
12 super(EntropyThread, self).__init__()
13 self.data = data
14 self.image = image
15 self.block_size = block_size
16 self.updated = False
17
18 def run(self):
19 width = self.image.width()
20 for i in range(0, width):
21 v = int(self.data.get_entropy(self.data.start + i * self.block_size, self.block_size)[0] * 255)
22 if v >= 240:
23 color = binaryninjaui.getThemeColor(ThemeColor.YellowStandardHighlightColor)
24 self.image.setPixelColor(i, 0, color)
25 else:
26 baseColor = binaryninjaui.getThemeColor(ThemeColor.FeatureMapBaseColor)
27 entropyColor = binaryninjaui.getThemeColor(ThemeColor.BlueStandardHighlightColor)
28 color = binaryninjaui.mixColor(baseColor, entropyColor, v)
29 self.image.setPixelColor(i, 0, color)
30 self.updated = True
31
32
33class EntropyWidget(QWidget):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected