RegisterLogin

Information

For your security
Never give out any banking or other information that is considered personal anywhere on the site.


Integration in Thunderbird



The integration has two goal:
1. Scan the email not only when received but also the past emails
2. Don't waste CPU time and IO disk to scan by outside, but scan the emails from inside the Thunderbird database
Thunderbird integration


How it works



The emails are sent by websocket to the user-mode application
note: in server evrioments without GUI the listening application is not open and so is also closed the websocket listener


See the code




browser.messageDisplay.onMessageDisplayed.addListener(openMailListener);
async function openMailListener(tab, message) {
	console.log(`Message2 open in tab ${tab.id}: ${message.subject}`);

	let attachments = await browser.messages.listAttachments(message.id);
	for (let att of attachments) {
    		let file = await browser.messages.getAttachmentFile(
        		message.id,
        		att.partName
    		);
		/**
		 * Get the Attachments
		 * and encode with base64
		 */
		var encoded = "";
		var isreturned = false;
		var reader = new FileReader();
   		reader.readAsDataURL(file);
   		reader.onload = function () {
			encoded = reader.result;
			isreturned = true;
			//console.log("ed:"+ encoded);
   		};
   		reader.onerror = function (error) {
     			console.log('Error: ', error);
			isreturned = true;
   		};
		while(!isreturned){
			console.log("waiting");
			await sleep(100);
		}
		//console.log("end:"+encoded);
		/**
		 * Check if is a virus by asking MutltiAntivirus
		 * 
		 */
		var isvirus= false;
		var isreturned = false;
		try{
			let ws = new WebSocket("ws://127.0.0.1:51001");
			ws.onopen = function(e) {
				ws.send(""+encoded+"");
			};
			ws.onmessage = function(e) {
				isreturned = true;
				//console.log( e.data);
				isvirus = e.data.includes("true");
				return isvirus;
			};
			ws.onerror = function (e) {
				console.log(e.data);
				isreturned = true;
			};
			while(!isreturned){
				console.log("waiting");
				await sleep(100);
			}
		}catch(evt){
			console.log(evt.data);
			return false;
		}
		/**
		 * Remove virus
		 * Todo: selct by preferences what action permorm
		 */
    		if(isvirus){
			await browser.messages.delete(message.id,true);
			console.log("virus removed");
		}else{
			console.log("is not a virus");
		}
	}
}

function sleep(ms) {
	return new Promise(resolve => setTimeout(resolve, ms));
}

browser.messages.onNewMailReceived.addListener(newMailListener);
async function newMailListener(folder, messages) {
	console.log(`Mail arrived `);
	for (let message of messages.messages) {
		console.log(`Arrived message ${message.id}: ${message.subject}`);

    		//let realMessage = context.extension.messageManager.get(message.id);

/*
    		let mparts = browser.messages.getFull(message.id);
    		console.log(`Arrived message ${mparts.contentType}: ${mparts.body}`);
    		for (let part of mparts.parts) {    
      			console.log(`Arrived message ${part.contentType}`);
    		}
*/

    		let attachments = await messenger.messages.listAttachments(message.id);
    		for (let attachment of attachments) {    
      			console.log(`Arrived message ${attachment.contentType.toLowerCase()}`);

      			let reader = new FileReader();
      			attachment.url = await new Promise((resolve) => {
        			reader.onload = (e) => {
          				resolve(e.target.result);
        			};
        			reader.readAsDataURL(file);
      			});

    		}

  	}
}


Submit



If you want to integrate your application with MultiAntivirus plese contact us, we will help you for the integration

Application name
eMail
Additional note

ADS
we are looking for sponsors, please contact us you may see your advertisement here








This site uses cookies.
Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is begin used.
For more detailed information on the cookies we use, please check our Privacy Policy
Necesary Cookies
Necessary cookies enable core functionality. The website cannot function properly without these cookies.
Analytical cookies help us to improve our website by collecting and reporting information on its usage.
Social Sharing Cookies
We use some social sharing plugins, to allow uou to share certain pages of our website on social mesia.
These plugins place cookies so that you can correctly view how many times a page has been readed