DMv6 patch
Nathan Hjelm <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
The VX-8560 does not use the 0x13d7 data field to set the shift. At this time I don't know how to detect which data field will be used so I threw together a hack that tries all key shifts until one works. I hate being inexact like this but I have no little time right now and this method does work with the VX-8560. Can someone test it with the enV2 and Dare? Once I have more time and more data I will write a scheme which doesn't involve brute-force. -Nathan ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ BitPim-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bitpim-devel
DMv6.patch
(application/octet-stream, 3.5 KB)
Index: src/phones/com_lg.py
===================================================================
--- src/phones/com_lg.py (revision 4635)
+++ src/phones/com_lg.py (working copy)
@@ -1612,8 +1612,8 @@
return struct.unpack_from ('<L', _res.data, 0)[0]
- def _DMv6_get_extra_data(self):
- _req=self.protocolclass.NVReq(field=0x13d7)
+ def _DMv6_get_extra_data(self,data_field):
+ _req=self.protocolclass.NVReq(field=data_field)
_res=self.sendbrewcommand(_req, self.protocolclass.NVRes)
return struct.unpack_from ('<L', _res.data, 0)[0]
@@ -1625,33 +1625,39 @@
return _res.get_compile_time()
def _enter_DMv6(self):
- # similar but slightly different from v5, the enV2 started this!
- # request the seed
- _req=self.protocolclass.DMKeyReq()
- _resp=self.sendbrewcommand(_req, self.protocolclass.DMKeyResp)
- _key=self.get_challenge_response(_resp.unlock_key)
- if _key is None:
- self.log('Failed to get the key.')
- raise EnterDMError('Failed to get the key')
+ # this loop is a hack -- different LG phones use different commands to get _extra. once
+ # the command is figured out we won't have to try every possible shift.
+ for _shift in range(0,4):
+ # similar but slightly different from v5, the enV2 started this!
+ # request the seed
+ _req=self.protocolclass.DMKeyReq()
+ _resp=self.sendbrewcommand(_req, self.protocolclass.DMKeyResp)
+ _key=self.get_challenge_response(_resp.unlock_key)
+ if _key is None:
+ self.log('Failed to get the key.')
+ raise EnterDMError('Failed to get the key')
- _esn=self._DMv6_get_esn()
- _extra=self._DMv6_get_extra_data()
- _ctime=self._DMv6_get_compile_time()
+ #_esn=self._DMv6_get_esn()
+ #_extra=self._DMv6_get_extra_data(0x13d7) # VX-9100 uses data field 0x13d7
+ #_ctime=self._DMv6_get_compile_time()
- # determine how many bytes the key needs be be shifted
- _shift_bytes = (_esn + ((_extra >> 16) & 0xf) + ((_extra >> 11) & 0x1f) + _ctime) % 16
- _shift = _shift_bytes / 4
+ # determine how many bytes the key needs be be shifted
+ #_shift_bytes = (_esn + ((_extra >> 16) & 0xf) + ((_extra >> 11) & 0x1f) + _ctime) % 16
+ #_shift = _shift_bytes / 4
- _req=self.protocolclass.DMEnterReq(unlock_key=_key)
- if _resp.unlock_code==0:
- _req.unlock_code=1
- elif _resp.unlock_code==2:
- _req.unlock_code=3
- _req.convert_to_key2(_shift)
- else:
- raise EnterDMError('Unknown unlock_code: %d'%_resp.unlock_code)
- _resp=self.sendbrewcommand(_req, self.protocolclass.DMEnterResp)
- if _resp.result!=1:
+ _req=self.protocolclass.DMEnterReq(unlock_key=_key)
+ if _resp.unlock_code==0:
+ # this response usually occurs in error. rebooting the phone seems to clear it
+ _req.unlock_code=1
+ elif _resp.unlock_code==2:
+ _req.unlock_code=3
+ _req.convert_to_key2(_shift)
+ else:
+ raise EnterDMError('Unknown unlock_code: %d'%_resp.unlock_code)
+ _resp=self.sendbrewcommand(_req, self.protocolclass.DMEnterResp)
+ if _resp.result == 1:
+ break
+ if _resp.result != 1:
raise EnterDMError('Bad response - unlock_ok: %d'%_resp.result)
def enter_DM(self, e=None):