diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c733c..1c32ced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # 变更日志 此项目的所有显著更改将记录在此文件中。 +## [2.0.13]-2023-03-07 +感谢 osxtest 为本项目贡献代码 +感谢 冰茶、 明月清风、 不悲、 1nfosec、 潜龙在渊 等师傅对来源提示和超链接功能的建议 +感谢 独自等待、 Wild Code Developer 对登录异常的反馈 +### 添加 +- 新增了插件图标处有几种类型被匹配到的数字提示,此功能为 osxtest 开发。 +- 新增了域名白名单,通过配置常用的域名,避免目标站点登录时csrf_token失效。 +- 新增了提取到的信息来源提示和超链接,现在你可以通过“ctrl+左键”或“右键-在新标签页中打开链接”来打开该信息的来源链接。 +### 修复 +- 修复一些体验上的bug。 + ## [2.0.12]-2023-02-14 感谢 小笼包 提出bug。 ### 修复 diff --git a/background.js b/background.js index bb91b4b..6782c5c 100755 --- a/background.js +++ b/background.js @@ -827,7 +827,7 @@ function webhook(data) { data = JSON.stringify(search_data[data]); // console.log(data); chrome.storage.local.get(["webhook_setting"], function(settings){ - if(settings["webhook_setting"] == {} || settings["webhook_setting"] ==undefined){ + if(!settings || !settings["webhook_setting"] || settings["webhook_setting"] == {} || settings["webhook_setting"] ==undefined){ // console.log('获取webhook_setting失败'); return; } @@ -902,14 +902,14 @@ chrome.runtime.onMessage.addListener( search_data[request.current]['tasklist'] = []; search_data[request.current]['donetasklist'] = []; }else{ - search_data[request.current] = {'current':request.current, 'tasklist': [], 'donetasklist': []}; + search_data[request.current] = {'current':request.current, 'tasklist': [], 'donetasklist': [], 'source': {}}; } let promiseTask = []; - for (var i = request.data.length - 1; i >= 0; i--) { + request.data.map((req_url)=>{ try{ - var myRequest = new Request(request.data[i], myInit); - search_data[request.current]['tasklist'].push(0); + var myRequest = new Request(req_url, myInit); let p = fetch(myRequest,myInit).then(function(response) { + search_data[request.current]['tasklist'].push(0); // console.log(response); response.text().then(function(text) { // console.log(text); @@ -919,54 +919,62 @@ chrome.runtime.onMessage.addListener( //遍历所有数据类型 for (var i = 0; i < key.length; i++) { - //如果传入的数据没有这个类型,就看下一个 - if (tmp_data[key[i]] == null){ - continue; - } - // 把前端的处理放到这里避免重复 - if (not_sub_key.indexOf(key[i])<0){ - tmp_data[key[i]] = sub_1(tmp_data[key[i]]) - } - //如果search_data有历史数据,进行检查 - if (tmp_data['current'] in search_data){ - for (var j = 0; j < key.length; j++) { - if (search_data[tmp_data['current']][key[j]]!=null){ - tmp_data[key[i]] = jiaoji(unique(tmp_data[key[i]]),find(unique(tmp_data[key[i]]),search_data[tmp_data['current']][key[j]])) + //如果传入的数据没有这个类型,就看下一个 + if (tmp_data[key[i]] == null){ + continue; + } + // 把前端的处理放到这里避免重复 + if (not_sub_key.indexOf(key[i])<0){ + tmp_data[key[i]] = sub_1(tmp_data[key[i]]) + } + tmp_data[key[i]].map((item)=>{ + search_data[tmp_data['current']]['source'][item] = req_url + }) + //如果search_data有历史数据,进行检查 + if (tmp_data['current'] in search_data){ + for (var j = 0; j < key.length; j++) { + if (search_data[tmp_data['current']][key[j]]!=null){ + tmp_data[key[i]] = jiaoji(unique(tmp_data[key[i]]),find(unique(tmp_data[key[i]]),search_data[tmp_data['current']][key[j]])) + } + } + } + if (tmp_data['current'] in search_data && search_data[tmp_data['current']][key[i]]!=null ){ + var search_data_value = unique(add(search_data[tmp_data['current']][key[i]],tmp_data[key[i]])).sort() + if ('static' in search_data[tmp_data['current']]){ + var res = collect_static(search_data_value,search_data[tmp_data['current']]['static']) + }else{ + var res = collect_static(search_data_value,[]) + } + search_data[tmp_data['current']][key[i]] = res['arr1'] + search_data[tmp_data['current']]['static'] = res['static'] + }else{ + var search_data_value = unique(tmp_data[key[i]]).sort() + if ('static' in search_data[tmp_data['current']]){ + var res = collect_static(search_data_value,search_data[tmp_data['current']]['static']) + }else{ + var res = collect_static(search_data_value,[]) + } + search_data[tmp_data['current']]['static'] = res['static'] + search_data[tmp_data['current']][key[i]] = res['arr1'] } - } - } - if (tmp_data['current'] in search_data && search_data[tmp_data['current']][key[i]]!=null ){ - var search_data_value = unique(add(search_data[tmp_data['current']][key[i]],tmp_data[key[i]])).sort() - if ('static' in search_data[tmp_data['current']]){ - var res = collect_static(search_data_value,search_data[tmp_data['current']]['static']) - }else{ - var res = collect_static(search_data_value,[]) - } - search_data[tmp_data['current']][key[i]] = res['arr1'] - search_data[tmp_data['current']]['static'] = res['static'] - }else{ - var search_data_value = unique(tmp_data[key[i]]).sort() - if ('static' in search_data[tmp_data['current']]){ - var res = collect_static(search_data_value,search_data[tmp_data['current']]['static']) - }else{ - var res = collect_static(search_data_value,[]) - } - search_data[tmp_data['current']]['static'] = res['static'] - search_data[tmp_data['current']][key[i]] = res['arr1'] - } } search_data[request.current]['donetasklist'].push(0); tab_url[sender.tab.id] = request.current; refresh_count(); chrome.storage.local.set({["findsomething_result_"+request.current]: search_data[request.current]}, function(){}); }); - }).catch(err=>{ console.log("fetch error",err)}); + }).catch(err=>{ + console.log("fetch error",err); + search_data[request.current]['donetasklist'].push(0); + refresh_count(); + chrome.storage.local.set({["findsomething_result_"+request.current]: search_data[request.current]}, function(){}); + }); promiseTask.push(p); } catch (e){ - continue; + // console.log(e); } - } + }); chrome.storage.local.get(["fetch_timeout"], function(settings){ if(settings["fetch_timeout"] == true){ @@ -1007,16 +1015,18 @@ chrome.runtime.onMessage.addListener( }); chrome.tabs.onUpdated.addListener(function (tabId, props) { - if (props.status == "complete" && tabId == selected_id) - refresh_count(); + if (props.status == "complete" && tabId == selected_id) + refresh_count(); }); chrome.tabs.onActivated.addListener(function (activeInfo) { - selected_id = activeInfo.tabId; - refresh_count(); + selected_id = activeInfo.tabId; + refresh_count(); }); chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { - selected_id = tabs[0].id; - refresh_count(); + if(tabs && tabs[0]){ + selected_id = tabs[0].id; + refresh_count(); + } }); \ No newline at end of file diff --git a/content.js b/content.js index 4a2f96f..ee03587 100755 --- a/content.js +++ b/content.js @@ -7,38 +7,44 @@ var source = document.getElementsByTagName('html')[0].innerHTML; var hostPath; var urlPath; - var urlWhiteList = ['google.com']; + var urlWhiteList = ['.google.com','.amazon.com','portswigger.net']; var target_list = []; - for(var i = 0;i < urlWhiteList.length;i++){ - if(host.indexOf(urlWhiteList[i]) != -1){ - return false; - } - } - target_list.push(window.location.href); - var source_href = source.match(/href=['"].*?['"]/g); var source_src = source.match(/src=['"].*?['"]/g); var script_src = source.match(/