Editing Trophy files

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 325: Line 325:
**Level 19 = 70,000
**Level 19 = 70,000
**Level 20 and up = previous level plus 8,000
**Level 20 and up = previous level plus 8,000
== Tools ==
<syntaxhighlight lang="python" enclose="div">
# (c) flatz
import sys, os, urllib2
import hashlib, hmac
from Crypto.Cipher import AES
def aes_encrypt_cbc(key, iv, input):
aes = AES.new(key, AES.MODE_CBC, iv)
output = aes.encrypt(input)
return output
def aes_decrypt_cbc(key, iv, input):
aes = AES.new(key, AES.MODE_CBC, iv)
output = aes.decrypt(input)
return output
def sha1_hmac(key, message):
return hmac.new(key, message, digestmod=hashlib.sha1).digest()
# paste a HMAC key from np_trophy_util.prx here... hint:
#  C3A3A0...
hmac_key =
'C3A3A0..........................................................................................................................'.decode('hex')
# paste an ERK from np_trophy_util.prx here... hint:
#  02499F...
keygen_erk = '02499F..........................'.decode('hex')
keygen_riv = '00000000000000000000000000000000'.decode('hex')
def build_url(np_comm_id, file_name, encrypted=False, env='np'):
np_comm_id_hash = sha1_hmac(hmac_key, np_comm_id).encode('hex').upper()
file_name_hash = sha1_hmac(hmac_key, '{0}/{1}'.format(np_comm_id, file_name)).encode('hex').upper()
file_extension = os.path.splitext(file_name)[1]
if encrypted:
file_extension_parts = file_extension.rpartition('.')
file_extension = file_extension_parts[1] + 'E' + file_extension_parts[2]
return 'http://trophy01.{0}.community.playstation.net/trophy/{0}/{1}_{2}/{3}{4}'.format(env, np_comm_id, np_comm_id_hash, file_name_hash, file_extension)
def fetch_file_data(np_comm_id, file_name, encrypted=False, env='np'):
file_url = build_url(np_comm_id, file_name, encrypted, env)
connection = urllib2.urlopen(file_url)
data = connection.read()
if encrypted:
data_erk = aes_encrypt_cbc(keygen_erk, keygen_riv, np_comm_id.ljust(16, '\x00'))
data_riv = data[:16]
data = aes_decrypt_cbc(data_erk, data_riv, data)[16:]
return data
icon0_png_url = build_url('NPWR03612_00', 'ICON0.PNG')
trop_sfm_url = build_url('NPWR03612_00', 'TROP.SFM', True)
trop000_png_url = build_url('NPWR03612_00', 'TROP000.PNG')
trop_sfm = fetch_file_data('NPWR03612_00', 'TROP.SFM', True)
print 'ICON0.PNG:', icon0_png_url
print 'TROP.SFM:', trop_sfm_url
print 'TROP000.PNG:', trop000_png_url
print trop_sfm
</syntaxhighlight>


== Unlock Trophys ==
== Unlock Trophys ==
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 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)