Created
May 21, 2022 09:33
-
-
Save JeelPatel231/3023f5d5c4cec886caf5b2bedafaa602 to your computer and use it in GitHub Desktop.
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
import re | |
def tear_decode(data_file, data_seed): | |
# lmao | |
def replacer(match): | |
# | x - 5 | basically | |
chars = { | |
'0': '5', | |
'1': '6', | |
'2': '7', | |
'5': '0', | |
'6': '1', | |
'7': '2' | |
} | |
return chars[match.group(0)] | |
# max | |
def bytes2str(a10): | |
a15 = '' | |
for i in a10: | |
a15 += chr(i) | |
return a15 | |
# max | |
def digest_pad(string): | |
emplist = [] | |
length = len(string) | |
extra = 15 - (length % 16) | |
emplist.append(extra) | |
for i in range(length): | |
emplist.append(string[i]) | |
for i in range(extra): | |
emplist.append(0) | |
return emplist | |
# max | |
def blocks2bytes(inp): | |
temp_list = [] | |
for i in range(len(inp)): | |
temp_list += [255 & rshift((inp[i]), 24)] | |
temp_list += [255 & rshift((inp[i]), 16)] | |
temp_list += [255 & rshift((inp[i]), 8)] | |
temp_list += [255 & inp[i]] | |
return temp_list | |
# max | |
def bytes2blocks(a22): | |
emplist = [] | |
length = len(a22) | |
listIndex = 0 | |
for i in range(length): | |
subIndex = i % 4 | |
shiftedByte = a22[i] << (3-subIndex)*8 | |
if(subIndex == 0): | |
emplist.append(shiftedByte) | |
else: | |
emplist[listIndex] |= (shiftedByte) | |
if(subIndex == 3): | |
listIndex += 1 | |
return emplist | |
def xor_blocks(a76, a77): | |
return [a76[0] ^ a77[0], a76[1] ^ a77[1]] | |
# max | |
def unpad(a46): | |
a52 = [] | |
even_odd = a46[0] % 2 | |
for i in range(1, len(a46) - even_odd): | |
a52 += [a46[i]] | |
return a52 | |
# max | |
def rshift(a, b): | |
return (a % 4294967296) >> b | |
def tea_code(a79, a80): | |
a85, a83 = a79 # unpacking | |
a87 = 0 | |
for _ in range(32): | |
a85 += (((((a83) << 4) ^ rshift((a83), 5)) + a83) ^ (a87 + a80[(a87 & 3)])) | |
a87 = (a87) - (1640531527) | |
a83 += (((((a85) << 4) ^ rshift((a85), 5)) + a85) ^ (a87 + a80[(rshift(a87, 11) & 3)])) | |
return [a85, a83] | |
# max | |
def binarydigest(a55): | |
print(a55) | |
a63 = [1633837924, 1650680933, 1667523942, 1684366951] | |
a62 = a63[:2] | |
a61 = a62 | |
a59 = bytes2blocks(digest_pad(bytes(a55, 'ascii'))) | |
for i in range(0,len(a59),4): | |
a66 = a59[i:i+2] | |
a68 = a59[i+2:i+4] | |
a62 = tea_code(xor_blocks(a66, a62), a63) | |
a61 = tea_code(xor_blocks(a68, a61), a63) | |
# THIS WHOLE BULLSHIT IS A LEFT SHIFT, eg [1,2,3,4] -> [2,3,4,1] | |
a64 = a62[0] | |
a62[0] = a62[1] | |
a62[1] = a61[0] | |
a61[0] = a61[1] | |
a61[1] = a64 | |
# left shift end | |
return [a62[0], a62[1], a61[0], a61[1]] | |
def ascii2bytes(inp): | |
a2b = {'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, 'K': 10, | |
'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, | |
'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, 'e': 30, | |
'f': 31, 'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39, 'o': 40, | |
'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48, 'x': 49, 'y': 50, | |
'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56, '5': 57, '6': 58, '7': 59, '8': 60, | |
'9': 61, '-': 62, '_': 63} | |
ind = -1 | |
length = len(inp) | |
listIndex = 0 | |
emplist = [] | |
# jeelTest = -4 | |
while True: | |
# ------ | |
# if set(inp).issubset(a2b.keys()): | |
# jeelTest += 4 | |
# ------- | |
for i in inp: | |
if i in a2b.keys(): | |
ind += 1 | |
break | |
#----- | |
emplist.append(a2b[inp[ind]] * 4) | |
while True: | |
ind += 1 | |
if inp[ind] in a2b.keys(): | |
break | |
a3 = a2b[inp[ind]] | |
emplist[listIndex] |= rshift((a3), 4) | |
listIndex += 1 | |
a3 = (15 & a3) | |
if (a3 == 0) and (ind == (length - 1)): | |
return emplist | |
emplist.append((a3) * 16) | |
while True: | |
ind += 1 | |
if ind >= length: | |
return emplist | |
if inp[ind] in a2b.keys(): | |
break | |
a3 = a2b[inp[ind]] | |
emplist[listIndex] |= rshift((a3), 2) | |
listIndex += 1 | |
a3 = (3 & a3) | |
if (a3 == 0) and (ind == (length - 1)): | |
return emplist | |
emplist.append((a3) << 6) | |
for i in inp: | |
ind += 1 | |
if inp[ind] in a2b.keys(): | |
break | |
emplist[listIndex] |= a2b[inp[ind]] | |
listIndex += 1 | |
def tea_decode(a90, a91): | |
a95,a96 = a90 # unpacking | |
a97 = -957401312 | |
for _ in range(32): | |
a96 = (a96) - (((((a95) << 4) ^ rshift((a95), 5)) + a95) ^ (a97 + a91[(rshift((a97), 11) & 3)])) | |
a97 = (a97) + 1640531527 | |
a95 = (a95) - (((((a96) << 4) ^ rshift((a96), 5)) + a96) ^ (a97 + a91[(a97 & 3)])) | |
return [a95, a96] | |
# replace 0,1,2,5,6,7 with | x - 5 | | |
data_seed = re.sub('[012567]', replacer, data_seed) | |
new_data_seed = binarydigest(data_seed) | |
new_data_file = bytes2blocks(ascii2bytes(data_file)) | |
a71 = [1633837924, 1650680933] | |
a74 = [] | |
for i in range(0,len(new_data_file),2): | |
a73 = new_data_file[i:i+2] | |
a74 += xor_blocks(a71, tea_decode(a73, new_data_seed)) | |
a71 = a73 | |
return re.sub('[012567]', replacer, bytes2str(unpad(blocks2bytes(a74)))) | |
src = "HJUM6mTcTc6EVgZFU7xlitmej8W6kGkryQ9P5sCuUT2AKQgL1vLk6elEklqDJV2EdI2LeV7JMN6KubmHa6RXYxe18YqhmSSgtowthrhS0u7P6CJjP-q5H2yaNfls1A5pSXjcgeO7uiWyK7829f0rcmVDF3kTCkOKA27etunuo6XqUsep4jdVPeY7p8Aq4cMIkfq85oX5b3df13c_j4SBS6rdvrTkN_D5Xj5qmwCK_U8XMTPPXHqjMhCTnBODqNygYtY1QIbIrmil-WkQ251Aag" | |
seed = "z5v75r3qewgbg6sh" | |
decoded = tear_decode(src, seed) | |
answer = "https://content-videovard-delivery-s82.vidvard.link/hls2/01/00302/e80ztxjs67he_,l,n,h,.urlset/master.m3u8?t=4yrewtNTxaCubrlC_xjw1k4yAqIcTk2iVHdc6VtJAKQ&s=1653049971&e=18000&f=1514682&srv=127.0.0.1&asn=45609" | |
print(decoded) | |
print(decoded == answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment