12345
本地調試
掛代理,讓所有網絡請求走代理
在代理軟件里面,攔截返回值
替換返回值
動態更改代碼
md5 加密 32,16
sh1 40
定位關鍵字辦法、
1 搜索
定位關鍵詞 比較準確,搜索的位置多,自己進行篩選,容易搜不到
2 dom 事件
定位的位置比較靠前,可以通過刪除事件的方式定位具體函數
用戶明文 -> 經過一些辦法->加密函數->拼裝封包-》發包函數->瀏覽器的發包函數
元素 --時間監聽器 --找點擊事件點開代碼 (可以刪除一些監聽器來判斷是否是找對了事件位置)
3 xhr 斷點
好處:定位的位置在發包函數 ,我們可以跟堆棧
壞處:只能用戶xhr 的包
只能斷掉xmlhttprequest 發包
不能斷開html 表單發包
方法1 發包 ,找請求特征碼
https://passport.gm99.com/login/login3?callback=jQuery171043825104545353954_1636722828440&encrypt=1&uname=15222222&password=H8VnhTvbucTZhBRyUqYtuX4QLq%252Ft11ArNsYQCZw3h2lVHPL9M8xAxtH%252BYkeGjn%252BPB1fiQ2qj7N0ZRMKrzZmAOVEsPKryEZp7qAYG4WMTDiFidwspIiFcq0bSYV2aeV0rTz%252BEahw3drRZnxLis2RWyxnU6juKo5T7PyPFPuhDqUM%253D&remember=&ckcode=8y8u&_=1636723443459
特征碼: login/login3 (網絡請求抓包后的路徑,問候前面的路徑)
打開 “源代碼” 在右側調試窗口 ,在XHR/提取斷點里面添加 特征碼
可以搜索open 函數定位ajax
方法 2 在network 面板抓包
在確定連接上,鼠標停止在發起程序上 ,找到第一個js,點擊進去,設置斷點,通過調試器堆棧來跟蹤
js hook 的三種方法
1 方法覆蓋
function xxx()
{
console.log("111");
}
xxx=function()
{
console.log("222");
}
2 覆蓋方法,保留方法
function xxx()
{
console.log("111");
}
var xxxx=xxx;
xxx=function()
{
console.log("222");
}
3 覆蓋瀏覽器環境的方法
window.alert=function(){console.log("?");}
hook 有時機的
Object.defineProperty 替換一個對象屬性
屬性可能是方法,后者一個值(geter ,seter)
(function() {
//嚴謹模式 檢查所有錯誤
'use strict';
//document 為要hook的對象 這里是hook的cookie
var cookieTemp = "";
Object.defineProperty(document, 'cookie', {
//hook set方法也就是賦值的方法
set: function(val) {
//這樣就可以快速給下面這個代碼行下斷點
//從而快速定位設置cookie的代碼
console.log('Hook捕獲到cookie設置->', val);
cookieTemp = val;
return val;
},
//hook get方法也就是取值的方法
get: function()
{
return cookieTemp;
}
});
})();
document.cooke="1" //設置時出發,hook執行 ,點vm 可以看到console.log 斷點
控制臺刷新,js失效
二 hook 時機
1 在控制臺注入hook 刷新失效
在網頁加載丟一個js的位置,下斷點,然后控制臺輸入hook
(可能注入時間會晚)
2 利用fd的替換向陽,注入hook
4 通過返回值來判斷定位
https://www.to8to.com/new_login.php
1 復制帳號登陸返回信息查找定位連接(用戶或密碼錯誤!)
2 找到連接關鍵詞,在元素中查找函數( https://www.to8to.com/new_login.php 其中new_login 是關鍵詞)
3 通過連接上的的事件函數定位,再次查找(在元素找關鍵詞new_login,找到from 上的clickcheck 等事件)
4 繼續通過clickcheck,在下面艘索框里找js
js 本地調試
https://static.to8to.com/gb_js/to8torsaszb.js?_=1636819920120
類似后綴帶時間抽得js , 無法下斷點,頁面刷新就消失
使用fd的AutoResponder
1抓包連接,點addrole
2 rule Editor
保存網站js 保存本地
寫正則
選擇本地js地址
regex:https://static\.to8to\.com/gb_js/to8torsaszb\.js\?_=\d+
C:\Users\Administrator\Desktop\js\1.js
3 在本地js 里面輸入debuger:
刷新頁面后斷點斷下
md5 拔算法
var _hex_md5;
!(function()
{
var hex_md5=function()
{
console.log("111");
}
_hex_md5=hex_md5;
}
)()
控制臺輸入
_hex_md5()
var _hex_md5;
!(function()
{
var j={
hex_md5:function()
{
console.log("111");
}
}
_hex_md5=j;
})()
控制臺輸入
_hex_md5.hex_md5()
扣代碼
1 webpack
function(x)
{
function xx(yy)
{
x(yy).call(xxx,xxx,xxx);// 必有一個加載模塊的方法 call,apply
}
xx(0)// 函數1 xx(1);
}(
[function(){},function(){}]
)
扣代碼方法 1 找加載器(加載模塊方法) 2 找到一個調用模塊 3 構造一個自執行
js 你想常規流程
抓包
調試js
扣取js
1 扣全
2 this 對象是誰
例子1
var zhiyuan={
name:"zhiyuan",
md5:function()
{
return "";
},
md1:function()
{
}
}
改寫
var md5= function()
{
return "";
}
方法2 改成例子1,形式
方法3 搜索zhiyuan,如果 搜索到全局zhiyuan ,看調用方法 ,包全部js,用函數調用
方法4 導出函數
var zhiyuan={
name:"zhiyuan",
md5:function()
{
return "";
}
window.md5=md5;
var md=md1:function()
{
}
}
運行
md5("111");
改寫
本地運行出值
本地請求服務器出值
常見加密方式
取鹽 加密方式,不可逆 crc 校驗方式
md 系列 md1 md2 md4 帶密碼的m5 (hmac)
md5 (16,32,40) 默認填充值 key :0123456789agcdef
123456 加密
16位 49ba59abbe56e057
32位 e10adc39 49ba59abbe56e057 vf20f883e
123456 加密
sha sha256 sha512
40 64 128
7c4a8d09ca3762af61e59520943dc26494f8941b
對稱加密(同一個秘要去解出明文)
aes des 3des
非對稱加密 (同一個明文可以生成不同的密文,不同的密文可還原相同密文)
rsa (私鑰 公鑰)
1 16進制 (長度不是md,和sha 的長度,最大字母只到了0-9 a-f 例如123456 aes 加密 0be6b89ce0c263215d95fee4cb54d0)
2 base64 AL5riQzgwmMhXZX+5MtU0A== (A- Z a -z + _=)
js 混淆、原理
混淆變量名
混淆代碼流程
btoa("zhiyuan")
"emhpeXVhbg=="
btoa("pcm")
"cGNt"
//以上控制臺編碼
var xxx=['emhpeXVhbg==','cGNt'];
function x1(id)
{
return atob(xxx[id]);
}
var zhiyuan="1";
var pcm="2";
console.log(window[x1(1)]);
eva 中的代碼可以被完全btoa ,
sojson 里面的aa,oo ,jj混淆通用解決辦法
設置尾部斷點,重新定義eval 和Function 函數
eval=function(){debugger;}
Function=function(){debugger;}
斷點斷到以上兩個函數上
然后輸入 arguments 輸出混淆的原來代碼參數,和函數內容
如果失敗,發現Function 一直是navite code
給選中的產生Function 的代碼重寫function
(?Д?)['_']=function(){debugger;}
然后產生 斷點后
輸入 arguments
js fuck
1 任何字符串+任意數據類型都是字符串 如 []+“”
2 true,false 與|返回true或者false
偽造的基礎 瀏覽器和js關系
1 扣取js 刪除環境的一些代碼
2 偽造環境,偽造代碼
簡單的網站 扣js就行
復雜的網站 偽造環境可以解決
1 為什么要偽造
a 全部偽造 python jsdom (被檢測) node.js (被檢測)
b 給指定網站 偽造
如何知道網站檢測了什么
1 通過看代碼,
2 通過調試,全局異常捕獲
3 本地環境報錯
2 如何偽造 學員群 domwindow
反調試基礎
檢測是否在調試
1 鍵盤監聽 如f12
2 檢測瀏覽器內外的寬度差
3 檢測開發者工具是否是true
4 console.log 是否被調用
5 代碼的時間差
6 利用tostring()
7 檢測站的層數 caller
分類
顯示
debugger
虛擬機 eval, Function
var AA=Function.prototype.constructor;
Function.prototype.constructor=function(x)
{
if(x!="debugger")
{
return aa(x);
}
return function(){};
}//替換相同長度字符串
//過反調試
var _constructor = constructor;
Function.prototype.constructor = function(s) {
if (s == "debugger"){
console.log(s);
return null;
}
return _constructor(s);
}
非虛擬機 1 條件斷點 false 2 直接替換代碼 a 瀏覽器直接提供重寫 :1 sources -〉override -> 選擇一個文件夾,2 右鍵選擇在線一個js文件 -〉save and override (出現紫色帳號) ,修改本地代碼
3 hook 掉調用函數
死循環, 無限循環, 無限digui,計時器
打開新頁面,寫你的歷史url
for(;;)
while(true)
隱性
引導錯誤邏輯
提交數據看是否正常,不行察看瀏覽器堆棧
http://www.sc.10086.cn/service/login.html
1 手工調試堆棧,hook 調用的debuger 的函數
2 var AA=Function.prototype.constructor;
Function.prototype.constructor=function(x)
{
if(x!="debugger")
{
return aa(x);
}
return function(){};
}
群內阿布插件
文件格式
xml ,json,文本
自定義格式
字節碼 protobuf(游戲),tlv(通用)
套接字 tcp/dup (粘包)
websocket 筆記
http://kedou.workerman.net/
刷新頁面 ,netwoke 篩選ws ,在消息里面可以看到服務器和客戶端時刻發送消息
綠色表示服務器向客戶端發送的消息
紅色表示客戶端向服務端發送的消息
請求 URL: ws://kedou.workerman.net:8280/
請求頭
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Key: APuglZ0zwwd0eaCNvWuGYw== (隨便寫,只是個標示符)
Sec-WebSocket-Version: 13
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: LJOoa1Jh/kqbx1mEeVM6SuWFlPk= (服務器隨生成)
Sec-WebSocket-Version: 13
Upgrade: websocket
webSocket = new WebSocket( model.settings.socketServer );
webSocket.onopen = app.onSocketOpen;
webSocket.onclose = app.onSocketClose;
webSocket.onmessage = app.onSocketMessage;
webSocketService = new WebSocketService(model, webSocket);
webSocke 不是v8引擎自帶的,本身是個關鍵詞
var socket =new webSocket(url,[protocol]);
webSocket 事件
socket.readystate
socket.onopen
socket.onmessage
socket.send
下斷點 關鍵詞 onopen,
https://www.huya.com/11633312
websocket hook 實踐
1 搜索下斷,搜很多
2 找到websocket( ,hooksend 方法
假設 p 是socket 對象
p.send_=p.send;
p.send=function(x)
{ debugger;
return p.send_(x);
}
js hook
連接服務器 拿回資源 渲染(解析) 資源 (js執行流程)
初始化(自執行) 頁面邏輯 等待用戶輸入 加密數據 提交數據
在上面流程任意環節 拆入自己代碼 讓瀏覽器縣執行自己的代碼
然后再執行自己代碼
作用域-〉變量產生的位置
上下文= 環境變量 (js v8虛擬機) (瀏覽器 新頁面)
this 指向問題
全局作用域 this=window
方法作用域 this=調用者
類作用域 this=自己
hook=改變原方法或者原來的執行流程
覆蓋原方法
es6 語法 object.defineProperty
給對象重新定義屬性
監聽屬性的設置值 和獲取值
proxy
給對象整體監聽
屬性初始化
設置值和獲取值
構造函數
hook ajax
XMLHttpRequest.prototype.send=function(){debugger}
debuer 中斷后,看堆棧 找出發包前數據
hook 時機
hook 只影響hook 完成后的操作
如果想網頁初始化進行hook
油猴 或者fideer fiider 會在 httpreponse 最前面插入 js
如果遇到抓包遇到察看不了js, 開啟fideer代理 會幫忙緩存 然后再開始斷點跟蹤
案例 https://bqcm0.cavip1.com/
定義方法三種方式 function functionname , var functionname ,functionname:
vscode 配置 無環境瀏覽器調試
安裝 node inspecet, 配置 launch.json,
開啟瀏覽器 實驗入口
瀏覽器內存漫游解決方案 (根據參數結果,找跟蹤位置)
ast-hook-for-js-RE
1 node 版本必須在14.0 以上、
2 安轉項目依賴 cd 到項目目錄 npm install
3 啟動服務 anyproxy ca //啟動代理服務 8001 代理端口,8002 開啟的管理工具的端口
4 瀏覽器輸入 127.0.0.1:8002 //進入代理管理工具
5 下載證書 安裝證書
6 cd 到 proxy-server 運行 node proxy-server.js (運行后最小化窗口不要動)
7打開網站 ,開啟proxy-server 代理地址(10086), f12抓包 ,找到參數結果 ,在控制臺輸入hook.search("xxx")
ast 插件 babel https://github.com/jamiebuilds/babel-handbook/blob/master/translations/zh-Hans/README.md
npm install --save '@babel/core'
自主練習
hook hookdebuger
Function.prototype.constructor_=Function.prototype.constructor;
Function.prototype.constructor=function(x)
{
debugger;
return Function.prototype.constructor_(x);
}
window.setInterval_=setInterval;
setInterval=function(x,x2)
{
if(x2!=0x7d0) //0x7d0 實際代碼為準
{
return window.setInterval_(x,x2);
}
}
//注意,就算hook了,setinterval還是會一直執行,這時候在 setinterval 設置斷點,刷新網頁,然后2個hook 一起輸入console (或者fidder 用hook插件,輸入js,掛代理,開啟)
wroker 多線程
https://developer.mozilla.org/zh-CN/docs/Web/API/Worker
http://www.ruanyifeng.com/blog/2018/07/web-worker.html
不可混淆關鍵詞 worker, onmessage ,postmessage, self
1 主線程不能直接調用自線程方法,只能發消息
2 主線程調試看不到子線程,子線程調試可以調試主線程
main.js
console.log("主線程啟動");
var worker = new Worker('worker.js');
worker.postMessage('Hello World');
worker.onmessage=function(event)
{
console.log("revied mesage"+event.data);
}
worker.js
console.log(self);
self.addEventListener('message', function (e) {
console.log(e.data+"1");
self.postMessage(e.data+"1");
}, false);
//Y29uc29sZS5sb2coc2VsZik7IA0Kc2VsZi5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgZnVuY3Rpb24gKGUpIHsNCiAgICBjb25zb2xlLmxvZyhlLmRhdGErIjEiKTsNCglzZWxmLnBvc3RNZXNzYWdlKGUuZGF0YSsiMSIpOw0KfSwgZmFsc2UpOw0K
調試 worker 偽造環境,把多線程改成單線程
var CryptoJS=CryptoJS||(function (Math, undefined) {
var C = {};
var C_lib = C.lib = {};
var Base = C_lib.Base = (function () {
function F() {};
return {
extend: function (overrides) {
F.prototype = this;
var subtype = new F();
if (overrides) {
subtype.mixIn(overrides);
}
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
subtype.init = function () {
subtype.$super.init.apply(this, arguments);
};
}
subtype.init.prototype = subtype;
subtype.$super = this;
return subtype;
}, create: function () {
var instance = this.extend();
instance.init.apply(instance, arguments);
return instance;
}, init: function () {}, mixIn: function (properties) {
for (var propertyName in properties) {
if (properties.hasOwnProperty(propertyName)) {
this[propertyName] = properties[propertyName];
}
}
if (properties.hasOwnProperty('toString')) {
this.toString = properties.toString;
}
}, clone: function () {
return this.init.prototype.extend(this);
}
};
}());
var WordArray = C_lib.WordArray = Base.extend({
init: function (words, sigBytes) {
words = this.words = words || [];
if (sigBytes != undefined) {
this.sigBytes = sigBytes;
} else {
this.sigBytes = words.length * 4;
}
}, toString: function (encoder) {
return (encoder || Hex).stringify(this);
}, concat: function (wordArray) {
var thisWords = this.words;
var thatWords = wordArray.words;
var thisSigBytes = this.sigBytes;
var thatSigBytes = wordArray.sigBytes;
this.clamp();
if (thisSigBytes % 4) {
for (var i = 0; i < thatSigBytes; i++) {
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
}
} else if (thatWords.length > 0xffff) {
for (var i = 0; i < thatSigBytes; i += 4) {
thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
}
} else {
thisWords.push.apply(thisWords, thatWords);
}
this.sigBytes += thatSigBytes;
return this;
}, clamp: function () {
var words = this.words;
var sigBytes = this.sigBytes;
words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
words.length = Math.ceil(sigBytes / 4);
}, clone: function () {
var clone = Base.clone.call(this);
clone.words = this.words.slice(0);
return clone;
}, random: function (nBytes) {
var words = [];
var r = (function (m_w) {
var m_w = m_w;
var m_z = 0x3ade68b1;
var mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
var result = ((m_z << 0x10) + m_w) & mask;
result /= 0x100000000;
result += 0.5;
return result * (Math.random() > .5 ? 1 : -1);
}
});
for (var i = 0, rcache; i < nBytes; i += 4) {
var _r = r((rcache || Math.random()) * 0x100000000);
rcache = _r() * 0x3ade67b7;
words.push((_r() * 0x100000000) | 0);
}
return new WordArray.init(words, nBytes);
}
});
var C_enc = C.enc = {};
var Hex = C_enc.Hex = {
stringify: function (wordArray) {
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var hexChars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
hexChars.push((bite >>> 4).toString(16));
hexChars.push((bite & 0x0f).toString(16));
}
return hexChars.join('');
}, parse: function (hexStr) {
var hexStrLength = hexStr.length;
var words = [];
for (var i = 0; i < hexStrLength; i += 2) {
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
}
return new WordArray.init(words, hexStrLength / 2);
}
};
var Latin1 = C_enc.Latin1 = {
stringify: function (wordArray) {
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var latin1Chars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
latin1Chars.push(String.fromCharCode(bite));
}
return latin1Chars.join('');
}, parse: function (latin1Str) {
var latin1StrLength = latin1Str.length;
var words = [];
for (var i = 0; i < latin1StrLength; i++) {
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
}
return new WordArray.init(words, latin1StrLength);
}
};
var Utf8 = C_enc.Utf8 = {
stringify: function (wordArray) {
try {
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
} catch (e) {
throw new Error('Malformed UTF-8 data');
}
}, parse: function (utf8Str) {
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
}
};
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
reset: function () {
this._data = new WordArray.init();
this._nDataBytes = 0;
}, _append: function (data) {
if (typeof data == 'string') {
data = Utf8.parse(data);
}
this._data.concat(data);
this._nDataBytes += data.sigBytes;
}, _process: function (doFlush) {
var data = this._data;
var dataWords = data.words;
var dataSigBytes = data.sigBytes;
var blockSize = this.blockSize;
var blockSizeBytes = blockSize * 4;
var nBlocksReady = dataSigBytes / blockSizeBytes;
if (doFlush) {
nBlocksReady = Math.ceil(nBlocksReady);
} else {
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
}
var nWordsReady = nBlocksReady * blockSize;
var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
if (nWordsReady) {
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
this._doProcessBlock(dataWords, offset);
}
var processedWords = dataWords.splice(0, nWordsReady);
data.sigBytes -= nBytesReady;
}
return new WordArray.init(processedWords, nBytesReady);
}, clone: function () {
var clone = Base.clone.call(this);
clone._data = this._data.clone();
return clone;
}, _minBufferSize: 0
});
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
cfg: Base.extend(),
init: function (cfg) {
this.cfg = this.cfg.extend(cfg);
this.reset();
}, reset: function () {
BufferedBlockAlgorithm.reset.call(this);
this._doReset();
}, update: function (messageUpdate) {
this._append(messageUpdate);
this._process();
return this;
}, finalize: function (messageUpdate) {
if (messageUpdate) {
this._append(messageUpdate);
}
var hash = this._doFinalize();
return hash;
}, blockSize: 512 / 32,
_createHelper: function (hasher) {
return function (message, cfg) {
return new hasher.init(cfg).finalize(message);
};
}, _createHmacHelper: function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
}
});
var C_algo = C.algo = {};
return C;
}(Math));
(function (Math) {
var C = CryptoJS;
var C_lib = C.lib;
var WordArray = C_lib.WordArray;
var Hasher = C_lib.Hasher;
var C_algo = C.algo;
var T = [];
(function () {
for (var i = 0; i < 64; i++) {
T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
}
}());
var MD5 = C_algo.MD5 = Hasher.extend({
_doReset: function () {
this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
}, _doProcessBlock: function (M, offset) {
for (var i = 0; i < 16; i++) {
var offset_i = offset + i;
var M_offset_i = M[offset_i];
M[offset_i] = ((((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00));
}
var H = this._hash.words;
var M_offset_0 = M[offset + 0];
var M_offset_1 = M[offset + 1];
var M_offset_2 = M[offset + 2];
var M_offset_3 = M[offset + 3];
var M_offset_4 = M[offset + 4];
var M_offset_5 = M[offset + 5];
var M_offset_6 = M[offset + 6];
var M_offset_7 = M[offset + 7];
var M_offset_8 = M[offset + 8];
var M_offset_9 = M[offset + 9];
var M_offset_10 = M[offset + 10];
var M_offset_11 = M[offset + 11];
var M_offset_12 = M[offset + 12];
var M_offset_13 = M[offset + 13];
var M_offset_14 = M[offset + 14];
var M_offset_15 = M[offset + 15];
var a = H[0];
var b = H[1];
var c = H[2];
var d = H[3];
a = FF(a, b, c, d, M_offset_0, 7, T[0]);
d = FF(d, a, b, c, M_offset_1, 12, T[1]);
c = FF(c, d, a, b, M_offset_2, 17, T[2]);
b = FF(b, c, d, a, M_offset_3, 22, T[3]);
a = FF(a, b, c, d, M_offset_4, 7, T[4]);
d = FF(d, a, b, c, M_offset_5, 12, T[5]);
c = FF(c, d, a, b, M_offset_6, 17, T[6]);
b = FF(b, c, d, a, M_offset_7, 22, T[7]);
a = FF(a, b, c, d, M_offset_8, 7, T[8]);
d = FF(d, a, b, c, M_offset_9, 12, T[9]);
c = FF(c, d, a, b, M_offset_10, 17, T[10]);
b = FF(b, c, d, a, M_offset_11, 22, T[11]);
a = FF(a, b, c, d, M_offset_12, 7, T[12]);
d = FF(d, a, b, c, M_offset_13, 12, T[13]);
c = FF(c, d, a, b, M_offset_14, 17, T[14]);
b = FF(b, c, d, a, M_offset_15, 22, T[15]);
a = GG(a, b, c, d, M_offset_1, 5, T[16]);
d = GG(d, a, b, c, M_offset_6, 9, T[17]);
c = GG(c, d, a, b, M_offset_11, 14, T[18]);
b = GG(b, c, d, a, M_offset_0, 20, T[19]);
a = GG(a, b, c, d, M_offset_5, 5, T[20]);
d = GG(d, a, b, c, M_offset_10, 9, T[21]);
c = GG(c, d, a, b, M_offset_15, 14, T[22]);
b = GG(b, c, d, a, M_offset_4, 20, T[23]);
a = GG(a, b, c, d, M_offset_9, 5, T[24]);
d = GG(d, a, b, c, M_offset_14, 9, T[25]);
c = GG(c, d, a, b, M_offset_3, 14, T[26]);
b = GG(b, c, d, a, M_offset_8, 20, T[27]);
a = GG(a, b, c, d, M_offset_13, 5, T[28]);
d = GG(d, a, b, c, M_offset_2, 9, T[29]);
c = GG(c, d, a, b, M_offset_7, 14, T[30]);
b = GG(b, c, d, a, M_offset_12, 20, T[31]);
a = HH(a, b, c, d, M_offset_5, 4, T[32]);
d = HH(d, a, b, c, M_offset_8, 11, T[33]);
c = HH(c, d, a, b, M_offset_11, 16, T[34]);
b = HH(b, c, d, a, M_offset_14, 23, T[35]);
a = HH(a, b, c, d, M_offset_1, 4, T[36]);
d = HH(d, a, b, c, M_offset_4, 11, T[37]);
c = HH(c, d, a, b, M_offset_7, 16, T[38]);
b = HH(b, c, d, a, M_offset_10, 23, T[39]);
a = HH(a, b, c, d, M_offset_13, 4, T[40]);
d = HH(d, a, b, c, M_offset_0, 11, T[41]);
c = HH(c, d, a, b, M_offset_3, 16, T[42]);
b = HH(b, c, d, a, M_offset_6, 23, T[43]);
a = HH(a, b, c, d, M_offset_9, 4, T[44]);
d = HH(d, a, b, c, M_offset_12, 11, T[45]);
c = HH(c, d, a, b, M_offset_15, 16, T[46]);
b = HH(b, c, d, a, M_offset_2, 23, T[47]);
a = II(a, b, c, d, M_offset_0, 6, T[48]);
d = II(d, a, b, c, M_offset_7, 10, T[49]);
c = II(c, d, a, b, M_offset_14, 15, T[50]);
b = II(b, c, d, a, M_offset_5, 21, T[51]);
a = II(a, b, c, d, M_offset_12, 6, T[52]);
d = II(d, a, b, c, M_offset_3, 10, T[53]);
c = II(c, d, a, b, M_offset_10, 15, T[54]);
b = II(b, c, d, a, M_offset_1, 21, T[55]);
a = II(a, b, c, d, M_offset_8, 6, T[56]);
d = II(d, a, b, c, M_offset_15, 10, T[57]);
c = II(c, d, a, b, M_offset_6, 15, T[58]);
b = II(b, c, d, a, M_offset_13, 21, T[59]);
a = II(a, b, c, d, M_offset_4, 6, T[60]);
d = II(d, a, b, c, M_offset_11, 10, T[61]);
c = II(c, d, a, b, M_offset_2, 15, T[62]);
b = II(b, c, d, a, M_offset_9, 21, T[63]);
H[0] = (H[0] + a) | 0;
H[1] = (H[1] + b) | 0;
H[2] = (H[2] + c) | 0;
H[3] = (H[3] + d) | 0;
}, _doFinalize: function () {
var data = this._data;
var dataWords = data.words;
var nBitsTotal = this._nDataBytes * 8;
var nBitsLeft = data.sigBytes * 8;
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
var nBitsTotalL = nBitsTotal;
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ((((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00));
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ((((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00));
data.sigBytes = (dataWords.length + 1) * 4;
this._process();
var hash = this._hash;
var H = hash.words;
for (var i = 0; i < 4; i++) {
var H_i = H[i];
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
}
return hash;
}, clone: function () {
var clone = Hasher.clone.call(this);
clone._hash = this._hash.clone();
return clone;
}
});
function FF(a, b, c, d, x, s, t) {
var n = a + ((b & c) | (~b & d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function GG(a, b, c, d, x, s, t) {
var n = a + ((b & d) | (c & ~d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function HH(a, b, c, d, x, s, t) {
var n = a + (b ^ c ^ d) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function II(a, b, c, d, x, s, t) {
var n = a + (c ^ (b | ~d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
C.MD5 = Hasher._createHelper(MD5);
C.HmacMD5 = Hasher._createHmacHelper(MD5);
}(Math));
function MD5_Encrypt(word) {
return CryptoJS.MD5(word).toString();
//反轉:
//return CryptoJS.MD5(word).toString().split("").reverse().join("");
}
var window=this;
// 所有線程緩存
var works={}
//線程本身(子線程)
var worker_self=function(){}
worker_self.prototype.postMessage=function(x)
{
if(!typeof(this.main.onmessage)=="undefined")
{
this.main.onmessage({data:x});
}
}
worker_self.prototype.onmessageEvents=[];
worker_self.prototype.onmessage=function(x)
{
for(var i=0;i<this.onmessageEvents.length;i++)
{
this.onmessageEvents[i](x);
}
}
worker_self.prototype.main=undefined;
worker_self.prototype.addEventListener=function(_type,func_,x)
{
if(_type=="message")
{
this.onmessageEvents.push(func_);
}
}
var Worker=function(jsname,jscode){
jsname= MD5_Encrypt(jsname);
jscode=atob(jscode);
if(typeof(works[jsname])=="undefined")
{
works[jsname]=new worker_self();
this.self_=works[jsname];
works[jsname].main=this;
eval("self=window.works[\""+jsname+"\"];"+jscode);
}
}
Worker.prototype.postMessage=function(x)
{
this.self_.onmessage({data:x});
}
Worker.prototype.self_=undefined;
Worker.prototype.onmessage=undefined;
Worker.prototype.self_=undefined;
var worker = new Worker('worker.js',"Y29uc29sZS5sb2coc2VsZik7IA0Kc2VsZi5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgZnVuY3Rpb24gKGUpIHsNCiAgICBjb25zb2xlLmxvZyhlLmRhdGErIjEiKTsNCglzZWxmLnBvc3RNZXNzYWdlKGUuZGF0YSsiMSIpOw0KfSwgZmFsc2UpOw0K");
worker.onmessage=function(event)
{
debugger;
console.log("revied mesage"+event.data);
}
worker.postMessage('Hello World');
http://www.iwencai.com