You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chartable.cxx 29KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122
  1. /*
  2. * Copyright 2024 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /***MODULE:chartable
  17. * rspamd module that make marks based on symbol chains
  18. *
  19. * Allowed options:
  20. * - symbol (string): symbol to insert (default: 'R_BAD_CHARSET')
  21. * - threshold (double): value that would be used as threshold in expression characters_changed / total_characters
  22. * (e.g. if threshold is 0.1 than charset change should occur more often than in 10 symbols), default: 0.1
  23. */
  24. #include "config.h"
  25. #include "libmime/message.h"
  26. #include "rspamd.h"
  27. #include "libstat/stat_api.h"
  28. #include "libmime/lang_detection.h"
  29. #include "unicode/utf8.h"
  30. #include "unicode/uchar.h"
  31. #include "contrib/ankerl/unordered_dense.h"
  32. #define DEFAULT_SYMBOL "R_MIXED_CHARSET"
  33. #define DEFAULT_URL_SYMBOL "R_MIXED_CHARSET_URL"
  34. #define DEFAULT_THRESHOLD 0.1
  35. #define msg_debug_chartable(...) rspamd_conditional_debug_fast(nullptr, task->from_addr, \
  36. rspamd_chartable_log_id, "chartable", task->task_pool->tag.uid, \
  37. G_STRFUNC, \
  38. __VA_ARGS__)
  39. INIT_LOG_MODULE(chartable)
  40. /* Initialization */
  41. int chartable_module_init(struct rspamd_config *cfg, struct module_ctx **ctx);
  42. int chartable_module_config(struct rspamd_config *cfg, bool validate);
  43. int chartable_module_reconfig(struct rspamd_config *cfg);
  44. module_t chartable_module = {
  45. "chartable",
  46. chartable_module_init,
  47. chartable_module_config,
  48. chartable_module_reconfig,
  49. nullptr,
  50. RSPAMD_MODULE_VER,
  51. (unsigned int) -1,
  52. };
  53. struct chartable_ctx {
  54. struct module_ctx ctx;
  55. const char *symbol;
  56. const char *url_symbol;
  57. double threshold;
  58. unsigned int max_word_len;
  59. };
  60. static inline struct chartable_ctx *
  61. chartable_get_context(struct rspamd_config *cfg)
  62. {
  63. return (struct chartable_ctx *) g_ptr_array_index(cfg->c_modules,
  64. chartable_module.ctx_offset);
  65. }
  66. static void chartable_symbol_callback(struct rspamd_task *task,
  67. struct rspamd_symcache_dynamic_item *item,
  68. void *unused);
  69. static void chartable_url_symbol_callback(struct rspamd_task *task,
  70. struct rspamd_symcache_dynamic_item *item,
  71. void *unused);
  72. int chartable_module_init(struct rspamd_config *cfg, struct module_ctx **ctx)
  73. {
  74. struct chartable_ctx *chartable_module_ctx;
  75. chartable_module_ctx = rspamd_mempool_alloc0_type(cfg->cfg_pool,
  76. struct chartable_ctx);
  77. chartable_module_ctx->max_word_len = 10;
  78. *ctx = (struct module_ctx *) chartable_module_ctx;
  79. return 0;
  80. }
  81. int chartable_module_config(struct rspamd_config *cfg, bool _)
  82. {
  83. const ucl_object_t *value;
  84. int res = TRUE;
  85. struct chartable_ctx *chartable_module_ctx = chartable_get_context(cfg);
  86. if (!rspamd_config_is_module_enabled(cfg, "chartable")) {
  87. return TRUE;
  88. }
  89. if ((value =
  90. rspamd_config_get_module_opt(cfg, "chartable", "symbol")) != nullptr) {
  91. chartable_module_ctx->symbol = ucl_obj_tostring(value);
  92. }
  93. else {
  94. chartable_module_ctx->symbol = DEFAULT_SYMBOL;
  95. }
  96. if ((value =
  97. rspamd_config_get_module_opt(cfg, "chartable", "url_symbol")) != nullptr) {
  98. chartable_module_ctx->url_symbol = ucl_obj_tostring(value);
  99. }
  100. else {
  101. chartable_module_ctx->url_symbol = DEFAULT_URL_SYMBOL;
  102. }
  103. if ((value =
  104. rspamd_config_get_module_opt(cfg, "chartable", "threshold")) != nullptr) {
  105. if (!ucl_obj_todouble_safe(value, &chartable_module_ctx->threshold)) {
  106. msg_warn_config("invalid numeric value");
  107. chartable_module_ctx->threshold = DEFAULT_THRESHOLD;
  108. }
  109. }
  110. else {
  111. chartable_module_ctx->threshold = DEFAULT_THRESHOLD;
  112. }
  113. if ((value =
  114. rspamd_config_get_module_opt(cfg, "chartable", "max_word_len")) != nullptr) {
  115. chartable_module_ctx->max_word_len = ucl_object_toint(value);
  116. }
  117. else {
  118. chartable_module_ctx->threshold = DEFAULT_THRESHOLD;
  119. }
  120. rspamd_symcache_add_symbol(cfg->cache,
  121. chartable_module_ctx->symbol,
  122. 0,
  123. chartable_symbol_callback,
  124. nullptr,
  125. SYMBOL_TYPE_NORMAL,
  126. -1);
  127. rspamd_symcache_add_symbol(cfg->cache,
  128. chartable_module_ctx->url_symbol,
  129. 0,
  130. chartable_url_symbol_callback,
  131. nullptr,
  132. SYMBOL_TYPE_NORMAL,
  133. -1);
  134. msg_info_config("init internal chartable module");
  135. return res;
  136. }
  137. int chartable_module_reconfig(struct rspamd_config *cfg)
  138. {
  139. return chartable_module_config(cfg, false);
  140. }
  141. static const auto latin_confusable = ankerl::unordered_dense::set<int>{
  142. 0x02028,
  143. 0x02029,
  144. 0x01680,
  145. 0x02000,
  146. 0x02001,
  147. 0x02002,
  148. 0x02003,
  149. 0x02004,
  150. 0x02005,
  151. 0x02006,
  152. 0x02008,
  153. 0x02009,
  154. 0x0200a,
  155. 0x0205f,
  156. 0x000a0,
  157. 0x02007,
  158. 0x0202f,
  159. 0x007fa,
  160. 0x0fe4d,
  161. 0x0fe4e,
  162. 0x0fe4f,
  163. 0x02010,
  164. 0x02011,
  165. 0x02012,
  166. 0x02013,
  167. 0x0fe58,
  168. 0x006d4,
  169. 0x02043,
  170. 0x002d7,
  171. 0x02212,
  172. 0x02796,
  173. 0x02cba,
  174. 0x0060d,
  175. 0x0066b,
  176. 0x0201a,
  177. 0x000b8,
  178. 0x0a4f9,
  179. 0x0037e,
  180. 0x00903,
  181. 0x00a83,
  182. 0x0ff1a,
  183. 0x00589,
  184. 0x00703,
  185. 0x00704,
  186. 0x016ec,
  187. 0x0fe30,
  188. 0x01803,
  189. 0x01809,
  190. 0x0205a,
  191. 0x005c3,
  192. 0x002f8,
  193. 0x0a789,
  194. 0x02236,
  195. 0x002d0,
  196. 0x0a4fd,
  197. 0x0ff01,
  198. 0x001c3,
  199. 0x02d51,
  200. 0x00294,
  201. 0x00241,
  202. 0x0097d,
  203. 0x013ae,
  204. 0x0a6eb,
  205. 0x1d16d,
  206. 0x02024,
  207. 0x00701,
  208. 0x00702,
  209. 0x0a60e,
  210. 0x10a50,
  211. 0x00660,
  212. 0x006f0,
  213. 0x0a4f8,
  214. 0x0055d,
  215. 0x0ff07,
  216. 0x02018,
  217. 0x02019,
  218. 0x0201b,
  219. 0x02032,
  220. 0x02035,
  221. 0x0055a,
  222. 0x005f3,
  223. 0x00060,
  224. 0x01fef,
  225. 0x0ff40,
  226. 0x000b4,
  227. 0x00384,
  228. 0x01ffd,
  229. 0x01fbd,
  230. 0x01fbf,
  231. 0x01ffe,
  232. 0x002b9,
  233. 0x00374,
  234. 0x002c8,
  235. 0x002ca,
  236. 0x002cb,
  237. 0x002f4,
  238. 0x002bb,
  239. 0x002bd,
  240. 0x002bc,
  241. 0x002be,
  242. 0x0a78c,
  243. 0x005d9,
  244. 0x007f4,
  245. 0x007f5,
  246. 0x0144a,
  247. 0x016cc,
  248. 0x16f51,
  249. 0x16f52,
  250. 0x0ff3b,
  251. 0x02768,
  252. 0x02772,
  253. 0x03014,
  254. 0x0fd3e,
  255. 0x0ff3d,
  256. 0x02769,
  257. 0x02773,
  258. 0x03015,
  259. 0x0fd3f,
  260. 0x02774,
  261. 0x1d114,
  262. 0x02775,
  263. 0x0204e,
  264. 0x0066d,
  265. 0x02217,
  266. 0x1031f,
  267. 0x01735,
  268. 0x02041,
  269. 0x02215,
  270. 0x02044,
  271. 0x02571,
  272. 0x027cb,
  273. 0x029f8,
  274. 0x1d23a,
  275. 0x031d3,
  276. 0x03033,
  277. 0x02cc6,
  278. 0x030ce,
  279. 0x04e3f,
  280. 0x02f03,
  281. 0x0ff3c,
  282. 0x0fe68,
  283. 0x02216,
  284. 0x027cd,
  285. 0x029f5,
  286. 0x029f9,
  287. 0x1d20f,
  288. 0x1d23b,
  289. 0x031d4,
  290. 0x04e36,
  291. 0x02f02,
  292. 0x0a778,
  293. 0x002c4,
  294. 0x002c6,
  295. 0x016ed,
  296. 0x02795,
  297. 0x1029b,
  298. 0x02039,
  299. 0x0276e,
  300. 0x002c2,
  301. 0x1d236,
  302. 0x01438,
  303. 0x016b2,
  304. 0x01400,
  305. 0x02e40,
  306. 0x030a0,
  307. 0x0a4ff,
  308. 0x0203a,
  309. 0x0276f,
  310. 0x002c3,
  311. 0x1d237,
  312. 0x01433,
  313. 0x16f3f,
  314. 0x02053,
  315. 0x002dc,
  316. 0x01fc0,
  317. 0x0223c,
  318. 0x1d7d0,
  319. 0x1d7da,
  320. 0x1d7e4,
  321. 0x1d7ee,
  322. 0x1d7f8,
  323. 0x0a75a,
  324. 0x001a7,
  325. 0x003e8,
  326. 0x0a644,
  327. 0x014bf,
  328. 0x0a6ef,
  329. 0x1d206,
  330. 0x1d7d1,
  331. 0x1d7db,
  332. 0x1d7e5,
  333. 0x1d7ef,
  334. 0x1d7f9,
  335. 0x0a7ab,
  336. 0x0021c,
  337. 0x001b7,
  338. 0x0a76a,
  339. 0x02ccc,
  340. 0x00417,
  341. 0x004e0,
  342. 0x16f3b,
  343. 0x118ca,
  344. 0x1d7d2,
  345. 0x1d7dc,
  346. 0x1d7e6,
  347. 0x1d7f0,
  348. 0x1d7fa,
  349. 0x013ce,
  350. 0x118af,
  351. 0x1d7d3,
  352. 0x1d7dd,
  353. 0x1d7e7,
  354. 0x1d7f1,
  355. 0x1d7fb,
  356. 0x001bc,
  357. 0x118bb,
  358. 0x1d7d4,
  359. 0x1d7de,
  360. 0x1d7e8,
  361. 0x1d7f2,
  362. 0x1d7fc,
  363. 0x02cd2,
  364. 0x00431,
  365. 0x013ee,
  366. 0x118d5,
  367. 0x1d212,
  368. 0x1d7d5,
  369. 0x1d7df,
  370. 0x1d7e9,
  371. 0x1d7f3,
  372. 0x1d7fd,
  373. 0x104d2,
  374. 0x118c6,
  375. 0x00b03,
  376. 0x009ea,
  377. 0x00a6a,
  378. 0x1e8cb,
  379. 0x1d7d6,
  380. 0x1d7e0,
  381. 0x1d7ea,
  382. 0x1d7f4,
  383. 0x1d7fe,
  384. 0x00223,
  385. 0x00222,
  386. 0x1031a,
  387. 0x00a67,
  388. 0x00b68,
  389. 0x009ed,
  390. 0x00d6d,
  391. 0x1d7d7,
  392. 0x1d7e1,
  393. 0x1d7eb,
  394. 0x1d7f5,
  395. 0x1d7ff,
  396. 0x0a76e,
  397. 0x02cca,
  398. 0x118cc,
  399. 0x118ac,
  400. 0x118d6,
  401. 0x0237a,
  402. 0x0ff41,
  403. 0x1d41a,
  404. 0x1d44e,
  405. 0x1d482,
  406. 0x1d4b6,
  407. 0x1d4ea,
  408. 0x1d51e,
  409. 0x1d552,
  410. 0x1d586,
  411. 0x1d5ba,
  412. 0x1d5ee,
  413. 0x1d622,
  414. 0x1d656,
  415. 0x1d68a,
  416. 0x00251,
  417. 0x003b1,
  418. 0x1d6c2,
  419. 0x1d6fc,
  420. 0x1d736,
  421. 0x1d770,
  422. 0x1d7aa,
  423. 0x00430,
  424. 0x0ff21,
  425. 0x1d400,
  426. 0x1d434,
  427. 0x1d468,
  428. 0x1d49c,
  429. 0x1d4d0,
  430. 0x1d504,
  431. 0x1d538,
  432. 0x1d56c,
  433. 0x1d5a0,
  434. 0x1d5d4,
  435. 0x1d608,
  436. 0x1d63c,
  437. 0x1d670,
  438. 0x00391,
  439. 0x1d6a8,
  440. 0x1d6e2,
  441. 0x1d71c,
  442. 0x1d756,
  443. 0x1d790,
  444. 0x00410,
  445. 0x013aa,
  446. 0x015c5,
  447. 0x0a4ee,
  448. 0x16f40,
  449. 0x102a0,
  450. 0x1d41b,
  451. 0x1d44f,
  452. 0x1d483,
  453. 0x1d4b7,
  454. 0x1d4eb,
  455. 0x1d51f,
  456. 0x1d553,
  457. 0x1d587,
  458. 0x1d5bb,
  459. 0x1d5ef,
  460. 0x1d623,
  461. 0x1d657,
  462. 0x1d68b,
  463. 0x00184,
  464. 0x0042c,
  465. 0x013cf,
  466. 0x015af,
  467. 0x0ff22,
  468. 0x0212c,
  469. 0x1d401,
  470. 0x1d435,
  471. 0x1d469,
  472. 0x1d4d1,
  473. 0x1d505,
  474. 0x1d539,
  475. 0x1d56d,
  476. 0x1d5a1,
  477. 0x1d5d5,
  478. 0x1d609,
  479. 0x1d63d,
  480. 0x1d671,
  481. 0x0a7b4,
  482. 0x00392,
  483. 0x1d6a9,
  484. 0x1d6e3,
  485. 0x1d71d,
  486. 0x1d757,
  487. 0x1d791,
  488. 0x00412,
  489. 0x013f4,
  490. 0x015f7,
  491. 0x0a4d0,
  492. 0x10282,
  493. 0x102a1,
  494. 0x10301,
  495. 0x0ff43,
  496. 0x0217d,
  497. 0x1d41c,
  498. 0x1d450,
  499. 0x1d484,
  500. 0x1d4b8,
  501. 0x1d4ec,
  502. 0x1d520,
  503. 0x1d554,
  504. 0x1d588,
  505. 0x1d5bc,
  506. 0x1d5f0,
  507. 0x1d624,
  508. 0x1d658,
  509. 0x1d68c,
  510. 0x01d04,
  511. 0x003f2,
  512. 0x02ca5,
  513. 0x00441,
  514. 0x0abaf,
  515. 0x1043d,
  516. 0x1f74c,
  517. 0x118f2,
  518. 0x118e9,
  519. 0x0ff23,
  520. 0x0216d,
  521. 0x02102,
  522. 0x0212d,
  523. 0x1d402,
  524. 0x1d436,
  525. 0x1d46a,
  526. 0x1d49e,
  527. 0x1d4d2,
  528. 0x1d56e,
  529. 0x1d5a2,
  530. 0x1d5d6,
  531. 0x1d60a,
  532. 0x1d63e,
  533. 0x1d672,
  534. 0x003f9,
  535. 0x02ca4,
  536. 0x00421,
  537. 0x013df,
  538. 0x0a4da,
  539. 0x102a2,
  540. 0x10302,
  541. 0x10415,
  542. 0x1051c,
  543. 0x0217e,
  544. 0x02146,
  545. 0x1d41d,
  546. 0x1d451,
  547. 0x1d485,
  548. 0x1d4b9,
  549. 0x1d4ed,
  550. 0x1d521,
  551. 0x1d555,
  552. 0x1d589,
  553. 0x1d5bd,
  554. 0x1d5f1,
  555. 0x1d625,
  556. 0x1d659,
  557. 0x1d68d,
  558. 0x00501,
  559. 0x013e7,
  560. 0x0146f,
  561. 0x0a4d2,
  562. 0x0216e,
  563. 0x02145,
  564. 0x1d403,
  565. 0x1d437,
  566. 0x1d46b,
  567. 0x1d49f,
  568. 0x1d4d3,
  569. 0x1d507,
  570. 0x1d53b,
  571. 0x1d56f,
  572. 0x1d5a3,
  573. 0x1d5d7,
  574. 0x1d60b,
  575. 0x1d63f,
  576. 0x1d673,
  577. 0x013a0,
  578. 0x015de,
  579. 0x015ea,
  580. 0x0a4d3,
  581. 0x0212e,
  582. 0x0ff45,
  583. 0x0212f,
  584. 0x02147,
  585. 0x1d41e,
  586. 0x1d452,
  587. 0x1d486,
  588. 0x1d4ee,
  589. 0x1d522,
  590. 0x1d556,
  591. 0x1d58a,
  592. 0x1d5be,
  593. 0x1d5f2,
  594. 0x1d626,
  595. 0x1d65a,
  596. 0x1d68e,
  597. 0x0ab32,
  598. 0x00435,
  599. 0x004bd,
  600. 0x022ff,
  601. 0x0ff25,
  602. 0x02130,
  603. 0x1d404,
  604. 0x1d438,
  605. 0x1d46c,
  606. 0x1d4d4,
  607. 0x1d508,
  608. 0x1d53c,
  609. 0x1d570,
  610. 0x1d5a4,
  611. 0x1d5d8,
  612. 0x1d60c,
  613. 0x1d640,
  614. 0x1d674,
  615. 0x00395,
  616. 0x1d6ac,
  617. 0x1d6e6,
  618. 0x1d720,
  619. 0x1d75a,
  620. 0x1d794,
  621. 0x00415,
  622. 0x02d39,
  623. 0x013ac,
  624. 0x0a4f0,
  625. 0x118a6,
  626. 0x118ae,
  627. 0x10286,
  628. 0x1d41f,
  629. 0x1d453,
  630. 0x1d487,
  631. 0x1d4bb,
  632. 0x1d4ef,
  633. 0x1d523,
  634. 0x1d557,
  635. 0x1d58b,
  636. 0x1d5bf,
  637. 0x1d5f3,
  638. 0x1d627,
  639. 0x1d65b,
  640. 0x1d68f,
  641. 0x0ab35,
  642. 0x0a799,
  643. 0x0017f,
  644. 0x01e9d,
  645. 0x00584,
  646. 0x1d213,
  647. 0x02131,
  648. 0x1d405,
  649. 0x1d439,
  650. 0x1d46d,
  651. 0x1d4d5,
  652. 0x1d509,
  653. 0x1d53d,
  654. 0x1d571,
  655. 0x1d5a5,
  656. 0x1d5d9,
  657. 0x1d60d,
  658. 0x1d641,
  659. 0x1d675,
  660. 0x0a798,
  661. 0x003dc,
  662. 0x1d7ca,
  663. 0x015b4,
  664. 0x0a4dd,
  665. 0x118c2,
  666. 0x118a2,
  667. 0x10287,
  668. 0x102a5,
  669. 0x10525,
  670. 0x0ff47,
  671. 0x0210a,
  672. 0x1d420,
  673. 0x1d454,
  674. 0x1d488,
  675. 0x1d4f0,
  676. 0x1d524,
  677. 0x1d558,
  678. 0x1d58c,
  679. 0x1d5c0,
  680. 0x1d5f4,
  681. 0x1d628,
  682. 0x1d65c,
  683. 0x1d690,
  684. 0x00261,
  685. 0x01d83,
  686. 0x0018d,
  687. 0x00581,
  688. 0x1d406,
  689. 0x1d43a,
  690. 0x1d46e,
  691. 0x1d4a2,
  692. 0x1d4d6,
  693. 0x1d50a,
  694. 0x1d53e,
  695. 0x1d572,
  696. 0x1d5a6,
  697. 0x1d5da,
  698. 0x1d60e,
  699. 0x1d642,
  700. 0x1d676,
  701. 0x0050c,
  702. 0x013c0,
  703. 0x013f3,
  704. 0x0a4d6,
  705. 0x0ff48,
  706. 0x0210e,
  707. 0x1d421,
  708. 0x1d489,
  709. 0x1d4bd,
  710. 0x1d4f1,
  711. 0x1d525,
  712. 0x1d559,
  713. 0x1d58d,
  714. 0x1d5c1,
  715. 0x1d5f5,
  716. 0x1d629,
  717. 0x1d65d,
  718. 0x1d691,
  719. 0x004bb,
  720. 0x00570,
  721. 0x013c2,
  722. 0x0ff28,
  723. 0x0210b,
  724. 0x0210c,
  725. 0x0210d,
  726. 0x1d407,
  727. 0x1d43b,
  728. 0x1d46f,
  729. 0x1d4d7,
  730. 0x1d573,
  731. 0x1d5a7,
  732. 0x1d5db,
  733. 0x1d60f,
  734. 0x1d643,
  735. 0x1d677,
  736. 0x00397,
  737. 0x1d6ae,
  738. 0x1d6e8,
  739. 0x1d722,
  740. 0x1d75c,
  741. 0x1d796,
  742. 0x02c8e,
  743. 0x0041d,
  744. 0x013bb,
  745. 0x0157c,
  746. 0x0a4e7,
  747. 0x102cf,
  748. 0x002db,
  749. 0x02373,
  750. 0x0ff49,
  751. 0x02170,
  752. 0x02139,
  753. 0x02148,
  754. 0x1d422,
  755. 0x1d456,
  756. 0x1d48a,
  757. 0x1d4be,
  758. 0x1d4f2,
  759. 0x1d526,
  760. 0x1d55a,
  761. 0x1d58e,
  762. 0x1d5c2,
  763. 0x1d5f6,
  764. 0x1d62a,
  765. 0x1d65e,
  766. 0x1d692,
  767. 0x00131,
  768. 0x1d6a4,
  769. 0x0026a,
  770. 0x00269,
  771. 0x003b9,
  772. 0x01fbe,
  773. 0x0037a,
  774. 0x1d6ca,
  775. 0x1d704,
  776. 0x1d73e,
  777. 0x1d778,
  778. 0x1d7b2,
  779. 0x00456,
  780. 0x0a647,
  781. 0x004cf,
  782. 0x0ab75,
  783. 0x013a5,
  784. 0x118c3,
  785. 0x0ff4a,
  786. 0x02149,
  787. 0x1d423,
  788. 0x1d457,
  789. 0x1d48b,
  790. 0x1d4bf,
  791. 0x1d4f3,
  792. 0x1d527,
  793. 0x1d55b,
  794. 0x1d58f,
  795. 0x1d5c3,
  796. 0x1d5f7,
  797. 0x1d62b,
  798. 0x1d65f,
  799. 0x1d693,
  800. 0x003f3,
  801. 0x00458,
  802. 0x0ff2a,
  803. 0x1d409,
  804. 0x1d43d,
  805. 0x1d471,
  806. 0x1d4a5,
  807. 0x1d4d9,
  808. 0x1d50d,
  809. 0x1d541,
  810. 0x1d575,
  811. 0x1d5a9,
  812. 0x1d5dd,
  813. 0x1d611,
  814. 0x1d645,
  815. 0x1d679,
  816. 0x0a7b2,
  817. 0x0037f,
  818. 0x00408,
  819. 0x013ab,
  820. 0x0148d,
  821. 0x0a4d9,
  822. 0x1d424,
  823. 0x1d458,
  824. 0x1d48c,
  825. 0x1d4c0,
  826. 0x1d4f4,
  827. 0x1d528,
  828. 0x1d55c,
  829. 0x1d590,
  830. 0x1d5c4,
  831. 0x1d5f8,
  832. 0x1d62c,
  833. 0x1d660,
  834. 0x1d694,
  835. 0x0212a,
  836. 0x0ff2b,
  837. 0x1d40a,
  838. 0x1d43e,
  839. 0x1d472,
  840. 0x1d4a6,
  841. 0x1d4da,
  842. 0x1d50e,
  843. 0x1d542,
  844. 0x1d576,
  845. 0x1d5aa,
  846. 0x1d5de,
  847. 0x1d612,
  848. 0x1d646,
  849. 0x1d67a,
  850. 0x0039a,
  851. 0x1d6b1,
  852. 0x1d6eb,
  853. 0x1d725,
  854. 0x1d75f,
  855. 0x1d799,
  856. 0x02c94,
  857. 0x0041a,
  858. 0x013e6,
  859. 0x016d5,
  860. 0x0a4d7,
  861. 0x10518,
  862. 0x005c0,
  863. 0x0007c,
  864. 0x02223,
  865. 0x023fd,
  866. 0x0ffe8,
  867. 0x00031,
  868. 0x00661,
  869. 0x006f1,
  870. 0x10320,
  871. 0x1e8c7,
  872. 0x1d7cf,
  873. 0x1d7d9,
  874. 0x1d7e3,
  875. 0x1d7ed,
  876. 0x1d7f7,
  877. 0x00049,
  878. 0x0ff29,
  879. 0x02160,
  880. 0x02110,
  881. 0x02111,
  882. 0x1d408,
  883. 0x1d43c,
  884. 0x1d470,
  885. 0x1d4d8,
  886. 0x1d540,
  887. 0x1d574,
  888. 0x1d5a8,
  889. 0x1d5dc,
  890. 0x1d610,
  891. 0x1d644,
  892. 0x1d678,
  893. 0x00196,
  894. 0x0ff4c,
  895. 0x0217c,
  896. 0x02113,
  897. 0x1d425,
  898. 0x1d459,
  899. 0x1d48d,
  900. 0x1d4c1,
  901. 0x1d4f5,
  902. 0x1d529,
  903. 0x1d55d,
  904. 0x1d591,
  905. 0x1d5c5,
  906. 0x1d5f9,
  907. 0x1d62d,
  908. 0x1d661,
  909. 0x1d695,
  910. 0x001c0,
  911. 0x00399,
  912. 0x1d6b0,
  913. 0x1d6ea,
  914. 0x1d724,
  915. 0x1d75e,
  916. 0x1d798,
  917. 0x02c92,
  918. 0x00406,
  919. 0x004c0,
  920. 0x005d5,
  921. 0x005df,
  922. 0x00627,
  923. 0x1ee00,
  924. 0x1ee80,
  925. 0x0fe8e,
  926. 0x0fe8d,
  927. 0x007ca,
  928. 0x02d4f,
  929. 0x016c1,
  930. 0x0a4f2,
  931. 0x16f28,
  932. 0x1028a,
  933. 0x10309,
  934. 0x1d22a,
  935. 0x0216c,
  936. 0x02112,
  937. 0x1d40b,
  938. 0x1d43f,
  939. 0x1d473,
  940. 0x1d4db,
  941. 0x1d50f,
  942. 0x1d543,
  943. 0x1d577,
  944. 0x1d5ab,
  945. 0x1d5df,
  946. 0x1d613,
  947. 0x1d647,
  948. 0x1d67b,
  949. 0x02cd0,
  950. 0x013de,
  951. 0x014aa,
  952. 0x0a4e1,
  953. 0x16f16,
  954. 0x118a3,
  955. 0x118b2,
  956. 0x1041b,
  957. 0x10526,
  958. 0x0ff2d,
  959. 0x0216f,
  960. 0x02133,
  961. 0x1d40c,
  962. 0x1d440,
  963. 0x1d474,
  964. 0x1d4dc,
  965. 0x1d510,
  966. 0x1d544,
  967. 0x1d578,
  968. 0x1d5ac,
  969. 0x1d5e0,
  970. 0x1d614,
  971. 0x1d648,
  972. 0x1d67c,
  973. 0x0039c,
  974. 0x1d6b3,
  975. 0x1d6ed,
  976. 0x1d727,
  977. 0x1d761,
  978. 0x1d79b,
  979. 0x003fa,
  980. 0x02c98,
  981. 0x0041c,
  982. 0x013b7,
  983. 0x015f0,
  984. 0x016d6,
  985. 0x0a4df,
  986. 0x102b0,
  987. 0x10311,
  988. 0x1d427,
  989. 0x1d45b,
  990. 0x1d48f,
  991. 0x1d4c3,
  992. 0x1d4f7,
  993. 0x1d52b,
  994. 0x1d55f,
  995. 0x1d593,
  996. 0x1d5c7,
  997. 0x1d5fb,
  998. 0x1d62f,
  999. 0x1d663,
  1000. 0x1d697,
  1001. 0x00578,
  1002. 0x0057c,
  1003. 0x0ff2e,
  1004. 0x02115,
  1005. 0x1d40d,
  1006. 0x1d441,
  1007. 0x1d475,
  1008. 0x1d4a9,
  1009. 0x1d4dd,
  1010. 0x1d511,
  1011. 0x1d579,
  1012. 0x1d5ad,
  1013. 0x1d5e1,
  1014. 0x1d615,
  1015. 0x1d649,
  1016. 0x1d67d,
  1017. 0x0039d,
  1018. 0x1d6b4,
  1019. 0x1d6ee,
  1020. 0x1d728,
  1021. 0x1d762,
  1022. 0x1d79c,
  1023. 0x02c9a,
  1024. 0x0a4e0,
  1025. 0x10513,
  1026. 0x00c02,
  1027. 0x00c82,
  1028. 0x00d02,
  1029. 0x00d82,
  1030. 0x00966,
  1031. 0x00a66,
  1032. 0x00ae6,
  1033. 0x00be6,
  1034. 0x00c66,
  1035. 0x00ce6,
  1036. 0x00d66,
  1037. 0x00e50,
  1038. 0x00ed0,
  1039. 0x01040,
  1040. 0x00665,
  1041. 0x006f5,
  1042. 0x0ff4f,
  1043. 0x02134,
  1044. 0x1d428,
  1045. 0x1d45c,
  1046. 0x1d490,
  1047. 0x1d4f8,
  1048. 0x1d52c,
  1049. 0x1d560,
  1050. 0x1d594,
  1051. 0x1d5c8,
  1052. 0x1d5fc,
  1053. 0x1d630,
  1054. 0x1d664,
  1055. 0x1d698,
  1056. 0x01d0f,
  1057. 0x01d11,
  1058. 0x0ab3d,
  1059. 0x003bf,
  1060. 0x1d6d0,
  1061. 0x1d70a,
  1062. 0x1d744,
  1063. 0x1d77e,
  1064. 0x1d7b8,
  1065. 0x003c3,
  1066. 0x1d6d4,
  1067. 0x1d70e,
  1068. 0x1d748,
  1069. 0x1d782,
  1070. 0x1d7bc,
  1071. 0x02c9f,
  1072. 0x0043e,
  1073. 0x010ff,
  1074. 0x00585,
  1075. 0x005e1,
  1076. 0x00647,
  1077. 0x1ee24,
  1078. 0x1ee64,
  1079. 0x1ee84,
  1080. 0x0feeb,
  1081. 0x0feec,
  1082. 0x0feea,
  1083. 0x0fee9,
  1084. 0x006be,
  1085. 0x0fbac,
  1086. 0x0fbad,
  1087. 0x0fbab,
  1088. 0x0fbaa,
  1089. 0x006c1,
  1090. 0x0fba8,
  1091. 0x0fba9,
  1092. 0x0fba7,
  1093. 0x0fba6,
  1094. 0x006d5,
  1095. 0x00d20,
  1096. 0x0101d,
  1097. 0x104ea,
  1098. 0x118c8,
  1099. 0x118d7,
  1100. 0x1042c,
  1101. 0x00030,
  1102. 0x007c0,
  1103. 0x009e6,
  1104. 0x00b66,
  1105. 0x03007,
  1106. 0x114d0,
  1107. 0x118e0,
  1108. 0x1d7ce,
  1109. 0x1d7d8,
  1110. 0x1d7e2,
  1111. 0x1d7ec,
  1112. 0x1d7f6,
  1113. 0x0ff2f,
  1114. 0x1d40e,
  1115. 0x1d442,
  1116. 0x1d476,
  1117. 0x1d4aa,
  1118. 0x1d4de,
  1119. 0x1d512,
  1120. 0x1d546,
  1121. 0x1d57a,
  1122. 0x1d5ae,
  1123. 0x1d5e2,
  1124. 0x1d616,
  1125. 0x1d64a,
  1126. 0x1d67e,
  1127. 0x0039f,
  1128. 0x1d6b6,
  1129. 0x1d6f0,
  1130. 0x1d72a,
  1131. 0x1d764,
  1132. 0x1d79e,
  1133. 0x02c9e,
  1134. 0x0041e,
  1135. 0x00555,
  1136. 0x02d54,
  1137. 0x012d0,
  1138. 0x00b20,
  1139. 0x104c2,
  1140. 0x0a4f3,
  1141. 0x118b5,
  1142. 0x10292,
  1143. 0x102ab,
  1144. 0x10404,
  1145. 0x10516,
  1146. 0x02374,
  1147. 0x0ff50,
  1148. 0x1d429,
  1149. 0x1d45d,
  1150. 0x1d491,
  1151. 0x1d4c5,
  1152. 0x1d4f9,
  1153. 0x1d52d,
  1154. 0x1d561,
  1155. 0x1d595,
  1156. 0x1d5c9,
  1157. 0x1d5fd,
  1158. 0x1d631,
  1159. 0x1d665,
  1160. 0x1d699,
  1161. 0x003c1,
  1162. 0x003f1,
  1163. 0x1d6d2,
  1164. 0x1d6e0,
  1165. 0x1d70c,
  1166. 0x1d71a,
  1167. 0x1d746,
  1168. 0x1d754,
  1169. 0x1d780,
  1170. 0x1d78e,
  1171. 0x1d7ba,
  1172. 0x1d7c8,
  1173. 0x02ca3,
  1174. 0x00440,
  1175. 0x0ff30,
  1176. 0x02119,
  1177. 0x1d40f,
  1178. 0x1d443,
  1179. 0x1d477,
  1180. 0x1d4ab,
  1181. 0x1d4df,
  1182. 0x1d513,
  1183. 0x1d57b,
  1184. 0x1d5af,
  1185. 0x1d5e3,
  1186. 0x1d617,
  1187. 0x1d64b,
  1188. 0x1d67f,
  1189. 0x003a1,
  1190. 0x1d6b8,
  1191. 0x1d6f2,
  1192. 0x1d72c,
  1193. 0x1d766,
  1194. 0x1d7a0,
  1195. 0x02ca2,
  1196. 0x00420,
  1197. 0x013e2,
  1198. 0x0146d,
  1199. 0x0a4d1,
  1200. 0x10295,
  1201. 0x1d42a,
  1202. 0x1d45e,
  1203. 0x1d492,
  1204. 0x1d4c6,
  1205. 0x1d4fa,
  1206. 0x1d52e,
  1207. 0x1d562,
  1208. 0x1d596,
  1209. 0x1d5ca,
  1210. 0x1d5fe,
  1211. 0x1d632,
  1212. 0x1d666,
  1213. 0x1d69a,
  1214. 0x0051b,
  1215. 0x00563,
  1216. 0x00566,
  1217. 0x0211a,
  1218. 0x1d410,
  1219. 0x1d444,
  1220. 0x1d478,
  1221. 0x1d4ac,
  1222. 0x1d4e0,
  1223. 0x1d514,
  1224. 0x1d57c,
  1225. 0x1d5b0,
  1226. 0x1d5e4,
  1227. 0x1d618,
  1228. 0x1d64c,
  1229. 0x1d680,
  1230. 0x02d55,
  1231. 0x1d42b,
  1232. 0x1d45f,
  1233. 0x1d493,
  1234. 0x1d4c7,
  1235. 0x1d4fb,
  1236. 0x1d52f,
  1237. 0x1d563,
  1238. 0x1d597,
  1239. 0x1d5cb,
  1240. 0x1d5ff,
  1241. 0x1d633,
  1242. 0x1d667,
  1243. 0x1d69b,
  1244. 0x0ab47,
  1245. 0x0ab48,
  1246. 0x01d26,
  1247. 0x02c85,
  1248. 0x00433,
  1249. 0x0ab81,
  1250. 0x1d216,
  1251. 0x0211b,
  1252. 0x0211c,
  1253. 0x0211d,
  1254. 0x1d411,
  1255. 0x1d445,
  1256. 0x1d479,
  1257. 0x1d4e1,
  1258. 0x1d57d,
  1259. 0x1d5b1,
  1260. 0x1d5e5,
  1261. 0x1d619,
  1262. 0x1d64d,
  1263. 0x1d681,
  1264. 0x001a6,
  1265. 0x013a1,
  1266. 0x013d2,
  1267. 0x104b4,
  1268. 0x01587,
  1269. 0x0a4e3,
  1270. 0x16f35,
  1271. 0x0ff53,
  1272. 0x1d42c,
  1273. 0x1d460,
  1274. 0x1d494,
  1275. 0x1d4c8,
  1276. 0x1d4fc,
  1277. 0x1d530,
  1278. 0x1d564,
  1279. 0x1d598,
  1280. 0x1d5cc,
  1281. 0x1d600,
  1282. 0x1d634,
  1283. 0x1d668,
  1284. 0x1d69c,
  1285. 0x0a731,
  1286. 0x001bd,
  1287. 0x00455,
  1288. 0x0abaa,
  1289. 0x118c1,
  1290. 0x10448,
  1291. 0x0ff33,
  1292. 0x1d412,
  1293. 0x1d446,
  1294. 0x1d47a,
  1295. 0x1d4ae,
  1296. 0x1d4e2,
  1297. 0x1d516,
  1298. 0x1d54a,
  1299. 0x1d57e,
  1300. 0x1d5b2,
  1301. 0x1d5e6,
  1302. 0x1d61a,
  1303. 0x1d64e,
  1304. 0x1d682,
  1305. 0x00405,
  1306. 0x0054f,
  1307. 0x013d5,
  1308. 0x013da,
  1309. 0x0a4e2,
  1310. 0x16f3a,
  1311. 0x10296,
  1312. 0x10420,
  1313. 0x1d42d,
  1314. 0x1d461,
  1315. 0x1d495,
  1316. 0x1d4c9,
  1317. 0x1d4fd,
  1318. 0x1d531,
  1319. 0x1d565,
  1320. 0x1d599,
  1321. 0x1d5cd,
  1322. 0x1d601,
  1323. 0x1d635,
  1324. 0x1d669,
  1325. 0x1d69d,
  1326. 0x022a4,
  1327. 0x027d9,
  1328. 0x1f768,
  1329. 0x0ff34,
  1330. 0x1d413,
  1331. 0x1d447,
  1332. 0x1d47b,
  1333. 0x1d4af,
  1334. 0x1d4e3,
  1335. 0x1d517,
  1336. 0x1d54b,
  1337. 0x1d57f,
  1338. 0x1d5b3,
  1339. 0x1d5e7,
  1340. 0x1d61b,
  1341. 0x1d64f,
  1342. 0x1d683,
  1343. 0x003a4,
  1344. 0x1d6bb,
  1345. 0x1d6f5,
  1346. 0x1d72f,
  1347. 0x1d769,
  1348. 0x1d7a3,
  1349. 0x02ca6,
  1350. 0x00422,
  1351. 0x013a2,
  1352. 0x0a4d4,
  1353. 0x16f0a,
  1354. 0x118bc,
  1355. 0x10297,
  1356. 0x102b1,
  1357. 0x10315,
  1358. 0x1d42e,
  1359. 0x1d462,
  1360. 0x1d496,
  1361. 0x1d4ca,
  1362. 0x1d4fe,
  1363. 0x1d532,
  1364. 0x1d566,
  1365. 0x1d59a,
  1366. 0x1d5ce,
  1367. 0x1d602,
  1368. 0x1d636,
  1369. 0x1d66a,
  1370. 0x1d69e,
  1371. 0x0a79f,
  1372. 0x01d1c,
  1373. 0x0ab4e,
  1374. 0x0ab52,
  1375. 0x0028b,
  1376. 0x003c5,
  1377. 0x1d6d6,
  1378. 0x1d710,
  1379. 0x1d74a,
  1380. 0x1d784,
  1381. 0x1d7be,
  1382. 0x0057d,
  1383. 0x104f6,
  1384. 0x118d8,
  1385. 0x0222a,
  1386. 0x022c3,
  1387. 0x1d414,
  1388. 0x1d448,
  1389. 0x1d47c,
  1390. 0x1d4b0,
  1391. 0x1d4e4,
  1392. 0x1d518,
  1393. 0x1d54c,
  1394. 0x1d580,
  1395. 0x1d5b4,
  1396. 0x1d5e8,
  1397. 0x1d61c,
  1398. 0x1d650,
  1399. 0x1d684,
  1400. 0x0054d,
  1401. 0x01200,
  1402. 0x104ce,
  1403. 0x0144c,
  1404. 0x0a4f4,
  1405. 0x16f42,
  1406. 0x118b8,
  1407. 0x02228,
  1408. 0x022c1,
  1409. 0x0ff56,
  1410. 0x02174,
  1411. 0x1d42f,
  1412. 0x1d463,
  1413. 0x1d497,
  1414. 0x1d4cb,
  1415. 0x1d4ff,
  1416. 0x1d533,
  1417. 0x1d567,
  1418. 0x1d59b,
  1419. 0x1d5cf,
  1420. 0x1d603,
  1421. 0x1d637,
  1422. 0x1d66b,
  1423. 0x1d69f,
  1424. 0x01d20,
  1425. 0x003bd,
  1426. 0x1d6ce,
  1427. 0x1d708,
  1428. 0x1d742,
  1429. 0x1d77c,
  1430. 0x1d7b6,
  1431. 0x00475,
  1432. 0x005d8,
  1433. 0x11706,
  1434. 0x0aba9,
  1435. 0x118c0,
  1436. 0x1d20d,
  1437. 0x00667,
  1438. 0x006f7,
  1439. 0x02164,
  1440. 0x1d415,
  1441. 0x1d449,
  1442. 0x1d47d,
  1443. 0x1d4b1,
  1444. 0x1d4e5,
  1445. 0x1d519,
  1446. 0x1d54d,
  1447. 0x1d581,
  1448. 0x1d5b5,
  1449. 0x1d5e9,
  1450. 0x1d61d,
  1451. 0x1d651,
  1452. 0x1d685,
  1453. 0x00474,
  1454. 0x02d38,
  1455. 0x013d9,
  1456. 0x0142f,
  1457. 0x0a6df,
  1458. 0x0a4e6,
  1459. 0x16f08,
  1460. 0x118a0,
  1461. 0x1051d,
  1462. 0x0026f,
  1463. 0x1d430,
  1464. 0x1d464,
  1465. 0x1d498,
  1466. 0x1d4cc,
  1467. 0x1d500,
  1468. 0x1d534,
  1469. 0x1d568,
  1470. 0x1d59c,
  1471. 0x1d5d0,
  1472. 0x1d604,
  1473. 0x1d638,
  1474. 0x1d66c,
  1475. 0x1d6a0,
  1476. 0x01d21,
  1477. 0x00461,
  1478. 0x0051d,
  1479. 0x00561,
  1480. 0x1170a,
  1481. 0x1170e,
  1482. 0x1170f,
  1483. 0x0ab83,
  1484. 0x118ef,
  1485. 0x118e6,
  1486. 0x1d416,
  1487. 0x1d44a,
  1488. 0x1d47e,
  1489. 0x1d4b2,
  1490. 0x1d4e6,
  1491. 0x1d51a,
  1492. 0x1d54e,
  1493. 0x1d582,
  1494. 0x1d5b6,
  1495. 0x1d5ea,
  1496. 0x1d61e,
  1497. 0x1d652,
  1498. 0x1d686,
  1499. 0x0051c,
  1500. 0x013b3,
  1501. 0x013d4,
  1502. 0x0a4ea,
  1503. 0x0166e,
  1504. 0x000d7,
  1505. 0x0292b,
  1506. 0x0292c,
  1507. 0x02a2f,
  1508. 0x0ff58,
  1509. 0x02179,
  1510. 0x1d431,
  1511. 0x1d465,
  1512. 0x1d499,
  1513. 0x1d4cd,
  1514. 0x1d501,
  1515. 0x1d535,
  1516. 0x1d569,
  1517. 0x1d59d,
  1518. 0x1d5d1,
  1519. 0x1d605,
  1520. 0x1d639,
  1521. 0x1d66d,
  1522. 0x1d6a1,
  1523. 0x00445,
  1524. 0x01541,
  1525. 0x0157d,
  1526. 0x0166d,
  1527. 0x02573,
  1528. 0x10322,
  1529. 0x118ec,
  1530. 0x0ff38,
  1531. 0x02169,
  1532. 0x1d417,
  1533. 0x1d44b,
  1534. 0x1d47f,
  1535. 0x1d4b3,
  1536. 0x1d4e7,
  1537. 0x1d51b,
  1538. 0x1d54f,
  1539. 0x1d583,
  1540. 0x1d5b7,
  1541. 0x1d5eb,
  1542. 0x1d61f,
  1543. 0x1d653,
  1544. 0x1d687,
  1545. 0x0a7b3,
  1546. 0x003a7,
  1547. 0x1d6be,
  1548. 0x1d6f8,
  1549. 0x1d732,
  1550. 0x1d76c,
  1551. 0x1d7a6,
  1552. 0x02cac,
  1553. 0x00425,
  1554. 0x02d5d,
  1555. 0x016b7,
  1556. 0x0a4eb,
  1557. 0x10290,
  1558. 0x102b4,
  1559. 0x10317,
  1560. 0x10527,
  1561. 0x00263,
  1562. 0x01d8c,
  1563. 0x0ff59,
  1564. 0x1d432,
  1565. 0x1d466,
  1566. 0x1d49a,
  1567. 0x1d4ce,
  1568. 0x1d502,
  1569. 0x1d536,
  1570. 0x1d56a,
  1571. 0x1d59e,
  1572. 0x1d5d2,
  1573. 0x1d606,
  1574. 0x1d63a,
  1575. 0x1d66e,
  1576. 0x1d6a2,
  1577. 0x0028f,
  1578. 0x01eff,
  1579. 0x0ab5a,
  1580. 0x003b3,
  1581. 0x0213d,
  1582. 0x1d6c4,
  1583. 0x1d6fe,
  1584. 0x1d738,
  1585. 0x1d772,
  1586. 0x1d7ac,
  1587. 0x00443,
  1588. 0x004af,
  1589. 0x010e7,
  1590. 0x118dc,
  1591. 0x0ff39,
  1592. 0x1d418,
  1593. 0x1d44c,
  1594. 0x1d480,
  1595. 0x1d4b4,
  1596. 0x1d4e8,
  1597. 0x1d51c,
  1598. 0x1d550,
  1599. 0x1d584,
  1600. 0x1d5b8,
  1601. 0x1d5ec,
  1602. 0x1d620,
  1603. 0x1d654,
  1604. 0x1d688,
  1605. 0x003a5,
  1606. 0x003d2,
  1607. 0x1d6bc,
  1608. 0x1d6f6,
  1609. 0x1d730,
  1610. 0x1d76a,
  1611. 0x1d7a4,
  1612. 0x02ca8,
  1613. 0x00423,
  1614. 0x004ae,
  1615. 0x013a9,
  1616. 0x013bd,
  1617. 0x0a4ec,
  1618. 0x16f43,
  1619. 0x118a4,
  1620. 0x102b2,
  1621. 0x1d433,
  1622. 0x1d467,
  1623. 0x1d49b,
  1624. 0x1d4cf,
  1625. 0x1d503,
  1626. 0x1d537,
  1627. 0x1d56b,
  1628. 0x1d59f,
  1629. 0x1d5d3,
  1630. 0x1d607,
  1631. 0x1d63b,
  1632. 0x1d66f,
  1633. 0x1d6a3,
  1634. 0x01d22,
  1635. 0x0ab93,
  1636. 0x118c4,
  1637. 0x102f5,
  1638. 0x118e5,
  1639. 0x0ff3a,
  1640. 0x02124,
  1641. 0x02128,
  1642. 0x1d419,
  1643. 0x1d44d,
  1644. 0x1d481,
  1645. 0x1d4b5,
  1646. 0x1d4e9,
  1647. 0x1d585,
  1648. 0x1d5b9,
  1649. 0x1d5ed,
  1650. 0x1d621,
  1651. 0x1d655,
  1652. 0x1d689,
  1653. 0x00396,
  1654. 0x1d6ad,
  1655. 0x1d6e7,
  1656. 0x1d721,
  1657. 0x1d75b,
  1658. 0x1d795,
  1659. 0x013c3,
  1660. 0x0a4dc,
  1661. 0x118a9,
  1662. };
  1663. static gboolean
  1664. rspamd_can_alias_latin(int ch)
  1665. {
  1666. return latin_confusable.contains(ch);
  1667. }
  1668. static double
  1669. rspamd_chartable_process_word_utf(struct rspamd_task *task,
  1670. rspamd_stat_token_t *w,
  1671. gboolean is_url,
  1672. unsigned int *ncap,
  1673. struct chartable_ctx *chartable_module_ctx,
  1674. gboolean ignore_diacritics)
  1675. {
  1676. const UChar32 *p, *end;
  1677. double badness = 0.0;
  1678. UChar32 uc;
  1679. UBlockCode sc;
  1680. unsigned int cat;
  1681. int last_is_latin = -1;
  1682. unsigned int same_script_count = 0, nsym = 0, nspecial = 0;
  1683. enum {
  1684. start_process = 0,
  1685. got_alpha,
  1686. got_digit,
  1687. got_unknown,
  1688. } state = start_process,
  1689. prev_state = start_process;
  1690. p = w->unicode.begin;
  1691. end = p + w->unicode.len;
  1692. /* We assume that w is normalized */
  1693. while (p < end) {
  1694. uc = *p++;
  1695. if (((int32_t) uc) < 0) {
  1696. break;
  1697. }
  1698. sc = ublock_getCode(uc);
  1699. cat = u_charType(uc);
  1700. if (!ignore_diacritics) {
  1701. if (cat == U_NON_SPACING_MARK ||
  1702. (sc == UBLOCK_LATIN_1_SUPPLEMENT) ||
  1703. (sc == UBLOCK_LATIN_EXTENDED_A) ||
  1704. (sc == UBLOCK_LATIN_EXTENDED_ADDITIONAL) ||
  1705. (sc == UBLOCK_LATIN_EXTENDED_B) ||
  1706. (sc == UBLOCK_COMBINING_DIACRITICAL_MARKS)) {
  1707. nspecial++;
  1708. }
  1709. }
  1710. if (u_isalpha(uc)) {
  1711. if (sc <= UBLOCK_COMBINING_DIACRITICAL_MARKS ||
  1712. sc == UBLOCK_LATIN_EXTENDED_ADDITIONAL) {
  1713. /*
  1714. * Assume all latin, IPA, diacritic and space modifiers
  1715. * characters as basic latin
  1716. */
  1717. sc = UBLOCK_BASIC_LATIN;
  1718. }
  1719. if (sc != UBLOCK_BASIC_LATIN && u_isupper(uc)) {
  1720. if (ncap) {
  1721. (*ncap)++;
  1722. }
  1723. }
  1724. if (state == got_digit) {
  1725. /* Penalize digit -> alpha translations */
  1726. if (!is_url && sc != UBLOCK_BASIC_LATIN &&
  1727. prev_state != start_process) {
  1728. badness += 0.25;
  1729. }
  1730. }
  1731. else if (state == got_alpha) {
  1732. /* Check script */
  1733. if (same_script_count > 0) {
  1734. if (sc != UBLOCK_BASIC_LATIN && last_is_latin) {
  1735. if (rspamd_can_alias_latin(uc)) {
  1736. badness += 1.0 / (double) same_script_count;
  1737. }
  1738. last_is_latin = 0;
  1739. same_script_count = 1;
  1740. }
  1741. else {
  1742. same_script_count++;
  1743. }
  1744. }
  1745. else {
  1746. last_is_latin = sc == UBLOCK_BASIC_LATIN;
  1747. same_script_count = 1;
  1748. }
  1749. }
  1750. prev_state = state;
  1751. state = got_alpha;
  1752. }
  1753. else if (u_isdigit(uc)) {
  1754. if (state != got_digit) {
  1755. prev_state = state;
  1756. }
  1757. state = got_digit;
  1758. same_script_count = 0;
  1759. }
  1760. else {
  1761. /* We don't care about unknown characters here */
  1762. if (state != got_unknown) {
  1763. prev_state = state;
  1764. }
  1765. state = got_unknown;
  1766. same_script_count = 0;
  1767. }
  1768. nsym++;
  1769. }
  1770. if (nspecial > 0) {
  1771. if (!ignore_diacritics) {
  1772. /* Count diacritics */
  1773. badness += nspecial;
  1774. }
  1775. else if (nspecial > 1) {
  1776. badness += (nspecial - 1.0) / 2.0;
  1777. }
  1778. }
  1779. /* Try to avoid FP for long words */
  1780. if (nsym > chartable_module_ctx->max_word_len) {
  1781. badness = 0;
  1782. }
  1783. else {
  1784. if (badness > 4.0) {
  1785. badness = 4.0;
  1786. }
  1787. }
  1788. msg_debug_chartable("word %*s, badness: %.2f",
  1789. (int) w->normalized.len, w->normalized.begin,
  1790. badness);
  1791. return badness;
  1792. }
  1793. static double
  1794. rspamd_chartable_process_word_ascii(struct rspamd_task *task,
  1795. rspamd_stat_token_t *w,
  1796. gboolean is_url,
  1797. struct chartable_ctx *chartable_module_ctx)
  1798. {
  1799. double badness = 0.0;
  1800. enum {
  1801. ascii = 1,
  1802. non_ascii
  1803. } sc,
  1804. last_sc;
  1805. int same_script_count = 0, seen_alpha = FALSE;
  1806. enum {
  1807. start_process = 0,
  1808. got_alpha,
  1809. got_digit,
  1810. got_unknown,
  1811. } state = start_process;
  1812. const auto *p = (const unsigned char *) w->normalized.begin;
  1813. const auto *end = p + w->normalized.len;
  1814. last_sc = non_ascii;
  1815. if (w->normalized.len > chartable_module_ctx->max_word_len) {
  1816. return 0.0;
  1817. }
  1818. /* We assume that w is normalized */
  1819. while (p < end) {
  1820. if (g_ascii_isalpha(*p) || *p > 0x7f) {
  1821. if (state == got_digit) {
  1822. /* Penalize digit -> alpha translations */
  1823. if (seen_alpha && !is_url && !g_ascii_isxdigit(*p)) {
  1824. badness += 0.25;
  1825. }
  1826. }
  1827. else if (state == got_alpha) {
  1828. /* Check script */
  1829. sc = (*p > 0x7f) ? ascii : non_ascii;
  1830. if (same_script_count > 0) {
  1831. if (sc != last_sc) {
  1832. badness += 1.0 / (double) same_script_count;
  1833. last_sc = sc;
  1834. same_script_count = 1;
  1835. }
  1836. else {
  1837. same_script_count++;
  1838. }
  1839. }
  1840. else {
  1841. last_sc = sc;
  1842. same_script_count = 1;
  1843. }
  1844. }
  1845. seen_alpha = TRUE;
  1846. state = got_alpha;
  1847. }
  1848. else if (g_ascii_isdigit(*p)) {
  1849. state = got_digit;
  1850. same_script_count = 0;
  1851. }
  1852. else {
  1853. /* We don't care about unknown characters here */
  1854. state = got_unknown;
  1855. same_script_count = 0;
  1856. }
  1857. p++;
  1858. }
  1859. if (badness > 4.0) {
  1860. badness = 4.0;
  1861. }
  1862. msg_debug_chartable("word %*s, badness: %.2f",
  1863. (int) w->normalized.len, w->normalized.begin,
  1864. badness);
  1865. return badness;
  1866. }
  1867. static gboolean
  1868. rspamd_chartable_process_part(struct rspamd_task *task,
  1869. struct rspamd_mime_text_part *part,
  1870. struct chartable_ctx *chartable_module_ctx,
  1871. gboolean ignore_diacritics)
  1872. {
  1873. rspamd_stat_token_t *w;
  1874. unsigned int i, ncap = 0;
  1875. double cur_score = 0.0;
  1876. if (part == nullptr || part->utf_words == nullptr ||
  1877. part->utf_words->len == 0 || part->nwords == 0) {
  1878. return FALSE;
  1879. }
  1880. for (i = 0; i < part->utf_words->len; i++) {
  1881. w = &g_array_index(part->utf_words, rspamd_stat_token_t, i);
  1882. if ((w->flags & RSPAMD_STAT_TOKEN_FLAG_TEXT)) {
  1883. if (w->flags & RSPAMD_STAT_TOKEN_FLAG_UTF) {
  1884. cur_score += rspamd_chartable_process_word_utf(task, w, FALSE,
  1885. &ncap, chartable_module_ctx, ignore_diacritics);
  1886. }
  1887. else {
  1888. cur_score += rspamd_chartable_process_word_ascii(task, w,
  1889. FALSE, chartable_module_ctx);
  1890. }
  1891. }
  1892. }
  1893. /*
  1894. * TODO: perhaps, we should do this analysis somewhere else and get
  1895. * something like: <SYM_SC><SYM_SC><SYM_SC> representing classes for all
  1896. * symbols in the text
  1897. */
  1898. part->capital_letters += ncap;
  1899. cur_score /= (double) part->nwords;
  1900. if (cur_score > 1.0) {
  1901. cur_score = 1.0;
  1902. }
  1903. if (cur_score > chartable_module_ctx->threshold) {
  1904. rspamd_task_insert_result(task, chartable_module_ctx->symbol,
  1905. cur_score, nullptr);
  1906. return TRUE;
  1907. }
  1908. return FALSE;
  1909. }
  1910. static void
  1911. chartable_symbol_callback(struct rspamd_task *task,
  1912. struct rspamd_symcache_dynamic_item *item,
  1913. void *_)
  1914. {
  1915. unsigned int i;
  1916. struct rspamd_mime_text_part *part;
  1917. struct chartable_ctx *chartable_module_ctx = chartable_get_context(task->cfg);
  1918. gboolean ignore_diacritics = TRUE, seen_violated_part = FALSE;
  1919. /* Check if we have parts with diacritic symbols language */
  1920. PTR_ARRAY_FOREACH(MESSAGE_FIELD(task, text_parts), i, part)
  1921. {
  1922. if (part->languages && part->languages->len > 0) {
  1923. auto *lang = (struct rspamd_lang_detector_res *) g_ptr_array_index(part->languages, 0);
  1924. int flags;
  1925. flags = rspamd_language_detector_elt_flags(lang->elt);
  1926. if ((flags & RS_LANGUAGE_DIACRITICS)) {
  1927. ignore_diacritics = TRUE;
  1928. }
  1929. else if (lang->prob > 0.75) {
  1930. ignore_diacritics = FALSE;
  1931. }
  1932. }
  1933. if (rspamd_chartable_process_part(task, part, chartable_module_ctx, ignore_diacritics)) {
  1934. seen_violated_part = TRUE;
  1935. }
  1936. }
  1937. if (MESSAGE_FIELD(task, text_parts)->len == 0) {
  1938. /* No text parts, assume that we should ignore diacritics checks for metatokens */
  1939. ignore_diacritics = TRUE;
  1940. }
  1941. if (task->meta_words != nullptr && task->meta_words->len > 0) {
  1942. rspamd_stat_token_t *w;
  1943. double cur_score = 0;
  1944. gsize arlen = task->meta_words->len;
  1945. for (i = 0; i < arlen; i++) {
  1946. w = &g_array_index(task->meta_words, rspamd_stat_token_t, i);
  1947. cur_score += rspamd_chartable_process_word_utf(task, w, FALSE,
  1948. nullptr, chartable_module_ctx, ignore_diacritics);
  1949. }
  1950. cur_score /= (double) (arlen + 1);
  1951. if (cur_score > 1.0) {
  1952. cur_score = 1.0;
  1953. }
  1954. if (cur_score > chartable_module_ctx->threshold) {
  1955. if (!seen_violated_part) {
  1956. /* Further penalise */
  1957. if (cur_score > 0.25) {
  1958. cur_score = 0.25;
  1959. }
  1960. }
  1961. rspamd_task_insert_result(task, chartable_module_ctx->symbol,
  1962. cur_score, "subject");
  1963. }
  1964. }
  1965. rspamd_symcache_finalize_item(task, item);
  1966. }
  1967. static void
  1968. chartable_url_symbol_callback(struct rspamd_task *task,
  1969. struct rspamd_symcache_dynamic_item *item,
  1970. void *unused)
  1971. {
  1972. /* XXX: TODO: unbreak module once URLs unicode project is over */
  1973. #if 0
  1974. struct rspamd_url *u;
  1975. GHashTableIter it;
  1976. gpointer k, v;
  1977. rspamd_stat_token_t w;
  1978. double cur_score = 0.0;
  1979. struct chartable_ctx *chartable_module_ctx = chartable_get_context (task->cfg);
  1980. g_hash_table_iter_init (&it, task->urls);
  1981. while (g_hash_table_iter_next (&it, &k, &v)) {
  1982. u = v;
  1983. if (cur_score > 2.0) {
  1984. cur_score = 2.0;
  1985. break;
  1986. }
  1987. if (u->hostlen > 0) {
  1988. w.stemmed.begin = u->host;
  1989. w.stemmed.len = u->hostlen;
  1990. if (g_utf8_validate (w.stemmed.begin, w.stemmed.len, nullptr)) {
  1991. cur_score += rspamd_chartable_process_word_utf (task, &w,
  1992. TRUE, nullptr, chartable_module_ctx);
  1993. }
  1994. else {
  1995. cur_score += rspamd_chartable_process_word_ascii (task, &w,
  1996. TRUE, chartable_module_ctx);
  1997. }
  1998. }
  1999. }
  2000. g_hash_table_iter_init (&it, task->emails);
  2001. while (g_hash_table_iter_next (&it, &k, &v)) {
  2002. u = v;
  2003. if (cur_score > 2.0) {
  2004. cur_score = 2.0;
  2005. break;
  2006. }
  2007. if (u->hostlen > 0) {
  2008. w.stemmed.begin = u->host;
  2009. w.stemmed.len = u->hostlen;
  2010. if (g_utf8_validate (w.stemmed.begin, w.stemmed.len, nullptr)) {
  2011. cur_score += rspamd_chartable_process_word_utf (task, &w,
  2012. TRUE, nullptr, chartable_module_ctx);
  2013. }
  2014. else {
  2015. cur_score += rspamd_chartable_process_word_ascii (task, &w,
  2016. TRUE, chartable_module_ctx);
  2017. }
  2018. }
  2019. }
  2020. if (cur_score > chartable_module_ctx->threshold) {
  2021. rspamd_task_insert_result (task, chartable_module_ctx->symbol,
  2022. cur_score, nullptr);
  2023. }
  2024. #endif
  2025. rspamd_symcache_finalize_item(task, item);
  2026. }