Editing Talk:Communication Processor

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
= CPUP Python Script =
= Python Script =


<pre>
<pre>
Line 40: Line 40:
h.write(dec[:-0x100])
h.write(dec[:-0x100])
</pre>
= fsimage1 Python Script =
<pre>
import os
import sys
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
cui_modulus = 0xA9697F9D9343CADE68E04F9E356E6AB6BBC7DE36A4D81B98A83BC12BE3F6DF96ED7A64389456ACA933BEBFBA4FFEF05CF45F2F886F434FBBC3A01348533070C0B7D5E9C21EFE53E95A6019DB51C12C6BAFEB94E992287963448E59606384B99F3FF3E5EB6AA08BF32A4DBA7A312520CEC2B69BB20A6D0640B117170AA2DDA1FB590AEE7ADFC4E80DFCF27FA55DDEC92C07922FDD05AB1618DCB727AA6FF70027A9410BC845E50EAFD46C0FD92FF500672DE56489C669B0AA481FFD75E99E21A8DC2F9F9E87957B46BBF63FB7DDBE8B8CA861BA349A62458E855EE78C3DD6791F92E76422144E51295B1337E15C126DF6FA0C29321BC1D7C00E3C19EEF3A3E7A5L
cui_pub_exponent = 0x10001L
def aes_decrypt_cbc(key, iv, input):
    return AES.new(key, AES.MODE_CBC, iv).decrypt(input)
def s2i(s):
  result = 0L
  for c in s:
    result = 256 * result + ord(c)
  return result
def as_bytestring(x):
  return ''.join([chr((x >> (i * 8)) & 0xFF) for i in xrange(x.bit_length() / 8 - 1, -1, -1)])
def rsa_public_encrypt(modulus, public_exponent, data):
  key = RSA.construct((modulus, public_exponent))
  data = as_bytestring(key._encrypt(s2i(data)))
  return data
with open(sys.argv[1],"rb") as f:
f.seek(-0x100, os.SEEK_END)
cui_sig = f.read()
cui_sig_out = rsa_public_encrypt(cui_modulus, cui_pub_exponent, cui_sig)[-0x34:]
iv, key, sig = cui_sig_out[:0x10], cui_sig_out[0x10:0x20], cui_sig_out[0x20:]
with open(sys.argv[1],"rb") as g:
body = g.read()[0x120:]
dec = aes_decrypt_cbc(key, iv, body)
with open(sys.argv[2],"wb") as h:
h.write(dec[:-0x100])
</pre>
= lsusb Output =
<pre>
Bus 003 Device 003: ID 054c:0432 Sony Corp. PSP2 Devkit
Device Descriptor:
  bLength                18
  bDescriptorType        1
  bcdUSB              2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass        0
  bDeviceProtocol        0
  bMaxPacketSize0        64
  idVendor          0x054c Sony Corp.
  idProduct          0x0432
  bcdDevice            2.20
  iManufacturer          1 Sony Computer Entertainment Inc.
  iProduct                2 PSP2 Devkit
  iSerial                0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                9
    bDescriptorType        2
    wTotalLength      0x0020
    bNumInterfaces          1
    bConfigurationValue    1
    iConfiguration          3 deci
    bmAttributes        0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                9
      bDescriptorType        4
      bInterfaceNumber        0
      bAlternateSetting      0
      bNumEndpoints          2
      bInterfaceClass      255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              3 deci
      Endpoint Descriptor:
        bLength                7
        bDescriptorType        5
        bEndpointAddress    0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type              None
          Usage Type              Data
        wMaxPacketSize    0x0200  1x 512 bytes
        bInterval              0
      Endpoint Descriptor:
        bLength                7
        bDescriptorType        5
        bEndpointAddress    0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type              None
          Usage Type              Data
        wMaxPacketSize    0x0200  1x 512 bytes
        bInterval              0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType        6
  bcdUSB              2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass        0
  bDeviceProtocol        0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:    0x0001
  Self Powered
</pre>
</pre>
Please note that all contributions to Vita Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see Vita Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)