Skip to content

Commit f399002

Browse files
committed
完成基础功能
1 parent 5acd2bb commit f399002

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1466
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
node_modules
3+
package-lock.json
4+
.DS_Store

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
11
# biu浏览器扩展
2+
3+
4+
# 如何开发
5+
6+
## Project setup
7+
```
8+
npm install
9+
```
10+
11+
### Compiles and hot-reloads for development
12+
```
13+
npm run serve
14+
```
15+
16+
### Compiles and minifies for production
17+
```
18+
npm run build
19+
```
20+
21+
### Lints and fixes files
22+
```
23+
npm run lint
24+
```

babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

chainWebpack.config.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require('path');
2+
const CopyWebpackPlugin = require('copy-webpack-plugin');
3+
const ExtensionReloader = require('webpack-extension-reloader');
4+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
5+
6+
const isDevMode = process.env.NODE_ENV === 'development'
7+
const backgroundMode = process.env.BACKGROUND_MODE;
8+
9+
const chainWebpack = config => {
10+
if (backgroundMode === 'js') {
11+
config.entry('background').add(path.resolve(__dirname, './src/background/index.js'));
12+
}
13+
config.entry('contentScripts').add(path.resolve(__dirname, './src/contentScripts/index.js'));
14+
config.output.filename('[name].js');
15+
config.plugins.delete('copy');
16+
17+
config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [[
18+
{ from: 'src/assets', to: 'assets' },
19+
{ from: 'src/manifest.json', to: 'manifest.json', flatten: true },
20+
]]);
21+
22+
if (isDevMode) {
23+
// development-mode
24+
config.plugin('ExtensionReloader').use(ExtensionReloader, [{
25+
contentScript: 'contentScripts',
26+
background: 'background',
27+
extensionPage: 'popup',
28+
options: 'options',
29+
}]);
30+
31+
config.plugin('CleanWebpackPlugin').use(CleanWebpackPlugin, [{
32+
cleanAfterEveryBuildPatterns: ['*hot-update*'],
33+
cleanStaleWebpackAssets: false,
34+
}]);
35+
}
36+
37+
config.optimization.clear();
38+
}
39+
40+
module.exports = chainWebpack;

package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "biu-browser-ext",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"core-js": "^3.6.5",
12+
"vue": "^3.0.0"
13+
},
14+
"devDependencies": {
15+
"@arco-design/web-vue": "^2.13.0",
16+
"@vue/cli-plugin-babel": "~4.5.0",
17+
"@vue/cli-plugin-eslint": "~4.5.0",
18+
"@vue/cli-service": "~4.5.0",
19+
"@vue/compiler-sfc": "^3.0.0",
20+
"axios": "^0.24.0",
21+
"babel-eslint": "^10.1.0",
22+
"cheerio": "^1.0.0-rc.10",
23+
"clean-webpack-plugin": "^3.0.0",
24+
"copy-to-clipboard": "^3.3.1",
25+
"dayjs": "^1.10.7",
26+
"eslint": "^6.7.2",
27+
"eslint-plugin-vue": "^7.0.0",
28+
"imurmurhash": "^0.1.4",
29+
"urijs": "^1.19.7",
30+
"web-storage-cache": "^1.1.1",
31+
"webpack-extension-reloader": "^1.1.4"
32+
}
33+
}

public/favicon.ico

66.1 KB
Binary file not shown.

public/index.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/api/asset.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import axios from "axios";
2+
import {getApiKey,getBaseUrl} from "@/utils/biu";
3+
4+
export const getAssetInfo = (params) => {
5+
return axios.request({
6+
url: getBaseUrl() + "/api/asset/search",
7+
params,
8+
headers: {
9+
'Biu-Api-Key': getApiKey()
10+
},
11+
method: "get"
12+
});
13+
};

src/api/dirscan.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import axios from "axios";
2+
3+
export const getHTTPResponse = (url, method = "get") => {
4+
return axios.request({
5+
url: url,
6+
method: method
7+
});
8+
};

src/api/dnslog.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import axios from "axios";
2+
import {getApiKey,getBaseUrl} from "@/utils/biu";
3+
4+
export const getRecords = (params) => {
5+
return axios.request({
6+
url: getBaseUrl() + "/api/dnslog",
7+
params,
8+
headers: {
9+
'Biu-Api-Key': getApiKey()
10+
},
11+
method: "get"
12+
});
13+
};

src/api/favicon.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import axios from "axios";
2+
import {mmh3} from "@/utils/mmh3";
3+
4+
export const getFaviconHash = (url) => {
5+
// 待开发
6+
7+
if (url) {
8+
if (url.indexOf(';base64,') > -1) {
9+
url = url.split(';base64,')[1];
10+
return mmh3(url);
11+
} else {
12+
return axios.request({
13+
url: url,
14+
responseType: 'arraybuffer',
15+
method: "get"
16+
}).then(response => {
17+
return mmh3(response.data)
18+
// let reader = new window.FileReader();
19+
// reader.readAsDataURL(response.data);
20+
// reader.onload = function () {
21+
// let imageDataUrl = reader.result;
22+
// url = imageDataUrl.split(';base64,')[1]
23+
// return mmh3(url)
24+
// }
25+
});
26+
}
27+
}
28+
29+
};

src/api/fofa.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import axios from "axios";
2+
import {getAuthorization} from "@/utils/fofa";
3+
4+
export const getHostInfo = (host) => {
5+
return axios.request({
6+
url: "https://fofa.so/hosts/" + host,
7+
method: "get"
8+
});
9+
};
10+
export const getHostComponentsInfo = (host) => {
11+
12+
return axios.request({
13+
url: "https://api.fofa.so/v1/host/" + host,
14+
headers: {'Authorization': getAuthorization()},
15+
method: "get"
16+
});
17+
};

src/api/project.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import axios from "axios";
2+
import {getApiKey,getBaseUrl} from "@/utils/biu";
3+
4+
export const getProjects = (params) => {
5+
return axios.request({
6+
url: getBaseUrl() + "/api/project",
7+
params,
8+
headers: {
9+
'Biu-Api-Key': getApiKey()
10+
},
11+
method: "get"
12+
});
13+
};
14+
export const updateProject = (data) => {
15+
return axios.request({
16+
url: getBaseUrl() + "/api/project/optimize",
17+
data,
18+
headers: {
19+
'Biu-Api-Key': getApiKey()
20+
},
21+
method: "patch"
22+
});
23+
};

src/api/snippet.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import axios from "axios";
2+
import {getApiKey,getBaseUrl} from "@/utils/biu";
3+
4+
export const addSnippet = (data) => {
5+
return axios.request({
6+
url: getBaseUrl() + "/api/snippet",
7+
data,
8+
headers: {
9+
'Biu-Api-Key': getApiKey()
10+
},
11+
method: "post"
12+
});
13+
};

src/assets/fofa.ico

1.12 KB
Binary file not shown.

src/assets/fofa.png

17 KB
Loading

src/assets/icon_128.png

733 KB
Loading

src/assets/logo.png

174 KB
Loading

src/assets/qaxhunter.svg

+25
Loading

src/assets/quake.png

12.6 KB
Loading

src/assets/shodan.png

8.76 KB
Loading

src/assets/zoomeye.png

5.65 KB
Loading

src/background/index.js

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import {getBaseUrl} from "@/utils/biu";
2+
import {addSnippet} from '@/api/snippet';
3+
4+
5+
chrome.contextMenus.create({ // eslint-disable-line
6+
title: '新增Biu笔记:%s',
7+
contexts: ['selection'],
8+
onclick: function (params) {
9+
addSnippet({
10+
"target": "",
11+
"content": "```\n" + params.selectionText + "\n```",
12+
"source": null,
13+
"tags": [],
14+
"public": false
15+
})
16+
}
17+
})
18+
chrome.contextMenus.create({ // eslint-disable-line
19+
title: 'Biu查看资产:%s',
20+
contexts: ['selection'],
21+
onclick: function (params) {
22+
chrome.tabs.create({url: getBaseUrl() + '/assets/detail/' + params.selectionText}); // eslint-disable-line
23+
}
24+
});
25+
chrome.contextMenus.create({ // eslint-disable-line
26+
title: 'Biu搜索:%s',
27+
contexts: ['selection'],
28+
onclick: function (params) {
29+
chrome.tabs.create({url: getBaseUrl() + '/assets/port?keyword=' + params.selectionText}); // eslint-disable-line
30+
}
31+
});
32+
chrome.contextMenus.create({ // eslint-disable-line
33+
title: 'Biu资产助手搜索:%s',
34+
contexts: ['selection'],
35+
onclick: function (params) {
36+
chrome.tabs.create({url: getBaseUrl() + '/vis?keywords=' + params.selectionText}); // eslint-disable-line
37+
}
38+
});
39+
chrome.contextMenus.create({ // eslint-disable-line
40+
title: 'Fofa搜索:%s',
41+
contexts: ['selection'],
42+
onclick: function (params) {
43+
chrome.tabs.create({url: 'https://fofa.so/result?q=' + params.selectionText}); // eslint-disable-line
44+
}
45+
});
46+
chrome.contextMenus.create({ // eslint-disable-line
47+
title: 'QAX Hunter搜索:%s',
48+
contexts: ['selection'],
49+
onclick: function (params) {
50+
chrome.tabs.create({url: 'https://hunter.qianxin.com/home/list?searchType=grammar&search=' + params.selectionText}); // eslint-disable-line
51+
}
52+
});
53+
chrome.contextMenus.create({ // eslint-disable-line
54+
title: 'Quake搜索:%s',
55+
contexts: ['selection'],
56+
onclick: function (params) {
57+
chrome.tabs.create({url: 'https://quake.360.cn/quake/#/searchResult?searchVal=' + params.selectionText}); // eslint-disable-line
58+
}
59+
});
60+
chrome.contextMenus.create({ // eslint-disable-line
61+
title: 'ZoomEye搜索:%s',
62+
contexts: ['selection'],
63+
onclick: function (params) {
64+
chrome.tabs.create({url: 'https://www.zoomeye.org/searchResult?q=' + params.selectionText}); // eslint-disable-line
65+
}
66+
});
67+
68+
chrome.contextMenus.create({ // eslint-disable-line
69+
title: '微步IP搜索:%s',
70+
contexts: ['selection'],
71+
onclick: function (params) {
72+
chrome.tabs.create({url: 'https://x.threatbook.cn/v5/ip/' + params.selectionText}); // eslint-disable-line
73+
}
74+
});
75+
76+
chrome.contextMenus.create({ // eslint-disable-line
77+
title: '微步域名搜索:%s',
78+
contexts: ['selection'],
79+
onclick: function (params) {
80+
chrome.tabs.create({url: 'https://x.threatbook.cn/v5/domain/' + params.selectionText}); // eslint-disable-line
81+
}
82+
});

0 commit comments

Comments
 (0)