Release 0.0.5
This commit is contained in:
parent
df4c1a6f36
commit
c3b90319eb
4 changed files with 33 additions and 12 deletions
|
|
@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## [0.0.5] - 2020-08-03
|
||||||
|
### Fixed
|
||||||
|
- Issue #4: fix broken progressbar
|
||||||
|
- Don't download the .ird if it already exists
|
||||||
|
- Don't show progressbar if --quiet flag is set
|
||||||
|
|
||||||
## [0.0.4] - 2020-08-03
|
## [0.0.4] - 2020-08-03
|
||||||
### Fixed
|
### Fixed
|
||||||
- Build
|
- Build
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,16 @@ def error(msg):
|
||||||
|
|
||||||
def warning(msg):
|
def warning(msg):
|
||||||
"""Print a warning message"""
|
"""Print a warning message"""
|
||||||
print('WARNING: %s. Continuing regardless' % msg)
|
print('WARNING: %s. Continuing regardless.' % msg)
|
||||||
|
|
||||||
|
|
||||||
def download_ird(ird_name):
|
def download_ird(ird_name):
|
||||||
"""Download an .ird from GET_IRD_NET_LOC"""
|
"""Download an .ird from GET_IRD_NET_LOC"""
|
||||||
|
|
||||||
|
# Check if file already exists and skip if it does
|
||||||
|
if os.path.exists(ird_name):
|
||||||
|
return
|
||||||
|
|
||||||
ird_link = GET_IRD_NET_LOC + ird_name
|
ird_link = GET_IRD_NET_LOC + ird_name
|
||||||
r = requests.get(ird_link, stream=True)
|
r = requests.get(ird_link, stream=True)
|
||||||
|
|
||||||
|
|
@ -111,7 +116,10 @@ def download_ird(ird_name):
|
||||||
def ird_by_game_id(game_id):
|
def ird_by_game_id(game_id):
|
||||||
"""Using a game_id, download the responding .ird from ALL_IRD_NET_LOC"""
|
"""Using a game_id, download the responding .ird from ALL_IRD_NET_LOC"""
|
||||||
gameid = game_id.replace('-','')
|
gameid = game_id.replace('-','')
|
||||||
r = requests.get(ALL_IRD_NET_LOC, headers = {'User-Agent': 'Anonymous (You)' }, timeout=5)
|
try:
|
||||||
|
r = requests.get(ALL_IRD_NET_LOC, headers = {'User-Agent': 'Anonymous (You)' }, timeout=5)
|
||||||
|
except requests.exceptions.ReadTimeout:
|
||||||
|
core.error('Server timed out, fix your connection or manually specify a key/ird.')
|
||||||
soup = BeautifulSoup(r.text, "html.parser")
|
soup = BeautifulSoup(r.text, "html.parser")
|
||||||
|
|
||||||
ird_name = False
|
ird_name = False
|
||||||
|
|
@ -121,7 +129,7 @@ def ird_by_game_id(game_id):
|
||||||
ird_name = url
|
ird_name = url
|
||||||
|
|
||||||
if not ird_name:
|
if not ird_name:
|
||||||
error("Unable to download IRD, couldn't find link")
|
error("Unable to download IRD, couldn't find link. You could specify the decryption key with -d if you have it.")
|
||||||
|
|
||||||
download_ird(ird_name)
|
download_ird(ird_name)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,14 +50,14 @@ class ISO:
|
||||||
|
|
||||||
def read_regions(self, input_iso, filename):
|
def read_regions(self, input_iso, filename):
|
||||||
"""List with info dict (start, end, whether it's encrypted) for every region.
|
"""List with info dict (start, end, whether it's encrypted) for every region.
|
||||||
|
|
||||||
Basically, every other (odd numbered) region is encrypted.
|
Basically, every other (odd numbered) region is encrypted.
|
||||||
"""
|
"""
|
||||||
regions = []
|
regions = []
|
||||||
|
|
||||||
encrypted = False
|
encrypted = False
|
||||||
for _ in range(0, self.number_of_regions):
|
for _ in range(0, self.number_of_regions):
|
||||||
|
|
||||||
regions.append({
|
regions.append({
|
||||||
'start': core.to_int(input_iso.read(self.NUM_INFO_BYTES)) * core.SECTOR,
|
'start': core.to_int(input_iso.read(self.NUM_INFO_BYTES)) * core.SECTOR,
|
||||||
'end': core.to_int(input_iso.read(self.NUM_INFO_BYTES)) * core.SECTOR,
|
'end': core.to_int(input_iso.read(self.NUM_INFO_BYTES)) * core.SECTOR,
|
||||||
|
|
@ -104,7 +104,7 @@ class ISO:
|
||||||
if not args.decryption_key:
|
if not args.decryption_key:
|
||||||
if not args.ird:
|
if not args.ird:
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
core.warning('No IRD file specified, downloading required file')
|
core.warning('No IRD file specified, finding required file')
|
||||||
args.ird = core.ird_by_game_id(self.game_id) # Download ird
|
args.ird = core.ird_by_game_id(self.game_id) # Download ird
|
||||||
|
|
||||||
self.ird = ird.IRD(args)
|
self.ird = ird.IRD(args)
|
||||||
|
|
@ -114,7 +114,7 @@ class ISO:
|
||||||
|
|
||||||
if self.regions[-1]['start'] > self.size:
|
if self.regions[-1]['start'] > self.size:
|
||||||
core.error('Corrupt ISO or error in IRD. Expected filesize larger than %.2f GiB, actual size is %.2f GiB' % (self.regions[-1]['start'] / 1024**3, self.size / 1024**3 ) )
|
core.error('Corrupt ISO or error in IRD. Expected filesize larger than %.2f GiB, actual size is %.2f GiB' % (self.regions[-1]['start'] / 1024**3, self.size / 1024**3 ) )
|
||||||
|
|
||||||
self.disc_key = cipher.encrypt(self.ird.data1)
|
self.disc_key = cipher.encrypt(self.ird.data1)
|
||||||
else:
|
else:
|
||||||
self.disc_key = cipher.encrypt(core.to_bytes(args.decryption_key))
|
self.disc_key = cipher.encrypt(core.to_bytes(args.decryption_key))
|
||||||
|
|
@ -127,7 +127,7 @@ class ISO:
|
||||||
print('Decrypting with disc key: %s' % self.disc_key.hex())
|
print('Decrypting with disc key: %s' % self.disc_key.hex())
|
||||||
|
|
||||||
with open(args.iso, 'rb') as input_iso:
|
with open(args.iso, 'rb') as input_iso:
|
||||||
|
|
||||||
if not args.output:
|
if not args.output:
|
||||||
output_name = '%s.iso' % self.game_id
|
output_name = '%s.iso' % self.game_id
|
||||||
else:
|
else:
|
||||||
|
|
@ -135,7 +135,8 @@ class ISO:
|
||||||
|
|
||||||
with open(output_name, 'wb') as output_iso:
|
with open(output_name, 'wb') as output_iso:
|
||||||
|
|
||||||
pbar = tqdm(total= (self.size // 2048) - 4 )
|
if not args.quiet:
|
||||||
|
pbar = tqdm(total= (self.size // 2048) )
|
||||||
|
|
||||||
for region in self.regions:
|
for region in self.regions:
|
||||||
input_iso.seek(region['start'])
|
input_iso.seek(region['start'])
|
||||||
|
|
@ -148,6 +149,9 @@ class ISO:
|
||||||
core.warning('Trying to read past the end of the file')
|
core.warning('Trying to read past the end of the file')
|
||||||
break
|
break
|
||||||
output_iso.write(data)
|
output_iso.write(data)
|
||||||
|
|
||||||
|
if not args.quiet:
|
||||||
|
pbar.update(1)
|
||||||
continue
|
continue
|
||||||
# Encrypted region, decrypt then write
|
# Encrypted region, decrypt then write
|
||||||
else:
|
else:
|
||||||
|
|
@ -168,9 +172,12 @@ class ISO:
|
||||||
|
|
||||||
output_iso.write(decrypted)
|
output_iso.write(decrypted)
|
||||||
|
|
||||||
pbar.update(1)
|
if not args.quiet:
|
||||||
|
pbar.update(1)
|
||||||
|
|
||||||
pbar.close()
|
if not args.quiet:
|
||||||
|
pbar.close()
|
||||||
|
print('Decryption complete.')
|
||||||
|
|
||||||
|
|
||||||
def print_info(self):
|
def print_info(self):
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -5,7 +5,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="libray",
|
name="libray",
|
||||||
version="0.0.4",
|
version="0.0.5",
|
||||||
description='A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs',
|
description='A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs',
|
||||||
author="Nichlas Severinsen",
|
author="Nichlas Severinsen",
|
||||||
author_email="ns@nsz.no",
|
author_email="ns@nsz.no",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue