-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #896 from JamesHabben/lava-output
update conDev
- Loading branch information
Showing
6 changed files
with
166 additions
and
83 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.41 KB
...ses/data/connectedDevices/testdata.connectedDevices.conDev.belkasoft_ctf6_ios_device1.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"belkasoft_ctf6_ios_device1": { | ||
"description": "", | ||
"maker": "", | ||
"make_data": { | ||
"input_data_path": "/Users/jameshabben/Documents/phone-images/belkasoft/BelkaCTF_6_CASE240405_D201AP.tar", | ||
"os": "macOS-15.0-x86_64-i386-64bit", | ||
"timestamp": "2024-10-23T09:45:39.397150", | ||
"last_commit": { | ||
"hash": "69ac7b29473ce1c743e18b67d635970f1d54742a", | ||
"author_name": "James Habben", | ||
"author_email": "james@wmif.net", | ||
"date": "2024-10-23T09:34:15-07:00", | ||
"message": "Update connectedDevices.py" | ||
} | ||
}, | ||
"artifacts": { | ||
"conDev": { | ||
"search_patterns": [ | ||
"*/iTunes_Control/iTunes/iTunesPrefs" | ||
], | ||
"file_count": 1, | ||
"expected_output": { | ||
"headers": [], | ||
"data": [] | ||
} | ||
} | ||
}, | ||
"image_name": "belkasoft_ctf6_ios_device1" | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...s/connectedDevices/connectedDevices.conDev.belkasoft_ctf6_ios_device1.20241023174502.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"metadata": { | ||
"module_name": "connectedDevices", | ||
"artifact_name": "Connected Devices", | ||
"function_name": "conDev", | ||
"case_number": "belkasoft_ctf6_ios_device1", | ||
"number_of_columns": 4, | ||
"number_of_rows": 2, | ||
"total_data_size_bytes": 66, | ||
"input_zip_path": "admin/test/cases/data/connectedDevices/testdata.connectedDevices.conDev.belkasoft_ctf6_ios_device1.zip", | ||
"start_time": "2024-10-23T17:45:02.496483+00:00", | ||
"end_time": "2024-10-23T17:45:02.541042+00:00", | ||
"run_time_seconds": 0.00015616416931152344, | ||
"last_commit": { | ||
"hash": "69ac7b29473ce1c743e18b67d635970f1d54742a", | ||
"author_name": "James Habben", | ||
"author_email": "james@wmif.net", | ||
"date": "2024-10-23T09:34:15-07:00", | ||
"message": "Update connectedDevices.py" | ||
} | ||
}, | ||
"headers": [ | ||
"User Name", | ||
"Computer Name", | ||
"File Offset", | ||
"Source File" | ||
], | ||
"data": [ | ||
[ | ||
"user", | ||
"DESKTOP-0CBP2ID", | ||
"384", | ||
"iTunesPrefs" | ||
], | ||
[ | ||
"user", | ||
"DESKTOP-0CBP2ID", | ||
"661", | ||
"iTunesPrefs" | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
__artifacts_v2__ = { | ||
"conDev": { | ||
"name": "Connected Devices", | ||
"description": "Extracts information about connected devices from iTunes preferences", | ||
"author": "", | ||
"version": "1.0", | ||
"date": "2024-10-23", | ||
"requirements": "none", | ||
"category": "Connected Devices", | ||
"notes": "", | ||
"paths": ('*/iTunes_Control/iTunes/iTunesPrefs',), | ||
"output_types": "standard" | ||
} | ||
} | ||
|
||
from scripts.ilapfuncs import logfunc, artifact_processor | ||
import os | ||
|
||
MAGIC_BYTES = b"\x01\x01\x80\x00\x00" | ||
MAGIC_OFFSET = 92 | ||
NAME_OFFSET = 157 | ||
|
||
@artifact_processor | ||
def conDev(files_found, report_folder, seeker, wrap_text, timezone_offset): | ||
data_list = [] | ||
data_headers = ('User Name', 'Computer Name', 'File Offset', 'Source File') | ||
source_path = '' | ||
|
||
for file_found in files_found: | ||
source_path = file_found | ||
with open(file_found, "rb") as f: | ||
data = f.read() | ||
|
||
logfunc(f"Data being interpreted for FRPD is of type: {type(data)}") | ||
|
||
magic_index = data.find(MAGIC_BYTES) | ||
if magic_index == -1: | ||
logfunc("Magic bytes not found in iTunes Prefs FRPD") | ||
continue | ||
|
||
logfunc("Found magic bytes in iTunes Prefs FRPD... Finding Usernames and Desktop names now") | ||
|
||
names = [] | ||
current_name = bytearray() | ||
name_start_offset = magic_index + MAGIC_OFFSET | ||
for i, byte in enumerate(data[name_start_offset:]): | ||
if byte == 0: | ||
if current_name: | ||
names.append((current_name.decode(), name_start_offset + i - len(current_name))) | ||
current_name = bytearray() | ||
name_start_offset = name_start_offset + i + 1 | ||
else: | ||
current_name.append(byte) | ||
|
||
# Process names in pairs | ||
for i in range(0, len(names), 2): | ||
if i + 1 < len(names): | ||
user_name, user_offset = names[i] | ||
computer_name, _ = names[i+1] | ||
data_list.append(( | ||
user_name, | ||
computer_name, | ||
str(user_offset), | ||
os.path.basename(file_found) | ||
)) | ||
else: | ||
user_name, user_offset = names[i] | ||
data_list.append(( | ||
user_name, | ||
'', | ||
str(user_offset), | ||
os.path.basename(file_found) | ||
)) | ||
|
||
return data_headers, data_list, source_path |