
दुर्भावनापूर्ण दस्तावेज़ों से स्वचालित रूप से 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 के साथ PNG फ़ाइल के अंदर पाए जाने वाले IDAT खंड से शुरू कर सकते हैं। हमने IDAT खंड पर मिलान करते समय लौटाए गए बाइट्स को भी कम कर दिया है।--jpg-sos फ़्लैग का उपयोग करके JPG मिलान को Scan marker की शुरुआत से शुरू कर सकते हैं।--jpg-sof2sos फ़्लैग भी शामिल किया है, जो Start of Frame (SOF) marker को तब तक पढ़ता है जब तक SOS नहीं मिल जाता, और फिर अतिरिक्त 45 बाइट पढ़ता है। यह उपयोगी है यदि मानक --jpg-sos आपको गलत सकारात्मक परिणाम दे रहा है।--jpg-jump फ़्लैग जोड़ा है जो संपीड़ित छवि डेटा पढ़ता है और यदि उसे दोहराए गए छवि बाइट मिलते हैं तो yara आउटपुट में एक हेक्स जंप बनाता है। यह हमें फ़ाइल के SOF और SOS, साथ ही छवि में कुछ अधिक अद्वितीय डेटा पर मिलान करने की अनुमति देता है।कृपया python3 में पुल अनुरोधों का योगदान करें, और आपके द्वारा पाए जाने वाले किसी भी बग को issues के रूप में सबमिट करें।