broken, fixes soon

This commit is contained in:
grant-kun 2022-11-01 13:10:27 -05:00
parent b79f3023b3
commit f41da4f703
4 changed files with 65 additions and 63 deletions

View File

@ -321,7 +321,7 @@
let html = false
function reg() {
console.log(document.getElementById('email').value)
sendenc('/reg', { 'user': 'root', 'address': document.getElementById('email').value, 'host': document.getElementById('host').value, 'port': document.getElementById('port').value, 'creds': document.getElementById('auth').value }).then(() => {
sendenc('/reg', { 'user': getCookie('user'), 'address': document.getElementById('email').value, 'host': document.getElementById('host').value, 'port': document.getElementById('port').value, 'creds': document.getElementById('auth').value }).then(() => {
update()
})
}

View File

@ -84,7 +84,6 @@ var decrypt = ((encrypted:any,ENC_KEY:any) => {
let decrypted = decipher.update(encrypted, 'base64', 'utf8');
return (decrypted + decipher.final('utf8'));
} catch(err){
console.log(err)
return false;
}
});
@ -137,6 +136,7 @@ app.use((req:any, res:any, next:any) => {
next()
})
*/ // get subdomains working:(
app.post('/mail/get/update',async(req:any,res:any)=>{
const key = new NodeRSA({b: 1024})
@ -166,14 +166,15 @@ app.post('/mail/get/update',async(req:any,res:any)=>{
res.send(JSON.stringify({data:skey.encrypt(JSON.stringify({messages:'reg'}),'base64'),enc:true,html:true}))
return
}
console.log(mail.host)
/*
var client = new ImapClient(mail.host, parseInt(mail.port), {
auth: {
user: mail.address,
pass: mail.creds,
},logLevel:1000
});
client.connect().then(()=>{
}
}).connect().then(()=>{
console.log('connected')
//['uid', 'flags','envelope'] for just header stuff
//['uid', 'flags','envelope','body']
@ -218,7 +219,10 @@ app.post('/mail/get/update',async(req:any,res:any)=>{
res.send(JSON.stringify({data:skey.encrypt(JSON.stringify({messages:[],bod:bo}),'base64'),enc:true,html:true}))
client.close()
}
}).catch((err:any)=>{
console.log(err)
})
//deprecated:(*/
})
app.post('/mail/del',async(req:any,res:any)=>{
const key = new NodeRSA({b: 1024})
@ -264,8 +268,6 @@ app.post('/mail/reg',async(req:any,res:any)=>{
if(user.alias==dec.data.user){
console.log(dec.login_key)
logkey = await (decrypt(user.login_key,dec.login_key))
console.log(user.login_key)
console.log(logkey)
mail=users.indexOf(user)
user.setDataValue('mail',encrypt(JSON.stringify({'emails':[{
'address':dec.data.address,

View File

@ -22,6 +22,7 @@
"body-parser": "^1.20.0",
"express": "^4.18.1",
"fs": "^0.0.1-security",
"imap-simple": "^5.1.0",
"ip": "^1.1.8",
"md5": "^2.3.0",
"node-rsa": "^1.1.1",

111
readme.md
View File

@ -12,17 +12,16 @@ security project to ~~learn client and server encryption~~ mail & advanced reque
create generic keys `openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./certs/selfsigned.key -out ./certs/selfsigned.crt`, or insert which ever ones to `./certs/selfsigned.key` and to `./certs/selfsigned.crt` respectively
---
***
### running
dependencies:
- ts-node |`npm i -g ts-node`
- package.json | `npm i`
- development (optional)
- nodemon | `npm i -g nodemon`
* ts-node |`npm i -g ts-node`
* package.json | `npm i`
* development (optional)
* nodemon | `npm i -g nodemon`
#### windows
@ -30,7 +29,7 @@ main build : `npm start`
dev : `npm run dev`
---
***
#### \*nix
@ -40,64 +39,64 @@ main build : `sudo ts-node .`
dev : `sudo nodemon .`
---
***
[gitea](https://git.disroot.org/grantsquires/kanna-site) | [github](https://github.com/squiresgrant/kanna-site)
## todo
- [ ] add extra pages
- [ ] home page (quick links, etc)
- [ ] mail
- [ ] allow for automation (ie, auto reply)
- [ ] forums
- [ ] storage
- [ ] viewer for images
- [ ] viewer for docs
- [ ] login
- [ ] performance related
- [ ] store all listeners in array and kill
- [ ] go through all html files, clean up code
- [ ] increase initiation vector (IV) size
* \[ ] add extra pages
* \[ ] home page (quick links, etc)
* \[ ] mail
* \[ ] allow for automation (ie, auto reply)
* \[ ] forums
* \[ ] storage
* \[ ] viewer for images
* \[ ] viewer for docs
* \[ ] login
* \[ ] performance related
* \[ ] store all listeners in array and kill
* \[ ] go through all html files, clean up code
* \[ ] increase initiation vector (IV) size
## currently
- [x] learning how mail works
- [ ] toggle plaintext/html emails
- [ ] option to markdownify email
- [ ] write md emails, send as html
- [ ] sexify
- [ ] settings.json
- [ ] make mail prettier
- [ ] dont accept old login keys
- [ ] add functionality
- [x] loading screen
- [x] storage for quicker (initial)loading
- [x] delete
- [ ] send
- [ ] reply
- [ ] draft
- [ ] forward
- [ ] sender info
- [ ] allow for email account adding
- [ ] docs
- [x] extra pages
- [x] 404 page
- [ ] sub domains
- [ ] ughh hate sub domains
- [ ] make my own libs
- [ ] encryption (md5 hashing, rsa, and aes)
- [ ] add aliases that are used in cookies and randomly gen.
- [ ] also server side hash to check/verify the alias
- [ ] more sexy gradients (everywhere)
- [ ] lower verbosity (and options to change it)
- [ ] move all dependencies to local ones
- [ ] check for permissions on what ports to open
* \[x] learning how mail works
* \[ ] toggle plaintext/html emails
* \[ ] option to markdownify email
* \[ ] write md emails, send as html
* \[ ] sexify
* \[ ] settings.json
* \[ ] make mail prettier
* \[ ] dont accept old login keys
* \[ ] add functionality
* \[x] loading screen
* \[x] storage for quicker (initial)loading
* \[x] delete
* \[ ] send
* \[ ] reply
* \[ ] draft
* \[ ] forward
* \[ ] sender info
* \[ ] allow for email account adding
* \[ ] docs
* \[x] extra pages
* \[x] 404 page
* \[ ] sub domains
* \[ ] ughh hate sub domains
* \[ ] make my own libs
* \[ ] encryption (md5 hashing, rsa, and aes)
* \[ ] [imap wrapper (soonish)](https://www.nylas.com/blog/nylas-imap-therefore-i-am/)
* \[ ] add aliases that are used in cookies and randomly gen.
* \[ ] also server side hash to check/verify the alias
* \[ ] more sexy gradients (everywhere)
* \[ ] lower verbosity (and options to change it)
* \[ ] move all dependencies to local ones
* \[ ] check for permissions on what ports to open
### issues
### issues
- [x] storage not saving
- [ ] check for login key cookie on page load
* \[x] storage not saving
* \[ ] check for login key cookie on page load
FeMail (iron mail)