发布时间:
一些在线阅读小说网站,页面显示内容是正常,但获取到的文本内容却是乱码或语句不通的汉字。出现这种情况大概率是加密字。
前提条件 #
- FontCreator 字体编辑工具:查找网络字码点或字形名称
- Umi-OCR 文字识别工具:用来识别
FontCreator
中的字形 - 同时你需要一点点
js
知识和对未知的探索精神 🙃
查找加密字体 #
F12 或 Ctrl + Shift + C 或 Ctrl + Shift + J 打开控制台,找到对应文本内容元素节点。
查找字体 #
- 网页显示内容和源码内容不一致
- 发现不常见字体
bqg
大概率加密字体 - 取消设置的默认字体,观察页面变化,发现确实是字体加密了。如下图:
下载字体 #
- 控制台条件过滤选择字体,
F5
刷新页面。没有条件过滤栏,点击左上侧有个漏斗形状图标。 - 在当前请求上右键 -> 在新标签页打开(第一个)自动下载字体。
字码点和字形 #
- 打开
FontCreator
将bqg.ttf
拖进去就可以看到字码点和字形了。 - Ctrl + A 全选所有字形,Ctrl + C 复制所有字码点。示例:
uni3984
- 使用
Umi-OCR
识别汉字,内容少可以手动敲。
提示
默认情况下字码点复制顺序和字形排列顺序一致,从左到右。
字码点:uni3984
uni 没用,关键在后四位是字体 Unicode
字符转十六进制后的结果。将获取到的字码点和汉字分成两个数组一一对应,方便后面代码处理。
编写代码 #
有了字码点和字形文本后,可以使用任意开发语言进行解码处理。这里使用 JavaScript
解码可以再浏览器直观看到内容变化。
关键代码 js
// 将网页获取的乱码字体先转 Unicode 编码,再转 十六进制 大写就得到了最终数据。
text.charCodeAt(i).toString(16).toUpperCase();
源码 js
function fontDecoding() {
// 字码点
const points = ["37E6", "37E7", "382B", "382C", "382D", "386D", "38C7", "38C8", "38C9", "38CA", "3917",
"3919", "391A", "3955", "3956", "3967", "3968", "396B", "396F", "3981", "3982", "3983", "3984",
"3985", "3986", "3987", "39A6", "39A7", "39A8", "39A9", "39AA", "39AB", "39AC", "39B1", "39B2",
"39B3", "39B4", "39B5", "39B6", "39B7", "39B9", "39BA", "39D6", "39D7", "39D8", "39D9", "39DA",
"39DB", "39DC", "39DD", "39DE", "39E0", "3A26", "3A27", "3A29", "3A2A", "3A2B", "3A2C", "3A3C",
"3A3D", "3A3E", "3A3F", "3A40", "3A41", "3A58", "3A59", "3A5A", "3A5B", "3A76", "3A77", "3A78",
"3A79", "3A7A", "3A7B", "3A7C", "3A7D", "3A7E", "3A8F", "3A90", "3A91", "3A92", "3AA7", "3AA8",
"3AA9", "3AAA", "3AAB", "3AB2", "3AB3", "3AB4", "3AB5", "3AB6", "3AB7", "3AB8", "3AB9", "3ABA",
"3ABB", "3ABC", "3ABD", "3ABE", "3ABF", "3AC0", "3AC5", "3AC6", "3AC7", "3AC8", "3AC9", "3ACA",
"3ACB", "3ACC", "3AE0", "3AE1", "3AE2", "3AE3", "3AE4", "3AE5", "3AE6", "3AE7", "3AE8", "3AE9",
"3AEA", "3AEB", "3AEC", "3AED", "3AEE", "3AEF", "3AF7", "3AF8", "3AF9", "3AFA", "3AFB", "3AFC",
"3BBA", "3BBB", "3BBC", "3BBD", "3BBE", "3C18", "3C19", "3C1A", "3C1B", "3C1C", "3C1D", "3C30",
"3C31", "3C32", "3C33", "3C34", "3C35", "3C36", "3C37", "3C38", "3C39", "3C3A", "3C4F", "3C50",
"3C51", "3C52", "3C53", "3C54", "3C55", "3C56", "3C57", "3C5A", "3C5B", "3C5C", "3C5D", "3C5E",
"3C5F", "3C66", "3C67", "3C68", "3C69", "3C6A", "3C6B", "3CA4", "3CA5", "3CCD", "3CCE", "3CCF",
"3CD0", "3CD1", "3CD2", "3CD3", "3CD4", "3CE1", "3CE2", "3CE3", "3CE4", "3CE5", "3D50", "3D51",
"3D52", "3D53", "3D54", "3D55", "3D56", "3D57", "3D59", "3D5B", "3D5C", "3D82", "3D83", "3D84",
"3D85", "3E4F", "3E50", "3E51", "3E52", "3E53", "3E54", "3E55", "3E56", "3E57", "3EA7", "4031",
"4032", "4033", "4034", "4068", "4069", "406A", "406B", "406C", "406D", "406F", "4070", "4071",
"4072", "40C3", "40C4", "40E2", "40E3", "40E4", "42C1", "42C2", "42C3", "42C4", "42C5", "42C6",
"42C7", "42DD", "42DE", "42DF", "42E0", "42E1", "42E2", "42E3", "42E4", "42E5", "42E6", "42E7",
"42E8", "42E9", "42EA", "431E", "431F", "4320", "4321", "4453", "4454", "4455", "4456", "4457",
"45D5", "45D6", "45D7", "45D8", "45D9", "45FB", "45FC", "45FD", "45FE", "45FF", "4602", "4613",
"4614", "4618", "46C8", "46C9", "46CA", "46CB", "46CC", "46CD", "46CE", "46CF", "46D0", "46D1",
"46D2", "46D3", "46D4", "46D5", "46D6", "46D7", "4725", "4727", "4728", "472A", "472C", "472D",
"472E", "4949", "494A", "494B", "494C", "494D", "49A1", "49A2", "49A3", "49A4", "49A5", "4A08",
"4A09", "4A0A", "4A9F", "4AA0", "4B74", "4B75", "4B76", "4B77", "4B78", "4B79", "4B7A", "4B7B",
"4B7C", "4B7D", "4B7E", "4B7F", "4B80", "4B81", "4B8A", "4B8B", "4B8C", "4B8D", "4B8E", "4B8F",
"4BB7", "4BB8", "4BB9", "4BBA", "4BBB", "4BE9", "4BEA", "4BEB", "4BEC", "4BED", "4BEE", "4BEF",
"4BF0", "4C02", "4C03", "4C04", "4C05", "4C85", "4C86", "4C87", "4C88", "4C89", "4C96", "4C97",
"4C98", "4C99", "4CBA", "4CBB", "4CBC", "4CBD", "4CBE", "4CBF", "4CC0", "4D8F", "4D90", "4D91",
"4D92", "4D93", "4E33", "4E35", "4E37", "4E40", "4E41", "4E44", "4E46", "4E4A", "4E55", "50FE",
"5677", "5678", "5679", "56A0", "56A1", "56A2", "5718", "5719", "571A", "571B", "571D", "5828",
"5868", "587A", "587F", "58B5", "58B7", "58BA", "58C4", "58DC", "590C", "590D", "596B", "5A48",
"5A56", "5A64", "5A7A", "5A90", "5AA9", "5AB1", "5AC0", "5AF3", "5B28", "5B2E", "5D57", "5D59",
"5D5A", "5D5C", "5D5E", "5D5F", "5DEA", "5DEC", "5DED", "6AFF", "6B07", "6B1B", "6B1C", "6B1D",
"9F32", "9F33", "9F34", "9F35", "9F36", "9F37", "9F38", "9F40", "9F42", "D6D2"
];
// 字形
const indices =
"一二十丁厂七八人入儿九几了刀力又三千亏士工才寸丈大与万上小口山巾千亡义之尸已弓己也飞气川亿个么久勺丸凡及习叉马乡丰开夫天元无云扎艺五支厅犬区尤匹车巨牙屯互切止少日中贝冈见手午气升长?片化仇币仍仅斤爪反介父从今凶乏仓氏风欠丹匀乌勾凤六文方火忆订户认心尺巴队办以允予幻玉未未击打巧正扑功扔甘世古节本术可丙左厉石右布龙平轧东的是在不有和这为国我电由只要他时来叫用们叹四失生到代作地于出就分乎对令成会乐句册外处冬鸟包主市闪发年动头汉宁它百同能而下过子说产种面后多定学法行至此所民得光经进虫着等部度家里如回水高自理起物现实加量都两体制机当使点业去把性好应合还因其些然前政那社事形相全表间样色关各重新线内数你明看原利比或但质第向道命变条污没结解问意建月公军系很情者最立想通并提直题党阶阴程奸展妇妈戏果料象员革位常总痉茎筑弄战婴轮泽胡锦涛毛林湿白医痹疱批扯疣走抄坝贡裸赤枪抓女美罪交密宫啊爱痒她媚变缥購屌残智共亲活克神丽李独暴游集男死套骚操足插圆假幼弟盗货芽花爹跌劳魔鬼殖器领屁逼菊婊棒极消妹母卫";
const decodeing = (text) => {
let target = '';
for (let i = 0; i < text.length; i++) {
let code = text.charCodeAt(i).toString(16).toUpperCase();
const findIndex = points.findIndex(item => item === code);
if (findIndex != -1) {
target += indices[findIndex]
} else {
target += text[i]
}
}
return target
};
const html = document.querySelector("#content").innerHTML;
const text = decodeing(html);
document.querySelector("#content").innerHTML = text;
alert('解码完成')
};
书签脚本 js
javascript:function fontDecoding(){const points=["37E6","37E7","382B","382C","382D","386D","38C7","38C8","38C9","38CA","3917","3919","391A","3955","3956","3967","3968","396B","396F","3981","3982","3983","3984","3985","3986","3987","39A6","39A7","39A8","39A9","39AA","39AB","39AC","39B1","39B2","39B3","39B4","39B5","39B6","39B7","39B9","39BA","39D6","39D7","39D8","39D9","39DA","39DB","39DC","39DD","39DE","39E0","3A26","3A27","3A29","3A2A","3A2B","3A2C","3A3C","3A3D","3A3E","3A3F","3A40","3A41","3A58","3A59","3A5A","3A5B","3A76","3A77","3A78","3A79","3A7A","3A7B","3A7C","3A7D","3A7E","3A8F","3A90","3A91","3A92","3AA7","3AA8","3AA9","3AAA","3AAB","3AB2","3AB3","3AB4","3AB5","3AB6","3AB7","3AB8","3AB9","3ABA","3ABB","3ABC","3ABD","3ABE","3ABF","3AC0","3AC5","3AC6","3AC7","3AC8","3AC9","3ACA","3ACB","3ACC","3AE0","3AE1","3AE2","3AE3","3AE4","3AE5","3AE6","3AE7","3AE8","3AE9","3AEA","3AEB","3AEC","3AED","3AEE","3AEF","3AF7","3AF8","3AF9","3AFA","3AFB","3AFC","3BBA","3BBB","3BBC","3BBD","3BBE","3C18","3C19","3C1A","3C1B","3C1C","3C1D","3C30","3C31","3C32","3C33","3C34","3C35","3C36","3C37","3C38","3C39","3C3A","3C4F","3C50","3C51","3C52","3C53","3C54","3C55","3C56","3C57","3C5A","3C5B","3C5C","3C5D","3C5E","3C5F","3C66","3C67","3C68","3C69","3C6A","3C6B","3CA4","3CA5","3CCD","3CCE","3CCF","3CD0","3CD1","3CD2","3CD3","3CD4","3CE1","3CE2","3CE3","3CE4","3CE5","3D50","3D51","3D52","3D53","3D54","3D55","3D56","3D57","3D59","3D5B","3D5C","3D82","3D83","3D84","3D85","3E4F","3E50","3E51","3E52","3E53","3E54","3E55","3E56","3E57","3EA7","4031","4032","4033","4034","4068","4069","406A","406B","406C","406D","406F","4070","4071","4072","40C3","40C4","40E2","40E3","40E4","42C1","42C2","42C3","42C4","42C5","42C6","42C7","42DD","42DE","42DF","42E0","42E1","42E2","42E3","42E4","42E5","42E6","42E7","42E8","42E9","42EA","431E","431F","4320","4321","4453","4454","4455","4456","4457","45D5","45D6","45D7","45D8","45D9","45FB","45FC","45FD","45FE","45FF","4602","4613","4614","4618","46C8","46C9","46CA","46CB","46CC","46CD","46CE","46CF","46D0","46D1","46D2","46D3","46D4","46D5","46D6","46D7","4725","4727","4728","472A","472C","472D","472E","4949","494A","494B","494C","494D","49A1","49A2","49A3","49A4","49A5","4A08","4A09","4A0A","4A9F","4AA0","4B74","4B75","4B76","4B77","4B78","4B79","4B7A","4B7B","4B7C","4B7D","4B7E","4B7F","4B80","4B81","4B8A","4B8B","4B8C","4B8D","4B8E","4B8F","4BB7","4BB8","4BB9","4BBA","4BBB","4BE9","4BEA","4BEB","4BEC","4BED","4BEE","4BEF","4BF0","4C02","4C03","4C04","4C05","4C85","4C86","4C87","4C88","4C89","4C96","4C97","4C98","4C99","4CBA","4CBB","4CBC","4CBD","4CBE","4CBF","4CC0","4D8F","4D90","4D91","4D92","4D93","4E33","4E35","4E37","4E40","4E41","4E44","4E46","4E4A","4E55","50FE","5677","5678","5679","56A0","56A1","56A2","5718","5719","571A","571B","571D","5828","5868","587A","587F","58B5","58B7","58BA","58C4","58DC","590C","590D","596B","5A48","5A56","5A64","5A7A","5A90","5AA9","5AB1","5AC0","5AF3","5B28","5B2E","5D57","5D59","5D5A","5D5C","5D5E","5D5F","5DEA","5DEC","5DED","6AFF","6B07","6B1B","6B1C","6B1D","9F32","9F33","9F34","9F35","9F36","9F37","9F38","9F40","9F42","D6D2"];const indices="一二十丁厂七八人入儿九几了刀力又三千亏士工才寸丈大与万上小口山巾千亡义之尸已弓己也飞气川亿个么久勺丸凡及习叉马乡丰开夫天元无云扎艺五支厅犬区尤匹车巨牙屯互切止少日中贝冈见手午气升长?片化仇币仍仅斤爪反介父从今凶乏仓氏风欠丹匀乌勾凤六文方火忆订户认心尺巴队办以允予幻玉未未击打巧正扑功扔甘世古节本术可丙左厉石右布龙平轧东的是在不有和这为国我电由只要他时来叫用们叹四失生到代作地于出就分乎对令成会乐句册外处冬鸟包主市闪发年动头汉宁它百同能而下过子说产种面后多定学法行至此所民得光经进虫着等部度家里如回水高自理起物现实加量都两体制机当使点业去把性好应合还因其些然前政那社事形相全表间样色关各重新线内数你明看原利比或但质第向道命变条污没结解问意建月公军系很情者最立想通并提直题党阶阴程奸展妇妈戏果料象员革位常总痉茎筑弄战婴轮泽胡锦涛毛林湿白医痹疱批扯疣走抄坝贡裸赤枪抓女美罪交密宫啊爱痒她媚变缥購屌残智共亲活克神丽李独暴游集男死套骚操足插圆假幼弟盗货芽花爹跌劳魔鬼殖器领屁逼菊婊棒极消妹母卫";const decodeing=(text)=>{let target='';for(let i=0;i<text.length;i++){let code=text.charCodeAt(i).toString(16).toUpperCase();const findIndex=points.findIndex(item=>item===code);if(findIndex!=-1){target+=indices[findIndex]}else{target+=text[i]}}return target};const html=document.querySelector("#content").innerHTML;const text=decodeing(html);document.querySelector("#content").innerHTML=text;alert('解码完成')};fontDecoding();
提示
书签脚本如何使用? 参考:谷歌浏览器书签脚本
最终效果 #
随便打开一篇小说,打开控制台观察,点击一次书签脚本,此时原文内容已被更新。