libray.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env python3
  2. # -*- coding: utf8 -*-
  3. # libray - Libre Blu-Ray PS3 ISO Tool
  4. # Copyright © 2018 - 2021 Nichlas Severinsen
  5. #
  6. # This file is part of libray.
  7. #
  8. # libray is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # libray is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with libray. If not, see <https://www.gnu.org/licenses/>.
  20. import argparse
  21. try:
  22. from libray import core
  23. except ImportError:
  24. import core
  25. if __name__ == '__main__':
  26. parser = argparse.ArgumentParser(description='A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs')
  27. parser._action_groups.pop()
  28. required = parser.add_argument_group('required arguments')
  29. required.add_argument('-i', '--iso', dest='iso', type=str, help='Path to .iso file or stream', required=True)
  30. optional = parser.add_argument_group('optional arguments')
  31. optional.add_argument('-o', '--output', dest='output', type=str, help='Output filename', default='')
  32. optional.add_argument('-k', '--ird', dest='ird', type=str, help='Path to .ird file', default='')
  33. optional.add_argument('-d', '--decryption-key', dest='decryption_key', type=str, help='Manually specify key', default='')
  34. optional.add_argument('-v', '--verbose', dest='verbose', help='Increase verbosity', action='count')
  35. optional.add_argument('-q', '--quiet', dest='quiet', help='Quiet mode, only prints on error', action='store_true')
  36. # -e is reserved for "extract" so re-encrypt is "-r"
  37. optional.add_argument('-r', '--re-encrypt', dest='reencrypt', help='Re-encrypt .iso', action='store_true')
  38. args = parser.parse_args()
  39. if args.reencrypt:
  40. core.encrypt(args)
  41. else:
  42. core.decrypt(args)