text
stringlengths
1
93.6k
visited = self.wireup(osci)
#visited = self.wireup(osci0, visited)
#visited = self.wireup(oscclient, visited)
# visited = self.wireup(threshold, visited)
visited = self.wireup(spec, visited)
visited = self.wireup(waterfall, visited)
def wireup(self, destination, visited=[]):
print 'wireup', destination, visited
if destination in visited: return visited
visited = visited + [destination]
for idx in dir(destination):
inp = getattr(destination, idx)
if type(inp) == Input:
self.connect(inp.source.block.gr_block, inp.block.gr_block)
return self.wireup(inp.source.block, visited)
return visited
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster'))
qapp = Qt.QApplication(sys.argv)
tb = top_block()
tb.start()
tb.show()
def quitting():
tb.stop()
#tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
tb = None # to clean up Qt widgets
# <FILESEP>
from binaryninja import PluginCommand, BackgroundTaskThread, log_info, show_message_box, MessageBoxButtonSet, MessageBoxIcon
from .utils import traverse_functions_bottom_up
class RenameAllFunctions(BackgroundTaskThread):
"""
A background task to rename all functions in the current BinaryView.
Attributes:
client (OllamaClient): The Ollama client instance.
bv (BinaryView): The current BinaryView instance.
"""
def __init__(self, client, bv):
"""
Initialize the RenameAllFunctions task.
Args:
client (OllamaClient): The Ollama client instance.
bv (BinaryView): The current BinaryView instance.
"""
super().__init__("Starting renaming task...", True)
self.bv = bv
self.client = client
def run(self):
"""
Execute the task to rename all functions in the BinaryView.
"""
self.bv.begin_undo_actions()
sorted_functions = traverse_functions_bottom_up(self.bv)
name_counter = {}
for function in sorted_functions:
if function.name.startswith("sub_") or function.name.startswith("func_"):
hlil = function.hlil
if hlil:
function_hlil = "\n".join([str(instr) for instr in hlil.instructions])
new_name = self.client.get_function_name(function_hlil)
if new_name:
if new_name in name_counter:
name_counter[new_name] += 1
new_name = f"{new_name}_{name_counter[new_name]}"
else:
name_counter[new_name] = 1
self.progress = f'Renamed {function.name} to {new_name}'
log_info(f'Renamed {function.name} to {new_name}')
function.name = new_name
else:
self.progress = f"Failed to generate a valid name for {function.name}"
log_info(f"Failed to generate a valid name for {function.name}")
self.bv.commit_undo_actions()
class RenameFunction(BackgroundTaskThread):
"""