<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 0xMOSTA on Medium]]></title>
        <description><![CDATA[Stories by 0xMOSTA on Medium]]></description>
        <link>https://medium.com/@mosta222?source=rss-2d7519970ed5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7xdWaJUdBJrGWTEDe2gj3A.jpeg</url>
            <title>Stories by 0xMOSTA on Medium</title>
            <link>https://medium.com/@mosta222?source=rss-2d7519970ed5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:27:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mosta222/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Normalization in SIEM AND ECS ELASTIC Common Schema خلاصة بالبلدي]]></title>
            <link>https://mosta222.medium.com/normalization-in-siem-and-ecs-elastic-common-schema-%D8%AE%D9%84%D8%A7%D8%B5%D8%A9-%D8%A8%D8%A7%D9%84%D8%A8%D9%84%D8%AF%D9%8A-048fa94ea08d?source=rss-2d7519970ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/048fa94ea08d</guid>
            <dc:creator><![CDATA[0xMOSTA]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 19:24:11 GMT</pubDate>
            <atom:updated>2025-12-03T19:24:11.126Z</atom:updated>
            <content:encoded><![CDATA[<h3>Normalization in SIEM AND ECS ELASTIC Common Schema</h3><p>السلام عليكم عاملين ايه يا اخواتي <br>من ضمن حاجات رائعة كدا اللي ممكن تستوقفنا هي مصطلح ال Normalization</p><p>يعني ايه اصلا المصطلح دا كا ترجمة ال Normalization بتيجي بمعني تسوية / تطبيع</p><p>فا نقدر نقول ان كا مصطلح التعريف بتاعه هيكون :</p><p>Normalization is ==the process of making something “normal” or standard==, with specific meanings in different contexts like database design, data processing, and sociology. In database design, it organizes data to reduce redundancy and improve integrity. In data processing, it scales numerical features to a common range for algorithms. In sociology, it refers to the process where behaviors and ideas become accepted as normal in a society.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*X5I_kyYURmK1JsEEHIpVDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*NVHQ66sXEyUZObmwskk0Qg.png" /></figure><p>طيب يعني ايه الكلام دا بالبلدي كدا هقولك سريعا بلغتنا ايه دا وهيفيدنا في ايه إن شاء الله</p><p>بالبلدي كدا انت بتحاول تنرمليز الحاجة (تخليها طبيعية ) او بمعني تاني منظمة (منظمة) {منظمة}</p><p>قولت اغير شكل الاقواس زيادة تاكيد المهم :</p><p>انت بتخلي الحاجة اللي عندك منظمة او علي شكل معياري (standard)</p><p>طيب ايه مصطلح معياري دا او مصطلح standard دا يطلع ايه ؟</p><p>**Standard =<br> حاجة متفق عليها كـ “الطريقة الصح” أو “الشكل الصح” اللي المفروض الكل يشتغل بيه.**</p><p>يعني: <br>حاجة مش ماشية بمزاج كل واحد… <br>لأ، دي طريقة **كل الناس أو الجهات** اتفقت إنها الصح، فبقينا نمشي عليها.</p><p>يعني علي سبيل المثال :</p><p>الفولت المستخدم في البيوت **220V** <br>ده Standard = قاعدة بيمشوا عليها.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*tVWHIaG-gjWjmxHX7cmfhA.png" /></figure><p>طيب نرجع لموضعنا :<br>قبل ما نخش نتكلم علي فكرة ال Normalization في ال SIEM و ال ECS</p><p>هنوضح شوية اكتر عن فكرة دي بشكل عام</p><p>في مادة عندنا في المعهد اسمها Data Mining او بالعربي التنقيب عن البيانات بس ايه الداتا مينينج دي</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*lyK12uaUgul9LPq_85mZWw.png" /></figure><p>تعالي نعدي علي البروسيس سريعا ما عدا نقطة واحدة فقط هيكون فيها كلام زيادة وسط النقط لانها بتتمحور حول فكرة ال Normalization</p><p>**1. نضافة الداتا (Data Cleaning)**</p><p>- أول حاجة بنسمي الله وننزل نكنس ونروق. أي داتا بايظة، ناقصة، أو متكررة مالهاش لازمة، بنرميها في الزبالة عشان نبدأ الشغل على ميه بيضا.</p><p>**2. تجميع الداتا (Data Integration)**</p><p>- بنلم “العفش” كله من كل حتة (شوية من ملفات إكسيل، على شوية من الداتا بيز) ونكبهم كلهم في مخزن واحد كبير عشان يبقوا تحت إيدنا.</p><p>**3. التنقية (Data Selection)**</p><p>- مش بناخد “عاطل على باطل”، إحنا بننقي بس العواميد اللي تلزمنا في الحوار بتاعنا، والباقي بنقوله “فكك مني” عشان مانزحمش الدنيا.</p><p>**4. تظبيط الداتا (Data Transformation)**</p><p>- هنا بقى “المطبخ”، بنجهز الداتا عشان الكمبيوتر يفهمها. أهم لقطة هنا هي الـ **Normalization** ودي حوارها بسيط:<br> <br> — **بالبلدي (توحيد المقامات):** لو عندك عمود فيه أرقام فلكية (زي المرتبات بالملايين) وعمود فيه فرافيت (زي السن 30 و 40)، الكمبيوتر “غشيم” ممكن يفتكر اللي رقمه كبير هو اللي أهم. الـ Normalization دي بتساويهم ببعض عشان محدش يتظلم.<br> <br> — **ليها طريقتين مشهورين:**<br> <br> — طريقة **Min-Max:** دي “بتفعص” الأرقام كلها وتحشرها في رينج ضيق (بين 0 و 1).<br> <br> — طريقة **Z-Score:** دي بتشوف الرقم “شاذ” وبعيد عن المتوسط قد إيه (ودي برنسة لو الداتا فيها شطحات غريبة).</p><p>**5. الحفر والتنقيب (Data Mining)**</p><p>- دي “ساعة الجد”، بنسلط الخوارزميات (الـ Algorithms) والذكاء الاصطناعي عشان يغطسوا جوه الداتا ويطلعولنا الأسرار والعلاقات المستخبية اللي عمرنا ما كنا هنشوفها بعيننا.</p><p>**6. الفرز والتقييم (Pattern Evaluation)**</p><p>- بعد ما طلعنا النتايج، بنقعد نفرزها.. بنشوف ده “دهب بجد” ومعلومة مفيدة، ولا ده شغل “هبد” وصدفة مالهاش لازمة؟ عشان منتعبش نفسنا على الفاضي.</p><p>**7. العرض والزتونة (Knowledge Representation)**</p><p>- أخر لقطة، بناخد الخلاصة النضيفة دي ونعملها في “شارتات” ورسومات بيانية شيك، عشان لما نعرضها على “الباشا الكبير” (صاحب القرار) يفهم الليلة فيها إيه من نظرة واحدة.</p><p># السؤال المهم ايه يبني علاقة كل دا برضو ب siem و لال ECS</p><p>بص احنا لسا بنوضح مبدا ال Normalization ولكن بابعاد مختلفة</p><p>فا اخيرا هنخش في الموضوع علي طول</p><p>هل دا شيبه نورمليزيشن في siem solution هل نفس الفكرة ؟</p><p>الإجابة المختصرة: **نفس “الهدف” (التوحيد)، بس “التطبيق” مختلف تماماً.**</p><p>هما نفس **”المبدأ الفلسفي”** ونفس الهدف النهائي، اللي هو: **(تحويل فوضى الاختلافات إلى نظام موحد)**.</p><p>### 1. الـ Normalization في الـ SIEM (حوار الترجمة)</p><p>هنا الموضوع مالوش علاقة بحسابات وأرقام، هنا إحنا بنلعب لعبة “توحيد اللغة”.</p><p>- **أصل الحكاية (المشكلة):** عندك شبكة “سلطة” (واه تقدر تعتبرها سلطة حرفيا طماطم علي بصل علي لمون علي خيار الي ما اخره )، كل جهاز فيها بيتكلم بلغة شكل وبيسمي الحاجة على مزاجه:</p><p>يعني مثلا كدا مثلا : <br> — عمك **Cisco** بيسمي أي بي المهاجم: `src_ip`<br> <br> — والحاج **Windows** بيسميه: `SourceAddress`<br> <br> — وبرنامج **Antivirus** بيسميه: `Client_IP`<br> <br>- **فا من الاخر بقا :** الـ SIEM بيقوم بدور “المترجم الفوري”. بياخد كل اللوجات (Logs) دي من الأجهزة المختلفة، ويقوم قالبهم كلهم لاسم واحد متفق عليه (مثلاً `Source_IP`).<br> <br>- **طيب انا استفدت ايه ساعتها :** عشان لما تيجي إنت يا باشا تعمل Rule وتقول “يا سيستم نبهني لو الـ `Source_IP` ده عمل قلق”، الـ SIEM يفهم لغة الأجهزة كلها مرة واحدة، بدل ما تقعد تكتب كود لكل جهاز لوحده وتتعب نفسك.</p><p>&gt; **من الأخر:** في الـ SIEM هي عملية “قص ولزق وتسمية” (Parsing &amp; Mapping) عشان كله يكون لغة واحدة.</p><p>### 2. الـ Normalization في الـ Data Mining (حوار الحسابات)</p><p>زي ما حكينا قبل كده، هنا بقى شغل “رياضة وحسابات بحتة”.</p><p>- **أصل الحكاية (المشكلة):** الأرقام جاية ملخبطة ومقاساتها مش زي بعض (مثلاً واحد بيقبض **20,000** جنيه، وعمره **30** سنة). الكمبيوتر “غشيم”، لما بيشوف رقم 20 ألف ورقم 30، بيفتكر إن الـ 20 ألف أهم بكتير عشان رقم كبير، فبيظلم “السن” ويهمله.<br> <br>- **الحل :** بنعمل معادلة رياضية “تفعص” الأرقام دي كلها وتخليها على ميزان واحد (مثلاً كله يبقى بين 0 و 1).<br> <br>- **الفايدة:** عشان الخوارزمية (الـ AI) تبقى عادلة ومتنحازش (Bias) للأرقام الكبيرة وتطنش الصغيرة، كله ياخد حقه في التحليل.</p><p>&gt; **من الأخر:** في الـ Data Mining هي عملية “إعادة تحجيم” (Rescaling) عشان نوحد المقامات.</p><p>### **مثال ع السريع عشان تثبت:**</p><p>- **في الـ SIEM:** زي لما يكون عندك 3 صنايعية، واحد صيني وواحد هندي وواحد إنجليزي، الـ Normalization إنك تجيب “مترجم” يخليهم كلهم يكلموك **”عربي”** عشان تفهمهم وتديهم أمر واحد.<br> <br>- **في الـ Data Mining:** زي لما يكون معاك واحد بيقبض بالدولار وواحد بالين الياباني وواحد بالجنيه، الـ Normalization إنك تحول فلوسهم كلها لـ **”دهب”** (معيار ثابت) عشان تعرف مين فيهم اللي غني بجد ومين اللي “فلسع”.</p><p>فا من الاخر هو نفس المبدا اللي احنا بنحكي عنه وهو التوحيد</p><p># جميل كدا ايه بقا ال ECS دا يطلع ايه بعد قصة دي كلها</p><p>جميل جدا نسمي الله بقا لان اخيرا وصلنا للجزء الاساسي واللي عمالين نقول كل دا عشانه</p><p>ال ECS اختصار Elastic Common Schema</p><p>جميل جدا والله عرفنا هي اختصار ايه بس برضو احنا فين ؟ تعالي اقولك</p><p>## الاول هسبلك لينك الدكومنتشن عشان لو حبيت تقرا اكتر عن الموضوع دا بالتفاصيل</p><p>## متنساش بالله عليك تدعيلي محتاج دعوتك جدا</p><p>## واه دوكومنتشن مهمة (دوكومنتشن مهمة) &lt;دوكومنتشن مهمة&gt; لو هتتعامل مع اي siem الدوكومنتشن بتاعته مهمممممممممممة</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0aCQnb2QNaG6fMDaxHckA.png" /></figure><p># ودا اللينك : (انقر اللينك لا تقلق :) عشان يبان دمي خفيف وكدا المهم :</p><p>[Elastic Common Schema (ECS) reference | Elastic Common Schema (ECS)](<a href="https://www.elastic.co/docs/reference/ecs">https://www.elastic.co/docs/reference/ecs</a>)</p><p>بص عشان متبقاش الدنيا معقده، الموضوع كله عبارة عن توحيد لغة.. تخيل إنك في سوق وكل واحد بينده على بضاعته بلكنة مختلفة، إنت مش هتفهم حاجة والدنيا هتبقى “سويقة”. أهو ده اللي بيحصل من غير ECS، الويندوز يسمي الـ IP باسم، والسيسكو باسم تاني، والسيرفر باسم تالت، وإنت كراجل شغال SOC تطلع عينك عشان تربط الأحداث ببعض وتعمل rules تغطي كل ده.</p><p>فجت Elastic قالتلك بصوا يا جدعان، احنا هنعمل قاموس موحد نمشي عليه كلنا.. أي IP بيبعت داتا هنسميه source.ip، وأي حد بيستقبل هنسميه destination.ip، واسم اليوزر هيبقى user.name، وهكذا بقى في كل حاجة سواء شبكات أو ملفات أو بروسيس، كله متقسم عائلات عشان مفيش حاجة تتوه.</p><p>الجمال بقى في الموضوع ده إنك لما تيجي تشتغل على الـ SIEM، مش محتاج تكتب كود لكل جهاز لوحده.. هي رول واحدة أو داشبورد واحدة هتفهم اللوجات اللي جاية من كل حتة مادام كلها متظبطة ومترجمة لـ ECS، يعني من الآخر هو المترجم اللي بيخليك رايق ومش شايل هم اختلاف الأجهزة والأنظمة اللي عندك في الشبكة.</p><p># دي الخلاصة ، نستعين شوية CHAT GPT عشان نرتب الكلام بتاعنا وشرح اللي مفروض اقوله مفصل شوية قدام وينظمه في شكل حلو كدا</p><p>ال **Elastic Common Schema (ECS)** وده بالذات مهم جدًا لأي حد بيشتغل **SOC / SIEM / Threat Hunting / Elastic Stack**.</p><p># Elastic Common Schema (ECS) يعني إيه؟</p><p>** ال ECS** هو Standard / معيار عملته Elastic علشان يوحّد شكل الـ **logs** اللي بتيجي من مصادر مختلفة.</p><p>بمعنى تاني:</p><p>&gt; **يوحّد أسماء الفيلدز + طريقة تخزين الداتا + طريقة ربط الأحداث** <br>&gt; علشان الـ SIEM يقدر يفهم كل اللوجات مهما كان مصدرها.</p><p># ليه أصلاً محتاج ECS؟</p><p>لأن بدون ECS:</p><p>- كل جهاز/سيستم بيبعت Logs بشكل مختلف<br> <br>- Windows ليه فورمات<br> <br>- Apache ليه فورمات<br> <br>- Zeek ليه فورمات<br> <br>- Suricata ليها فورمات<br> <br>- Firewalls ليها فورمات</p><p>كل واحد مسمي الفيلدز بطريقته! <br>مثلاً:</p><p>- واحد كاتب **src_ip**<br> <br>- واحد كاتب **source.ip**<br> <br>- واحد كاتب **client_ip**</p><p>فإنت كـ **SOC** أو **Hunting** هتتلخبط، وإنشاء Dashboards/Rules هيبقى عذاب.</p><p>ECS حلّت المشكلة.</p><p>— -</p><p># ECS بيعمل إيه فعليًا؟</p><p>بيوحّد أسماء الفيلدز، مثلًا:</p><p>|الوظيفة|بدون ECS|مع ECS|<br>| — -| — -| — -|<br>|IP المصدر|src, source_address, client_ip|**source.ip**|<br>|IP الوجهة|dst, daddr|**destination.ip**|<br>|User|username, account, user|**user.name**|<br>|Process ID|pid|**process.pid**|<br>|Hash|md5, file_md5|**file.hash.md5**|</p><p>يعني كله يمشي على Standard واحد.</p><p>— -</p><p># ECS عبارة عن إيه؟</p><p>ECS عبارة عن **قائمة كبيرة من الفيلدز** منظمة حسب تصنيفات، زي:</p><p>- **event.*** → كل حاجة عن الحدث<br> <br>- **source.*** → الطرف المرسل<br> <br>- **destination.*** → الطرف المستقبل<br> <br>- **process.*** → العمليات (Processes)<br> <br>- **file.*** → الملفات<br> <br>- **user.*** → اليوزر<br> <br>- **network.*** → الشبكة<br> <br>- **host.*** → الجهاز<br> <br>- **rule.*** → القواعد<br> <br>- **http.*** → http logs<br> <br>- **dns.*** → dns logs<br> <br>- **tls.***<br> <br>- **os.***<br> <br>- **cloud.***<br> <br>- إلخ…</p><p>كل Categorization معمول علشان الـ SIEM يفهم السياق automatically.</p><p>— -</p><p># مثال حقيقي:</p><p>لو عندك Windows Event 4624 (Successful Logon)</p><p>بدون ECS → هيجيلك كده:</p><p>- IpAddress<br> <br>- WorkstationName<br> <br>- TargetUserName<br> <br>- LogonType</p><p>بعد ECS → يتحول لـ:</p><p>- **source.ip**<br> <br>- **host.name**<br> <br>- **user.name**<br> <br>- **event.type: start**<br> <br>- **event.category: authentication**<br> <br>- **event.action: logon**</p><p>وده اللي بيخلي Kibana يفهم:</p><p>- ده Login<br> <br>- من الجهاز الفلاني<br> <br>- بواسطة يوزر فلاني<br> <br>- من IP معين<br> <br>- بنوع Logon محدد</p><p>— -</p><p># ليه ECS مهم للـ SOC/Hunter؟</p><p>### لأنه بيسهّل:</p><p>- SIEM correlation rules<br> <br>- Building dashboards<br> <br>- Threat hunting queries<br> <br>- Machine learning analytics<br> <br>- Normalizing logs في أي نظام (ELK, Splunk, Sentinel…)</p><p>### وبيمنع:</p><p>- تضارب الفيلدز<br> <br>- لوجات مش متوافقة<br> <br>- صعوبة التحليل<br> <br>- صعوبة كتابة Queries</p><p>— -</p><p># خلاصة قصيرة</p><p>**ECS** = طريقة موحّدة لتسمية وتنظيم كل اللوجات قبل دخولها Elastic SIEM. <br>علشان:</p><p>✔ نفس شكل الفيلدز <br>✔ نفس الـ structure <br>✔ نفس المعنى <br>✔ إنك تقدر تعمل correlation بسهولة <br>✔ وإن التحليل يبقى أسرع ومفهوم</p><p>— -</p><p># طيب هو هو نفس كلامنا عادي خالص بس خليت شات جي بي تي ينظمه ويغلفه كدا بشكل حلو وكويس :) :) :) :)</p><p># طيب يعني ال ECS دا المسئول عن عملية ال Normalization</p><p>يا سلام هو دا اللي بنقوله فعلا</p><p>بالظبط… **ECS = قلب عملية الـ Normalization في Elastic**.</p><p>**أيوه**، ECS هو الـ **standard** اللي بتستخدمه Elastic علشان تعمل:</p><p>- **Normalization**<br> <br>- **Unification of log fields**<br> <br>- **Mapping لكل الـ sources المختلفة**</p><p>يعني أي Log بيدخل إلى ELK/Elastic SIEM لازم يتعملّه **mapping → تحويل → تطبيع** علشان يلتزم بالـ ECS.</p><p>وبالتالي:</p><p>### الـ Normalization = تحويل اللوج من شكله الخام</p><p>(زي Windows event log, Apache log, Cisco ASA, Suricata…)</p><p>### إلى شكل موحّد</p><p>(ECS fields → زي user.name / source.ip / process.pid)</p><p>وده يخلي أي Dashboard, Detection rule, Query <br>يشتغل على كل الـ logs بدون مشاكل.</p><p>— -</p><p># علاقة ECS بـ Normalization؟</p><p>### في ELK:</p><p>```<br>Raw Logs → Logstash / Beats processors → ECS Normalization → Elasticsearch index<br>```</p><p>### اللي بيحصل أثناء الـ Normalization:</p><p>- إعادة تسمية الفيلدز<br> <br>- تنظيم الـ fields في categories<br> <br>- تنظيف الداتا<br> <br>- Parsing<br> <br>- Enrichments<br> <br>- Mapping لـ ECS</p><p>مثال: <br>لو Windows بعتلك:</p><blockquote>```<br>TargetUserName : “Mostafa”<br>IpAddress: “10.0.0.5”<br>```</blockquote><p>بعد التطبيع حسب ECS:</p><blockquote>```<br>user.name: “Mostafa”<br>source.ip: “10.0.0.5”<br>event.category: “authentication”<br>event.type: “start”<br>```</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jw2urycu6srHwmNFBm-6Q.png" /></figure><p># وبس كدا الحمد لله خلصنا متسناش اقرا دوكومنتشن الرسمية وادعيلي وادعي لاهلي ولكل المسلمين</p><p>والسلام عليكم ورحمة الله وبركاته</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=048fa94ea08d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network mapping System]]></title>
            <link>https://mosta222.medium.com/network-mapping-system-f55f3bc52efd?source=rss-2d7519970ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f55f3bc52efd</guid>
            <dc:creator><![CDATA[0xMOSTA]]></dc:creator>
            <pubDate>Tue, 02 Jul 2024 17:57:58 GMT</pubDate>
            <atom:updated>2024-07-02T17:57:58.288Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Create a Network Mapping System</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLyparDvY0RC8kstnzHx1g.png" /></figure><h3>What is System?</h3><p>A system is a structured and organized collection of interrelated components or elements working together to achieve a specific objective. Systems can be simple or complex, and they can be found in various domains, including engineering, biology, and information technology.</p><h3>What is system Analysis &amp; Design</h3><p>System analysis and design is a discipline within the field of software engineering that focuses on understanding, designing, and implementing efficient and effective information systems.</p><p>It involves a systematic approach to identifying, analyzing, and solving problems within an organization or business.</p><h3>What is UML Diagrams</h3><p>UML, which stands for Unified Modeling Language, is a standardized modeling language used in software engineering for visualizing, specifying, constructing, and documenting the artifacts of a system. UML provides a set of graphical notations and a framework for expressing complex systems in a visual form.</p><h3><strong>Why We Use UML Diagrams</strong></h3><h4>using UML</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNKQm-LAuKzwG-4O6fx8Ig.png" /></figure><p>UML diagrams are graphical representations of different aspects of a software system. These diagrams help software developers and other stakeholders to understand the system, its structure, behavior, and interactions. There are several types of UML diagrams, each serving a specific purpose.</p><p>UML diagrams are widely used in software development to improve communication among team members, document system architecture, and aid in the analysis and design phases of the software development life cycle. They serve as a visual communication tool that helps stakeholders, including developers, architects, and clients, to better understand and discuss complex systems.</p><h3>Types of UML Diagrams</h3><p><strong>USE CASE</strong></p><p>Illustrate the interactions between the system and external entities (actors) to represent the functionality of the system from the user’s perspective</p><p><strong>Activity</strong></p><p>Represent workflows and business processes, illustrating the flow of activities within a system.Class</p><p><strong>Sequence</strong></p><p>Show the interactions between objects over time, emphasizing the order in which messages are exchanged.</p><p><strong>Class</strong></p><p>Depict the static structure of a system by showing classes, their attributes, methods, and relationships.</p><p><strong>State Machine</strong></p><p>State machine diagrams can also show how an entity responds to various events by changing from one state to another. State machine diagram is a UML diagram used to model the dynamic nature of a system.</p><p><strong>Deployment</strong></p><p>Illustrate the physical deployment of software components in a hardware environment</p><p><strong>Component</strong></p><p>Represent the components and their relationships within a system</p><p><strong>Package Diagrams</strong></p><p>Show the dependencies between packages and the organization of model elements into packages.</p><p><strong>Object Diagrams</strong></p><p>Provide a snapshot of the objects in a system and the relationships between them at a specific point in time.</p><h3><strong>Specific Types Which We Use</strong></h3><p>types :</p><p>USE CASE</p><p>Activity</p><p>Sequence</p><p>Class</p><h3>What is Firewall</h3><p>A firewall is a security device or software that acts as a barrier between a trusted internal network and an untrusted external network, controlling and monitoring incoming and outgoing network traffic to prevent unauthorized access and protect against cyber threats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*P14px8HlC8Dk129asePtrw.png" /></figure><h3>Let’s Get start in our project Portscanning or Network Mapping System</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7v9D5odYEd5QHrcnHO_mzg.png" /></figure><h3>practical part</h3><p>The stage of presenting the design diagrams and practical applications of our system.</p><h4>USE CASE DIAGRAM</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Vop8MdTZF9Xr2wIW8mfZA.png" /></figure><h4>Activity Diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DKQwNiNEupz7Cs-MTdSJ4w.png" /></figure><h4>Sequence Diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJSAoWi0QxiOzpri3eupoA.png" /></figure><h4>Class Diagram First one</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2h3rgXVmu_tJnPUSJKF_hg.png" /></figure><h4>Class Diagram Second one</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*zm6KLZlhS90yHGaEtML9hA.png" /></figure><h4>Class Diagram Third one</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kl0Kti4dk2SoP3QmaKZ4gQ.png" /></figure><h3>code of softtware</h3><pre>import socket<br>import os<br>import sys<br><br>target_host = input(&quot;Enter the target host: &quot;)<br><br> # Function to check if a port is open<br>def check_port(target_host, target_port):<br>    try:<br>        # Create a socket object<br>        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>        <br>        # Set a timeout value for the connection attempt<br>        sock.settimeout(2)<br>        <br>        # Connect to the target host and port<br>        result = sock.connect_ex((target_host, target_port))<br>        <br>        # Check if the port is open or closed<br>        if result == 0:<br>            # Get service and vulnerability information<br>            service = socket.getservbyport(target_port)<br>            vulnerabilities = os.popen(f&quot;nmap -p {target_port} --script vulners {target_host}&quot;).read()<br>            <br>            # Get system information<br>            system_info = os.popen(f&quot;nmap -p {target_port} -O {target_host}&quot;).read()<br>            <br>            # Print port status and additional information<br>            print(f&quot;Port {target_port} is open&quot;)<br>            print(f&quot;Service: {service}&quot;)<br>            print(f&quot;Vulnerabilities:\n{vulnerabilities}&quot;)<br>            print(f&quot;System Information:\n{system_info}&quot;)<br>        else:<br>            print(f&quot;Port {target_port} is closed or filtered&quot;)<br>        <br>        # Close the socket<br>        sock.close()<br>        <br>    except socket.error:<br>        print(&quot;Could not connect to the target host.&quot;)<br><br> # Perform port scanning for all ports (1 to 65535)<br>for port in range(1, 65536):<br>    <br>    check_port(target_host, port)<br><br>  # Get operating system information<br>def get_os_info(target_host):<br>    os_info = os.popen(f&quot;nmap -O {target_host}&quot;).read()<br>    print(f&quot;Operating System Information:\n{os_info}&quot;)<br><br> # Prompt the user to get OS information<br>answer = input(&quot;Do you want to get the operating system information? (y/n): &quot;)<br>if answer.lower() == &quot;y&quot;:<br>    get_os_info(target_host)<br>else:<br>    sys.exit(0)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f55f3bc52efd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[notes to create script test cis-controls]]></title>
            <link>https://mosta222.medium.com/notes-to-create-script-test-cis-controls-ca60a93fcc52?source=rss-2d7519970ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca60a93fcc52</guid>
            <dc:creator><![CDATA[0xMOSTA]]></dc:creator>
            <pubDate>Sun, 23 Jun 2024 23:23:31 GMT</pubDate>
            <atom:updated>2024-07-02T17:30:04.637Z</atom:updated>
            <content:encoded><![CDATA[<h3>write script to test cis-controls</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*UcLVBeuVC6LlD0-Awt_nAA.png" /></figure><p>In order to test cis-controls in my operating system, Ubuntu 22.04 LTS, what do I need to download first on my device before the testing process, so that the testing process can be completed in the first place?</p><p>To test CIS controls in Ubuntu 22.04 LTS, you will need to download the following :</p><pre>- CIS Ubuntu Linux 22.04 LTS Benchmark v1.0.0.pdf <br><br>- cis_pdf_parser.py</pre><p>You can download the CIS Ubuntu Linux 22.04 LTS Benchmark v1.0.0.pdf from the CIS website:</p><pre>https://www.cisecurity.org/cis-benchmarks/</pre><p>You can download the cis_pdf_parser.py script from the following GitHub repository:</p><pre>https://github.com/ComplianceAsCode/cis-benchmark-parser</pre><p>Once you have downloaded these files, you will be able to run the Python script to test the CIS controls in Ubuntu 22.04 LTS.</p><p>Here are the steps on how to test the CIS controls in Ubuntu 22.04 LTS:</p><p>1. Open a terminal window.</p><p>2. Install the following Python packages:</p><pre>sudo apt install python3-pip <br>sudo pip3 install subprocess csv</pre><p>3. Save the Python script (cis_benchmark_test.py) in the same directory as the CIS Ubuntu Linux 22.04 LTS Benchmark v1.0.0.pdf and cis_pdf_parser.py files.</p><p>4. Run the following command:</p><pre>python3 cis_benchmark_test.py</pre><p>The script will parse the CIS Ubuntu Linux 22.04 LTS Benchmark v1.0.0.pdf into a CSV file and then test each CIS control requirement. If any of the requirements fail, the script will print an error message to the console.</p><p>You can then review the output of the script to identify any CIS controls that need to be remediated.</p><p>Are there commands that must be executed in the terminal in our case if I am the one who will create the script that will run the test?</p><p>Yes, there are commands that must be executed in the terminal in order to create the script that will run the test. These commands are necessary to install the required Python packages, parse the CIS Benchmark PDF file into a CSV file, and test each CIS Benchmark requirement.</p><p>The following is a list of the commands that must be executed in the terminal:</p><pre>sudo apt install python3-pip<br>sudo pip3 install subprocess csv<br>python3 cis_pdf_parser.py /path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.pdf<br>/path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv <br>python3 cis_benchmark_test.py /path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv</pre><p>The first command installs the required Python packages: subprocess and csv. The second command parses the CIS Benchmark PDF file into a CSV file. The third command runs the Python script to test the CIS Benchmark requirements.</p><p>Here is an example of how to use the commands above:</p><pre>sudo apt install python3-pip<br>sudo pip3 install subprocess csv <br>python3 cis_pdf_parser.py /home/user/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.pdf<br> /home/user/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv <br>python3 cis_benchmark_test.py /home/user/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv</pre><p>This will create a Python script that can be used to test the CIS Benchmark requirements on your Ubuntu 22.04 LTS machine.</p><p>there are any thing with above ? Yes, there is one thing that you need to be aware of when using the commands above. The cis_pdf_parser.py script is not installed by default on Ubuntu 22.04 LTS. You will need to download and install the script manually.</p><p>To download and install the cis_pdf_parser.py script, you can use the following commands:</p><pre>cd /path/to/download/directory<br>wget https://github.com/ComplianceAsCode/cis-benchmark-parser/raw/main/cis_pdf_parser.py<br>chmod +x cis_pdf_parser.py</pre><p>Once you have installed the cis_pdf_parser.py script, you can proceed with the steps above to create the Python script to test the CIS Benchmark requirements.</p><p>Here is an example of how to install the cis_pdf_parser.py script:</p><pre>cd /home/user/Downloads<br>wget <a href="https://github.com/ComplianceAsCode/cis-benchmark-">https://github.com/ComplianceAsCode/cis-benchmark-</a>parser/raw/main/cis_pdf_parser.py<br>chmod +x cis_pdf_parser.py</pre><p>Once you have installed the cis_pdf_parser.py script, you can create the Python script to test the CIS Benchmark requirements using the following commands:</p><pre>python3 cis_pdf_parser.py/path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.pdf<br>/path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv <br>python3 cis_benchmark_test.py /path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv</pre><p>This will create a Python script that can be used to test the CIS Benchmark requirements on your Ubuntu 22.04 LTS machine.</p><p>EX FOR script</p><p>python script to test cis benchmark in ubuntu 22.04 LTS</p><pre>import subprocess<br>import csv <br># Define the CIS Benchmark PDF file path <br>CIS_BENCHMARK_PDF_PATH = &quot;/path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.pdf&quot; <br># Define the CSV output file path<br> CIS_BENCHMARK_CSV_PATH = &quot;/path/to/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv&quot; <br># Parse the CIS Benchmark PDF file into a CSV file <br>def parse_cis_benchmark_pdf(): <br>    # Create a subprocess to run the cis_pdf_parser.py script <br>    subprocess.run([&quot;python3&quot;, &quot;cis_pdf_parser.py&quot;, CIS_BENCHMARK_PDF_PATH, <br>CIS_BENCHMARK_CSV_PATH]) <br># Test the CIS Benchmark <br>def test_cis_benchmark(): <br>    # Open the CIS Benchmark CSV file <br>    with open(CIS_BENCHMARK_CSV_PATH, &quot;r&quot;) as f: <br>        # Create a CSV reader object <br>        reader = csv.reader(f) <br>        # Iterate over the rows in the CSV file <br>        for row in reader: <br>            # Get the CIS Benchmark requirement ID <br>            requirement_id = row[0] <br>            # Get the CIS Benchmark requirement description <br>            requirement_description = row[1] <br>            # Get the CIS Benchmark requirement test command <br>            requirement_test_command = row[2] <br>            # Run the CIS Benchmark requirement test command <br>            subprocess.run(requirement_test_command.split()) <br>            # Check the output of the CIS Benchmark requirement test command <br>            if subprocess.call(requirement_test_command.split()) != 0: <br>                # The CIS Benchmark requirement test failed <br>                print(f&quot;CIS Benchmark requirement {requirement_id} failed: <br>{requirement_description}&quot;) <br># Main function <br>def main(): <br>    # Parse the CIS Benchmark PDF file into a CSV file <br>    parse_cis_benchmark_pdf() <br>    # Test the CIS Benchmark <br>    test_cis_benchmark() <br>if __name__ == &quot;__main__&quot;: <br>    main()</pre><p>To use the script, simply save it as a Python file (e.g. cis_benchmark_test.py ) and run it in a terminal window:</p><pre>python3 cis_benchmark_test.py</pre><p>The script will parse the CIS Benchmark PDF file into a CSV file and then test each CIS Benchmark requirement. If any of the requirements fail, the script will print an error message to the console.</p><p>What should I modify in this code in order for it to work in my machine?</p><p>To modify the Python script to work in your machine, you will need to :</p><ul><li>Change the path to the CIS Benchmark PDF file in the CIS_BENCHMARK_PDF_PATH variable.</li><li>Change the path to the output CSV file in the CIS_BENCHMARK_CSV_PATH variable.</li><li>Make sure that the cis_pdf_parser.py script is installed on your machine.</li></ul><p>If you do not have the cis_pdf_parser.py script installed, you can download it from the following GitHub repository:</p><pre>https://github.com/ComplianceAsCode/cis-benchmark-parser</pre><p>Once you have downloaded the script, save it in the same directory as the cis_benchmark_test.py script.</p><p>Once you have made these modifications, you should be able to run the script on your machine without any problems.</p><p>Here is an example of how to modify the script for a specific machine:</p><pre># Define the CIS Benchmark PDF file path <br>CIS_BENCHMARK_PDF_PATH = “/home/user/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.pdf” <br><br># Define the CSV output file path<br> CIS_BENCHMARK_CSV_PATH = &quot;/home/user/CIS_Ubuntu_Linux_22.04_LTS_Benchmark.csv&quot;</pre><p>If you are using a different operating system, you may need to modify the script accordingly. For example, if you are using Windows, you may need to change the path to the CIS Benchmark PDF file to something like C:\Users\user\CIS_OS_name_os-version_Benchmark.pdf .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca60a93fcc52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bruteforce BTLO WRITE-UP]]></title>
            <link>https://mosta222.medium.com/bruteforce-btlo-write-up-9fc479ed815b?source=rss-2d7519970ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fc479ed815b</guid>
            <dc:creator><![CDATA[0xMOSTA]]></dc:creator>
            <pubDate>Sun, 23 Jun 2024 22:48:36 GMT</pubDate>
            <atom:updated>2024-07-30T07:12:54.527Z</atom:updated>
            <content:encoded><![CDATA[<p>Bruteforce BTLO</p><p>Scenario</p><ul><li>Can you analyze logs from an attempted RDP bruteforce attack?<br> <br>One of our system administrators identified a large number of Audit Failure events in the Windows Security Event log. <br> <br>There are a number of different ways to approach the analysis of these logs! Consider the suggested tools, but there are many others out there!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*hpjF4g0xSi7rzCrJu56elQ.png" /></figure><p>Link of challenge :</p><p><a href="https://blueteamlabs.online/home/challenge/bruteforce-16629bf9a2">https://blueteamlabs.online/home/challenge/bruteforce-16629bf9a2</a></p><p>Download file from this link (or from challenge site ) : <br><a href="https://blueteamlabs.online/storage/files/00fd9853557296dd3312d4529c137f1cecb329d7.zip">https://blueteamlabs.online/storage/files/00fd9853557296dd3312d4529c137f1cecb329d7.zip</a></p><p>Bruteforce.zip 110 KB — — — — — — — — — → pass : BTLO</p><p>before we start in this challenge and solve questions :</p><p>let’s go to talk about Brute force attack</p><p>Brute Force Attacks: In-Depth Explanation, Examples, and Tools</p><h3>Introduction:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*0RMl89qgjFQbzf55ScnT9g.png" /></figure><p>In the realm of cybersecurity, brute force attacks stand as a prominent threat, posing a significant risk to data integrity and system access. This method involves a systematic, exhaustive approach to cracking passwords, encryption keys, or other authentication mechanisms by attempting every possible combination until the correct one is discovered.</p><h3><strong>How Brute Force Attacks Work:</strong></h3><p>Imagine a combination lock with a set number of digits. A brute force attack would involve trying every possible combination, from 0000 to 9999, until the correct sequence unlocks the lock. This process, while time-consuming, can be automated using powerful computing resources.</p><h3>Common Targets of Brute Force Attacks:</h3><p>- <strong>Passwords</strong>: Passwords serve as the primary gateway to user accounts, making them a prime target for brute force attacks. Hackers may utilize automated tools to test millions of password combinations, including common words, phrases, and easily guessable patterns.<br> <br>- <strong>Encryption Keys</strong>: Encryption keys are crucial for securing sensitive data, and brute force attacks aim to crack these keys to gain unauthorized access. The complexity of the encryption algorithm determines the difficulty of cracking the key.<br> <br>- <strong>Login Attempts</strong>: In some cases, attackers may overwhelm a system with a barrage of login attempts, hoping to trigger account lockouts or consume system resources, disrupting legitimate user access.</p><h3><strong>Brute Force Attacks vs. Dictionary Attacks:</strong></h3><p>While both methods aim to crack passwords, they differ in their approach:</p><p>- <strong>Brute Force Attacks</strong>: These attacks systematically test every possible combination of characters, regardless of their likelihood of being a valid password.<br> <br>- <strong>Dictionary Attacks</strong>: These attacks leverage a list of commonly used passwords or phrases, increasing the probability of success but limiting the scope of possibilities.</p><h3>Protecting Against Brute Force Attacks:</h3><p>To safeguard against brute force attacks, implement robust security measures:</p><p>- <strong>Strong Passwords</strong>: Employ strong passwords that incorporate a mix of uppercase and lowercase letters, numbers, and symbols, avoiding easily guessable patterns.<br> <br>- <strong>Two-Factor Authentication (2FA)</strong>: Enable 2FA, which adds an extra layer of security by requiring a secondary verification method, such as a code sent to your phone, in addition to the password.<br> <br>- <strong>Account Lockouts</strong>: Implement account lockouts after a certain number of failed login attempts to prevent attackers from persisting indefinitely.<br> <br>- <strong>Software Updates</strong>: Regularly update software and firmware to patch vulnerabilities that attackers might exploit.</p><h3>Real-World Examples of Brute Force Attacks:</h3><p>- <strong>Data Breaches</strong>: Stolen login credentials from one data breach can be used in brute force attacks against other systems, expanding the attack surface.<br> <br>- <strong>Online Accounts with Weak Security</strong>: Attackers may target online accounts with lax security measures, such as those using default passwords or easily guessable credentials.</p><h3>Brute Force Attack Tools:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pzpgzo2vjkvabS-xgYoXOg.png" /></figure><p>Numerous tools are designed to facilitate brute force attacks, ranging from simple scripts to sophisticated automated frameworks:</p><ul><li><strong>John the Ripper:</strong> A popular open-source password cracking tool that supports various cracking modes, including brute force.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*4eWtd7w2jA9czOe1UBPSMA.png" /></figure><ul><li><strong>Hydra</strong>: A versatile cracking tool capable of attacking a wide range of protocols, including HTTP, FTP, and SSH.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*jY3gb91f11r926IVdEW-yA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*AXVBeRQG63Lajas_DJtJ_Q.png" /></figure><ul><li><strong>Hashcat</strong>: A high-performance password cracking tool that utilizes advanced techniques like GPU acceleration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*de61rlLXWKfyk7qZxqFExw.png" /></figure><h3>Combating Brute Force Attacks:</h3><p>In addition to the preventive measures mentioned earlier, organizations can employ proactive strategies to combat brute force attacks:</p><p>- <strong>Implement Intrusion Detection Systems (IDS)</strong>: IDS monitor network traffic and system activity to identify suspicious patterns that may indicate brute force attempts.<br> <br>- <strong>Utilize Rate Limiting</strong>: Implement rate limiting mechanisms to restrict the number of login attempts or requests from a single source, preventing attackers from overwhelming the system.<br> <br>- <strong>Educate Users</strong>: Train employees on password security practices and raise awareness of the risks associated with brute force attacks.</p><h3>Conclusion:</h3><p>Brute force attacks pose a persistent threat to cybersecurity, but by implementing robust security measures, staying vigilant, and utilizing appropriate tools, organizations and individuals can effectively defend against these attacks and safeguard their valuable data and systems.</p><p>ok, now let’s try to solve questions :</p><p>## Challenge Submission :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*zMPTClu1Tf7ULTx2kbEaPg.png" /></figure><p>Question 1) How many Audit Failure events are there? (Format: Count of Events) _(3 points)_</p><p>Answer : 3103</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_-w-o7mD2dTUSqbnTuP9Q.png" /></figure><p>this text file which we can find logs in it is too long</p><p>so, i choose this to filter logs from this text file (Failure Reason ) by logic we will find it in all Audit Failure events</p><p>```terminal<br>┌──(kali㉿kali)-[~/Desktop]<br>└─$ grep -o “Failure Reason” BTLO_Bruteforce_Challenge.txt | wc -l<br>```</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KxNmNqD3xdiYJa6bLlnqoQ.png" /></figure><p>Question 2) What is the username of the local account that is being targeted? (Format: Username) _(2 points)_</p><p>Answer : administrator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VEZDq7-fumJHAojMuFuJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*hCXcjfUJ2LzEuoZ4MNLBUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EM-AxI_FSC38Q1VnzON0UA.png" /></figure><p>check other logs in txt file you will find administrator in account name</p><p>Question 3) What is the failure reason related to the Audit Failure logs? (Format: String) _(3 points)_</p><p>Answer : Unknown user name or bad password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*RDl5z11UwIMOMfQiinOS8Q.png" /></figure><p>Question 4) What is the Windows Event ID associated with these logon failures? (Format: ID) _(3 points)_</p><p>Answer : 4625</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*FrFa9LUj3kLnMeWHQucgxQ.png" /></figure><p>Question 5) What is the source IP conducting this attack? (Format: X.X.X.X) _(3 points)_</p><p>Answer : 113.161.192.227</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*yS6gwCmhRGkQSDLLAqsNLQ.png" /></figure><p>Question 6) What country is this IP address associated with? (Format: Country) _(3 points)_</p><p>Answer : Vietnam</p><p>we can use ip lookup tool : like that :<br><a href="https://www.iplocation.net/ip-lookup">https://www.iplocation.net/ip-lookup</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*4g5jsw297uKdi0hHf8UszA.png" /></figure><p>Question 7) What is the range of source ports that were used by the attacker to make these login requests? (LowestPort-HighestPort — Ex: 100–541) _(3 points)_</p><p>Answer : 49162–65534</p><p>”Alright, solving this issue hinges on our comprehension of brute force attacks, the information provided to us, and our inferences derived from analyzing the logs.”</p><p>Alright, we aim to identify the scope of ports utilized. Let’s delve into the process of determining the solution approach through the provided images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*FjRs219bwyyFYhyWlrCmPQ.png" /></figure><p>we can find all port numbers in Source port : <br>so , we can use it like (keyword)</p><p>Okay, so we’re going to go through this file and extract another file from it that contains all the port numbers as well as the keyword we chose.</p><p>we can use this command to make that :</p><p>``` terminal</p><p>┌──(kali㉿kali)-[~/Desktop]<br>└─$ cat BTLO_Bruteforce_Challenge.txt | grep “Source Port:” &gt; BTLO_port.txt</p><p>```</p><p>now we can write script by python to check this file <br>and print min_port-Number and max_port-number</p><pre><br>import re<br>def find_min_max_port_numbers(filename):<br> &quot;&quot;&quot;<br> Scans the provided file for occurrences of the phrase &quot;Source Port:&quot;, extracts the following port numbers,<br> and prints the minimum and maximum port numbers found.<br>Args:<br> filename (str): The path to the file containing the port number information.<br> &quot;&quot;&quot;<br>min_port = None<br> max_port = None<br>try:<br> # Open the file in read mode<br> with open(filename, &#39;r&#39;) as f:<br> for line in f:<br> # Find lines containing the phrase &quot;Source Port:&quot; (case-insensitive)<br> if re.search(r&quot;(Source|source) Port\s*:\s*(\d+)&quot;, line, re.IGNORECASE):<br> # Extract the port number following &quot;Source Port:&quot;<br> port_str = re.findall(r&quot;(Source|source) Port\s*:\s*(\d+)&quot;, line, re.IGNORECASE)[0][1]<br># Convert port string to integer (with error handling)<br> try:<br> port = int(port_str)<br> except ValueError:<br> print(f&quot;Invalid port format found in line: {line}&quot;)<br> continue # Skip to the next line if conversion fails<br># Update minimum and maximum ports<br> if min_port is None or port &lt; min_port:<br> min_port = port<br> if max_port is None or port &gt; max_port:<br> max_port = port<br>except FileNotFoundError:<br> print(f&quot;Error: File &#39;{filename}&#39; not found.&quot;)<br> return<br># Print the minimum and maximum port numbers<br> if min_port is not None and max_port is not None:<br> print(f&quot;Minimum source port number: {min_port}&quot;)<br> print(f&quot;Maximum source port number: {max_port}&quot;)<br> else:<br> print(&quot;No source port numbers found in the file.&quot;)<br>if __name__ == &#39;__main__&#39;:<br> filename = &#39;BTLO_port.txt&#39; # Use your actual file name<br> find_min_max_port_numbers(filename)<br></pre><pre>Explanation:</pre><ol><li><strong><em>Import</em></strong><em>:<br></em> <br> — `import re`: This line imports the `re` module, which provides regular expression functionalities used for pattern matching in text.<br><em>2. </em><strong><em>Function Definition</em></strong><em>:<br></em> <br> — `def find_min_max_port_numbers(filename):`: This line defines a function named `find_min_max_port_numbers` that takes a single argument, `filename` (a string representing the path to the file containing port numbers).<br>3. <strong><em>Docstring</em></strong>:<br> <br> — The lines within triple quotes (`”””`) at the beginning of the function define a docstring. It provides a description of the function’s purpose, arguments, and return value (although this function doesn’t explicitly return anything).<br><strong><em>4. Variable Initialization:<br></em></strong> <br> — `min_port = None`: This line initializes a variable called `min_port` to `None`, which will store the minimum port number found in the file.<br> — `max_port = None`: Similar to `min_port`, this variable will store the maximum port number found.<br><strong><em>5. `try-except` Block for File Handling:<br></em></strong> <br> — `try:`: This block attempts to open the file and process its contents.<br> — `with open(filename, ‘r’) as f:`: This line opens the file specified by `filename` in read mode (`’r’`) and assigns it to the variable `f`. The `with` statement ensures that the file is automatically closed after the block ends.<br> — `for line in f:`: This line iterates through each line in the opened file `f`.<br><strong><em>6. Finding Lines with “Source Port:” (Case-Insensitive):<br></em></strong> <br> — `if re.search(r”(Source|source) Port\s*:\s*(\d+)”, line, re.IGNORECASE):`: This line uses the `re.search()` function within an `if` statement:<br> — `r”(Source|source) Port\s*:\s*(\d+)”`: This is a regular expression that searches for lines containing either “Source Port:” or “source port:” (case-insensitive because of `re.IGNORECASE`) followed by optional whitespace (`\s*`), a colon (`:`), more optional whitespace (`\s*`), and then one or more digits (`\d+`) representing the port number captured in the second capturing group (`(\d</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z2eiRGQPLJVOzS3g8nGWmQ.png" /></figure><p>output after run our script is : 49162–65534</p><p>and Done :) THX so much Hackers Mostafa Essam (0xMOSTA) was with you</p><p>see you next challenge ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*7khlagaiIN1IO1WhdVByJA.png" /></figure><p>```terminal<br>| — — MOSTA<br>| — -$exit<br>```<br>bye ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fc479ed815b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Email analysis challenge LetsDefend]]></title>
            <link>https://mosta222.medium.com/email-analysis-challenge-letsdefend-f3ef453efe6b?source=rss-2d7519970ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3ef453efe6b</guid>
            <dc:creator><![CDATA[0xMOSTA]]></dc:creator>
            <pubDate>Thu, 21 Dec 2023 09:34:35 GMT</pubDate>
            <atom:updated>2023-12-21T09:54:47.758Z</atom:updated>
            <content:encoded><![CDATA[<p>Email analysis challenge in LetsDefend</p><p>Link of challenge : <br><a href="https://app.letsdefend.io/challenge/email-analysis">https://app.letsdefend.io/challenge/email-analysis</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c124K2O19lC9125sM-3FgQ.png" /></figure><p>Email Link: [Download](<a href="https://letsdefend-images.s3.us-east-2.amazonaws.com/Challenge/Email-Analysis/BusinessEmail.zip">https://letsdefend-images.s3.us-east-2.amazonaws.com/Challenge/Email-Analysis/BusinessEmail.zip</a>) <br>Password: infected <br> <br>Attachment: [Download](<a href="https://letsdefend-images.s3.us-east-2.amazonaws.com/Challenge/Email-Analysis/united+scientific+equipent.zip">https://letsdefend-images.s3.us-east-2.amazonaws.com/Challenge/Email-Analysis/united+scientific+equipent.zip</a>) <br>Password: infected</p><p>Note : download email and Attachment in your virtual machine.</p><p>Lets go :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*rU12pzMdAlXZ2usq_7AhLQ.png" /></figure><p>ok we got email file and attachment file here <br>which called : BusinessEmail.eml &amp; united scientific equipent.exe</p><p>lets go to solve questions :<br>we open email file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*Ib4tRjgTRoUbO_g8ROElTg.png" /></figure><p>Q1: What is the sending email address? <br>answer : <a href="/service/mailto:yanting@united.com.sg">yanting@united.com.sg</a></p><p>Q2: What is the email address of the recipient?<br>answer : <a href="/service/mailto:admin@malware-traffic-analysis.net">admin@malware-traffic-analysis.net</a></p><p>Q3: What is the subject line of the email?<br>answer : united scientific equipment</p><p>Q4: What date was the Email sent? Date format: MM/DD/YYYY?<br>answer : 02/08/2021</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*ueCnbtm5qb9t9kvaBwzn4w.png" /></figure><p>Q5: What is the originating IP?<br>answer : 71.19.248.52</p><p>Q6: What country is the ip address from?<br>i use online ip lookup tool to get this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-EldHIsXzrRgT0ZfblM82Q.png" /></figure><p>link of tool : <a href="https://www.iplocation.net/ip-lookup">https://www.iplocation.net/ip-lookup</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*ZrKKVOeBpr6qzXz1OJ0aPg.png" /></figure><p>Answer Here is : Canada</p><p>Q7: What is the name of the attachment when you unzip it? (with extension)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*BCA-ZxX4QBG-OQXxUmvjBw.png" /></figure><p>answer : united scientific equipent.exe</p><p>Q8 : What is the sha256 hash of the File?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHV2JTD7gJTmiz2MmCCygA.png" /></figure><p>answer : 9909753bfb0ac8ab165bab3555233d03b01a9274a92e57c022f87ccbe51ca415</p><p>Q9 : Is the email attachment malicious? Yes/No<br>we can get md5 hash or sha256 of attachment file and search by it in virustotal\</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*S6nIDbJf8KXidVSez7hMLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cyu-2DmqtY1fvtukWoEEgA.png" /></figure><p>Answer : Yes</p><p>الحمد لله<br>We have finished. Thank you all. I pray to Allah for your success. Mustafa Essam was with you .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3ef453efe6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>