开发者

Encrypting html data received from ajax request?

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\\x开发者_运维知识库3dmicon 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?


you can't.

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


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.


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 ..
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜