
Android लॉग्स इवेंट्स और Protobuf पार्सर

यदि आप योगदान करना चाहते हैं तो मुझसे यहाँ संपर्क करें: https://abrignoni.github.io
ब्लॉग पोस्ट यहाँ देखें: https://leapps.org/blog
Python 3.10 या उससे ऊपर
आपके Python वातावरण के लिए निर्भरताएँ requirements.txt में सूचीबद्ध हैं। नीचे दिए गए कमांड का उपयोग करके उन्हें इंस्टॉल करें। सुनिश्चित करें कि py भाग आपके वातावरण के लिए सही है, जैसे py, python, या python3 आदि।
py -m pip install -r requirements.txt
या
pip3 install -r requirements.txt
Linux पर चलाने के लिए, आपको tkinter को अलग से इंस्टॉल करना होगा:
sudo apt-get install python3-tk
एक्ज़ीक्यूटेबल में कंपाइल करने के लिए ताकि आप इसे Python इंस्टॉल किए बिना सिस्टम पर चला सकें।
Windows OS
aleapp.exe बनाने के लिए, चलाएँ:
pyinstaller scripts\pyinstaller\aleapp.spec
aleappGUI.exe बनाने के लिए, चलाएँ:
pyinstaller scripts\pyinstaller\aleappGUI.spec
macOS
aleapp बनाने के लिए, चलाएँ:
pyinstaller scripts/pyinstaller/aleapp_macOS.spec
aleappGUI.app बनाने के लिए, चलाएँ:
pyinstaller scripts/pyinstaller/aleappGUI_macOS.spec
Linux
aleapp बनाने के लिए, चलाएँ:
pyinstaller scripts/pyinstaller/aleapp_Linux.spec
aleappGUI बनाने के लिए, चलाएँ:
pyinstaller scripts/pyinstaller/aleappGUI_Linux.spec
$ python aleapp.py -t <zip | tar | fs | gz> -i <path_to_extraction> -o <path_for_report_output>
$ python aleappGUI.py
$ python aleapp.py --help
प्रत्येक प्लगइन एक Python सोर्स फ़ाइल है जिसे scripts/artifacts फ़ोल्डर में जोड़ा जाना चाहिए, जिसे ALEAPP चलाने पर हर बार डायनामिक रूप से लोड किया जाएगा।
प्लगइन सोर्स फ़ाइल में मॉड्यूल की शुरुआत में __artifacts_v2__ नामक एक डिक्शनरी होनी चाहिए, जो उन आर्टिफैक्ट्स को परिभाषित करती है जिन्हें प्लगइन प्रोसेस करता है। __artifacts_v2__ डिक्शनरी में कुंजियाँ आर्टिफैक्ट(s) के लिए ID होनी चाहिए जो ALEAPP के भीतर अद्वितीय हों। मान ऐसे डिक्शनरी होने चाहिए जिनमें निम्नलिखित कुंजियाँ हों:
name: आर्टिफैक्ट का नाम स्ट्रिंग के रूप में।description: आर्टिफैक्ट का विवरण स्ट्रिंग के रूप में।author: प्लगइन का लेखक स्ट्रिंग के रूप में।version: आर्टिफैक्ट का संस्करण स्ट्रिंग के रूप में।date: आर्टिफैक्ट में अंतिम अपडेट की तारीख स्ट्रिंग के रूप में।requirements: आर्टिफैक्ट को प्रोसेस करने के लिए कोई भी आवश्यकता स्ट्रिंग के रूप में।category: आर्टिफैक्ट की श्रेणी स्ट्रिंग के रूप में।notes: कोई अतिरिक्त नोट्स स्ट्रिंग के रूप में।paths: स्ट्रिंग्स का एक टपल जिसमें glob खोज पैटर्न हों जो उस डेटा के पथ से मेल खाते हों जिसकी प्लगइन आर्टिफैक्ट के लिए अपेक्षा करता है।function: उस फ़ंक्शन का नाम जो आर्टिफैक्ट की प्रोसेसिंग के लिए एंट्री पॉइंट है, स्ट्रिंग के रूप में।उदाहरण के लिए:
__artifacts_v2__ = {
"cool_artifact_1": {
"name": "Cool Artifact 1",
"description": "Extracts cool data from database files",
"author": "@username",
"version": "0.1",
"date": "2022-10-25",
"requirements": "none",
"category": "Really cool artifacts",
"notes": "",
"paths": ('*/com.android.cooldata/databases/database*.db',),
"function": "get_cool_data1"
},
"cool_artifact_2": {
"name": "Cool Artifact 2",
"description": "Extracts cool data from XML files",
"author": "@username",
"version": "0.1",
"date": "2022-10-25",
"requirements": "none",
"category": "Really cool artifacts",
"notes": "",
"paths": ('*/com.android.cooldata/files/cool.xml',),
"function": "get_cool_data2"
}
}
__artifacts__ डिक्शनरी में एंट्री पॉइंट के रूप में संदर्भित फ़ंक्शन निम्नलिखित तर्क लेने चाहिए:
उदाहरण के लिए:
def get_cool_data1(files_found, report_folder, seeker, wrap_text):
pass # do processing here
प्लगइन्स से आम तौर पर ALEAPP के HTML आउटपुट प्रारूप, TSV में आउटपुट प्रदान करने की अपेक्षा की जाती है, और वैकल्पिक रूप से टाइमलाइन में रिकॉर्ड सबमिट करने की। इस आउटपुट को उत्पन्न करने के लिए फ़ंक्शन artifact_report और ilapfuncs मॉड्यूल में पाए जा सकते हैं। उच्च स्तर पर, एक उदाहरण इस प्रकार दिख सकता है:
__artifacts_v2__ = {
"cool_artifact_1": {
"name": "Cool Artifact 1",
"description": "Extracts cool data from database files",
"author": "@username", # Replace with the actual author's username or name
"version": "0.1", # Version number
"date": "2022-10-25", # Date of the latest version
"requirements": "none",
"category": "Really cool artifacts",
"notes": "",
"paths": ('*/com.android.cooldata/databases/database*.db',),
"function": "get_cool_data1"
}
}
import datetime
from scripts.artifact_report import ArtifactHtmlReport
import scripts.ilapfuncs
def get_cool_data1(files_found, report_folder, seeker, wrap_text):
# let's pretend we actually got this data from somewhere:
rows = [
(datetime.datetime.now(), "Cool data col 1, value 1", "Cool data col 1, value 2", "Cool data col 1, value 3"),
(datetime.datetime.now(), "Cool data col 2, value 1", "Cool data col 2, value 2", "Cool data col 2, value 3"),
]
headers = ["Timestamp", "Data 1", "Data 2", "Data 3"]
# HTML output:
report = ArtifactHtmlReport("Cool stuff")
report_name = "Cool DFIR Data"
report.start_artifact_report(report_folder, report_name)
report.add_script()
report.write_artifact_data_table(headers, rows, files_found[0]) # assuming only the first file was processed
report.end_artifact_report()
# TSV output:
scripts.ilapfuncs.tsv(report_folder, headers, rows, report_name, files_found[0]) # assuming first file only
# Timeline:
scripts.ilapfuncs.timeline(report_folder, report_name, rows, headers)
एक PR जो किसी आर्टिफैक्ट को जोड़ता या बदलता है, समीक्षा और मर्ज करने में सबसे आसान होता है जब उसके साथ दो चीज़ें आती हैं: एक वास्तविक एक्सट्रैक्शन से काटा गया छोटा टेस्ट फिक्स्चर, और sample_data मान जो रिकॉर्ड करते हैं कि मॉड्यूल ने क्या उत्पादित किया। स्क्रिप्ट्स दोनों उत्पन्न करती हैं। यहाँ पूरा फ्लो है।
किसी भी चीज़ से पहले एक नियम: आप यहाँ जो भी कमिट करते हैं वह सार्वजनिक हो जाता है। केवल उस डेटा का उपयोग करें जिसे साझा करने की आपको अनुमति है, जैसे एक टेस्ट डिवाइस जिसे आपने स्वयं भरा है, एक सार्वजनिक शोध इमेज, या एक फ़ाइल जिसे आपने हाथ से सैनिटाइज़ किया है। कभी भी केसवर्क न करें।
1. अपने एक्सट्रैक्शन से एक फिक्स्चर काटें
python admin/test/scripts/make_test_data.py <module> --case 1 --input <extraction.zip>
यह आपके मॉड्यूल के paths पैटर्न से मेल खाने वाली फ़ाइलों को एक्सट्रैक्शन से बाहर निकालता है और केस फ़ाइल admin/test/cases/testdata.<module>.json के साथ-साथ प्रत्येक आर्टिफैक्ट के लिए एक छोटा zip admin/test/cases/data/<module>/ के अंतर्गत लिखता है।
आकार नियम: प्रति zip 10 MB से कम, इसे PR के साथ कमिट करें। 10 से 25 MB के बीच, केस फ़ाइल कमिट करें और zip को PR कमेंट में संलग्न करें। उससे बड़ा, PR में बताएं और एक मेंटेनर हैंडऑफ़ की व्यवस्था करेगा।
2. अपेक्षित आउटपुट रिकॉर्ड करें
TZ=UTC python admin/test/scripts/test_module.py <module> -a all -c all
यह मॉड्यूल को फिक्स्चर के विरुद्ध चलाता है और आउटपुट का एक स्नैपशॉट admin/test/results/<module>/ के अंतर्गत लिखता है। स्नैपशॉट को भी कमिट करें। यह मर्ज के बाद मॉड्यूल की सुरक्षा करने वाला बेसलाइन बन जाता है। TZ=UTC भाग रखें: कमिट किए गए स्नैपशॉट UTC हैं और CI UTC चलाता है।
3. वही तुलना चलाएँ जो CI चलाएगा
python admin/test/scripts/run_test_cases.py --module <module>
4. sample_data मान उत्पन्न करें
python admin/scripts/validate_sample_data.py --emit <extraction.zip> --key <image_name>
यह आपके एक्सट्रैक्शन पर ALEAPP को एंड-टू-एंड चलाता है और आपकी ब्रांच पर बदले गए मॉड्यूल के लिए पेस्ट-रेडी sample_data ब्लॉक प्रिंट करता है। उन्हें अपने मॉड्यूल के __artifacts_v2__ में पेस्ट करें और इमेज पर दिखाई देने वाला ऐप नाम और संस्करण जोड़ें। यदि कोई गिनती शून्य है, तो रिकॉर्ड करने से पहले जाँचें कि सोर्स फ़ाइल वास्तव में खाली है।
5. सब कुछ कमिट करें और PR खोलें
मॉड्यूल, केस फ़ाइल, फिक्स्चर zips, और रिकॉर्ड किया गया स्नैपशॉट एक साथ कमिट करें। अधिक विवरण admin/docs/testing/create_module_test_cases.md में है।
यदि आपका एक्सट्रैक्शन साझा नहीं किया जा सकता है, तो भी PR खोलें और ऐसा बताएं। एक फिक्स्चर अक्सर सार्वजनिक शोध इमेज से काटा जा सकता है, या वास्तविक फ़ाइल को हाथ से सैनिटाइज़ किया जा सकता है। जब तक हम इसे सुलझाते हैं, समीक्षा रुकती नहीं है।
यह टूल DFIR समुदाय में कई लोगों के सहयोगात्मक प्रयास का परिणाम है।
ALEAPP लोगो Derek Eiri की सौजन्य से।