-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
40 lines (32 loc) · 1015 Bytes
/
app.js
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
const express = require('express');
const smtp = require('smtp-client');
const path = require('path');
const app = express();
const port = 80;
let s = new smtp.SMTPClient({
host: "hahacking.local",
port: 25
});
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static("public"));
app.get('/', (req, res) => {
res.sendFile('index.html', { root: path.join(__dirname, '/public') });
});
app.post('/', (req, res) => {
let email = req.body.email;
let text = req.body.text;
(async function() {
await s.connect();
await s.greet({hostname: "hahacking.local"});
await s.mail({from: email});
await s.rcpt({to: "[email protected]"});
await s.data(text);
await s.quit();
})().catch(console.error);
res.sendFile('index.html', { root: path.join(__dirname, '/public') });
});
app.listen(port, (error) => {
if (!error) console.log(`[+] App listening on port ${port}`)
else console.log(`[-] Error occurred during startup`, error)
});