Roblox Cache Buster: Simple script to convert Roblox cache files on `%temp%/Roblox/http` folder to normal, openable files (if valid). Run the script inside `%temp%/Roblox/http`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from genericpath import isfile | |
import puremagic, io, os | |
os.makedirs('cachebuster', exist_ok=True) | |
for file_name in os.listdir('.'): | |
if not os.path.isfile(file_name): | |
continue | |
# print(file_name) | |
new_file_headers = b"" | |
new_file_content = None | |
with open(file_name, mode='rb') as file: | |
if file.read(4) != b"RBXH": | |
continue | |
# Seeking to HTTP request | |
start = b"" | |
while start != b"\x03\x00\x00\x00": | |
start = start[-3:] + file.read(1) | |
# print("READ HEADER") | |
last_tell = 0 | |
header = b"" | |
separator_exists = False | |
while (len(header) < 64 or separator_exists) and file.peek(1): | |
header += file.read(1) | |
if header[-2:] == b": ": | |
separator_exists = True | |
if header[-2:] == b"\r\n" and separator_exists: | |
last_tell = file.tell() | |
new_file_headers += header | |
# print(header) | |
header = b"" | |
separator_exists = False | |
if new_file_headers == b"": | |
# print("NO HEADER") | |
print(file_name + ": No header") | |
continue | |
# print("READ CONTENT") | |
file.seek(last_tell) | |
new_file_content = io.BytesIO(file.read()) | |
# print(puremagic.magic_stream(file)) | |
# print(new_file.read(16)) | |
new_file_name = None | |
puremagic_result = None | |
try: | |
puremagic_result = puremagic.magic_stream(new_file_content) | |
# print(puremagic_result[0].extension) | |
new_file_name = "cachebuster/" + file_name + puremagic_result[0].extension | |
except: | |
new_file_name = "cachebuster/" + file_name | |
new_file_content.seek(0) | |
# if len(new_file_content) == 0: | |
# continue | |
if not new_file_content.read(1): | |
print(file_name + ": No content") | |
continue | |
if not puremagic_result: | |
print(file_name + ": OK, unknown") | |
continue | |
new_file_content.seek(0) | |
with open(new_file_name, 'wb') as new_file: | |
new_file.write(new_file_content.read()) | |
print(file_name + ": OK, " + puremagic_result[0].name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puremagic==1.14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment