Advertisement
Sehnryr

test.py

Feb 12th, 2020
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.91 KB | None | 0 0
  1. import re
  2. import execjs
  3.  
  4. content = '''
  5. (String.fromCharCode
  6.        (
  7.            (010 * 12 + 6),
  8.            (06 * (0x1 * (1 * 0xa + 6) + 1) + 12),
  9.            (4 * 27 + 3),
  10.            (01 * 0x3b + 50),
  11.            (1 * 0x34 + 15),
  12.            (1 * (1 * (3 * ((0x1 * 8 + 7) * 1 + 0) + 8) + 24) + 27),
  13.            (0x1 * (2 * 0x25 + 7) + 16),
  14.            (1 * 0112 + 40),
  15.            (1 * 0x2c + 23),
  16.            (0x3 * 042 + 9),
  17.            (1 * ((05 * 4 + 1) * 03 + 0) + 37),
  18.            (0x2 * (1 * 0x1f + 4) + 31)
  19.        ))
  20.        String.fromCharCode
  21.        (
  22.            (010 * 12 + 6),
  23.            (06 * (0x1 * (1 * 0xa + 6) + 1) + 12),
  24.            (4 * 27 + 3),
  25.            (01 * 0x3b + 50),
  26.            (1 * 0x34 + 15),
  27.            (1 * (1 * (3 * ((0x1 * 8 + 7) * 1 + 0) + 8) + 24) + 27),
  28.            (0x1 * (2 * 0x25 + 7) + 16),
  29.            (1 * 0112 + 40),
  30.            (1 * 0x2c + 23),
  31.            (0x3 * 042 + 9),
  32.            (1 * ((05 * 4 + 1) * 03 + 0) + 37),
  33.            (0x2 * (1 * 0x1f + 4) + 31)
  34.        )
  35. '''
  36. # soup = re.findall(r"\((.+?)\)", content, re.MULTILINE)
  37. # print(soup)
  38.  
  39. looptime = len(re.findall(r"String.fromCharCode", content))
  40.  
  41. pepper = "String.fromCharCode"
  42. text = content
  43.  
  44. for _ in range(looptime):
  45.     num = text.find(pepper) + len(pepper)
  46.     text = text[num:]
  47.  
  48.     soup = list(text)
  49.     soup.append(' ') # Just to be sure
  50.     i = 0
  51.     first = int()
  52.     last = int()
  53.     for idx, vegetable in enumerate(soup):
  54.         o = i
  55.         if vegetable == '(':
  56.             i += 1
  57.         if vegetable == ')':
  58.             i -= 1
  59.         if i == 1 and o == 0: # First Opened Bracket
  60.             first = idx
  61.         if i == 0 and o == 1: # Last Closed Bracket
  62.             break
  63.     last = idx + 1
  64.     content = content.replace(f"{pepper}{text[:first]}{text[first:last]}", execjs.eval(f"{pepper}{text[first:last]}"), 1)
  65.     text = text[last:]
  66.  
  67. print(content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement