SHARE
TWEET

Untitled

a guest Aug 25th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pprint
  2. yy_meta = [0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
  3. yy_accept = [0x0000, 0x0000, 0x0000, 0x001C, 0x001A, 0x0018, 0x0018, 0x001A, 0x000E, 0x000F, 0x0015, 0x0013, 0x0017, 0x0014, 0x0019, 0x0016, 0x0012, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x0010, 0x0011, 0x000C, 0x0000, 0x0019, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D,
  4.              0x000D, 0x000D, 0x000B, 0x000D, 0x0003, 0x000D, 0x000D, 0x0006, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x0001, 0x0004, 0x000D, 0x0002, 0x000D, 0x0005, 0x000D, 0x000A, 0x000D, 0x000D, 0x0008, 0x000D, 0x0000, 0x0009, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  5. yy_base = [0x0000, 0x0000, 0x0000, 0x0050, 0x0051, 0x0051, 0x0051, 0x004B, 0x0051, 0x0051, 0x0051, 0x0051, 0x0051, 0x0051, 0x0042, 0x0051, 0x0051, 0x0000, 0x0039, 0x0032, 0x0012, 0x002E, 0x002E, 0x002F, 0x0034, 0x0033, 0x0051, 0x0051, 0x0051, 0x0042, 0x0039, 0x0000, 0x002D, 0x0012, 0x002D, 0x002F, 0x002A, 0x002A, 0x0025,
  6.            0x0022, 0x001D, 0x0000, 0x002B, 0x0000, 0x0022, 0x0026, 0x0000, 0x0020, 0x001A, 0x0018, 0x0018, 0x0017, 0x0000, 0x0000, 0x0016, 0x0000, 0x001F, 0x0000, 0x001C, 0x0000, 0x0015, 0x0016, 0x001F, 0x0012, 0x0011, 0x0000, 0x0018, 0x0010, 0x0012, 0x0051, 0x0051, 0x002B, 0x0022, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  7. yy_def = [0x0000, 0x0046, 0x0001, 0x0046, 0x0046, 0x0046, 0x0046, 0x0047, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0046, 0x0046, 0x0046, 0x0047, 0x0046, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048,
  8.           0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0046, 0x0048, 0x0046, 0x0046, 0x0046, 0x0046, 0x0000, 0x0046, 0x0046, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  9. yy_nxt = [0x0000, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0004, 0x000E, 0x000F, 0x0010, 0x0011, 0x0004, 0x0011, 0x0011, 0x0012, 0x0011, 0x0011, 0x0011, 0x0013, 0x0014, 0x0011, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x0011, 0x0011, 0x001A, 0x001B, 0x0022, 0x002A, 0x001F, 0x0045, 0x002B, 0x0044, 0x0043, 0x0042, 0x0041, 0x0023, 0x001D, 0x001D, 0x0040, 0x003F, 0x003E, 0x003D, 0x003C, 0x003B, 0x003A, 0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0034, 0x0033, 0x0032, 0x0031,
  10.           0x0030, 0x002F, 0x002E, 0x002D, 0x002C, 0x0029, 0x001E, 0x001C, 0x0028, 0x0027, 0x0026, 0x0025, 0x0024, 0x0021, 0x0020, 0x001E, 0x001C, 0x0046, 0x0003, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  11. yy_chk = [0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0014, 0x0021, 0x0048, 0x0044, 0x0021, 0x0043, 0x0042, 0x0040, 0x003F, 0x0014, 0x0047, 0x0047, 0x003E, 0x003D, 0x003C, 0x003A, 0x0038, 0x0036, 0x0033, 0x0032, 0x0031, 0x0030, 0x002F, 0x002D, 0x002C, 0x002A, 0x0028, 0x0027,
  12.           0x0026, 0x0025, 0x0024, 0x0023, 0x0022, 0x0020, 0x001E, 0x001D, 0x0019, 0x0018, 0x0017, 0x0016, 0x0015, 0x0013, 0x0012, 0x000E, 0x0007, 0x0003, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  13. yy_ec=lol = [0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x01, 0x0D, 0x01, 0x0E, 0x01, 0x01, 0x01, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x01, 0x0B, 0x01, 0x01, 0x10, 0x01, 0x11, 0x0F, 0x12, 0x13, 0x14, 0x0F, 0x15, 0x0F, 0x16, 0x0F, 0x0F, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x0F, 0x1C, 0x1D, 0x1E, 0x0F, 0x1F, 0x0F, 0x20, 0x0F, 0x0F, 0x21, 0x01, 0x22, 0x01, 0x01,
  14.        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01]
  15. yo = ([(x, c) for x, c in enumerate(lol) if c != 1 and x])
  16. state = 8
  17. ll = {4: ['.', '/', '\\', '_'],
  18.       5: ['\t', ' '],
  19.       6: ['\n'],
  20.       8: ['('],
  21.       9: [')'],
  22.       10: ['*'],
  23.       11: ['+'],
  24.       12: [','],
  25.       13: ['-'],
  26.       15: [';'],
  27.       16: ['='],
  28.  
  29.       17: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'n', 'q', 'u', 'v', 'w', 'x', 'y', 'z'],
  30.       14: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
  31.       7: ['"'],
  32.  
  33.       18: ['d'],
  34.       19: ['l'],
  35.       20: ['m'],
  36.       21: ['o'],
  37.       22: ['p'],
  38.       23: ['r'],
  39.       24: ['s'],
  40.       25: ['t'],
  41.       26: ['{'],
  42.       27: ['}']}
  43.  
  44. count = 0
  45. def ks(a, ptr):
  46.     global count
  47.     yy_current_state = a
  48.     ptr=list(bytearray(ptr))
  49.     # print a,
  50.     while ptr:
  51.         v4 = ptr[0]
  52.         yy_c = yy_ec[v4]
  53.         assert yy_c
  54.         v6 = yy_current_state
  55.         while True:
  56.             v7 = yy_c + yy_base[v6]
  57.             if (yy_chk[v7] == yy_current_state):
  58.                 break
  59.             yy_current_state = yy_def[v6]
  60.             if (yy_current_state > 70): # max status
  61.                 yy_c = yy_meta[yy_c]
  62.                 # print bytearray(ptr), yy_c,
  63.                 count += 1
  64.             v6 = yy_def[v6]
  65.         yy_current_state = yy_nxt[v7]
  66.         ptr.pop(0)
  67.     # print
  68.     return yy_current_state
  69. import string
  70.  
  71. for i in [1]:
  72.     print 'state', i
  73.     key=string.lowercase+string.uppercase+'_{}$='
  74.     queue=list(key)
  75.     # queue=['server_']
  76.     while queue:
  77.         text=queue.pop()
  78.         for a in key:
  79.             count = 0
  80.             res = ks(i, text+a)
  81.             if yy_accept[res] not in (13, 0):
  82.                 print (text+a, res, yy_accept[res])
  83.             if res == 70:
  84.                 count += 1
  85.             if count == 0:
  86.                 print 'found', text + a, res    
  87.                 queue.append(text+a)
  88. exit()
  89.  
  90. # print [(i,yy_accept[i]) for i,x in enumerate(yy_base) if x == 81]
  91. for _state in range(len(yy_base)):
  92.     res = []
  93.     for x, yy_c in yo:
  94.         l = yy_base[_state]+yy_c
  95.         if l >= len(yy_chk):
  96.             continue
  97.         if yy_chk[l] == _state:
  98.             res.append(chr(x))
  99.     if res:
  100.         for x in ll.items():
  101.             if x[0] == _state:
  102.                 print x[1], res
  103.         # print _state,res
  104.  
  105. exit()
  106. # print zip(yy_accept, yy_base)
  107.  
  108. yy_meta = [0x0100, 0x0101, 0x0102, 0x0201, 0x0101, 0x0201, 0x0103, 0x0301, 0x0301, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
  109.            0x0303, 0x0103, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000]
  110. nexts = {}
  111. for x, yy_c in yo:
  112.     # yy_c: translated character
  113.     # translate state using base
  114.     base = yy_base[state]
  115.     next = base+yy_c
  116.     _state = state
  117.     nxt = state
  118.     while not yy_chk[next] == state:
  119.         ey
  120.         __yy_current_state = yy_def[nxt]
  121.         if (__yy_current_state > 70):            # lastdfa + 2
  122.                                                   # lastdfa: 69
  123.             yy_c = yy_meta[yy_c]
  124.         nxt = yy_def[nxt]
  125.         # total states: 79   print x, yy_nxt[next]
  126.         base = yy_base[__yy_current_state]
  127.  
  128.     nxt = yy_nxt[next]
  129.     if nxt not in nexts:
  130.         nexts[nxt] = []
  131.     nexts[nxt].append(chr(x))
  132. pprint.pprint(nexts)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top