
أنشئ قواعد YARA تلقائياً من المستندات الضارة.

Halogen هي أداة لأتمتة إنشاء قواعد yara استنادًا إلى ملفات الصور المضمنة داخل مستند ضار. يمكن أن يساعد هذا المتخصصين في الأمن السيبراني في كتابة قواعد الكشف عن التهديدات الضارة، بالإضافة إلى مساعدة المستجيبين في تحديد التهديد الذي يتعاملون معه. حاليًا، يمكن لـ Halogen إنشاء قواعد بناءً على ملفات JPG و PNG.

python3 halogen.py -h
usage: halogen.py [-h] [-f FILE] [-d DIR] [-n NAME] [--png-idat] [--jpg-sos] [--jpg-sof2sos] [--jpg-jump] [-c CONTAINER] [--clam] [--rprefix RPREFIX]
Halogen: Automatically create yara rules based on images embedded in office documents.
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE File to parse
-d DIR, --directory DIR
directory to scan for image files.
-n NAME, --rule-name NAME
specify a custom name for the rule file
--png-idat For PNG matches, instead of starting with the PNG file header, start with the IDAT chunk.
--jpg-sos For JPG matches, skip over the header and look for the Start of Scan marker, and begin the match there.
--jpg-sof2sos for JPG matches, skip over the header and match the SOF all the way to the SOS + 45 bytes of the data within the SOS.
--jpg-jump for JPG matches, skip over the header and identify the sof, the sos and then read the actual image data take that data and look for repeated bytes. Skip those bytes and then
create 45 bytes of raw image data.
-c CONTAINER, --container CONTAINER
specify a clamav container type defaults to CL_TYPE_MSOLE2, CL_TYPE_OOXML_WORD, CL_TYPE_OOXML_XL, CL_TYPE_OOXML_PPT
--clam generate a clam rule instead of a yara rule
--rprefix RPREFIX specify a clamav ruleset prefix
لقد قمنا بتضمين بعض ملفات المستندات الاختبارية مع صور مضمنة لتجربتها. سيؤدي تشغيل python3 halogen/halogen.py -d tests/ > /tmp/halogen_test.yara إلى إنتاج ملف yara الاختياري الذي يحتوي على جميع الصور الموجودة داخل الملفات في دليل tests/.
من هنا يمكنك تشغيل yara -d /tmp/halogen_test.yara tests/ وملاحظة الصور التي تتطابق مع أي ملفات.
--png-idat يمكنك البدء من جزء IDAT الموجود داخل ملف PNG. كما قمنا بتقليل البايتات المرتجعة عند المطابقة على جزء IDAT.--jpg-sos.--jpg-sof2sos، الذي يقرأ علامة بدء الإطار (SOF) حتى يتم العثور على SOS، ثم يقرأ 45 بايت إضافية. هذا مفيد إذا كانت مطابقة --jpg-sos القياسية تعطي نتائج إيجابية خاطئة.--jpg-jump الذي يقرأ بيانات الصورة المضغوطة وينشئ قفزة سداسية عشرية في مخرجات yara إذا وجد بايتات مكررة للصورة. يتيح لنا ذلك المطابقة على SOF و SOS للملف، بالإضافة إلى بعض البيانات الفريدة في الصورة.يرجى المساهمة بطلبات سحب في python3، وتقديم أي أخطاء تجدها كمسائل (issues).