Skip to content

Commit

Permalink
2.3.3 - Support new protobuf library version (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AloneLiberty committed Apr 4, 2024
1 parent 3ff3888 commit 96e3eda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions FlipperNested/bridge.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inspect
import serial
import serial.tools.list_ports
from google.protobuf.internal.encoder import _VarintBytes
Expand Down Expand Up @@ -122,16 +123,21 @@ def get_files(self, path="/ext") -> list:
cmd_data.path = path
rep_data = self._rpc_send_and_read_answer(cmd_data, "storage_list_request")

storage_response.extend(
MessageToDict(message=rep_data.storage_list_response, including_default_value_fields=True, )["file"])
storage_response.extend(self._message_to_dict(rep_data.storage_list_response)["file"])

while rep_data.has_next:
rep_data = self._rpc_read_answer()
storage_response.extend(
MessageToDict(message=rep_data.storage_list_response, including_default_value_fields=True, )["file"])
storage_response.extend(self._message_to_dict(rep_data.storage_list_response)["file"])

return storage_response

@staticmethod
def _message_to_dict(message):
if 'including_default_value_fields' in inspect.signature(MessageToDict).parameters:
return MessageToDict(message=message, including_default_value_fields=True)
else:
return MessageToDict(message=message, always_print_fields_with_no_presence=True)

def file_read(self, path=None):
storage_response = []
cmd_data = storage_pb2.ReadRequest()
Expand Down Expand Up @@ -182,7 +188,7 @@ def mkdir(self, path="/ext"):
cmd_data = storage_pb2.MkdirRequest()
cmd_data.path = path

rep_data = self._rpc_send_and_read_answer(cmd_data, "storage_mkdir_request")
self._rpc_send_and_read_answer(cmd_data, "storage_mkdir_request")

def file_rename(self, old, new):
cmd_data = storage_pb2.RenameRequest()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(name="FlipperNested", version="2.3.2", author="AloneLiberty",
setuptools.setup(name="FlipperNested", version="2.3.3", author="AloneLiberty",
description="Recover keys from collected nonces", long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/AloneLiberty/FlipperNestedRecovery",
Expand Down

0 comments on commit 96e3eda

Please sign in to comment.