Skip to content

Fixes error when Dump All SMS on Windows#114

Merged
AzeemIdrisi merged 3 commits into
AzeemIdrisi:mainfrom
mokapi47:main
May 18, 2026
Merged

Fixes error when Dump All SMS on Windows#114
AzeemIdrisi merged 3 commits into
AzeemIdrisi:mainfrom
mokapi47:main

Conversation

@mokapi47
Copy link
Copy Markdown
Contributor

I forced adb() to decode the output to UTF-8 using errors="replace" in console.py, which prevents the Windows cp1252 crash on Android bytes. I also secured _write_dump() in data_extraction.py to prevent crashes if stdout or stderr is None

there are errors :
Export all SMS messages from the device to a file on this computer? This accesses private communications. Y / N >
Exception in thread Thread-13 (_readerthread):
Traceback (most recent call last):
File "C:\Users\moka\AppData\Local\Python\pythoncore-3.14-64\Lib\threading.py", line 1082, in _bootstrap_inner
self._context.run(self.run)
~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\moka\AppData\Local\Python\pythoncore-3.14-64\Lib\threading.py", line 1024, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\moka\AppData\Local\Python\pythoncore-3.14-64\Lib\subprocess.py", line 1614, in _readerthread
buffer.append(fh.read())
~~~~~~~^^
File "C:\Users\moka\AppData\Local\Python\pythoncore-3.14-64\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 7957: character maps to
Traceback (most recent call last):
File "C:\Users\moka\Desktop\PhoneSploit-Pro\phonesploitpro.py", line 31, in
run()
~~~^^
File "C:\Users\moka\Desktop\PhoneSploit-Pro\modules\cli.py", line 448, in run
main(config)
~~~~^^^^^^^^
File "C:\Users\moka\Desktop\PhoneSploit-Pro\modules\cli.py", line 312, in main
data_extraction.dump_sms(config)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users\moka\Desktop\PhoneSploit-Pro\modules\data_extraction.py", line 54, in dump_sms
_write_dump(dest, result)
~~~~~~~~~~~^^^^^^^^^^^^^^
File "C:\Users\moka\Desktop\PhoneSploit-Pro\modules\data_extraction.py", line 27, in write_dump
dest.write_text(result.stdout, encoding="utf-8")
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\moka\AppData\Local\Python\pythoncore-3.14-64\Lib\pathlib_init
.py", line 807, in write_text
raise TypeError('data must be str, not %s' %
data.class.name)
TypeError: data must be str, not NoneType

@AzeemIdrisi
Copy link
Copy Markdown
Owner

The diff shows unnecessary changes, please edit your PR to show only relevant changes for proper review.

@mokapi47
Copy link
Copy Markdown
Contributor Author

that's good ?

Comment thread modules/data_extraction.py Outdated

def _write_dump(dest: Path, result: subprocess.CompletedProcess[str]) -> None:
"""Persist adb output: stdout only on success; on failure, record stderr in a sibling file."""
stdout = result.stdout or ""
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file is not needed. Revert back.

Remove unnecessary assignment of stdout variable.
@AzeemIdrisi
Copy link
Copy Markdown
Owner

You misunderstood my comment, Keep changes only in console.py, and discard the rest. Check diff.

Copy link
Copy Markdown
Owner

@AzeemIdrisi AzeemIdrisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

@AzeemIdrisi AzeemIdrisi merged commit b41acf8 into AzeemIdrisi:main May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants