freemyipod r789 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r788‎ | r789 | r790 >
Date:18:43, 18 November 2011
Author:theseven
Status:new
Tags:
Comment:
(lib)ipoddfu.py: Make this work in Python 3
Modified paths:
  • /tools/ipoddfu/ipoddfu.py (modified) (history)
  • /tools/ipoddfu/libipoddfu.py (modified) (history)

Diff [purge]

Index: tools/ipoddfu/ipoddfu.py
@@ -26,7 +26,7 @@
2727 import libipoddfu
2828
2929 if len(sys.argv) != 2:
30 - print "Syntax: ipoddfu.py <file>"
 30+ print("Syntax: ipoddfu.py <file>")
3131 exit(2)
3232
3333 dev = libipoddfu.ipoddfu()
Index: tools/ipoddfu/libipoddfu.py
@@ -100,7 +100,7 @@
101101
102102 crc = 0xffffffff
103103 for i in range(len(data)):
104 - crc = (crc >> 8) ^ crc_table[(crc ^ struct.unpack("B", data[i])[0]) & 0xff];
 104+ crc = (crc >> 8) ^ crc_table[(crc ^ data[i]) & 0xff];
105105
106106 return crc
107107
@@ -112,16 +112,16 @@
113113
114114 def upload(self, data, exploit = 0):
115115 if exploit == 1 and self.generation == 2 and self.type == 1:
116 - data = f.read().ljust(0x200f0, "\0") \
117 - + "\xb8\x48\x02\x22\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
118 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
119 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
120 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
121 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
122 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
123 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
124 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
125 - + "\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22"
 116+ data = f.read().ljust(0x200f0, b"\0") \
 117+ + b"\xb8\x48\x02\x22\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
 118+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 119+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 120+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 121+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 122+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 123+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 124+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22" \
 125+ + b"\0\0\0\x22\0\0\0\x22\0\0\0\x22\0\0\0\x22"
126126
127127 data = data + struct.pack("<I", self.crc32(data))
128128