mirror of
https://github.com/hexahigh/nodejs-hash-antivirus.git
synced 2025-12-11 20:05:07 +01:00
released
This commit is contained in:
parent
3466e2c98e
commit
aa5b8ed263
30
dbcreator.js
Normal file
30
dbcreator.js
Normal file
@ -0,0 +1,30 @@
|
||||
var prompt = require("prompt-sync")({ sigint: true });
|
||||
var fs = require('fs');
|
||||
var crypto = require('crypto');
|
||||
var os = require("os");
|
||||
|
||||
// Set delay to ms
|
||||
function delay(milliseconds) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, milliseconds);
|
||||
});
|
||||
}
|
||||
const filetoadd = prompt("Enter path/name of file to be added: ");
|
||||
const buff = fs.readFileSync(filetoadd);
|
||||
var outputdata0 = crypto.createHash("md5").update(buff).digest("hex");
|
||||
var outputdata = outputdata0.toString().toUpperCase();
|
||||
|
||||
var text = outputdata;
|
||||
processInput()
|
||||
|
||||
function processInput () {
|
||||
fs.open('dbcreator.txt', 'a', 666, function( e, id ) {
|
||||
fs.write( id, text + os.EOL, null, 'utf8', function(){
|
||||
fs.close(id, function(){
|
||||
console.log('Custom database is updated');
|
||||
console.log('If the file is a virus, please submit the hash here:');
|
||||
console.log('\x1b[32m%s\x1b[0m', "")
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user