combsjy / iphone-dataprotection

Automatically exported from code.google.com/p/iphone-dataprotection
0 stars 0 forks source link

ios_examiner.py - UnicodeEncodeError - 'ascii' codec can't encode character u'\u2019' #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Successfully uploading custom ramdisk to device using the following:

./redsn0w_mac_0.9.12b2/redsn0w.app/Contents/MacOS/redsn0w -i 
IOS5_IPSW_FOR_YOUR_DEVICE -r myramdisk.dmg -k kernelcache.release.n88.patched 
-a "-v rd=md0 nand-disable=1"

2. Attempting to execute the ios_examiner.py script using the following:

python python_scripts/ios_examiner.py

What is the expected output? What do you see instead?

Expecting to see ios_examiner command prompt ((iPhone4-data) /) and seeing 
instead the following:

Connecting to device : xxxxx
Device model: iPhone 3GS
UDID: xxxxx
ECID: xxxxx
Serial number: xxxxx
key835: xxxxx
key89B: xxxxx
Chip id 0x3294d798 banks per CE physical 1
NAND geometry : 16GB (4 CEs (1 physical banks/CE) of 4148 blocks of 128 pages 
of 8192 bytes data, 12 bytes metdata)
Searching for special pages...
Found NANDDRIVERSIGN, DEVICEINFOBBT special pages in CE 0
Device does not boot from NAND (=> has a NOR)
NAND signature 0x43313133 flags 0x4 withening=0, epoch=3
Using VSVFL
VSVFL context open OK
YaFTL context OK, version=CX01 maxIndexUsn=937471 context usn=937471
Found protective MBR
LwVM magic mismatch
Found GPT header current_lba=1 partition_entries_lba=2
cprotect version : 2 (iOS 4)
iOS version:  4.1
Keybag state: locked
Traceback (most recent call last):
  File "python_scripts/ios_examiner.py", line 366, in <module>
    main()
  File "python_scripts/ios_examiner.py", line 363, in main
    ExaminerShell(image).cmdloop("")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 
10: ordinal not in range(128)

What version of the product are you using? On what operating system?

Utilizing the most recent version of the tools via hg pull && hg update running 
on OS X 10.7.4 (genuine Mac hardware, not virtualized environment).

Please provide any additional information below.

Was able to successfully run ios_examiner.py roughly a week ago without issue, 
the only changes to the 3GS device was the implementation of a passcode; have 
been attempting to brute force passcode.

Original issue reported on code.google.com by oakridge...@yahoo.ca on 20 Aug 2012 at 4:31

GoogleCodeExporter commented 9 years ago
Additionally I have built a new custom ramdisk and kernel utilizing the 
steps/process outlined in the wiki 
(http://code.google.com/p/iphone-dataprotection/wiki/README) and continue to 
experience the same outcome:

hg clone https://code.google.com/p/iphone-dataprotection/ 
cd iphone-dataprotection

make -C img3fs/

curl -O -L 
https://sites.google.com/a/iphone-dev.com/files/home/redsn0w_mac_0.9.12b2.zip
unzip redsn0w_mac_0.9.12b2.zip
cp redsn0w_mac_0.9.12b2/redsn0w.app/Contents/MacOS/Keys.plist .

python python_scripts/kernel_patcher.py IOS5_IPSW_FOR_YOUR_DEVICE

sh ./make_ramdisk_n88ap.sh

./redsn0w_mac_0.9.12b2/redsn0w.app/Contents/MacOS/redsn0w -i 
IOS5_IPSW_FOR_YOUR_DEVICE -r myramdisk.dmg -k kernelcache.release.n88.patched 
-a "-v rd=md0 nand-disable=1"

python python_scripts/ios_examiner.py 
Connecting to device : xxxxx
Device model: iPhone 3GS
UDID: xxxxx
ECID: xxxxx
Serial number: xxxxx
key835: xxxxx
key89B: xxxxx
Chip id 0x3294d798 banks per CE physical 1
NAND geometry : 16GB (4 CEs (1 physical banks/CE) of 4148 blocks of 128 pages 
of 8192 bytes data, 12 bytes metdata)
Searching for special pages...
Found NANDDRIVERSIGN, DEVICEINFOBBT special pages in CE 0
Device does not boot from NAND (=> has a NOR)
NAND signature 0x43313133 flags 0x4 withening=0, epoch=3
Using VSVFL
VSVFL context open OK
YaFTL context OK, version=CX01 maxIndexUsn=937490 context usn=937490
Found protective MBR
LwVM magic mismatch
Found GPT header current_lba=1 partition_entries_lba=2
cprotect version : 2 (iOS 4)
iOS version:  4.1
Keybag state: locked
Traceback (most recent call last):
  File "python_scripts/ios_examiner.py", line 366, in <module>
    main()
  File "python_scripts/ios_examiner.py", line 363, in main
    ExaminerShell(image).cmdloop("")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 
10: ordinal not in range(128)

Original comment by oakridge...@yahoo.ca on 20 Aug 2012 at 4:49

GoogleCodeExporter commented 9 years ago
Try changing this line in ios_examiner.py
http://code.google.com/p/iphone-dataprotection/source/browse/python_scripts/ios_
examiner.py#105
from
self.prompt = "(%s-%s) %s " % (self.deviceName, self.volname, self.curdir)
to
self.prompt = "(%s-%s) %s " % (self.deviceName.encode("utf-8"), self.volname, 
self.curdir)

the tools currently fail when printing unicode strings with non ascii 
characters, i still have to find a proper fix for this.

Original comment by jean.sig...@gmail.com on 21 Aug 2012 at 9:22

GoogleCodeExporter commented 9 years ago
Hello,

Applying the stated modification to the ios_examiner.py script has resolved 
this issue, I am again able to upload the custom ramdisk to the target device 
and utilize the script.

Thank you for your prompt reply and resolution to this issue.

Original comment by oakridge...@yahoo.ca on 22 Aug 2012 at 3:38

GoogleCodeExporter commented 9 years ago
Thank you, working for me as well!

Original comment by phu....@gmail.com on 22 Sep 2012 at 11:10

GoogleCodeExporter commented 9 years ago
Hi, may I just add that a similar patch is needer for backup_tool.py as well.
I have 2 device backups on my PC, one is parsed fine with backup_tool, but 
here's the output for the second:

d:\Downloads\Progas\iPhone\kernel\python_scripts>backup_tool.py d:\Downloads\Pro
gas\iPhone\MobileSync\Backup8enc\4686770c9855b9594f9e783b589a3887229c0caa\
Traceback (most recent call last):
  File "D:\Downloads\Progas\iPhone\kernel\python_scripts\backup_tool.py", line 7
8, in <module>
    main()
  File "D:\Downloads\Progas\iPhone\kernel\python_scripts\backup_tool.py", line 7
5, in main
    extract_backup(backup_path, output_path)
  File "D:\Downloads\Progas\iPhone\kernel\python_scripts\backup_tool.py", line 2
0, in extract_backup
    print i + " : " + unicode(info.get(i, "missing"))
  File "D:\Downloads\Progas\iPhone\python27\lib\encodings\cp866.py", line 12, in
 encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position
 17: character maps to <undefined>

Original comment by r...@pisem.net on 17 Feb 2013 at 3:48