加密从ajax请求收到的html数据?

发布于 2024-11-03 14:09:25 字数 2293 浏览 1 评论 0原文

如何加密从 ajax 请求接收的数据?例如,我从 Google 注意到,当发出 get 请求时,收到的数据都是乱七八糟的,例如:

position:absolute;top:0;width:155px\\x22 onclick\\x3d\\x22google.psy\\x26\\x26google.psy.qs(event)\\x22\\x3e\\x3cdiv id\\x3dms\\x3e\\x3cul\\x3e\\x3cli class\\x3d\\x22mitem msel\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-20px -85px\\x22\\x3e\\x3c/span\\x3eEverything\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3disch\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d2\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAgQ_AUoAQ\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-40px -85px\\x22\\x3e\\x3c/span\\x3eImages\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dvid\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d3\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAkQ_AUoAg\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-80px -85px\\x22\\x3e\\x3c/span\\x3eVideos\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dnws\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d4\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAoQ_AUoAw\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-120px -85px\\x22\\x3e\\x3c/span\\x3eNews\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dshop\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d5\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAsQ_AUoBA\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-120px -105px\\x22\\x3e\\

我怎样才能实现类似的结构?

How can I encrypt the data receieved from an ajax request? For example I noticed from Google when a get request is made the data that is receieved is all scambled like :

position:absolute;top:0;width:155px\\x22 onclick\\x3d\\x22google.psy\\x26\\x26google.psy.qs(event)\\x22\\x3e\\x3cdiv id\\x3dms\\x3e\\x3cul\\x3e\\x3cli class\\x3d\\x22mitem msel\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-20px -85px\\x22\\x3e\\x3c/span\\x3eEverything\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3disch\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d2\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAgQ_AUoAQ\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-40px -85px\\x22\\x3e\\x3c/span\\x3eImages\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dvid\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d3\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAkQ_AUoAg\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-80px -85px\\x22\\x3e\\x3c/span\\x3eVideos\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dnws\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d4\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAoQ_AUoAw\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-120px -85px\\x22\\x3e\\x3c/span\\x3eNews\\x3c/a\\x3e\\x3cli class\\x3d\\x22mitem\\x22\\x3e\\x3ca href\\x3d\\x22/search?q\\x3dasdfadf\\x26amp;hl\\x3den\\x26amp;prmd\\x3divns\\x26amp;source\\x3dlnms\\x26amp;tbm\\x3dshop\\x26amp;ei\\x3dHZy4TeKYG6bw0gG8pbTRDw\\x26amp;sa\\x3dX\\x26amp;oi\\x3dmode_link\\x26amp;ct\\x3dmode\\x26amp;cd\\x3d5\\x26amp;sqi\\x3d2\\x26amp;ved\\x3d0CAsQ_AUoBA\\x22 class\\x3d\\x22q qs\\x22\\x3e\\x3cspan class\\x3dmicon style\\x3d\\x22background-position:-120px -105px\\x22\\x3e\\

How can I achieve a similar structure?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

悲欢浪云 2024-11-10 14:09:25

你不能。

在您发布的代码中,它不是加密,而只是编码。

you can't.

in the code you posted it's not encryption but just encoding.

青衫儰鉨ミ守葔 2024-11-10 14:09:25

它并不是真正的“加密”,只是经过混淆和编码。 我不确定所使用的编码类型。 检查此SO post,它有一个类似的问题,它指出 ASCII 是十六进制编码的。

It is not really "encrypted" simply obfuscated and encoded. I am unsure of the encoding type being used. Check this SO post, which has a similar question and it states ASCII that is encoded hexadecimal.

要走干脆点 2024-11-10 14:09:25

数据示例没有被扰乱,它只是被编码了。任何“奇怪”字符都将替换为 \\x##,其中 ## 是代表该字符的十六进制数字。

\\x22 is probably a "
\\x3d is probably a =
and so on ..

The data example isn't scrambled, it's just encoded. Any 'strange' character is replace by \\x## where ## is some hexadecimal number representing that character.

\\x22 is probably a "
\\x3d is probably a =
and so on ..
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文