-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
75 lines (70 loc) · 3.46 KB
/
index.js
File metadata and controls
75 lines (70 loc) · 3.46 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
const ExifImage = require('exif').ExifImage;
const ExifTransformer = require('exif-be-gone')
const fs = require("fs")
const prompt = require('prompt');
console.log('\x1b[32m%s\x1b[0m', `
█████▒▄████▄ ██ ▄█▀▓█████ ▒██ ██▒ ██▓ █████▒
▓██ ▒▒██▀ ▀█ ██▄█▒ ▓█ ▀ ▒▒ █ █ ▒░▓██▒▓██ ▒
▒████ ░▒▓█ ▄ ▓███▄░ ▒███ ░░ █ ░▒██▒▒████ ░
░▓█▒ ░▒▓▓▄ ▄██▒▓██ █▄ ▒▓█ ▄ ░ █ █ ▒ ░██░░▓█▒ ░
░▒█░ ▒ ▓███▀ ░▒██▒ █▄░▒████▒▒██▒ ▒██▒░██░░▒█░
▒ ░ ░ ░▒ ▒ ░▒ ▒▒ ▓▒░░ ▒░ ░▒▒ ░ ░▓ ░░▓ ▒ ░
░ ░ ▒ ░ ░▒ ▒░ ░ ░ ░░░ ░▒ ░ ▒ ░ ░
░ ░ ░ ░ ░░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░
░
made by: datwalkerv // 6O
\n`)
console.log('\x1b[32m%s\x1b[0m', '[+]' , '1. Extract exif data\n');
console.log('\x1b[32m%s\x1b[0m', '[+]' , '2. Delete exif data\n\n');
console.log('\x1b[32m%s\x1b[0m', '[x]' , '0. Exit\n');
prompt.start()
prompt.get(['option'], function (err, result) {
if (err) return console.log(err)
let option = result.option
if(option == 1){
console.log('\x1b[32m%s\x1b[0m', '[+]' , 'Ex: cat.jpg\n')
prompt.start();
prompt.get(['imagedir'], function(e, res){
if(e) return console.log(e)
let imagedir = res.imagedir
if(fs.existsSync(imagedir)){
try {
new ExifImage({ image : imagedir }, function (error, exifData) {
if (error){
console.log('\x1b[31m%s\x1b[0m', '[x]' , 'Error: \n'+error.message)
} else {
console.log('\n\n')
console.log('\x1b[32m%s\x1b[0m', '[+]' , 'Extracted exif datas:\n\n');
console.log(exifData);
}
});
} catch (error) {
console.log('\x1b[31m%s\x1b[0m', '[x]' , 'Error: \n'+error.message)
}
}
})
} else if (option == 2){
console.log('\x1b[32m%s\x1b[0m', '[+]' , 'Ex: cat.jpg');
prompt.start()
prompt.get(['imginput'], function (e, res) {
let imginput = res.imginput
let imgoutput = `output.jpg`;
if(fs.existsSync(imginput)){
try {
const reader = fs.createReadStream(imginput)
const writer = fs.createWriteStream(imgoutput)
reader.pipe(new ExifTransformer()).pipe(writer)
console.log('\x1b[32m%s\x1b[0m', '[+]' , `Image created at: ${imgoutput}`)
} catch (error) {
console.log('\x1b[31m%s\x1b[0m', '[x]' , 'Error: \n'+error)
}
}
});
} else if (option == 0){
process.exit(0)
} else {
console.log('\x1b[31m%s\x1b[0m', '[x]' , 'Choose one of the options above!\n')
return
}
})