Skip to content

Commit

Permalink
update 更新代码,移除seo
Browse files Browse the repository at this point in the history
  • Loading branch information
expzhizhuo committed Dec 27, 2023
1 parent ac24862 commit 1e7dcec
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 143 deletions.
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
Expand Down
14 changes: 9 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fofa-search",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"scripts": {
"serve": "vue-cli-service build --watch",
Expand Down
33 changes: 14 additions & 19 deletions src/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@
* @Last Modified by: zhizhuo
* @Last Modified time: 2023-02-02 13:45:25
*/
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
/* eslint-disable */

console.log("background page is ok")

URLDATA = null,
COOKIESDATA = null,
let URLDATA = null;
let COOKIESDATA = null;

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
console.log(request);
switch (request.cmd) {
case 'inject':
geturl()
get_url()
break;
case 'popup':
switch (request.click) {
case 'geturl':
sendResponse(URLDATA);
break;
case 'getcookies':
getcookies(URLDATA)
get_cookies(URLDATA)
sendResponse(COOKIESDATA);
break;
case 'do':
Expand All @@ -51,19 +48,18 @@ COOKIESDATA = null,
sendResponse('OK');
});

function geturl() {
let data = chrome.tabs.query({ active: true, lastFocusedWindow: true }, (tabs) => {
let url = tabs[0].url;
URLDATA = url
console.log('url--', url);
return url
}
function get_url() {
return chrome.tabs.query({active: true, lastFocusedWindow: true}, (tabs) => {
let url = tabs[0].url;
URLDATA = url
console.log('url--', url);
return url
}
);
return data;
}

function getcookies(url) {
let data = chrome.cookies.getAll({ url }, function (cookies) {
function get_cookies(url) {
return chrome.cookies.getAll({url}, function (cookies) {
const resList = cookies.map(item => {
return `${item.name}=${item.value}`
})
Expand All @@ -72,5 +68,4 @@ function getcookies(url) {
COOKIESDATA = cookieStr
return cookieStr;
});
return data;
}
2 changes: 1 addition & 1 deletion src/plugins/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"message": "This is a chrome browser plug-in based on fofa to make it easy for users to quickly find information about the site."
},
"MainDesc": {
"message": "{'title':'Basic information','description':{'country':'Country/Region','city':'City','organization':'Org','lastime':'Last update time'},'seotitle':'SEO Information','seodescription':{'baidu':' Baidu','pc360':'360','sougou':'Sougou','shenma':'Shenma'},'portitle':'Open Port','portdescription':{'recommendtitle':'FOFA Query','prompt':'Loading','prompterror':'N/A'},'MainError':{'buttonerror':'Do not click this plugin in the Plugin Center!','geturlerror':'Failed to obtain url, please refresh Tab'}}"
"message": "{'author': 'Author', 'team': 'Team', 'title': 'Basic information', 'description': {'country': 'Country/Region', 'city': 'City', 'organization': 'Org', 'lastime': 'Last update time'}, 'seotitle': 'SEO Information', 'portitle': 'Open Port', 'portdescription': {'recommendtitle': 'FOFA Query', 'prompt': 'Loading', 'prompterror': 'N/A'}, 'MainError': {'buttonerror': 'Do not click this plugin in the Plugin Center!', 'geturlerror': 'Failed to obtain url, please refresh Tab'}}"
}
}
2 changes: 1 addition & 1 deletion src/plugins/_locales/zh/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"message": "这是一个基于fofa的chrome浏览器插件,方便用户快速查找网站信息。"
},
"MainDesc": {
"message": "{'title':'组件信息','description':{'country':'国家','city':'城市','organization':'组织','lastime':'最后更新时间'},'seotitle':'站点权重信息','seodescription':{'baidu':'百度','pc360':'360','sougou':'搜狗','shenma':'神马'},'portitle':'端口信息','portdescription':{'recommendtitle':'FOFA推荐语句','prompt':'正在生成请稍等...','prompterror':'无法获取该站点信息'},'MainError':{'buttonerror':'请不要在插件中心点击此插件!','geturlerror':'获取url失败,请刷新Tab'}}"
"message": "{'author': '作者', 'team': '团队', 'title': '组件信息', 'description': {'country': '国家', 'city': '城市', 'organization': '组织', 'lastime': '最后更新时间'}, 'seotitle': '站点权重信息', 'seodescription': {'baidu': '百度', 'pc360': '360', 'sougou': '搜狗', 'shenma': '神马'}, 'portitle': '端口信息', 'portdescription': {'recommendtitle': 'FOFA推荐语句', 'prompt': '正在生成请稍等...', 'prompterror': '无法获取该站点信息'}, 'MainError': {'buttonerror': '请不要在插件中心点击此插件!', 'geturlerror': '获取url失败,请刷新Tab'}}"
}
}
137 changes: 22 additions & 115 deletions src/popup/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<div class="main">
<a-spin tip="Loading..." :delay="1" :spinning="MainLoading">
<br />
<div class="top">
<span>{{MainDesc.author}}:zhizhuo</span>
<span style="margin-left: 10px">{{MainDesc.team}}:WgpSec</span>
</div>
<div class="fofa-group">
<div>
<a-divider style="font-size: 18px">{{ MainDesc.title }}</a-divider>
Expand Down Expand Up @@ -63,87 +67,6 @@
</a-spin>
</div>
</div>
<a-divider style="font-size: 18px">{{ MainDesc.seotitle }}</a-divider>
<div>
<div v-if="seodata" style="text-align: center">
<span
>{{ MainDesc.seodescription.baidu }}:
<a-tag color="green" style="font-size: 14px">
<div v-if="seodata.baidu">
{{ seodata.baidu }}
</div>
<div v-else>-</div>
</a-tag>
</span>
<span
>{{ MainDesc.seodescription.pc360 }}:<a-tag
color="green"
style="font-size: 14px"
>
<div v-if="seodata.s360">
{{ seodata.s360 }}
</div>
<div v-else>-</div>
</a-tag></span
>
<span
>{{ MainDesc.seodescription.sougou }}:<a-tag
color="green"
style="font-size: 14px"
>
<div v-if="seodata.sougou">
{{ seodata.sougou }}
</div>
<div v-else>-</div>
</a-tag></span
>
<span
>{{ MainDesc.seodescription.shenma }}:<a-tag
color="green"
style="font-size: 14px"
>
<div v-if="seodata.shenma">
{{ seodata.shenma }}
</div>
<div v-else>-</div>
</a-tag></span
>
</div>
<div v-else>
<span
>{{ MainDesc.seodescription.baidu }}:<a-tag
color="green"
style="font-size: 14px"
>
-
</a-tag></span
>
<span
>{{ MainDesc.seodescription.pc360 }}:<a-tag
color="green"
style="font-size: 14px"
>
-
</a-tag></span
>
<span
>{{ MainDesc.seodescription.sougou }}:<a-tag
color="green"
style="font-size: 14px"
>
-
</a-tag></span
>
<span
>{{ MainDesc.seodescription.shenma }}:<a-tag
color="green"
style="font-size: 14px"
>
-
</a-tag></span
>
</div>
</div>
<a-divider style="font-size: 18px">{{ MainDesc.portitle }}</a-divider>
<div v-if="Ip || Domain">
<div>
Expand All @@ -164,7 +87,7 @@
</a-button>
</div>
</div>
<div v-else-if="Ip == 0 && Domain == 0">
<div v-else-if="Ip === 0 && Domain === 0">
<p>
{{ MainDesc.portdescription.recommendtitle }}:{{
MainDesc.portdescription.prompterror
Expand Down Expand Up @@ -218,7 +141,6 @@
</div>
</template>
<script>
// eslint-disable-next-line no-undef
import { ref, getCurrentInstance, onMounted, defineComponent } from "vue";
import { CopyOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue";
Expand All @@ -232,17 +154,16 @@ export default defineComponent({
const { proxy } = getCurrentInstance(); //来获取全局 globalProperties 中配置的信息
//定义变量
const urldata = ref(null);
const seodata = ref({});
const domaindata = ref("");
const dataSource = ref([]);
const Ip = ref(null);
const Domain = ref(null);
const HostData = ref({});
const HostStatus = ref("");
const tableLoading = ref("");
const HostStatus = ref();
const tableLoading = ref();
const MainLoading = ref("");
//国际化开发语言
const MainDesc = ref(null);
const MainDesc = ref({});
MainDesc.value = JSON.parse(
// eslint-disable-next-line no-undef
chrome.i18n.getMessage("MainDesc").replaceAll("'", '"')
Expand All @@ -252,21 +173,20 @@ export default defineComponent({
// eslint-disable-next-line no-undef
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (
request.click == "sendurl" &&
MainLoading.value == true &&
HostStatus.value == true &&
tableLoading.value == true
request.click === "sendurl" &&
MainLoading.value === true &&
HostStatus.value === true &&
tableLoading.value === true
) {
getHost();
geturlinfo();
getseo();
get_urlinfo();
return;
}
sendResponse("OK");
});
//获取URL
const geturl = () => {
const get_url = () => {
// eslint-disable-next-line no-undef
chrome.tabs.query({ active: true, lastFocusedWindow: true }, (tabs) => {
let url = tabs[0].url;
Expand All @@ -278,29 +198,28 @@ export default defineComponent({
url = url.substring(0, url.indexOf(":"));
}
urldata.value = url;
} else if (url.indexOf("chrome://") != -1) {
} else if (url.indexOf("chrome://") !== -1) {
MainLoading.value = false;
tableLoading.value = false;
HostStatus.value = false;
urldata.value = null;
Ip.value = 0;
Domain.value = 0;
message.error(MainDesc.value.MainError.buttonerror);
return;
} else {
MainLoading.value = false;
tableLoading.value = false;
HostStatus.value = false;
urldata.value = null;
Ip.value = 0;
Domain.value = 0;
message.error(MainDesc.value.MainError.geturlerror);
message.error(MainDesc.value.MainError.get_urlerror);
}
});
};
//获取站点信息
const geturlinfo = () => {
const get_urlinfo = () => {
try {
let search = urldata.value;
let domain = null;
Expand Down Expand Up @@ -405,21 +324,6 @@ export default defineComponent({
message.error("ERROR:" + error.message);
}
};
//获取seo信息
const getseo = () => {
try {
let url = urldata.value;
proxy.$get(`http://api.iot-wiki.cn/api/v1/seo?url=${url}`).then((res) => {
if (res.code == 200) {
seodata.value = res.data.list;
} else {
message.error("ERROR:" + res.message);
}
});
} catch (error) {
message.error("ERROR:" + error.message);
}
};
//单击复制事件
const copy = (event) => {
Expand All @@ -432,7 +336,7 @@ export default defineComponent({
tableLoading.value = true;
HostStatus.value = true;
MainLoading.value = true;
geturl();
get_url();
});
return {
Expand Down Expand Up @@ -475,7 +379,6 @@ export default defineComponent({
HostStatus,
MainLoading,
tableLoading,
seodata,
MainDesc,
//自定义函数
Expand All @@ -489,6 +392,10 @@ export default defineComponent({
width: 600px;
height: 400px;
}
.top{
margin-left: 25px;
font-size: 13px;
}
.fofa-group {
margin-left: 25px;
font-size: 15px;
Expand Down

0 comments on commit 1e7dcec

Please sign in to comment.