Skip to content

Instantly share code, notes, and snippets.

@four0four
Created December 14, 2021 01:54
Show Gist options
  • Save four0four/c4ba37b95241df3b75b40eba0d3b1e11 to your computer and use it in GitHub Desktop.
Save four0four/c4ba37b95241df3b75b40eba0d3b1e11 to your computer and use it in GitHub Desktop.
diff --git a/__init__.py b/__init__.py
index 5d325b4..b99f313 100644
--- a/__init__.py
+++ b/__init__.py
@@ -3,17 +3,17 @@ import requests
import shutil
from zipfile import ZipFile
from tempfile import TemporaryDirectory
-from PySide2.QtWidgets import (QPushButton, QWidget, QVBoxLayout,
+from PySide6.QtWidgets import (QPushButton, QWidget, QVBoxLayout,
QHBoxLayout, QDialog, QFileSystemModel, QTreeView, QLabel, QSplitter,
QMessageBox, QHeaderView)
-from PySide2.QtCore import Qt, QFileInfo, QUrl
+from PySide6.QtCore import Qt, QFileInfo, QUrl
+
+from PySide6.QtGui import QDesktopServices, QKeySequence
-from PySide2.QtGui import QDesktopServices, QKeySequence
-from PySide2.QtWebEngineWidgets import QWebEnginePage, QWebEngineView, QWebEngineProfile
from binaryninja import user_plugin_path
+from binaryninja import TypeBuilder, Type, Symbol
from binaryninja.log import log_error, log_debug, log_info
-from binaryninja.types import Type, Symbol, Structure
from binaryninja.plugin import PluginCommand
from binaryninja.enums import SegmentFlag, SectionSemantics, SymbolType
from binaryninja.interaction import get_open_filename_input, show_message_box
@@ -40,9 +40,9 @@ class SVDBrowser(QDialog):
self.browseButton = QPushButton("Browse SVD Folder")
self.deleteSvdButton = QPushButton("Delete")
self.applySvdButton = QPushButton("Apply SVD")
- self.view = QWebEngineView()
- url = "https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-search"
- self.view.load(QUrl(url))
+ #self.view = QWebEngineView()
+ #url = "https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-search"
+ #self.view.load(QUrl(url))
self.columns = 3
self.context = context
@@ -81,7 +81,7 @@ class SVDBrowser(QDialog):
vlayoutWidget = QWidget()
vlayout = QVBoxLayout()
- vlayout.addWidget(self.view)
+ #vlayout.addWidget(self.view)
vlayout.addLayout(buttons)
vlayoutWidget.setLayout(vlayout)
@@ -210,12 +210,12 @@ def load_svd(bv, svd_file = None):
bv.define_user_symbol(Symbol(SymbolType.ImportedDataSymbol, p['base'], p['name']))
for p in base_peripherals:
- s = Structure()
+ s = TypeBuilder.structure()
for r in p['registers'].values():
if r['size'] is None:
- s.insert(r['offset'], Type.int(4, False), r['name'])
+ s.insert(r['offset'], TypeBuilder.int(4, False), r['name'])
else:
- s.insert(r['offset'], Type.int(int(r['size']/8), False), r['name'])
+ s.insert(r['offset'], TypeBuilder.int(int(r['size']/8), False), r['name'])
struct_type = Type.structure_type(s)
bv.define_user_type(p['name'], struct_type)
register_peripheral(p, struct_type)
@@ -225,14 +225,8 @@ def load_svd(bv, svd_file = None):
register_peripheral(p, struct_type)
-PluginCommand.register(
- "SVD\\SVD Browser",
- "Manage SVD files and browse/search for new files to load.",
- launch_browser
-)
-
PluginCommand.register(
"SVD\\Load SVD",
"Apply an SVD's memory map",
load_svd
-)
\ No newline at end of file
+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment