backend #2
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,3 +4,6 @@
|
|||||||
*.db
|
*.db
|
||||||
.idea/
|
.idea/
|
||||||
configs/config.yaml
|
configs/config.yaml
|
||||||
|
build
|
||||||
|
main.spec
|
||||||
|
pyinstallericon.ico
|
File diff suppressed because one or more lines are too long
2
cdrm-frontend/dist/index.html
vendored
2
cdrm-frontend/dist/index.html
vendored
@ -12,7 +12,7 @@
|
|||||||
<meta property='og:url' content="{{ data.opengraph_url }}" />
|
<meta property='og:url' content="{{ data.opengraph_url }}" />
|
||||||
<meta property='og:locale' content='en_US' />
|
<meta property='og:locale' content='en_US' />
|
||||||
<title>{{ data.tab_title }}</title>
|
<title>{{ data.tab_title }}</title>
|
||||||
<script type="module" crossorigin src="/assets/index-bTy8Pcga.js"></script>
|
<script type="module" crossorigin src="/assets/index-D2On2KQO.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-0Rv9u7Qs.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-0Rv9u7Qs.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB |
BIN
cdrm-frontend/public/og-api.jpg
Normal file
BIN
cdrm-frontend/public/og-api.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 KiB |
BIN
cdrm-frontend/public/og-cache.jpg
Normal file
BIN
cdrm-frontend/public/og-cache.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 207 KiB |
BIN
cdrm-frontend/public/og-home.jpg
Normal file
BIN
cdrm-frontend/public/og-home.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 302 KiB |
BIN
cdrm-frontend/public/og-testplayer.jpg
Normal file
BIN
cdrm-frontend/public/og-testplayer.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 99 KiB |
@ -30,6 +30,7 @@ function Home() {
|
|||||||
const handleSubmitButton = (event) => {
|
const handleSubmitButton = (event) => {
|
||||||
let pssh = document.getElementById('pssh').value;
|
let pssh = document.getElementById('pssh').value;
|
||||||
let licurl = document.getElementById('licurl').value;
|
let licurl = document.getElementById('licurl').value;
|
||||||
|
let proxy = document.getElementById('proxy').value;
|
||||||
let headers = document.getElementById('headers').value;
|
let headers = document.getElementById('headers').value;
|
||||||
let cookies = document.getElementById('cookies').value;
|
let cookies = document.getElementById('cookies').value;
|
||||||
let data = document.getElementById('data').value;
|
let data = document.getElementById('data').value;
|
||||||
@ -42,6 +43,7 @@ function Home() {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
pssh: pssh,
|
pssh: pssh,
|
||||||
licurl: licurl,
|
licurl: licurl,
|
||||||
|
proxy: proxy,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
cookies: cookies,
|
cookies: cookies,
|
||||||
data: data
|
data: data
|
||||||
@ -64,6 +66,7 @@ function Home() {
|
|||||||
const handleResetButton = (event) => {
|
const handleResetButton = (event) => {
|
||||||
let pssh = document.getElementById('pssh');
|
let pssh = document.getElementById('pssh');
|
||||||
let licurl = document.getElementById('licurl');
|
let licurl = document.getElementById('licurl');
|
||||||
|
let proxy = document.getElementById('proxy');
|
||||||
let headers = document.getElementById('headers');
|
let headers = document.getElementById('headers');
|
||||||
let cookies = document.getElementById('cookies');
|
let cookies = document.getElementById('cookies');
|
||||||
let data = document.getElementById('data');
|
let data = document.getElementById('data');
|
||||||
@ -94,6 +97,8 @@ function Home() {
|
|||||||
<input type='text' id='pssh' name='pssh' className='text-white bg-[rgba(0,0,0,0.2)] focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-shadow duration-300 ease-in-out p-2' />
|
<input type='text' id='pssh' name='pssh' className='text-white bg-[rgba(0,0,0,0.2)] focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-shadow duration-300 ease-in-out p-2' />
|
||||||
<label htmlFor='licurl' className='text-white mb-1 mt-1'>License URL:</label>
|
<label htmlFor='licurl' className='text-white mb-1 mt-1'>License URL:</label>
|
||||||
<input type='text' id='licurl' name='licurl' className='text-white bg-[rgba(0,0,0,0.2)] focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-shadow duration-300 ease-in-out p-2' />
|
<input type='text' id='licurl' name='licurl' className='text-white bg-[rgba(0,0,0,0.2)] focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-shadow duration-300 ease-in-out p-2' />
|
||||||
|
<label htmlFor='proxy' className='text-white mb-1 mt-1'>Proxy:</label>
|
||||||
|
<input type='text' id='proxy' name='proxy' className='text-white bg-[rgba(0,0,0,0.2)] focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-shadow duration-300 ease-in-out p-2' />
|
||||||
<label htmlFor='headers' className='text-white mb-1 mt-1'>Headers:</label>
|
<label htmlFor='headers' className='text-white mb-1 mt-1'>Headers:</label>
|
||||||
<textarea id='headers' name='headers' className='text-white bg-[rgba(0,0,0,0.2)] h-24 focus:h-92 focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-all duration-300 ease-in-out p-2 resize-none' />
|
<textarea id='headers' name='headers' className='text-white bg-[rgba(0,0,0,0.2)] h-24 focus:h-92 focus:outline-none rounded focus:shadow-sm focus:shadow-cyan-500/50 transition-all duration-300 ease-in-out p-2 resize-none' />
|
||||||
<label htmlFor='cookies' className='text-white mb-1 mt-1'>Cookies:</label>
|
<label htmlFor='cookies' className='text-white mb-1 mt-1'>Cookies:</label>
|
||||||
|
@ -4,7 +4,7 @@ tags = {
|
|||||||
'keywords': 'CDRM, Widevine, PlayReady, DRM, Decrypt, CDM, CDM-Project, CDRM-Project, TPD94, Decryption',
|
'keywords': 'CDRM, Widevine, PlayReady, DRM, Decrypt, CDM, CDM-Project, CDRM-Project, TPD94, Decryption',
|
||||||
'opengraph_title': 'CDRM-Project',
|
'opengraph_title': 'CDRM-Project',
|
||||||
'opengraph_description': 'Self Hosted web application written in Python/JavaScript utilizing the Flask/Tailwind Framework and ReactJS library to decrypt Widevine & Playready content',
|
'opengraph_description': 'Self Hosted web application written in Python/JavaScript utilizing the Flask/Tailwind Framework and ReactJS library to decrypt Widevine & Playready content',
|
||||||
'opengraph_image': 'https://cdrm-project.com/lockforog.png',
|
'opengraph_image': 'https://cdrm-project.com/og-home.jpg',
|
||||||
'opengraph_url': 'https://cdm-project.com/tpd94/cdrm-project',
|
'opengraph_url': 'https://cdm-project.com/tpd94/cdrm-project',
|
||||||
'tab_title': 'CDRM-Project',
|
'tab_title': 'CDRM-Project',
|
||||||
},
|
},
|
||||||
@ -13,7 +13,7 @@ tags = {
|
|||||||
'keywords': 'Cache, Vault, Widevine, PlayReady, DRM, Decryption, CDM, CDRM-Project, CDRM-Project, TPD94, Decryption',
|
'keywords': 'Cache, Vault, Widevine, PlayReady, DRM, Decryption, CDM, CDRM-Project, CDRM-Project, TPD94, Decryption',
|
||||||
'opengraph_title': 'Search the Cache',
|
'opengraph_title': 'Search the Cache',
|
||||||
'opengraph_description': 'Search the cache by KID or PSSH for decryption keys',
|
'opengraph_description': 'Search the cache by KID or PSSH for decryption keys',
|
||||||
'opengraph_image': 'https://cdrm-project.com/lockforog.png',
|
'opengraph_image': 'https://cdrm-project.com/og-cache.jpg',
|
||||||
'opengraph_url': 'https://cdrm-project.com/cache',
|
'opengraph_url': 'https://cdrm-project.com/cache',
|
||||||
'tab_title': 'Cache',
|
'tab_title': 'Cache',
|
||||||
},
|
},
|
||||||
@ -22,7 +22,7 @@ tags = {
|
|||||||
'keywords': 'Shaka, Player, DRM, CDRM, CDM, CDRM-Project, TPD94, Decryption, CDM-Project, KID, KEY',
|
'keywords': 'Shaka, Player, DRM, CDRM, CDM, CDRM-Project, TPD94, Decryption, CDM-Project, KID, KEY',
|
||||||
'opengraph_title': 'Test Player',
|
'opengraph_title': 'Test Player',
|
||||||
'opengraph_description': 'Shaka Player for testing decryption keys',
|
'opengraph_description': 'Shaka Player for testing decryption keys',
|
||||||
'opengraph_image': 'https://cdrm-project.com/lockforog.png',
|
'opengraph_image': 'https://cdrm-project.com/og-testplayer.jpg',
|
||||||
'opengraph_url': 'https://cdrm-project.com/testplayer',
|
'opengraph_url': 'https://cdrm-project.com/testplayer',
|
||||||
'tab_title': 'Test Player',
|
'tab_title': 'Test Player',
|
||||||
},
|
},
|
||||||
@ -31,7 +31,7 @@ tags = {
|
|||||||
'keywords': 'API, python, requests, send, remotecdm, remote, cdm, CDM-Project, CDRM-Project, TPD94, Decryption, DRM, Web, Vault',
|
'keywords': 'API, python, requests, send, remotecdm, remote, cdm, CDM-Project, CDRM-Project, TPD94, Decryption, DRM, Web, Vault',
|
||||||
'opengraph_title': 'API',
|
'opengraph_title': 'API',
|
||||||
'opengraph_description': 'Documentation for the program "CDRM-Project"',
|
'opengraph_description': 'Documentation for the program "CDRM-Project"',
|
||||||
'opengraph_image': 'https://cdrm-project.com/lockforog.png',
|
'opengraph_image': 'https://cdrm-project.com/og-api.jpg',
|
||||||
'opengraph_url': 'https://cdrm-project.com/api',
|
'opengraph_url': 'https://cdrm-project.com/api',
|
||||||
'tab_title': 'API',
|
'tab_title': 'API',
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import ast
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +73,18 @@ def is_base64(string):
|
|||||||
# If decoding or encoding fails, it's not Base64
|
# If decoding or encoding fails, it's not Base64
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def api_decrypt(pssh:str = None, license_url: str = None, headers: str = None, cookies: str = None, json_data: str = None):
|
def is_url_and_split(input_str):
|
||||||
|
parsed = urlparse(input_str)
|
||||||
|
|
||||||
|
# Check if it's a valid URL with scheme and netloc
|
||||||
|
if parsed.scheme and parsed.netloc:
|
||||||
|
protocol = parsed.scheme
|
||||||
|
fqdn = parsed.netloc
|
||||||
|
return True, protocol, fqdn
|
||||||
|
else:
|
||||||
|
return False, None, None
|
||||||
|
|
||||||
|
def api_decrypt(pssh:str = None, license_url: str = None, proxy: str = None, headers: str = None, cookies: str = None, json_data: str = None):
|
||||||
with open(f'{os.getcwd()}/configs/config.yaml', 'r') as file:
|
with open(f'{os.getcwd()}/configs/config.yaml', 'r') as file:
|
||||||
config = yaml.safe_load(file)
|
config = yaml.safe_load(file)
|
||||||
if config['database_type'].lower() == 'sqlite':
|
if config['database_type'].lower() == 'sqlite':
|
||||||
@ -165,14 +176,30 @@ def api_decrypt(pssh:str = None, license_url: str = None, headers: str = None, c
|
|||||||
'message': f'An error occurred getting json_data\n\n{error}'
|
'message': f'An error occurred getting json_data\n\n{error}'
|
||||||
}
|
}
|
||||||
licence = None
|
licence = None
|
||||||
|
proxies = None
|
||||||
|
if proxy is not None:
|
||||||
|
is_url, protocol, fqdn = is_url_and_split(proxy)
|
||||||
|
if is_url:
|
||||||
|
proxies = {'http': proxy, 'https': proxy}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'message': f'Your proxy is invalid, please put it in the format of http(s)://fqdn.tld:port'
|
||||||
|
}
|
||||||
try:
|
try:
|
||||||
licence = requests.post(
|
licence = requests.post(
|
||||||
url=license_url,
|
url=license_url,
|
||||||
headers=format_headers,
|
headers=format_headers,
|
||||||
|
proxies=proxies,
|
||||||
cookies=format_cookies,
|
cookies=format_cookies,
|
||||||
json=format_json_data if format_json_data is not None else None,
|
json=format_json_data if format_json_data is not None else None,
|
||||||
data=pr_challenge if format_json_data is None else None
|
data=pr_challenge if format_json_data is None else None
|
||||||
)
|
)
|
||||||
|
except requests.exceptions.ConnectionError as error:
|
||||||
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'message': f'An error occurred sending license challenge through your proxy\n\n{error}'
|
||||||
|
}
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
return {
|
return {
|
||||||
'status': 'error',
|
'status': 'error',
|
||||||
@ -310,14 +337,25 @@ def api_decrypt(pssh:str = None, license_url: str = None, headers: str = None, c
|
|||||||
'message': f'An error occurred getting json_data\n\n{error}'
|
'message': f'An error occurred getting json_data\n\n{error}'
|
||||||
}
|
}
|
||||||
licence = None
|
licence = None
|
||||||
|
proxies = None
|
||||||
|
if proxy is not None:
|
||||||
|
is_url, protocol, fqdn = is_url_and_split(proxy)
|
||||||
|
if is_url:
|
||||||
|
proxies = {'http': proxy, 'https': proxy}
|
||||||
try:
|
try:
|
||||||
licence = requests.post(
|
licence = requests.post(
|
||||||
url=license_url,
|
url=license_url,
|
||||||
headers=format_headers,
|
headers=format_headers,
|
||||||
|
proxies=proxies,
|
||||||
cookies=format_cookies,
|
cookies=format_cookies,
|
||||||
json=format_json_data if format_json_data is not None else None,
|
json=format_json_data if format_json_data is not None else None,
|
||||||
data=wv_challenge if format_json_data is None else None
|
data=wv_challenge if format_json_data is None else None
|
||||||
)
|
)
|
||||||
|
except requests.exceptions.ConnectionError as error:
|
||||||
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'message': f'An error occurred sending license challenge through your proxy\n\n{error}'
|
||||||
|
}
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
return {
|
return {
|
||||||
'status': 'error',
|
'status': 'error',
|
||||||
|
@ -77,6 +77,8 @@ def requirements_check():
|
|||||||
print("Invalid input. Please enter 'Y' to install or 'N' to exit.")
|
print("Invalid input. Please enter 'Y' to install or 'N' to exit.")
|
||||||
|
|
||||||
def run_python_checks():
|
def run_python_checks():
|
||||||
|
if getattr(sys, 'frozen', False): # Check if running from PyInstaller
|
||||||
|
return
|
||||||
version_check()
|
version_check()
|
||||||
pip_check()
|
pip_check()
|
||||||
venv_check()
|
venv_check()
|
||||||
|
@ -195,6 +195,13 @@ def decrypt_data():
|
|||||||
api_request_licurl = api_request_data['licurl']
|
api_request_licurl = api_request_data['licurl']
|
||||||
else:
|
else:
|
||||||
api_request_licurl = None
|
api_request_licurl = None
|
||||||
|
if 'proxy' in api_request_data:
|
||||||
|
if api_request_data['proxy'] == '':
|
||||||
|
api_request_proxy = None
|
||||||
|
else:
|
||||||
|
api_request_proxy = api_request_data['proxy']
|
||||||
|
else:
|
||||||
|
api_request_proxy = None
|
||||||
if 'headers' in api_request_data:
|
if 'headers' in api_request_data:
|
||||||
if api_request_data['headers'] == '':
|
if api_request_data['headers'] == '':
|
||||||
api_request_headers = None
|
api_request_headers = None
|
||||||
@ -216,7 +223,7 @@ def decrypt_data():
|
|||||||
api_request_data = api_request_data['data']
|
api_request_data = api_request_data['data']
|
||||||
else:
|
else:
|
||||||
api_request_data = None
|
api_request_data = None
|
||||||
result = api_decrypt(pssh=api_request_pssh, license_url=api_request_licurl, headers=api_request_headers, cookies=api_request_cookies, json_data=api_request_data)
|
result = api_decrypt(pssh=api_request_pssh, proxy=api_request_proxy, license_url=api_request_licurl, headers=api_request_headers, cookies=api_request_cookies, json_data=api_request_data)
|
||||||
if result['status'] == 'success':
|
if result['status'] == 'success':
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'status': 'success',
|
'status': 'success',
|
||||||
|
@ -1,30 +1,33 @@
|
|||||||
from flask import Blueprint, send_from_directory, request, render_template
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from flask import Blueprint, send_from_directory, request, render_template
|
||||||
from configs import index_tags
|
from configs import index_tags
|
||||||
|
|
||||||
react_bp = Blueprint('react_bp', __name__, static_folder=f'{os.getcwd()}/cdrm-frontend/dist', static_url_path='/',
|
if getattr(sys, 'frozen', False): # Running as a bundled app
|
||||||
template_folder=f'{os.getcwd()}/cdrm-frontend/dist')
|
base_path = sys._MEIPASS
|
||||||
|
else: # Running in a normal Python environment
|
||||||
|
base_path = os.path.abspath(".")
|
||||||
|
|
||||||
|
static_folder = os.path.join(base_path, 'cdrm-frontend', 'dist')
|
||||||
|
|
||||||
|
react_bp = Blueprint(
|
||||||
|
'react_bp',
|
||||||
|
__name__,
|
||||||
|
static_folder=static_folder,
|
||||||
|
static_url_path='/',
|
||||||
|
template_folder=static_folder
|
||||||
|
)
|
||||||
|
|
||||||
@react_bp.route('/', methods=['GET'])
|
@react_bp.route('/', methods=['GET'])
|
||||||
@react_bp.route('/<path:path>', methods=["GET"])
|
@react_bp.route('/<path:path>', methods=["GET"])
|
||||||
@react_bp.route('/<path>', methods=["GET"])
|
@react_bp.route('/<path>', methods=["GET"])
|
||||||
def index(path=''):
|
def index(path=''):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
if path != "" and os.path.exists(react_bp.static_folder + '/' + path):
|
file_path = os.path.join(react_bp.static_folder, path)
|
||||||
|
if path != "" and os.path.exists(file_path):
|
||||||
return send_from_directory(react_bp.static_folder, path)
|
return send_from_directory(react_bp.static_folder, path)
|
||||||
elif path.lower() == '':
|
elif path.lower() in ['', 'cache', 'api', 'testplayer']:
|
||||||
data = index_tags.tags['index']
|
data = index_tags.tags.get(path.lower(), index_tags.tags['index'])
|
||||||
return render_template('index.html', data=data)
|
|
||||||
elif path.lower() == 'cache':
|
|
||||||
data = index_tags.tags['cache']
|
|
||||||
return render_template('index.html', data=data)
|
|
||||||
elif path.lower() == 'api':
|
|
||||||
data = index_tags.tags['api']
|
|
||||||
return render_template('index.html', data=data)
|
|
||||||
elif path.lower() == 'testplayer':
|
|
||||||
data = index_tags.tags['test_player']
|
|
||||||
return render_template('index.html', data=data)
|
return render_template('index.html', data=data)
|
||||||
else:
|
else:
|
||||||
return send_from_directory(react_bp.static_folder, 'index.html')
|
return send_from_directory(react_bp.static_folder, 'index.html')
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user