alldata_menu.js
20.4 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
const log = require('electron-log')
const sqlite3 = require('sqlite3').verbose();
log.info("ddfsfsfsf")
document.addEventListener("DOMContentLoaded", function(){
getInfoRows();
});
function el(selector) {
return document.getElementById(selector);
}
el('menu-info').addEventListener('click', function(){
// Get the mysql service
getInfoRows();
},false);
el('menu-calling').addEventListener('click', function(){
// Get the mysql service
getCallingRows();
},false);
el('menu-photo').addEventListener('click', function(){
// Get the mysql service
getPhotoRows();
},false);
el('menu-contact').addEventListener('click', function(){
// Get the mysql service
getContactRows();
},false);
el('menu-video').addEventListener('click', function(){
// Get the mysql service
getVideoRows();
},false);
el('menu-sms').addEventListener('click', function(){
// Get the mysql service
getSmsRows();
},false);
el('menu-audio').addEventListener('click', function(){
// Get the mysql service
getAudioRows();
},false);
el('menu-document').addEventListener('click', function(){
// Get the mysql service
getDocumentRows();
},false);
el('menu-calendar').addEventListener('click', function(){
// Get the mysql service
getCalendarRows();
},false);
el('menu-network').addEventListener('click', function(){
// Get the mysql service
getNetworkRows();
},false);
el('menu-appinfo').addEventListener('click', function(){
// Get the mysql service
getAppinfoRows();
},false);
el('menu-wifi').addEventListener('click', function(){
// Get the mysql service
getWifiRows();
},false);
el('menu-usagestats').addEventListener('click', function(){
// Get the mysql service
getAppUsageRows();
},false);
function getInfoRows(){
Promise.all([getphoneinfo(),getaccountinfo()]).then(function(value){
log.info(value);
var html = value[0] + value[1];
document.querySelector('#table > tbody').innerHTML = html;
});
}
function getCallingRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Id</th>\
<th>Type</th>\
<th>Name</th>\
<th>Number</th>\
<th>Duration</th>\
<th>Date</th>\
</tr>"
let sql = "SELECT * FROM calllog"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.id}</td>
<td>${row.type}</td>
<td>${row.name}</td>
<td>${row.number}</td>
<td>${row.duration}</td>
<td>${row.date}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getPhotoRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Title</th>\
<th>Id</th>\
<th>Date Added</th>\
<th>Display Name</th>\
<th>Mime type</th>\
<th>Path</th>\
<th>Latitude</th>\
<th>Longitude</th>\
<th>Size</th>\
</tr>"
let sql = "SELECT * FROM photo"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.title}</td>
<td>${row.id}</td>
<td>${row.date_added}</td>
<td>${row.display_name}</td>
<td>${row.mime_type}</td>
<td>${row.path}</td>
<td>${row.latitude}</td>
<td>${row.longitude}</td>
<td>${row.size}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getContactRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Number</th>\
<th>Name</th>\
<th>Photo_id</th>\
<th>Person_id</th>\
</tr>"
let sql = "SELECT * FROM contact"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.number}</td>
<td>${row.name}</td>
<td>${row.photo_id}</td>
<td>${row.person_id}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getVideoRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Title</th>\
<th>Date Added</th>\
<th>Display Name</th>\
<th>Mime type</th>\
<th>Path</th>\
<th>Latitude</th>\
<th>Longitude</th>\
<th>Album</th>\
<th>Artist</th>\
<th>Bookmark</th>\
<th>Category</th>\
<th>Description</th>\
<th>Language</th>\
<th>Resolution</th>\
<th>Tags</th>\
<th>Size</th>\
</tr>"
let sql = "SELECT * FROM video"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.title}</td>
<td>${row.date_added}</td>
<td>${row.display_name}</td>
<td>${row.mime_type}</td>
<td>${row.path}</td>
<td>${row.latitude}</td>
<td>${row.longitude}</td>
<td>${row.album}</td>
<td>${row.artist}</td>
<td>${row.bookmark}</td>
<td>${row.category}</td>
<td>${row.description}</td>
<td>${row.language}</td>
<td>${row.resolution}</td>
<td>${row.tags}</td>
<td>${row.size}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getSmsRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Mid</th>\
<th>Tid</th>\
<th>Type</th>\
<th>Address</th>\
<th>Person</th>\
<th>Creator</th>\
<th>Date</th>\
<th>Body</th>\
<th>Read_c</th>\
</tr>"
let sql = "SELECT * FROM sms"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.mid}</td>
<td>${row.tid}</td>
<td>${row.type}</td>
<td>${row.address}</td>
<td>${row.person}</td>
<td>${row.creator}</td>
<td>${row.date}</td>
<td>${row.body}</td>
<td>${row.read_c}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getAudioRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Title</th>\
<th>Date Added</th>\
<th>Mime type</th>\
<th>Path</th>\
<th>Album</th>\
<th>Artist</th>\
<th>Composer</th>\
<th>Year</th>\
<th>Size</th>\
</tr>"
let sql = "SELECT * FROM audio"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.title}</td>
<td>${row.date_added}</td>
<td>${row.mime_type}</td>
<td>${row.path}</td>
<td>${row.album}</td>
<td>${row.artist}</td>
<td>${row.composer}</td>
<td>${row.year}</td>
<td>${row.size}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getDocumentRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Name</th>\
<th>Title</th>\
<th>Mime type</th>\
<th>Date Added</th>\
<th>Date Modified</th>\
<th>Path</th>\
<th>Size</th>\
</tr>"
let sql = "SELECT * FROM documentinfo"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.name}</td>
<td>${row.title}</td>
<td>${row.mime_type}</td>
<td>${row.date_added}</td>
<td>${row.date_modified}</td>
<td>${row.path}</td>
<td>${row.size}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getCalendarRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Id</th>\
<th>Title</th>\
<th>Calendar Id</th>\
<th>Event Location</th>\
<th>Description</th>\
<th>Dstart</th>\
<th>Dend</th>\
<th>Duration</th>\
<th>All day</th>\
<th>Display name</th>\
<th>Account name</th>\
<th>Owner name</th>\
<th>Rrlue</th>\
<th>Rdate</th>\
</tr>"
let sql = "SELECT * FROM calendar"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.id}</td>
<td>${row.title}</td>
<td>${row.calendar_id}</td>
<td>${row.event_location}</td>
<td>${row.description}</td>
<td>${row.dtstart}</td>
<td>${row.dtend}</td>
<td>${row.duration}</td>
<td>${row.all_day}</td>
<td>${row.display_name}</td>
<td>${row.account_name}</td>
<td>${row.owner_name}</td>
<td>${row.rrlue}</td>
<td>${row.rdate}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getNetworkRows(){
Promise.all([getandroidmetadata(),getinetAddress(),getlinkAddress(),getnetworkInfo(),getrouteInfo()]).then(function(value){
log.info(value);
var html = value[0] + value[1] + value[2] + value[3] + value[4];
document.querySelector('#table > tbody').innerHTML = html;
});
}
function getAppinfoRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>Packagename</th>\
<th>Version</th>\
<th>Name</th>\
<th>First insatll</th>\
<th>Last update</th>\
<th>Wifi Usage</th>\
<th>Cellular Usage</th>\
</tr>"
let sql = "SELECT * FROM appinfo"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.packagename}</td>
<td>${row.version}</td>
<td>${row.name}</td>
<td>${row.firstinstall}</td>
<td>${row.lastupdate}</td>
<td>${row.wifiusage}</td>
<td>${row.cellularusage}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getWifiRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>ID</th>\
<th>Ssid</th>\
<th>Bssid</th>\
<th>Wepkeys</th>\
</tr>"
let sql = "SELECT * FROM wifi"
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr>
<td>${row.id}</td>
<td>${row.ssid}</td>
<td>${row.bssid}</td>
<td>${row.wepkeys}</td>
</tr>`;
});
document.querySelector('#table > tbody').innerHTML = html;
db.close();
log.info("Query succesfully executed");
});
}
function getAppUsageRows(){
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
var html = "<tr><th>packagename</th>\
<th>firsttimestamp</th>\
<th>lasttimestamp</th>\
<th>lasttimeused</th>\
<th>totaltimeforeground</th>\
</tr>"
let sql = `select * from AppUsageDay
union
select * from AppUsageMonth
union
select * from AppUsageWeek
union
select * from AppUsageYear;`
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
const offset = new Date().getTimezoneOffset() * 60000;
rows.forEach((row) => {
html += `<tr>
<td>${row.packagename}</td>
<td>${row.firsttimestamp}</td>
<td>${row.lasttimestamp}</td>
<td>${row.lasttimeused}</td>
<td>${row.totaltimeforeground}</td>
</tr>`
});
db.close();
document.querySelector('#table > tbody').innerHTML = html;
log.info("Query succesfully executed");
});
}
var getphoneinfo = function getPhoneinfo(){
return new Promise(function(resolve, reject){
setTimeout( function(){
// var html = `<tr><th>Phone type</th><th>Software Number</th><th>Phone number</th>
// <th>Subscribe id</th><th>Adid</th><th>Call state</th>
// <th>Data state</th><th>Network type</th><th>Etwork countryis</th>
// <th>Simcountryiso</th><th>Network operator</th><th>Sim operator</th>
// <th>Network operator name</th><th>Sim operator name</th><th>Sim serial number</th>
// <th>Simstate</th><th>Is networking Roming</th>
// </tr>`;
var html = `<tr><th>Phone type</th><th>Software Number</th><th>Phone number</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
let sql = "SELECT * FROM android_metadata";
db.get(sql, [], (err, row) => {
if (err) {
throw err;
}
html += `<tr><td>${row.phonetype}</td><td>${row.softwarenumber}</td><td>${row.phonenumber}</td></tr>`
html += `<tr><th>Subscribe id</th><th>Adid</th><th>Call state</th></tr>`
html += `<tr><td>${row.subscriberid}</td><td>${row.adid}</td><td>${row.callstate}</td></tr>`
html += `<tr><th>Data state</th><th>Network type</th><th>Etwork countryis</th></tr>`
html += `<tr><td>${row.datastate}</td><td>${row.networktype}</td><td>${row.networkcountryiso}</td></tr>`
html += `<tr><th>Simcountryiso</th><th>Network operator</th><th>Sim operator</th></tr>`
html += `<tr><td>${row.simcountryiso}</td><td>${row.networkoperater}</td><td>${row.simoperator}</td></tr>`
html += `<tr><th>Network operator name</th><th>Sim operator name</th><th>Sim serial number</th></tr>`
html += `<tr><td>${row.networkoperatorname}</td><td>${row.simoperatorname}</td><td>${row.simserialnumber}</td></tr>`
html += `<tr><th>Simstate</th><th>Is networking Roming</th></tr>`
html += `<tr><td>${row.simstate}</td><td>${row.isnetworkroming}</td></tr>`
db.close();
resolve(html);
});
}, 1000)
})
}
var getaccountinfo = function getAccountinfo(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>Account name</th><th>Accounttype</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/InnerDatabase.db');
let sql = "SELECT * FROM accountinfo";
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr><td>${row.accountname}</td><td>${row.accounttype}</td></tr>`
});
db.close();
resolve(html);
});
}, 1000)
})
}
var getandroidmetadata = function getAM(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>locale</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/networkDatabase.db');
let sql = "SELECT * FROM android_metadata";
db.get(sql, [], (err, row) => {
if (err) {
throw err;
}
html += `<tr><td>${row.locale}</td></tr>`
db.close();
resolve(html);
});
}, 1000)
})
}
var getinetAddress = function getIA(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>net_id</th><th>host_address</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/networkDatabase.db');
let sql = "SELECT * FROM inetAddress";
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr><td>${row.net_id}</td><td>${row.host_address}</td></tr>`
});
db.close();
resolve(html);
});
}, 1000)
})
}
var getlinkAddress = function getLA(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>net_id</th><th>host_address</th><th>prefix_length</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/networkDatabase.db');
let sql = "SELECT * FROM linkAddress";
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr><td>${row.net_id}</td><td>${row.host_address}</td><td>${row.prefix_length}</td></tr>`
});
db.close();
resolve(html);
});
}, 1000)
})
}
var getnetworkInfo = function getNI(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>net_id</th><th>domain</th><th>interface_name</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/networkDatabase.db');
let sql = "SELECT * FROM network_info";
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr><td>${row.net_id}</td><td>${row.domain}</td><td>${row.interface_name}</td></tr>`
});
db.close();
resolve(html);
});
}, 1000)
})
}
var getrouteInfo = function getRI(){
return new Promise(function(resolve, reject){
setTimeout( function(){
var html = `<tr><th>net_id</th><th>destination</th><th>d_prefix</th><th>gateway</th><th>interface_name</th></tr>`;
const db = new sqlite3.Database('./apps/com.example.dataextraction/db/networkDatabase.db');
let sql = "SELECT * FROM routeinfo";
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
html += `<tr><td>${row.net_id}</td><td>${row.destination}</td><td>${row.d_prefix}</td><td>${row.gateway}</td><td>${row.interface_name}</td></tr>`
});
db.close();
resolve(html);
});
}, 1000)
})
}