Skip to content

Commit 4262812

Browse files
committed
update
1 parent d22f43c commit 4262812

File tree

26 files changed

+432
-157
lines changed

26 files changed

+432
-157
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ CaptfEncoder是一款可扩展跨平台网络安全工具套件,提供网络
101101
* 实用工具
102102
* 图片Exif
103103
* Hash类型识别
104+
* File Type
105+
* File Hash
104106

105107

106108
## 项目网站

extensions/ext.app.home/ascii.component.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ module.exports = {
1313
template: `
1414
<v-container fluid class="ma-3">
1515
<v-row dense>
16-
<v-textarea outlined rows="2" label="Text" v-model="text" @input="invokeText">
16+
<v-textarea outlined rows="2" label="Text" spellcheck="false" v-model="text" @input="invokeText">
1717
</v-textarea>
1818
</v-row>
1919
<v-row dense>
20-
<v-textarea outlined rows="2" label="Bin" v-model="bin" @input="invokeBin">
20+
<v-textarea outlined rows="2" label="Bin" spellcheck="false" v-model="bin" @input="invokeBin">
2121
</v-textarea>
2222
</v-row>
2323
<v-row dense>
24-
<v-textarea outlined rows="2" label="Oct" v-model="oct" @input="invokeOct">
24+
<v-textarea outlined rows="2" label="Oct" spellcheck="false" v-model="oct" @input="invokeOct">
2525
</v-textarea>
2626
</v-row>
2727
<v-row dense>
28-
<v-textarea outlined rows="2" label="Dec" v-model="dec" @input="invokeDec">
28+
<v-textarea outlined rows="2" label="Dec" spellcheck="false" v-model="dec" @input="invokeDec">
2929
</v-textarea>
3030
</v-row>
3131
<v-row dense>
32-
<v-textarea outlined rows="2" label="Hex" v-model="hex" @input="invokeHex">
32+
<v-textarea outlined rows="2" label="Hex" spellcheck="false" v-model="hex" @input="invokeHex">
3333
</v-textarea>
3434
</v-row>
3535
</v-container>

extensions/ext.app.home/hash.component.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ module.exports = {
1414
template: `
1515
<v-container fluid class="ma-3">
1616
<v-row dense>
17-
<v-textarea outlined rows="2" label="Input" v-model="input">
17+
<v-textarea outlined rows="2" label="Input" spellcheck="false" v-model="input">
1818
</v-textarea>
1919
</v-row>
2020
<v-row dense>
21-
<v-textarea outlined rows="2" label="MD5 32" :value="md5_32" readonly>
21+
<v-textarea outlined rows="2" label="MD5 32" spellcheck="false" :value="md5_32" readonly>
2222
</v-textarea>
2323
</v-row>
2424
<v-row dense>
25-
<v-textarea outlined rows="2" label="MD5 16" :value="md5_16" readonly>
25+
<v-textarea outlined rows="2" label="MD5 16" spellcheck="false" :value="md5_16" readonly>
2626
</v-textarea>
2727
</v-row>
2828
<v-row dense>
29-
<v-textarea outlined rows="2" label="SHA-1" :value="sha1" readonly>
29+
<v-textarea outlined rows="2" label="SHA-1" spellcheck="false" :value="sha1" readonly>
3030
</v-textarea>
3131
</v-row>
3232
<v-row dense>
33-
<v-textarea outlined rows="2" label="SHA-256" :value="sha256" readonly>
33+
<v-textarea outlined rows="2" label="SHA-256" spellcheck="false" :value="sha256" readonly>
3434
</v-textarea>
3535
</v-row>
3636
<v-row dense>
37-
<v-textarea outlined rows="2" label="SHA-512" :value="sha512" readonly>
37+
<v-textarea outlined rows="2" label="SHA-512" spellcheck="false" :value="sha512" readonly>
3838
</v-textarea>
3939
</v-row>
4040
</v-container>

extensions/ext.app.home/web.component.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ module.exports = {
1515
template: `
1616
<v-container fluid class="ma-3">
1717
<v-row dense>
18-
<v-textarea outlined rows="2" label="Input" v-model="input">
18+
<v-textarea outlined rows="2" label="Input" spellcheck="false" v-model="input">
1919
</v-textarea>
2020
</v-row>
2121
<v-row dense>
22-
<v-textarea outlined rows="2" label="Hex" :value="hex" readonly>
22+
<v-textarea outlined rows="2" label="Hex" spellcheck="false" :value="hex" readonly>
2323
</v-textarea>
2424
</v-row>
2525
<v-row dense>
26-
<v-textarea outlined rows="2" label="Unicode" :value="unicode" readonly>
26+
<v-textarea outlined rows="2" label="Unicode" spellcheck="false" :value="unicode" readonly>
2727
</v-textarea>
2828
</v-row>
2929
<v-row dense>
30-
<v-textarea outlined rows="2" label="Base64" :value="base64" readonly>
30+
<v-textarea outlined rows="2" label="Base64" spellcheck="false" :value="base64" readonly>
3131
</v-textarea>
3232
</v-row>
3333
<v-row dense>
34-
<v-textarea outlined rows="2" label="Html entity" :value="html" readonly>
34+
<v-textarea outlined rows="2" label="Html entity" spellcheck="false" :value="html" readonly>
3535
</v-textarea>
3636
</v-row>
3737
<v-row dense>
38-
<v-textarea outlined rows="2" label="Url" :value="url" readonly>
38+
<v-textarea outlined rows="2" label="Url" spellcheck="false" :value="url" readonly>
3939
</v-textarea>
4040
</v-row>
4141
<v-row dense>
42-
<v-textarea outlined rows="2" label="Sql" :value="sql" readonly>
42+
<v-textarea outlined rows="2" label="Sql" spellcheck="false" :value="sql" readonly>
4343
</v-textarea>
4444
</v-row>
4545
</v-container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
File hash
2+
===========
3+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
const defaultValue = require('../../ext.common/default-value');
3+
4+
const {crc32}= require("crc");
5+
6+
module.exports = async function (input, options = {}) {
7+
8+
try {
9+
let output = '';
10+
11+
if (input && input.data) {
12+
const result = crc32(Buffer.from(input.data));
13+
14+
if (result) {
15+
output = result;
16+
}
17+
}
18+
19+
return {
20+
success: true,
21+
output: output,
22+
};
23+
}
24+
catch (err) {
25+
return {
26+
success: false,
27+
output: '',
28+
message: err.message
29+
};
30+
}
31+
32+
}
33+
34+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
const defaultValue = require('../../ext.common/default-value');
3+
4+
const crypto = require("crypto");
5+
6+
module.exports = async function (input, options = {}) {
7+
8+
try {
9+
let output = '';
10+
11+
if (input && input.data) {
12+
13+
const algorithm = defaultValue(options.algorithm, 'md5');
14+
15+
const hasher = crypto.createHash(algorithm);
16+
17+
hasher.update(Buffer.from(input.data));
18+
19+
const result = hasher.digest("hex");
20+
21+
if (result) {
22+
output = result;
23+
}
24+
}
25+
26+
return {
27+
success: true,
28+
output: output,
29+
};
30+
}
31+
catch (err) {
32+
return {
33+
success: false,
34+
output: '',
35+
message: err.message
36+
};
37+
}
38+
39+
}
40+
41+
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
const options = {
2+
value: {
3+
algorithm: "md5",
4+
},
5+
schema: {
6+
fields: [{
7+
type: "select",
8+
label: "Algorithm",
9+
key: "algorithm",
10+
items: [{
11+
text: "MD5",
12+
value: "md5"
13+
}, {
14+
text: "SHA1",
15+
value: "sha1"
16+
}, {
17+
text: "SHA224",
18+
value: "sha224"
19+
}, {
20+
text: "SHA256",
21+
value: "sha256"
22+
}, {
23+
text: "SHA384",
24+
value: "sha384"
25+
}, {
26+
text: "SHA512",
27+
value: "sha512"
28+
}, {
29+
text: "CRC32",
30+
value: "crc32"
31+
},],
32+
cols: 3
33+
34+
}]
35+
36+
}
37+
}
38+
39+
40+
module.exports = {
41+
name: 'getter',
42+
data() {
43+
return {
44+
loading: false,
45+
file: '',
46+
output: '',
47+
options: options.value,
48+
schema: options.schema
49+
}
50+
},
51+
template: `
52+
<v-container fluid class="ma-2">
53+
<ext-loading absolute :show="loading"></ext-loading>
54+
<ext-form :model="options" :schema="schema">
55+
</ext-form>
56+
<v-row height="40" >
57+
<v-toolbar flat >
58+
<v-text-field type="text" :value="file" outline readonly label="File">
59+
<template v-slot:append-outer>
60+
<v-btn elevation="2" @click="openFile" text >Select...</v-btn>
61+
</template>
62+
</v-text-field>
63+
</v-toolbar>
64+
</v-row>
65+
<v-row>
66+
<v-col>
67+
<ext-editor v-model="output" readonly>
68+
</ext-editor>
69+
</v-col>
70+
</v-row>
71+
</v-container>
72+
73+
`,
74+
watch: {
75+
options: {
76+
async handler(newValue) {
77+
await this.invoke();
78+
},
79+
deep: true,
80+
},
81+
},
82+
methods: {
83+
async openFile() {
84+
this.fileData = await this.$openFile('Open file');
85+
86+
await this.invoke();
87+
},
88+
89+
async invoke() {
90+
if (this.fileData) {
91+
this.loading = true;
92+
93+
this.file = this.fileData.file;
94+
95+
let result;
96+
97+
if (this.options.algorithm === "md5"
98+
|| this.options.algorithm === "sha1"
99+
|| this.options.algorithm === "sha224"
100+
|| this.options.algorithm === "sha256"
101+
|| this.options.algorithm === "sha384"
102+
|| this.options.algorithm === "sha512") {
103+
result = await this.$extInvoke('ext.app.misc.file-hash.get', this.fileData, this.options);
104+
} else if (this.options.algorithm === "crc32") {
105+
result = await this.$extInvoke('ext.app.misc.file-crc32.get', this.fileData);
106+
}
107+
108+
if (result && result.success) {
109+
this.output = result.output;
110+
}
111+
else {
112+
this.output = '';
113+
this.$store.dispatch("showSnackbar", result.message);
114+
}
115+
116+
this.loading = false;
117+
} else {
118+
this.file = '';
119+
this.output = '';
120+
}
121+
}
122+
123+
124+
}
125+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "ext.app.misc.file-hash",
3+
"description": "File hash",
4+
"version": "1.0.0",
5+
"author": "guyoung",
6+
"url": "",
7+
"dependencies": {
8+
}
9+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
const getter = require('./getter.component');
3+
4+
module.exports = {
5+
name: 'ext.app.misc.file-type.view.component',
6+
data() {
7+
return {
8+
tab: null,
9+
}
10+
},
11+
components: {
12+
getter,
13+
},
14+
template: `
15+
<ext-tab title="File hash">
16+
<v-container fluid>
17+
<getter />
18+
</v-container>
19+
</ext-tab>
20+
`,
21+
methods: {
22+
23+
}
24+
}

0 commit comments

Comments
 (0)