-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
172 lines (132 loc) · 6.52 KB
/
app.js
File metadata and controls
172 lines (132 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
const { http, express, encryptingAES, decryptingAES, encryptingDES, decryptingDES, encryptingTripleDES, decryptingTripleDES, encryptingRabbit, decryptingRabbit, encryptingMD5, encryptingSHA1, encryptingSHA256, encryptingSHA512, encryptingSHA3, encryptingRIPEMD160, encodingBase64, salting, encodingHEX, encryptingHMACMD5, encryptingHMACSHA1, encryptingHMACSHA256, encryptingHMACSHA512, readFile } = require('./requires');
const server = express();
server.use(express.json());
const hostname = '127.0.0.1';
const port = 3000;
server.get('/', () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
// Get All information File
server.get('/getAllFile', (req, res) => {
let { pathOut } = req.body;
const wordlistEncrypted = readFile({ pathOut });
return res.json({ wordlistEncrypted })
});
// AES
server.post('/AES/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingAES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/AES/decrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
decryptingAES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// DES
server.post('/DES/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingDES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/DES/decrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
decryptingDES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// Triple DES
server.post('/TripleDES/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingTripleDES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/TripleDES/decrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
decryptingTripleDES({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// Rabbit
server.post('/Rabbit/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingRabbit({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/Rabbit/decrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
decryptingRabbit({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// MD5
server.post('/MD5/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encryptingMD5({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// SHA1
server.post('/SHA1/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encryptingSHA1({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// SHA2
server.post('/SHA256/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encryptingSHA256({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/SHA512/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encryptingSHA512({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// SHA3
server.post('/SHA3/encrypting', (req, res) => {
const { pathIn, pathOut, outputLength } = req.body;
encryptingSHA3({ pathIn, pathOut, outputLength });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// RIPEMD160
server.post('/RIPEMD160/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encryptingRIPEMD160({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// ENCODING
server.post('/Base64/encoding', (req, res) => {
const { pathIn, pathOut } = req.body;
encodingBase64({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/HEX/encrypting', (req, res) => {
const { pathIn, pathOut } = req.body;
encodingHEX({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// Salt
server.post('/Salt/salting', (req, res) => {
const { pathIn, pathOut } = req.body;
salting({ pathIn, pathOut });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
// HMAC
server.post('/HMAC/MD5/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingHMACMD5({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/HMAC/SHA1/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingHMACSHA1({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/HMAC/SHA256/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingHMACSHA256({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.post('/HMAC/SHA512/encrypting', (req, res) => {
const { pathIn, pathOut, secretKey } = req.body;
encryptingHMACSHA512({ pathIn, pathOut, secretKey });
return res.json({ Message: 'Deu certo! Use o get para buscar as informações ou abra o arquivo.', PathFile: pathOut });
});
server.listen(port);