Skip to content

Instantly share code, notes, and snippets.

@ioncodes
Created August 27, 2020 17:59
Show Gist options
  • Save ioncodes/8e14cb5448913d0352cadf52330f109b to your computer and use it in GitHub Desktop.
Save ioncodes/8e14cb5448913d0352cadf52330f109b to your computer and use it in GitHub Desktop.
Data miner script for Dead By Daylight updated for [ByDanngel](https://twitter.com/ByDanngel). I don't own any of this code (Owner: DarkV#5244), I only made a quick update.
from Crypto.Cipher import AES
from http.cookiejar import CookieJar, CookiePolicy
from datetime import datetime
import requests
import json
import base64
import zlib
import os
import os.path
import urllib3
import progressbar
os.system("")
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# [Config Reading]
try:
with open('Custom.json', "r") as file:
data = json.load(file)
headers = data['User-Agent']
json_acceptable_string = headers.replace("'", "\"")
headers = json.loads(json_acceptable_string)
except FileNotFoundError:
headers = {
'User-Agent': 'DeadByDaylight/++DeadByDaylight+Live-CL-283530 Windows/10.0.18363.1.256.64bit'}
# [Config]
ValidValue = True # Input Menu Deafult = True
# headers = {'User-Agent':'DeadByDaylight/++DeadByDaylight+Live-CL-283530 Windows/10.0.18363.1.256.64bit'}
i = 0
# [Custom Function]
class style():
CEND = '\33[0m'
CBOLD = '\33[1m'
CITALIC = '\33[3m'
CURL = '\33[4m'
CBLINK = '\33[5m'
CBLINK2 = '\33[6m'
CSELECTED = '\33[7m'
CBLACK = '\33[30m'
CRED = '\33[31m'
CGREEN = '\33[32m'
CYELLOW = '\33[33m'
CBLUE = '\33[34m'
CVIOLET = '\33[35m'
CBEIGE = '\33[36m'
CWHITE = '\33[37m'
CBLACKBG = '\33[40m'
CREDBG = '\33[41m'
CGREENBG = '\33[42m'
CYELLOWBG = '\33[43m'
CBLUEBG = '\33[44m'
CVIOLETBG = '\33[45m'
CBEIGEBG = '\33[46m'
CWHITEBG = '\33[47m'
CGREY = '\33[90m'
CRED2 = '\33[91m'
CGREEN2 = '\33[92m'
CYELLOW2 = '\33[93m'
CBLUE2 = '\33[94m'
CVIOLET2 = '\33[95m'
CBEIGE2 = '\33[96m'
CWHITE2 = '\33[97m'
CGREYBG = '\33[100m'
CREDBG2 = '\33[101m'
CGREENBG2 = '\33[102m'
CYELLOWBG2 = '\33[103m'
CBLUEBG2 = '\33[104m'
CVIOLETBG2 = '\33[105m'
CBEIGEBG2 = '\33[106m'
CWHITEBG2 = '\33[107m'
def authBHVR(headers,):
url = ''
url_response = requests.get(url, headers=headers, verify=False)
data = url_response.json()
def version_download(build, headers):
BaseUrl = 'https://' + build + '.bhvrdbd.com'
url = BaseUrl + '/api/v1/utils/contentVersion/version'
url_response = requests.get(url, headers=headers, verify=False)
data = url_response.json()
decoded = list(data['availableVersions'])
time_value = 0 # Value for datastamp
CookieURL = BaseUrl + '/api/v1/auth/login/guest'
for i in range(len(decoded)):
result = decoded[i]
raw = data['availableVersions'][result]
unix_stamp = int(raw.split('-')[1])
if (result.startswith('m_') == False) and (unix_stamp > time_value):
version = decoded[i]
time_value = unix_stamp
Cookie = requests.post(CookieURL, headers=headers, json={"clientData": {
"catalogId": version, "gameContentId": version, "consentId": version}}, verify=False)
value_Cookie = requests.utils.dict_from_cookiejar(Cookie.cookies)
return version, time_value, value_Cookie
def cookie_request(value_Cookie, headers, url, name):
BHVR = requests.get(url, headers=headers,
cookies=value_Cookie, verify=False)
decoded = json.loads(BHVR.content)
with open(name, "w") as file:
json.dump(decoded, file, indent=4)
def download_function(headers, name, url):
print('Saving a response in :', name)
print(url)
url_response = requests.get(url, headers=headers, verify=False)
if name == version + '/contentSchedule.json' or name == version + '/bonusPointEventsContent.json':
cipher = AES.new(b"5BCC2D6A95D4DF04A005504E59A9B36E", AES.MODE_ECB)
raw = url_response.content[8:]
base64_raw = base64.b64decode(raw)
print(base64_raw)
aes_raw = cipher.decrypt(base64_raw)
aes = "".join([chr(c + 1) for c in aes_raw]).replace("\u0001", "")
decoded = json.loads(aes)
print(decoded)
with open("Decoded.txt", "w") as file:
json.dump(decoded, file, indent=4)
else:
cipher = AES.new(b"5BCC2D6A95D4DF04A005504E59A9B36E", AES.MODE_ECB)
raw = url_response.content[8:]
base64_raw = base64.b64decode(raw)
aes_raw = cipher.decrypt(base64_raw)
aes = "".join([chr(c + 1) for c in aes_raw]).replace("\u0001", "")
O_base64 = base64.b64decode(aes[8:])
zlib_raw = O_base64[4:len(O_base64)]
zlib_parsed = zlib.decompress(zlib_raw).decode("utf16")
decoded = json.loads(zlib_parsed)
with open(name, "w") as file:
json.dump(decoded, file, indent=4)
def CDN_download(root_path, headers, version, build, value_Cookie, choice, i):
# download_function(name = '',url = root_path + version + '')
BaseUrl = 'https://' + build + '.bhvrdbd.com'
if (os.path.exists(version)) == False:
os.mkdir(version)
if i == 1:
download_function(headers, name=version + '/ranksThresholds.json',
url=root_path + '/content/' + version + '/ranksThresholds.json')
elif i == 2:
download_function(headers, name=version + '/emblemTunable.json',
url=root_path + '/content/' + version + '/emblemTunable.json')
elif i == 3:
download_function(headers, name=version + '/catalog.json',
url=root_path + '/content/' + version + '/catalog.json')
elif i == 4:
download_function(headers, name=version + '/specialEventsContent.json',
url=root_path + '/content/' + version + '/specialEventsContent.json')
elif i == 5:
download_function(headers, name=version + '/archiveRewardData.json',
url=root_path + '/content/' + version + '/archiveRewardData/content.json')
elif i == 6:
download_function(headers, name=version + '/eula_psn_eu.json', url=root_path +
'/content/' + version + '/consents/eula_psn_eu/v2/definition.json')
elif i == 7:
download_function(headers, name=version + '/eula.json', url=root_path +
'/content/' + version + '/consents/eula/v2/definition.json')
elif i == 8:
download_function(headers, name=version + '/privacy.json', url=root_path +
'/content/' + version + '/consents/privacy/v2/definition.json')
elif i == 9:
download_function(headers, name=version + '/eula_psn_na.json', url=root_path +
'/content/' + version + '/consents/eula_psn_na/v2/definition.json')
elif i == 10:
download_function(headers, name=version + '/GameConfigs.json',
url=root_path + '/content/' + version + '/GameConfigs.json')
elif (i == 11) and (not choice == 5):
download_function(headers, name=version + '/contentSchedule.json',
url=root_path + '/schedule/contentSchedule.json')
elif i == 12:
download_function(headers, name=version + '/newsContent.json',
url=root_path + '/news/newsContent.json')
elif i == 13:
download_function(headers, name=version + '/bonusPointEventsContent.json',
url=root_path + '/bonusPointEvents/bonusPointEventsContent.json')
elif i == 14:
download_function(headers, name=version + '/featuredPageContent.json',
url=root_path + '/banners/featuredPageContent.json')
elif i == 15:
cookie_request(value_Cookie, headers, url=BaseUrl +
'/api/v1/config', name=version + '/Config.json')
elif i == 16:
cookie_request(value_Cookie, headers, url=BaseUrl +
'/api/v1/archives/stories/get/storyIds', name=version + '/storyIds.json')
elif i == 17:
cookie_request(value_Cookie, headers, url=BaseUrl +
'/api/v1/extensions/shrine/getAvailable', name=version + '/Shrine.json')
elif i == 18:
Tome_download(value_Cookie, BaseUrl, headers, root_path, version)
def url_response(headers, value_Cookie, url, name):
url_response = requests.get(
url, headers=headers, cookies=value_Cookie, verify=False)
content = json.loads(url_response.content)
name = version + '/' + name
print('Saving a response in :', name)
with open(name, "w") as file:
json.dump(content, file, indent=4)
def Tome_download(value_Cookie, BaseUrl, headers, root_path, version):
# https://steam.live.bhvrdbd.com/api/v1/archives/journal/getjournal?storyId=Tome03
# https://steam.live.bhvrdbd.com/api/v1/archives/stories/get/story?storyId=Tome03
# https://cdn.live.dbd.bhvronline.com/clientData/4fabea45-bce0-4461-8950-162659636437/content/3.7.0_299646live/archiveQuests/Tome03.json
storyIds = version + '/storyIds.json'
with open(storyIds, "r") as file:
data = json.load(file)
decoded = list(data['openStories'])
decoded.append("Tome05")
for i in range(len(decoded)):
tome = decoded[i]
tome = str(tome)
url_response(headers, value_Cookie, url=BaseUrl +
'/api/v1/archives/journal/getjournal?storyId=' + tome, name='journal' + ' ' + tome + '.json')
url_response(headers, value_Cookie, url=BaseUrl +
'/api/v1/archives/stories/get/story?storyId=' + tome, name='stories' + ' ' + tome + '.json')
download_function(headers, name=version + '/' + tome + '.json', url=root_path +
'/content/' + version + '/archiveQuests/' + tome + '.json')
def menu(mobile, wfor):
print('Please select a brach for', wfor + '.', 'The list is shown below. ')
print('1.live')
print('2.dev')
print('3.ptb')
print('4.stage')
print('5.cert')
print('6.qa')
if mobile == True:
print('7.mobile')
# [Begin_Coment]
print(style.CURL + 'Dead By CDN' + style.CEND +
' version 0.2 ' + style.CRED + "PUBLIC BETA" + style.CEND)
print('Code write by: DarkV#5244')
print('Open Source Code')
print('Using a new CDN Dead By Daylight, by sending a request on server')
print('')
# [Menu]
menu(True, 'build')
while True:
try:
choice = int(input(style.CGREEN + ">>> " + style.CEND))
except ValueError:
print('Invalid input!')
else:
break
# [Selecter]
if choice == 1:
root_path = 'https://cdn.live.dbd.bhvronline.com/clientData/4fabea45-bce0-4461-8950-162659636437' # live
build = "steam.live"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 2:
root_path = 'https://cdn.dev.dbd.bhvronline.com/clientData/b114b47d-a3e6-44b7-90eb-cd110b09acc1' # dev
build = "latest.dev"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 3:
root_path = 'https://cdn.ptb.dbd.bhvronline.com/clientData/6d750932-d109-49c7-8e6b-beb67fe327f2' # ptb
build = "latest.ptb"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 4:
root_path = 'https://cdn.stage.dbd.bhvronline.com/clientData/ef06650f-6108-4441-8677-8bc05a10b801' # stage
build = "latest.stage"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 5:
root_path = 'https://cdn.cert.dbd.bhvronline.com/clientData/81e79fac-5729-424d-aaec-4aecd65c44311' # cert
build = "latest.cert"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 6:
root_path = 'https://cdn.qa.dbd.bhvronline.com/clientData/5908c7cc-2e5a-41fb-a287-181cdd23ba62' # qa
build = "latest.qa"
version, time_value, value_Cookie = version_download(build, headers)
print('Latest version selected how :', '"' + version + '"')
print('The latest changes for this version were :',
datetime.fromtimestamp(time_value))
for i in progressbar.progressbar(range(20), redirect_stdout=True):
CDN_download(root_path, headers, version,
build, value_Cookie, choice, i)
elif choice == 7:
menu(False, 'mobile build')
while True:
try:
choice = int(input(style.CRED + ">>> " + style.CEND))
except ValueError:
print('Invalid input!')
else:
break
else:
print('Incorect input! Please try again')
input()
print('Press any key to continue...')
input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment