Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
guyoung committed Apr 16, 2021
1 parent d22f43c commit 4262812
Show file tree
Hide file tree
Showing 26 changed files with 432 additions and 157 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ CaptfEncoder是一款可扩展跨平台网络安全工具套件,提供网络
* 实用工具
* 图片Exif
* Hash类型识别
* File Type
* File Hash


## 项目网站
Expand Down
10 changes: 5 additions & 5 deletions extensions/ext.app.home/ascii.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ module.exports = {
template: `
<v-container fluid class="ma-3">
<v-row dense>
<v-textarea outlined rows="2" label="Text" v-model="text" @input="invokeText">
<v-textarea outlined rows="2" label="Text" spellcheck="false" v-model="text" @input="invokeText">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Bin" v-model="bin" @input="invokeBin">
<v-textarea outlined rows="2" label="Bin" spellcheck="false" v-model="bin" @input="invokeBin">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Oct" v-model="oct" @input="invokeOct">
<v-textarea outlined rows="2" label="Oct" spellcheck="false" v-model="oct" @input="invokeOct">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Dec" v-model="dec" @input="invokeDec">
<v-textarea outlined rows="2" label="Dec" spellcheck="false" v-model="dec" @input="invokeDec">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Hex" v-model="hex" @input="invokeHex">
<v-textarea outlined rows="2" label="Hex" spellcheck="false" v-model="hex" @input="invokeHex">
</v-textarea>
</v-row>
</v-container>
Expand Down
12 changes: 6 additions & 6 deletions extensions/ext.app.home/hash.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ module.exports = {
template: `
<v-container fluid class="ma-3">
<v-row dense>
<v-textarea outlined rows="2" label="Input" v-model="input">
<v-textarea outlined rows="2" label="Input" spellcheck="false" v-model="input">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="MD5 32" :value="md5_32" readonly>
<v-textarea outlined rows="2" label="MD5 32" spellcheck="false" :value="md5_32" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="MD5 16" :value="md5_16" readonly>
<v-textarea outlined rows="2" label="MD5 16" spellcheck="false" :value="md5_16" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="SHA-1" :value="sha1" readonly>
<v-textarea outlined rows="2" label="SHA-1" spellcheck="false" :value="sha1" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="SHA-256" :value="sha256" readonly>
<v-textarea outlined rows="2" label="SHA-256" spellcheck="false" :value="sha256" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="SHA-512" :value="sha512" readonly>
<v-textarea outlined rows="2" label="SHA-512" spellcheck="false" :value="sha512" readonly>
</v-textarea>
</v-row>
</v-container>
Expand Down
14 changes: 7 additions & 7 deletions extensions/ext.app.home/web.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ module.exports = {
template: `
<v-container fluid class="ma-3">
<v-row dense>
<v-textarea outlined rows="2" label="Input" v-model="input">
<v-textarea outlined rows="2" label="Input" spellcheck="false" v-model="input">
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Hex" :value="hex" readonly>
<v-textarea outlined rows="2" label="Hex" spellcheck="false" :value="hex" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Unicode" :value="unicode" readonly>
<v-textarea outlined rows="2" label="Unicode" spellcheck="false" :value="unicode" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Base64" :value="base64" readonly>
<v-textarea outlined rows="2" label="Base64" spellcheck="false" :value="base64" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Html entity" :value="html" readonly>
<v-textarea outlined rows="2" label="Html entity" spellcheck="false" :value="html" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Url" :value="url" readonly>
<v-textarea outlined rows="2" label="Url" spellcheck="false" :value="url" readonly>
</v-textarea>
</v-row>
<v-row dense>
<v-textarea outlined rows="2" label="Sql" :value="sql" readonly>
<v-textarea outlined rows="2" label="Sql" spellcheck="false" :value="sql" readonly>
</v-textarea>
</v-row>
</v-container>
Expand Down
3 changes: 3 additions & 0 deletions extensions/ext.app.misc.file-hash/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
File hash
===========

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

const defaultValue = require('../../ext.common/default-value');

const {crc32}= require("crc");

module.exports = async function (input, options = {}) {

try {
let output = '';

if (input && input.data) {
const result = crc32(Buffer.from(input.data));

if (result) {
output = result;
}
}

return {
success: true,
output: output,
};
}
catch (err) {
return {
success: false,
output: '',
message: err.message
};
}

}


Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

const defaultValue = require('../../ext.common/default-value');

const crypto = require("crypto");

module.exports = async function (input, options = {}) {

try {
let output = '';

if (input && input.data) {

const algorithm = defaultValue(options.algorithm, 'md5');

const hasher = crypto.createHash(algorithm);

hasher.update(Buffer.from(input.data));

const result = hasher.digest("hex");

if (result) {
output = result;
}
}

return {
success: true,
output: output,
};
}
catch (err) {
return {
success: false,
output: '',
message: err.message
};
}

}


125 changes: 125 additions & 0 deletions extensions/ext.app.misc.file-hash/getter.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
const options = {
value: {
algorithm: "md5",
},
schema: {
fields: [{
type: "select",
label: "Algorithm",
key: "algorithm",
items: [{
text: "MD5",
value: "md5"
}, {
text: "SHA1",
value: "sha1"
}, {
text: "SHA224",
value: "sha224"
}, {
text: "SHA256",
value: "sha256"
}, {
text: "SHA384",
value: "sha384"
}, {
text: "SHA512",
value: "sha512"
}, {
text: "CRC32",
value: "crc32"
},],
cols: 3

}]

}
}


module.exports = {
name: 'getter',
data() {
return {
loading: false,
file: '',
output: '',
options: options.value,
schema: options.schema
}
},
template: `
<v-container fluid class="ma-2">
<ext-loading absolute :show="loading"></ext-loading>
<ext-form :model="options" :schema="schema">
</ext-form>
<v-row height="40" >
<v-toolbar flat >
<v-text-field type="text" :value="file" outline readonly label="File">
<template v-slot:append-outer>
<v-btn elevation="2" @click="openFile" text >Select...</v-btn>
</template>
</v-text-field>
</v-toolbar>
</v-row>
<v-row>
<v-col>
<ext-editor v-model="output" readonly>
</ext-editor>
</v-col>
</v-row>
</v-container>
`,
watch: {
options: {
async handler(newValue) {
await this.invoke();
},
deep: true,
},
},
methods: {
async openFile() {
this.fileData = await this.$openFile('Open file');

await this.invoke();
},

async invoke() {
if (this.fileData) {
this.loading = true;

this.file = this.fileData.file;

let result;

if (this.options.algorithm === "md5"
|| this.options.algorithm === "sha1"
|| this.options.algorithm === "sha224"
|| this.options.algorithm === "sha256"
|| this.options.algorithm === "sha384"
|| this.options.algorithm === "sha512") {
result = await this.$extInvoke('ext.app.misc.file-hash.get', this.fileData, this.options);
} else if (this.options.algorithm === "crc32") {
result = await this.$extInvoke('ext.app.misc.file-crc32.get', this.fileData);
}

if (result && result.success) {
this.output = result.output;
}
else {
this.output = '';
this.$store.dispatch("showSnackbar", result.message);
}

this.loading = false;
} else {
this.file = '';
this.output = '';
}
}


}
}
9 changes: 9 additions & 0 deletions extensions/ext.app.misc.file-hash/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ext.app.misc.file-hash",
"description": "File hash",
"version": "1.0.0",
"author": "guyoung",
"url": "",
"dependencies": {
}
}
24 changes: 24 additions & 0 deletions extensions/ext.app.misc.file-hash/view.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

const getter = require('./getter.component');

module.exports = {
name: 'ext.app.misc.file-type.view.component',
data() {
return {
tab: null,
}
},
components: {
getter,
},
template: `
<ext-tab title="File hash">
<v-container fluid>
<getter />
</v-container>
</ext-tab>
`,
methods: {

}
}
3 changes: 3 additions & 0 deletions extensions/ext.app.misc.file-type/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
File type
===========

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

const defaultValue = require('../../ext.common/default-value');

const fileType = require("file-type");

module.exports = async function (input, options = {}) {

try {
let output = '';

if (input && input.data) {
const result = fileType(Buffer.from(input.data));

if (result) {
output = `ext: ${result.ext}\nmime: ${result.mime}`;
}
}

return {
success: true,
output: output,
};
}
catch (err) {
return {
success: false,
output: '',
message: err.message
};
}

}


Loading

0 comments on commit 4262812

Please sign in to comment.