@@ -152,6 +152,8 @@ def getChar(idx, charTbl=asciiTbl, continuousOrder=True): # continuousOrder mean
152152
153153 if not continuousOrder :
154154 originalTbl = list (charTbl )
155+ else :
156+ shiftTable = [5 , 4 ] # used for gradual expanding into unicode charspace
155157
156158 if len (charTbl ) == 1 :
157159 forgedPayload = safeStringFormat (payload .replace ('%3E' , '%3D' ), (expressionUnescaped , idx , charTbl [0 ]))
@@ -205,11 +207,14 @@ def getChar(idx, charTbl=asciiTbl, continuousOrder=True): # continuousOrder mean
205207 if maxValue == 1 :
206208 return None
207209 elif minValue == maxChar : # going beyond the original charset
208- # if the original charTbl was [0,..,127] new one will be [128,..,128*256 -1] or from 128 to 32767
210+ # if the original charTbl was [0,..,127] new one will be [128,..,128*16 -1] or from 128 to 2047
209211 # and instead of making a HUGE list with all elements we use here xrange, which is a virtual list
210- charTbl = xrange (maxChar + 1 , (maxChar + 1 ) << 8 )
211- maxChar = maxValue = charTbl [- 1 ]
212- minChar = minValue = charTbl [0 ]
212+ if shiftTable :
213+ charTbl = xrange (maxChar + 1 , (maxChar + 1 ) << shiftTable .pop ())
214+ maxChar = maxValue = charTbl [- 1 ]
215+ minChar = minValue = charTbl [0 ]
216+ else :
217+ return None
213218 else :
214219 retVal = minValue + 1
215220 return chr (retVal ) if retVal < 128 else unichr (retVal )
0 commit comments