Skip to content

[bug] Error: invalid size when downloading files single / recursively #722

@bwyyoung

Description

@bwyyoung

Describe the bug
Frida agent exception: invalid size when downloading recursive directory

To Reproduce
Steps to reproduce the behavior:
filesystem download files files --folder
filesystem download generatefid.lock
(File 2025-03-13 05:22:17 GMT True True False 0.0 B generatefid.lock)

Expected behavior
Ignore invalid file size / undownloadable files and continue recursive download.

Evidence / Logs / Screenshots

(Android: 15) [usb] # filesystem download files files --folder
Downloading /data/user/13/com.myapp.name/files to files
Do you want to download the full directory? [Y/n]: Y
Downloading directory recursively...
A Frida agent exception has occurred.
Error: invalid size
    at value (frida/runtime/core.js:214)
    at readFileSync (/node_modules/frida-fs/dist/index.js:373)
    at readFile (src/android/filesystem.ts:82)
    at androidFileDownload (src/rpc/android.ts:39)
    at call (native)
    at <anonymous> (frida/runtime/message-dispatcher.js:11)
    at o (frida/runtime/message-dispatcher.js:23)
Python stack trace: Traceback (most recent call last):
  File "/home/kali/Desktop/reverse_tether/objection/objection/console/repl.py", line 361, in run
    self.run_command(document)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/kali/Desktop/reverse_tether/objection/objection/console/repl.py", line 169, in run_command
    exec_method(arguments)
    ~~~~~~~~~~~^^^^^^^^^^^
  File "/home/kali/Desktop/reverse_tether/objection/objection/commands/filemanager.py", line 413, in download
    _download_android(source, destination, should_download_folder)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/reverse_tether/objection/objection/commands/filemanager.py", line 532, in _download_android
    file_data = api.android_file_download(path)
  File "/home/kali/Desktop/reverse_tether/objection/venv/lib/python3.13/site-packages/frida/core.py", line 180, in method
    return script._rpc_request(request, data, **kwargs)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/reverse_tether/objection/venv/lib/python3.13/site-packages/frida/core.py", line 86, in wrapper
    return f(*args, **kwargs)
  File "/home/kali/Desktop/reverse_tether/objection/venv/lib/python3.13/site-packages/frida/core.py", line 497, in _rpc_request
    raise result.error
frida.core.RPCException: Error: invalid size
    at value (frida/runtime/core.js:214)
    at readFileSync (/node_modules/frida-fs/dist/index.js:373)
    at readFile (src/android/filesystem.ts:82)
    at androidFileDownload (src/rpc/android.ts:39)
    at call (native)
    at <anonymous> (frida/runtime/message-dispatcher.js:11)
    at o (frida/runtime/message-dispatcher.js:23)

Environment (please complete the following information):

Application
N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    freshissueDefault label for new, untriaged issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions