Skip to content

Commit

Permalink
ver:2.0.17 (#43)
Browse files Browse the repository at this point in the history
## [2.0.17]-2024-01-13
感谢 喂草。、 向上 对内存占用问题的反馈。
感谢 FREE2E! 对.jsp后缀错误分拣到静态路径区问题的反馈。
### 变更
- 因为旧版本收集到的数据会永久存在localStorage中,导致在每次存取数据时出现内存暴增的问题。本次增加了对数据的过期逻辑,7天未访问的url数据将会过期。
- 配置页新增了“清除缓存”操作,用户可手动清除缓存。
- 补充了.tw的顶级域。

### 修复
- 修复了对.jsp后缀错误分拣到静态路径区的问题。
  • Loading branch information
ResidualLaugh authored Jan 24, 2024
1 parent edcfe2a commit 61a1585
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# 变更日志
此项目的所有显著更改将记录在此文件中。
## [2.0.17]-2024-01-13
感谢 喂草。、 向上 对内存占用问题的反馈。
感谢 FREE2E! 对.jsp后缀错误分拣到静态路径区问题的反馈。
### 变更
- 因为旧版本收集到的数据会永久存在localStorage中,导致在每次存取数据时出现内存暴增的问题。本次增加了对数据的过期逻辑,7天未访问的url数据将会过期。
- 配置页新增了“清除缓存”操作,用户可手动清除缓存。
- 补充了.tw的顶级域。

### 修复
- 修复了对.jsp后缀错误分拣到静态路径区的问题。

## [2.0.16]-2023-07-09
感谢 长风 对webhook回传信息不全问题的反馈。
### 变更
Expand Down
25 changes: 22 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var js = [];
var search_data = {};
var static_file = ['.jpg','.png','.gif','.css','.svg','.ico','.js'];
var non_static_file = ['.jsp']
var key = ["ip","ip_port","domain","path","incomplete_path","url","sfz","mobile","mail","jwt","algorithm","secret"];
var not_sub_key = ["secret"];
var nuclei_regex = [
Expand Down Expand Up @@ -776,6 +777,9 @@ function collect_static(arr1,arr2) {
arr1.forEach(function (item,index,array) {
for (var i = 0; i < static_file.length; i++) {
if(item.indexOf(static_file[i])!=-1){
if(static_file[i]=='.js' && item.indexOf('.jsp')!=-1){
continue
}
arr3.splice(arr3.indexOf(item),1)
if(arr2.indexOf(item)==-1){
arr2.push(item)
Expand Down Expand Up @@ -831,10 +835,10 @@ function extract_info(data) {
extract_data['mail'] = data.match(/['"][a-zA-Z0-9\._\-]*@[a-zA-Z0-9\._\-]{1,63}\.((?!js|css|jpg|jpeg|png|ico)[a-zA-Z]{2,})['"]/g);
extract_data['ip'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/.*?)?['"]/g);
extract_data['ip_port'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}(\/.*?)?['"]/g);
extract_data['domain'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?(\/)?['"]/g);
extract_data['domain'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|tw|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?(\/)?['"]/g);
extract_data['path'] = data.match(/['"](?:\/|\.\.\/|\.\/)[^\/\>\< \)\(\{\}\,\'\"\\]([^\>\< \)\(\{\}\,\'\"\\])*?['"]/g);
extract_data['incomplete_path'] = data.match(/['"][^\/\>\< \)\(\{\}\,\'\"\\][\w\/]*?\/[\w\/]*?['"]/g);
extract_data['url'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?(\/.*?)?['"]/g);
extract_data['url'] = data.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|tw|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?(\/.*?)?['"]/g);
extract_data['jwt'] = data.match(/['"](ey[A-Za-z0-9_-]{10,}\.[A-Za-z0-9._-]{10,}|ey[A-Za-z0-9_\/+-]{10,}\.[A-Za-z0-9._\/+-]{10,})['"]/g);
// search_data['algorithm'] = data.match(/\WBase64\.encode\(|\WBase64\.decode\(|\Wbtoa\(|\Watob\(|\WCryptoJS\.AES\.|\WCryptoJS\.DES\.|\WJSEncrypt\(|\Wrsa\.|\WKJUR\.|\W$\.md5\(|\Wmd5\(|\Wsha1\(|\Wsha256\(|\Wsha512\(/gi);
extract_data['algorithm'] = data.match(/\W(Base64\.encode|Base64\.decode|btoa|atob|CryptoJS\.AES|CryptoJS\.DES|JSEncrypt|rsa|KJUR|$\.md5|md5|sha1|sha256|sha512)[\(\.]/gi);
Expand All @@ -843,7 +847,7 @@ function extract_info(data) {
extract_data['url'].map((url)=>{
extract_data['ip'] = add(extract_data['ip'], url.match(/['"](([a-zA-Z0-9]+:)?\/\/)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/g))
extract_data['ip_port'] = add(extract_data['ip_port'], url.match(/['"](([a-zA-Z0-9]+:)?\/\/)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}(\/.*?)?['"]/g))
extract_data['domain'] = add(extract_data['domain'], url.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?/g))
extract_data['domain'] = add(extract_data['domain'], url.match(/['"](([a-zA-Z0-9]+:)?\/\/)?[a-zA-Z0-9\-\.]*?\.(xin|com|cn|net|com.cn|vip|top|cc|shop|club|wang|xyz|luxe|site|news|pub|fun|online|win|red|loan|ren|mom|net.cn|org|link|biz|bid|help|tech|date|mobi|so|me|tv|co|vc|pw|video|party|pics|website|store|ltd|ink|trade|live|wiki|space|gift|lol|work|band|info|click|photo|market|tel|social|press|game|kim|org.cn|games|pro|men|love|studio|rocks|asia|group|science|design|software|engineer|lawyer|fit|beer|tw|我爱你|中国|公司|网络|在线|网址|网店|集团|中文网)(\:\d{1,5})?/g))
})
}
return extract_data;
Expand Down Expand Up @@ -915,11 +919,26 @@ function refresh_count() {
console.log(search_data[cur]['pretasknum'],search_data[cur]['donetasklist'].length,search_data[cur]['tasklist'].length)
search_data[cur]['done'] = 'done'
chrome.storage.local.set({["findsomething_result_"+cur]: search_data[cur]}, function(){});
refresh_storage_expire_index(cur)
webhook(cur);
}

}

function refresh_storage_expire_index(cur) {
console.log("refresh_storage_expire_index:"+cur)
chrome.storage.local.get(["expire_index"], function(expire_index){
expire_index = expire_index["expire_index"]
if(!expire_index){
expire_index = {}
}
const today = new Date();
const todaystr = today.toLocaleDateString('cn', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '');
expire_index[cur]=todaystr;
chrome.storage.local.set({["expire_index"]: expire_index}, function(){} )
})
}

function persist_tmp_data(tmp_data, req_url, current) {
//遍历所有数据类型
for (var i = 0; i < key.length; i++) {
Expand Down
25 changes: 25 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
// @Date : 2020-09-12 16:26:48
// @Author : residuallaugh
(function(){
chrome.storage.local.get(["expire_index"], function(expire_index){
expire_index=expire_index["expire_index"]
if(!expire_index) {
return
}
// console.log(expire_index)
const today = new Date();
const sevenDaysAgo = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000);
const sevenDaysAgostr = sevenDaysAgo.toLocaleDateString('cn', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '');
let reset = false;
Object.keys(expire_index).forEach(key => {
// console.log("正在遍历索引"+key+",日期是:"+expire_index[key])
if (expire_index[key]<sevenDaysAgostr) {
reset=true
delete expire_index[key]
// console.log("这个url已经过期了,"+key+"之前的时间是"+expire_index[key])
chrome.storage.local.remove(["findsomething_result_"+key], function() {});
}
});
if(reset){
// console.log("重新设置expire_index:")
// console.log(expire_index)
chrome.storage.local.set({["expire_index"]: expire_index}, function(){} )
}
})
var protocol = window.location.protocol;
var host = window.location.host;
var domain_host = host.split(':')[0];
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FindSomething",
"version": "2.0.16",
"version": "2.0.17",
"manifest_version": 3,
"description": "在网页的源代码或js中找到一些有趣的东西",
"permissions": [
Expand Down
1 change: 1 addition & 0 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</div>
<div style="width:100%; height: 800px; margin-left: 15px; margin-top: 16px;">
<div style="width: 300px; float: left;">
<div class="findsomething_title" style="margin-bottom:10px;"><div style="float:left; width: 230px;">清理缓存</div><a href="#"><div id="clear_localStorage" style="width: 60px; float: left;">清理</div></a></div>
<div class="findsomething_title" style="margin-bottom:10px;"><div style="float:left; width: 230px;">全局悬浮窗</div><a href="#"><div id="global_float" style="width: 60px; float: left;">打开</div></a></div>
<div class="findsomething_title" style="margin-bottom:10px;"><div style="float:left; width: 230px;">自动超时</div><a href="#"><div id="fetch_timeout" style="width: 60px; float: left;">打开</div></a></div>
<div class="findsomething_title" style="margin-bottom:10px;">Webhook</div>
Expand Down
6 changes: 6 additions & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ document.getElementById("reset_allowlist").onclick=function () {
chrome.storage.local.set({"allowlist": []});
}

document.getElementById("clear_localStorage").onclick=function () {
chrome.storage.local.clear();
console.log("清理完成");
alert("清理完成");
}

document.getElementById("global_float").onclick=function () {
// var webhook_setting = {};
chrome.storage.local.get(["global_float"], function(settings){
Expand Down

0 comments on commit 61a1585

Please sign in to comment.