MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / SJISDistributionAnalysis

Class SJISDistributionAnalysis

thirdparty/chardet/chardistribution.py:192–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191
192class SJISDistributionAnalysis(CharDistributionAnalysis):
193 def __init__(self):
194 super(SJISDistributionAnalysis, self).__init__()
195 self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER
196 self._table_size = JIS_TABLE_SIZE
197 self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO
198
199 def get_order(self, byte_str):
200 # for sjis encoding, we are interested
201 # first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
202 # second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
203 # no validation needed here. State machine has done that
204 first_char, second_char = byte_str[0], byte_str[1]
205 if (first_char >= 0x81) and (first_char <= 0x9F):
206 order = 188 * (first_char - 0x81)
207 elif (first_char >= 0xE0) and (first_char <= 0xEF):
208 order = 188 * (first_char - 0xE0 + 31)
209 else:
210 return -1
211 order = order + second_char - 0x40
212 if second_char > 0x7F:
213 order = -1
214 return order
215
216
217class EUCJPDistributionAnalysis(CharDistributionAnalysis):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…