|
1 |
| -# Created by @KefreR (Frank Ressat) |
2 |
| - |
3 |
| -from scripts.ilapfuncs import logfunc, logdevinfo, timeline, kmlgen, tsv, is_platform_windows, open_sqlite_db_readonly |
4 |
| -from scripts.artifact_report import ArtifactHtmlReport |
5 |
| - |
6 | 1 | __artifacts_v2__ = {
|
7 |
| - "Twint": { |
8 |
| - "name": "Twint Transaction Artifacts", |
9 |
| - "description": "Extract all the data available related to transactions made with the instant payment app Twint prepaid", |
10 |
| - "author": "@KefreR", |
| 2 | + "twintTransactions": { |
| 3 | + "name": "Twint - Transactions", |
| 4 | + "description": "Extract data related to transactions made with the instant payment app Twint prepaid", |
| 5 | + "author": "@KefreR (Frank Ressat)", |
11 | 6 | "version": "0.1",
|
12 | 7 | "date": "2023-11-21",
|
13 | 8 | "requirements": "none",
|
14 |
| - "category": "Twint Prepaid", |
| 9 | + "category": "Finance", |
15 | 10 | "notes": "",
|
16 | 11 | "paths": ('*/var/mobile/Containers/Data/Application/*/Library/Application Support/Twint.sqlite*'),
|
17 |
| - "function": "get_twint" |
| 12 | + "output_types": ["standard"], |
| 13 | + "artifact_icon": "dollar-sign" |
18 | 14 | }
|
19 | 15 | }
|
20 | 16 |
|
21 | 17 |
|
22 |
| -def get_twint(files_found, report_folder, seeker, wrap_text, time_offset): |
23 |
| - for file_found in files_found: |
24 |
| - file_found = str(file_found) |
25 |
| - |
26 |
| - if file_found.endswith('Twint.sqlite'): |
27 |
| - break |
| 18 | +from scripts.ilapfuncs import artifact_processor, get_sqlite_db_records, convert_cocoa_core_data_ts_to_utc |
28 | 19 |
|
29 |
| - db = open_sqlite_db_readonly(file_found) |
30 |
| - cursor = db.cursor() |
31 |
| - |
32 |
| - cursor.execute(f''' |
| 20 | +@artifact_processor |
| 21 | +def twintTransactions(files_found, report_folder, seeker, wrap_text, time_offset): |
| 22 | + data_list = [] |
| 23 | + db_file = '' |
| 24 | + db_records = [] |
| 25 | + |
| 26 | + query = ''' |
33 | 27 | SELECT
|
34 |
| - ZTRANSACTION.Z_PK, |
35 |
| - datetime(ZTRANSACTION.ZCREATIONDATE+978307200,'UNIXEPOCH'), |
36 |
| - datetime(ZTRANSACTION.ZMODIFIEDTIMESTAMP+978307200,'UNIXEPOCH'), |
37 |
| - datetime(ZTRANSACTION.ZSECONDPHASETIMESTAMP+978307200,'UNIXEPOCH'), |
38 |
| - datetime(ZTRANSACTION.ZSTATUSPENDINGUNTILDATE+978307200,'UNIXEPOCH'), |
39 |
| - ZTRANSACTION.ZMERCHANTBRANCHNAME, |
40 |
| - ZTRANSACTION.ZMERCHANTNAME, |
41 |
| - ZTRANSACTION.ZP2PSENDERMOBILENR, |
42 |
| - ZTRANSACTION.ZP2PINITIATEMESSAGE, |
43 |
| - ZTRANSACTION.ZP2PRECIPIENTMOBILENR, |
44 |
| - ZTRANSACTION.ZP2PRECIPIENTNAME , |
45 |
| - ZTRANSACTION.ZP2PREPLYMESSAGE, |
46 |
| - ZTRANSACTION.ZAUTHORIZEDAMOUNT, |
47 |
| - ZTRANSACTION.ZPAIDAMOUNT, |
48 |
| - ZTRANSACTION.ZREQUESTEDAMOUNT, |
49 |
| - ZTRANSACTION.ZDISCOUNT, |
50 |
| - ZTRANSACTION.ZCURRENCY, |
51 |
| - ZTRANSACTION.ZCONTENTREFERENCE, |
52 |
| - ZTRANSACTION.ZORDERLINK, |
53 |
| - ZTRANSACTION.ZP2PHASPICTURE, |
54 |
| - ZTRANSACTION.ZORDERSTATEVALUE, |
55 |
| - ZTRANSACTION.ZORDERTYPEVALUE, |
56 |
| - ZTRANSACTION.ZTRANSACTIONSIDEVALUE, |
57 |
| - ZTRANSACTION.ZMERCHANTCONFIRMATION FROM ZTRANSACTION''') |
| 28 | + ZTRANSACTION.ZCREATIONDATE, |
| 29 | + ZTRANSACTION.ZMODIFIEDTIMESTAMP, |
| 30 | + ZTRANSACTION.ZSECONDPHASETIMESTAMP, |
| 31 | + ZTRANSACTION.ZSTATUSPENDINGUNTILDATE, |
| 32 | + ZTRANSACTION.ZMERCHANTBRANCHNAME, |
| 33 | + ZTRANSACTION.ZMERCHANTNAME, |
| 34 | + ZTRANSACTION.ZP2PSENDERMOBILENR, |
| 35 | + ZTRANSACTION.ZP2PINITIATEMESSAGE, |
| 36 | + ZTRANSACTION.ZP2PRECIPIENTMOBILENR, |
| 37 | + ZTRANSACTION.ZP2PRECIPIENTNAME, |
| 38 | + ZTRANSACTION.ZP2PREPLYMESSAGE, |
| 39 | + ZTRANSACTION.ZAUTHORIZEDAMOUNT, |
| 40 | + ZTRANSACTION.ZPAIDAMOUNT, |
| 41 | + ZTRANSACTION.ZREQUESTEDAMOUNT, |
| 42 | + ZTRANSACTION.ZDISCOUNT, |
| 43 | + ZTRANSACTION.ZCURRENCY, |
| 44 | + ZTRANSACTION.ZCONTENTREFERENCE, |
| 45 | + ZTRANSACTION.ZORDERLINK, |
| 46 | + ZTRANSACTION.ZP2PHASPICTURE, |
| 47 | + ZTRANSACTION.ZORDERSTATEVALUE, |
| 48 | + ZTRANSACTION.ZORDERTYPEVALUE, |
| 49 | + ZTRANSACTION.ZTRANSACTIONSIDEVALUE, |
| 50 | + ZTRANSACTION.ZMERCHANTCONFIRMATION |
| 51 | + FROM ZTRANSACTION''' |
58 | 52 |
|
59 |
| - data_list = cursor.fetchall() |
60 |
| - usagentries = len(data_list) |
| 53 | + for file_found in files_found: |
| 54 | + if file_found.endswith('Twint.sqlite'): |
| 55 | + db_file = file_found |
| 56 | + db_records = get_sqlite_db_records(db_file, query) |
| 57 | + break |
61 | 58 |
|
62 |
| - if usagentries > 0: |
63 |
| - descritpion ="Twint - Transaction" |
64 |
| - report = ArtifactHtmlReport(f'{descritpion}') |
65 |
| - report.start_artifact_report(report_folder, f'{descritpion}') |
66 |
| - report.add_script() |
67 |
| - data_headers = ( |
68 |
| - 'Index', 'Creation date', 'Sender confirmation date', 'Receiver validation date', 'Transaction expiry date', |
69 |
| - 'Merchant branch name','Merchant name', 'Sender mobile number', 'Sender message', 'Receiver mobile number', |
70 |
| - 'Receiver contact name', 'Response message', 'Amount authorized for the transaction', 'Paid amount', |
71 |
| - 'Requested amount', 'Discount', 'Currency', 'Content reference', 'Order link', 'Presence of multimedia content', |
72 |
| - 'Transaction status', 'Type of transaction', 'Direction of the transaction', 'Merchant confirmation') |
73 |
| - report.write_artifact_data_table(data_headers, data_list, file_found, html_escape=False) |
74 |
| - report.end_artifact_report() |
| 59 | + for record in db_records: |
| 60 | + creation_date = convert_cocoa_core_data_ts_to_utc(record[0]) |
| 61 | + modified_ts = convert_cocoa_core_data_ts_to_utc(record[1]) |
| 62 | + second_phase_ts = convert_cocoa_core_data_ts_to_utc(record[2]) |
| 63 | + status_pending_until_date = convert_cocoa_core_data_ts_to_utc(record[3]) |
| 64 | + data_list.append( |
| 65 | + (creation_date, modified_ts, second_phase_ts, status_pending_until_date, record[4], record[5], |
| 66 | + record[6], record[7], record[8], record[9], record[10], record[11], record[12], |
| 67 | + record[13], record[14], record[15], record[16], record[17], record[18], record[19], |
| 68 | + record[20], record[21], record[22])) |
75 | 69 |
|
76 |
| - tsvname = f'{descritpion}' |
77 |
| - tsv(report_folder, data_headers, data_list, tsvname) |
78 |
| - else: |
79 |
| - logfunc('Twint - No data available') |
| 70 | + data_headers = ( |
| 71 | + ('Creation date', 'datetime'), ('Sender confirmation date', 'datetime'), ('Receiver validation date', 'datetime'), |
| 72 | + ('Transaction expiry date', 'datetime'), 'Merchant branch name', 'Merchant name', 'Sender mobile number', |
| 73 | + 'Sender message', 'Receiver mobile number', 'Receiver contact name', 'Response message', |
| 74 | + 'Amount authorized for the transaction', 'Paid amount', 'Requested amount', 'Discount', 'Currency', |
| 75 | + 'Content reference', 'Order link', 'Presence of multimedia content', 'Transaction status', 'Type of transaction', |
| 76 | + 'Direction of the transaction', 'Merchant confirmation') |
80 | 77 |
|
81 |
| - db.close() |
| 78 | + return data_headers, data_list, db_file |
0 commit comments