fa
Feedback

فریب کلاهبرداران را نخورید! تل‌متریو این کانال‌ها را شناسایی و برچسب‌گذاری می‌کند 👉 برای مشاهده برچسب، اشتراک تهیه کنید

ReverseEngineering

ReverseEngineering

رفتن به کانال در Telegram
1 730
مشترکین
-124 ساعت
-47 روز
+28230 روز
آرشیو پست ها
Process Tree و Parent-Child Relationship وقتی یه برنامه توی ویندوز اجرا میشه ممکنه خودش برنامه‌ های دیگه‌ای رو هم اجرا کنه این برنامه‌ها هم میتونن دوباره Process های جدیدی بسازن و در نهایت یه ساختار درختی از Process ها به وجود بیاد به این ساختار Process Tree میگیم برای ما شناخت این ساختار اهمیت زیادی داره چون توی خیلی از تکنیک‌ها با ساخت Processهای جدید و کنترل نحوه اجرای اون‌ها سروکار داریم Parent Process و Child Process فرض کنید برنامه Explorer یه برنامه به اسم Notepad رو اجرا میکنه اینجا Explorer میشه Parent Process و Notepad هم Child Process محسوب میشه حالا اگه Notepad هم یه برنامه دیگه رو اجرا کنه اون برنامه فرزند Notepad به حساب میاد ساختار کلی به این شکله
explorer.exe
    |
    └── notepad.exe
            |
            └── child.exe
                    |
                    └── another.exe
هر Process میتونه چندین Child Process داشته باشه و همین موضوع باعث میشه ساختار درختی بزرگ‌تری شکل بگیره ویندوز چطور یه Process جدید ایجاد میکنه یکی از API های مهم ویندوز برای ساخت Process جدید تابع زیر هست
CreateProcessW()
این تابع به برنامه اجازه میده یه Process جدید ایجاد و اجرا کنه ساختار کلی استفاده از این تابع به این شکله
BOOL CreateProcessW(
    LPCWSTR lpApplicationName,
    LPWSTR lpCommandLine,
    LPSECURITY_ATTRIBUTES lpProcessAttributes,
    LPSECURITY_ATTRIBUTES lpThreadAttributes,
    BOOL bInheritHandles,
    DWORD dwCreationFlags,
    LPVOID lpEnvironment,
    LPCWSTR lpCurrentDirectory,
    LPSTARTUPINFOW lpStartupInfo,
    LPPROCESS_INFORMATION lpProcessInformation
);
فعلا لازم نیست تمام پارامترها رو حفظ کنید فقط بهتره با چند مورد مهم‌تر آشنا بشیم موقع ایجاد Process چه اتفاقی میفته؟ وقتی یه برنامه از CreateProcessW استفاده میکنه ویندوز باید چند مرحله رو انجام بده تا Process جدید آماده اجرا بشه به شکل ساده روند کار رو میتونیم اینطوری در نظر بگیریم
Parent Process
      |
      v
CreateProcessW()
      |
      v
Process Creation
      |
      v
Create Initial Thread
      |
      v
Load Executable Image
      |
      v
Initialize Process
      |
      v
Execute Program
این فقط یه نمای ساده از فرآینده در واقع ایجاد Process و آماده‌سازی محیط اجرای اون شامل مراحل داخلی بیشتری توی Windows Kernel و User Mode میشه تفاوت Process و Thread اینجا باید به یه نکته مهم توجه کنیم Process و Thread دو مفهوم متفاوت هستن Process محیط اجرای برنامه رو فراهم میکنه و شامل مواردی مثل فضای آدرس مجازی و منابع و اطلاعات مربوط به خودش میشه اما Thread واحدیه که دستورالعمل‌های برنامه رو اجرا میکنه هر Process حداقل یه Thread اولیه داره که اجرای برنامه از طریق اون شروع میشه
Process
   |
   ├── Thread 1
   |
   ├── Thread 2
   |
   └── Thread 3
پس وقتی یه Process جدید ایجاد میشه ویندوز باید Thread اولیه اون رو هم آماده کنه تا برنامه بتونه اجرا بشه Parent PID هر Process توی ویندوز یه شناسه به اسم PID داره وقتی یه Process جدید ایجاد میشه اطلاعات مربوط به Process والد هم میتونه توی ساختارهای مختلف ویندوز ثبت بشه مثلا:
explorer.exe
PID: 1200
    |
    └── notepad.exe
        PID: 2400
        Parent PID: 1200
توی این مثال مقدار Parent PID در Process فرزند به PID مربوط به Process والد اشاره میکنه اما یه نکته فنی وجود داره Parent PID همیشه لزوما به معنی Process ی نیست که واقعا عملیات ایجاد Process جدید رو انجام داده ویندوز مکانیزم‌ هایی داره که از طریق اون‌ها میشه Process والد ثبت‌شده برای Process جدید رو مشخص کرد برای همین توی تحلیل فنی باید بین Process ی که واقعا Process جدید رو ایجاد کرده و Parent Process ثبت‌شده تفاوت قائل بشیم چرا شناخت این موضوع برای ما مهمه چون توی بعضی از تکنیک‌ها نحوه ایجاد Process ها و ارتباط بین اون‌ها اهمیت زیادی داره مثلا اجرای برنامه‌های فرزند از طریق یه Process موجود ایجاد Process با تنظیمات خاص مدیریت Handleهایی که قابلیت به ارث رسیدن دارن کنترل محیط اجرای Process جدید بررسی ارتباط بین Process ها و Threadها شناخت این مفاهیم پایه کمک میکنه توی مباحث پیشرفته‌تری مثل Process Injection و Process Manipulation بهتر متوجه بشیم ویندوز در پشت صحنه چه اتفاقاتی رو مدیریت میکنه
24 نوامبر, 15:28

How is this done in Ghidra? Once we have identified a potential structure, we can create a new structure definition within the "Data Type Manager" and define its fields. If the variable type and its base address are known, we can assign this structure type to the corresponding variable. This makes the representation of field accesses much more readable. For instance, instead of simply seeing that the program reads data from [rcx+4], we can recognize that it is accessing the second field of the structure. This also simplifies the analysis of subsequent functions, as we no longer need to manually recalculate which part of memory each offset refers to every single time. Exercise: Suppose you encounter the following instructions in a binary file:
mov eax, dword ptr [rbx]
cmp eax, 0 mov ecx, dword ptr [rbx+8] mov byte ptr [rbx+12], 1 Based on these instructions, determine: First, which memory offsets are being accessed, and what is the size of each access? Second, what types of fields might exist at these offsets? Third, why can we not yet state with certainty exactly which fields the original structure contained? The key takeaway here is that in reverse engineering, it is not necessary to know the original structure from the very beginning. By examining the offsets, the sizes of the accesses, and how the data is utilized, we can reconstruct the likely memory structure step-by-step and arrive at a plausible model. @reverseengine
24 نوامبر, 15:04

For example, the compiler may increase the size of the structure to 12 bytes to meet the required alignment. On the other hand, the structure may have more fields that have not yet been accessed in the parts of the program we examined. Therefore, we should try to estimate the actual size of the structure by examining how memory is allocated and using different pointers and offsets.
24 نوامبر, 15:02

Struct Reconstruction When you are reversing a binary file 😂 Usually you don't have access to the original source code and you don't know what structures the programmer used and what fields each structure has Here we have to try to reconstruct the data structures based on how the program accesses memory We call this Struct Reconstruction Assume the original program has the following structure:
struct User {
int id;
int age;
char active;
};
This structure has three fields, one for the user ID, one for the age, and one that indicates the user's active status. But when you examine the compiled file, you may not see any trace of the User name or fields like id and age, and only have assembly instructions that work with memory addresses. So we need to understand what the original structure was like from these instructions. Finding the field addresses Suppose you came across the following instructions in assembly:
mov eax, dword ptr [rcx]
mov edx, dword ptr [rcx+4]
movzx eax, byte ptr [rcx+8]
Let's see what each of these instructions does. The first instruction
mov eax, dword ptr [rcx]
Reads four bytes from the address in RCX The second instruction
mov edx, dword ptr [rcx+4]
Reads four bytes from the address four bytes after the initial address The instruction Third
movzx eax, byte ptr [rcx+8]
Reads a byte from an address eight bytes after the starting address So what we have so far is this
Base address + 0 four bytes
Base address + 4 four bytes
Base address + 8 one byte
This pattern can show that the program is accessing three different fields of a structure Identifying the size and type of fields Based on the size of the accesses, we can guess what type of data each field has For example, a four-byte access could be related to int or float A one-byte access could also be related to char or a boolean value Of course, just looking at the size of the access cannot determine the exact type of data because, for example, a four-byte value could be part of a larger number To better identify it, we need to see what the program does with this value after reading it If the value is used with normal arithmetic instructions, it may be an integer If it is used with instructions related to floating-point operations, it is more likely that we are dealing with a float Can Reconstruct the structure Now, given the information we have obtained, we can construct a possible structure
struct Unknown {
int field_0;
int field_4;
char field_8;
};
For now, we have chosen the names of the fields based on the memory offset because we do not yet know what each one does exactly But we may find out by examining other parts of the program that field_0 is the user ID, field_4 holds the user's age, and field_8 specifies the user's active status So the naming of the fields should be done based on the actual use of the data, not just what we see in the assembly Checking the writing to the fields It is not only the instructions that read information from memory that are important Instructions that write information to memory can also give us good clues For example:
mov dword ptr [rcx], 123
mov dword ptr [rcx+4], 25
mov byte ptr [rcx+8], 1
These instructions write information to offsets zero, four, and eight, respectively If we see in different parts of the program that the same offsets are used for both reading and writing, it is likely that The fields of a structure become larger. Of course, we still need to make sure that RCX is really the base address of a specific structure and does not just point to a part of memory. Finding the actual size of the structure. There is an important point here. The largest offset we find does not necessarily mean the full size of the structure. For example, if the last field starts at offset eight and has a byte of the same size, we need at least 9 bytes of space for these fields. However, the final size of the structure may be larger due to memory alignment rules.
24 نوامبر, 15:02

این کار توی Ghidra چطور انجام میشه بعد از اینکه ساختار احتمالی رو پیدا کردیم میتونیم از بخش Data Type Manager یه ساختار جدید بسازیم و فیلدهاش رو تعریف کنیم بعد اگه نوع متغیر و آدرس پایه مشخص باشه میتونیم نوع ساختار رو به متغیر مربوط اختصاص بدیم تا دسترسی به فیلدها به شکل خواناتری نمایش داده بشه مثلا به‌جای اینکه فقط ببینیم برنامه از [rcx+4] اطلاعات میخونه بتونیم تشخیص بدیم که داره به فیلد دوم ساختار دسترسی پیدا میکنه این کار باعث میشه تحلیل توابع بعدی هم راحت‌تر بشه چون دیگه لازم نیست هر بار از اول حساب کنیم هر آفست به کدوم قسمت حافظه اشاره میکنه تمرین: فرض کنید توی یه فایل باینری به دستورهای زیر رسیدید
mov eax, dword ptr [rbx]
cmp eax, 0
mov ecx, dword ptr [rbx+8]
mov byte ptr [rbx+12], 1
با توجه به این دستورها مشخص کنید اول اینکه چه آفست‌هایی از حافظه استفاده شدن و اندازه هر دسترسی چقدره دوم اینکه چه نوع فیلدهایی ممکنه توی این آفست‌ها وجود داشته باشن سوم اینکه چرا هنوز نمیتونیم با اطمینان بگیم ساختار اصلی دقیقا چه فیلدهایی داشته نکته اصلی این قسمت اینه که توی مهندسی معکوس لازم نیست از همون اول ساختار اصلی رو بدونیم میتونیم با بررسی آفست‌ها و اندازه دسترسی‌ ها و نحوه استفاده از داده‌ ها قدم‌ به‌ قدم ساختار احتمالی حافظه رو بازسازی کنیم و به یه مدل قابل‌ قبول برسیم @reverseengine
24 نوامبر, 14:58

Struct Reconstruction وقتی دارید یه فایل باینری رو برعکس میکنید 😂 معمولا به سورس کد اصلی دسترسی ندارید و نمیدونید برنامه‌نویس از چه ساختار هایی استفاده کرده و هر ساختار چه فیلدهایی داشته اینجا باید از روی نحوه دسترسی برنامه به حافظه سعی کنیم ساختارهای داده رو دوباره بازسازی کنیم به این کار Struct Reconstruction میگیم فرض کنید برنامه اصلی همچین ساختاری داشته:
struct User {
    int id;
    int age;
    char active;
};
این ساختار سه تا فیلد داره که یکی برای شناسه کاربره یکی برای سن و یکی هم وضعیت فعال بودن کاربر رو مشخص میکنه اما وقتی فایل کامپایل شده رو بررسی میکنید ممکنه هیچ اثری از اسم User یا فیلدهایی مثل id و age نبینید و فقط دستورهای اسمبلی رو داشته باشید که با آدرس‌های حافظه کار میکنن پس باید از روی همین دستورها بفهمیم ساختار اصلی چطوری بوده پیدا کردن آدرس فیلدها فرض کنید توی اسمبلی به دستورهای زیر رسیدید
mov eax, dword ptr [rcx]
mov edx, dword ptr [rcx+4]
movzx eax, byte ptr [rcx+8]
بیاید ببینیم هر کدوم از این دستورها چه کاری انجام میدن دستور اول
mov eax, dword ptr [rcx]
چهار بایت از آدرسی که داخل RCX قرار داره میخونه دستور دوم
mov edx, dword ptr [rcx+4]
چهار بایت از آدرسی میخونه که چهار بایت بعد از آدرس اولیه قرار داره دستور سوم
movzx eax, byte ptr [rcx+8]
یک بایت از آدرسی میخونه که هشت بایت بعد از آدرس اولیه قرار گرفته پس چیزی که تا اینجا داریم این شکلیه
آدرس پایه + 0    چهار بایت
آدرس پایه + 4    چهار بایت
آدرس پایه + 8    یک بایت
این الگو میتونه نشون بده که برنامه داره به سه فیلد مختلف از یه ساختار دسترسی پیدا میکنه تشخیص اندازه و نوع فیلدها از روی اندازه دسترسی‌ها میتونیم حدس بزنیم هر فیلد چه نوع داده‌ای داره مثلا دسترسی چهار بایتی میتونه مربوط به int یا float باشه دسترسی یک بایتی هم ممکنه مربوط به char یا یه مقدار بولی باشه البته فقط با دیدن اندازه دسترسی نمیشه نوع دقیق داده رو مشخص کرد چون مثلا یه مقدار چهار بایتی ممکنه بخشی از یه عدد بزرگتر هم باشه برای تشخیص بهتر باید ببینیم برنامه بعد از خوندن این مقدار باهاش چیکار میکنه اگه مقدار با دستورهای محاسباتی معمولی استفاده بشه ممکنه یه عدد صحیح باشه اگه هم با دستورهای مربوط به عملیات ممیز شناور استفاده بشه احتمال اینکه با یه float طرف باشیم بیشتر میشه بازسازی ساختار حالا با توجه به اطلاعاتی که به دست آوردیم میتونیم یه ساختار احتمالی بسازیم
struct Unknown {
    int field_0;
    int field_4;
    char field_8;
};
فعلا اسم فیلدها رو بر اساس آفست حافظه انتخاب کردیم چون هنوز نمیدونیم هر کدوم دقیقا چه کاربردی دارن اما ممکنه با بررسی بخش‌های دیگه برنامه متوجه بشیم که field_0 شناسه کاربره و field_4 سن کاربر رو نگه میداره و field_8 هم وضعیت فعال بودن کاربر رو مشخص میکنه پس اسم‌ گذاری فیلدها باید بر اساس کاربرد واقعی داده‌ها انجام بشه نه فقط چیزی که از روی اسمبلی میبینیم بررسی نوشتن روی فیلدها فقط دستورهایی که از حافظه اطلاعات میخونن مهم نیستن دستورهایی که روی حافظه اطلاعات مینویسن هم میتونن سرنخ‌های خوبی بهمون بدن مثلا:
mov dword ptr [rcx], 123
mov dword ptr [rcx+4], 25
mov byte ptr [rcx+8], 1
این دستورها به‌ترتیب روی آفست‌ های صفر و چهار و هشت اطلاعات مینویسن اگه توی بخش‌ های مختلف برنامه ببینیم که همین آفست‌ ها هم برای خوندن و هم برای نوشتن استفاده میشن احتمال اینکه با فیلدهای یه ساختار طرف باشیم بیشتر میشه البته هنوز باید مطمئن بشیم که RCX واقعا آدرس پایه یه ساختار مشخصه و فقط به یه بخش از حافظه اشاره نمیکنه پیدا کردن اندازه واقعی ساختار اینجا یه نکته مهم وجود داره بزرگ‌ترین آفستی که پیدا میکنیم حتما به معنی اندازه کامل ساختار نیست مثلا اگه آخرین فیلد از آفست هشت شروع بشه و یک بایت هم اندازه داشته باشه حداقل 9 بایت فضا برای این فیلدها نیاز داریم اما اندازه نهایی ساختار ممکنه به خاطر قوانین هم‌ ترازی حافظه یا همون Alignment بیشتر باشه مثلا کامپایلر ممکنه اندازه ساختار رو به 12 بایت برسونه تا هم‌ترازی موردنیاز رعایت بشه از طرف دیگه ممکنه ساختار فیلدهای بیشتری هم داشته باشه که هنوز توی بخش‌هایی از برنامه که بررسی کردیم بهشون دسترسی پیدا نشده برای همین باید با بررسی نحوه تخصیص حافظه و استفاده از اشاره‌گرها و آفست‌های مختلف سعی کنیم اندازه واقعی ساختار رو تخمین بزنیم
24 نوامبر, 14:58

MLFQ Scheduling based on Job Behavior In previous algorithms such as Round Robin, each Process or Job was placed in the ready queue and took turns receiving some CPU time But there was a problem Not all programs behave the same Some programs need the CPU for a long time and perform heavy calculations, while others wait for input and output operations such as reading files or getting information from the network after a small amount of processing So it makes sense that the operating system does not treat both types of programs exactly the same This is where the MLFQ or Multi-Level Feedback Queue algorithm comes in In MLFQ, instead of a single ready queue, we have several queues with different priorities For example, consider the following three levels:
High Priority | v +-------------+ | High Queue | +-------------+ | v +-------------+ | Medium Queue| +-------------+ | v +-------------+ | Low Queue | +-------------+
The higher the priority of a queue Jobs in it get the CPU sooner If several Jobs are in the same priority level, CPU time is usually divided between them using the Round Robin algorithm How does a Job move between queues Suppose a newly executed program In most MLFQ implementations, this program enters the highest priority level first Now the behavior of the program is examined If the program uses up all its CPU time in a level and still needs processing, its priority is reduced and it is moved to a lower queue For example:
New Job | v High Queue | | Uses CPU allotment v Medium Queue | | Uses CPU allotment v Low Queue
This behavior causes programs that constantly need the CPU to be moved to lower queues Difference between CPU-bound and Interactive programs Here we have one of the most interesting parts of MLFQ CPU-bound programs usually use a lot of CPU In contrast, Interactive or I/O-bound programs may wait for a short processing to get information and temporarily exit the Ready state For example:
CPU-bound:
Running -> Running -> Running -> Running | v Lower Priority
I/O-bound:
Running -> Waiting for I/O | v Ready Again
As a result, interactive programs can usually maintain a higher priority and get the CPU again more quickly Of course, this behavior depends on the exact rules of the MLFQ implementation, and simply giving up the CPU every time does not mean maintaining priority Starvation Problem There is a major problem in MLFQ Suppose new jobs with high priority enter the system one after another In this situation, jobs in lower queues may not receive CPU for a very long time This problem is called Starvation One solution to deal with this problem is Priority Boost In this method, the operating system increases the priority of jobs after a certain period of time and moves them back to the highest queue Before Boost:
High Queue Medium Queue Low Queue | | Priority Boost v High Queue
All Jobs In this way, jobs that have been waiting in lower queues for a long time get the opportunity to run the CPU again Difference between MLFQ and Round Robin In Round Robin, jobs are usually within a priority level and take turns with Quantum But in MLFQ, we have several priority levels and the position of jobs changes according to the behavior and amount of CPU consumption The goal of MLFQ is to do proper scheduling without knowing in advance how much CPU each program needs by examining its behavior It is also important to understand these concepts for reverse engineering Because thread scheduling can affect the timing of the program's concurrent behavior and even reproduce some race conditions The important point is that the schedulers of today's operating systems do not use exactly this simple MLFQ model @reverseengine
24 نوامبر, 14:24

MLFQ زمان‌ بندی بر اساس رفتار Job توی الگوریتم‌ های قبلی مثل Round Robin هر Process یا Job داخل صف آماده قرار میگرفت و به نوبت مقداری از زمان CPU رو دریافت میکرد اما یک مشکل وجود داشت همه برنامه‌ ها رفتار یکسانی نداشتن بعضی برنامه‌ ها برای مدت طولانی به CPU نیاز دارن و محاسبات سنگینی انجام میدن بعضی دیگه بعد از مقدار کمی پردازش منتظر عملیات ورودی و خروجی مثل خواندن فایل یا گرفتن اطلاعات از شبکه میمونن پس منطقیه که سیستم‌ عامل با هر دو نوع برنامه دقیقاً یکسان رفتار نکنه اینجاست که الگوریتم MLFQ یا Multi-Level Feedback Queue وارد میشه در MLFQ به جای یک صف آماده چند صف با اولویت‌ های متفاوت داریم برای مثال سه سطح زیر رو در نظر بگیرید:
High Priority
      |
      v
+-------------+
| High Queue  |
+-------------+
      |
      v
+-------------+
| Medium Queue|
+-------------+
      |
      v
+-------------+
| Low Queue   |
+-------------+
هرچه اولویت یک صف بالاتر باشه Job های داخل اون زودتر CPU رو میگیرن اگر چند Job در یک سطح اولویت قرار داشته باشن معمولا با الگوریتم Round Robin بین اونها زمان CPU تقسیم میشه Job چطور بین صف‌ ها جابه‌جا میشه فرض کنید یک برنامه تازه اجرا شده در بیشتر برنامه ها از پیاده‌سازی‌ های MLFQ این برنامه اول وارد بالاترین سطح اولویت میشه حالا رفتار برنامه بررسی میشه اگر برنامه تمام سهم زمانی CPU خودش رو در یک سطح مصرف کنه و همچنان به پردازش نیاز داشته باشه اولویتش کم میشه و به صف پایین‌ تر منتقل میشه برای مثال:
New Job
   |
   v
High Queue
   |
   | Uses CPU allotment
   v
Medium Queue
   |
   | Uses CPU allotment
   v
Low Queue
این رفتار باعث میشه برنامه‌ هایی که دائما به CPU نیاز دارن به مرور به صف‌ های پایین‌تر منتقل بشن تفاوت برنامه‌های CPU-bound و Interactive اینجا یکی از جذاب‌ترین بخش‌های MLFQ رو داریم برنامه‌ های CPU-bound معمولا زمان زیادی از CPU استفاده میکنن در مقابل برنامه‌های Interactive یا I/O-bound ممکنه بعد از یک پردازش کوتاه برای گرفتن اطلاعات منتظر بمونن و موقتا از حالت Ready خارج بشن برای مثال:
CPU-bound:

Running -> Running -> Running -> Running
                |
                v
        Lower Priority

I/O-bound:

Running -> Waiting for I/O
                |
                v
          Ready Again
در نتیجه برنامه‌ های تعاملی معمولا میتونن اولویت بالاتری رو حفظ کنن و سریعتر دوباره CPU رو دریافت کنن البته این رفتار به قوانین دقیق پیاده‌ سازی MLFQ بستگی داره و صرفا هر بار واگذار کردن CPU به معنی حفظ اولویت نیست مشکل Starvation یک مشکل مهم در MLFQ وجود داره فرض کنید پشت سر هم Job های جدیدی با اولویت بالا وارد سیستم بشن در این شرایط ممکنه Job هایی که در صف‌ های پایینتر قرار دارن برای مدت بسیار طولانی CPU دریافت نکنن به این مشکل Starvation گفته میشه یکی از راهکار های مقابله با این مشکل Priority Boost هست در این روش سیستم‌ عامل بعد از گذشت یک بازه زمانی مشخص اولویت Job ها رو بیشتر میکنه و اون‌ ها رو دوباره به بالاترین صف منتقل میکنه
Before Boost:

High Queue
Medium Queue
Low Queue

        |
        | Priority Boost
        v

High Queue
   All Jobs
به این شکل Job هایی که مدت زیادی در صف‌های پایینتر منتظر موندن دوباره فرصت اجرای CPU رو پیدا میکنن تفاوت MLFQ با Round Robin در Round Robin Job ها معمولا داخل یک سطح اولویت قرار دارن و به نوبت Quantum میگیرن اما در MLFQ چند سطح اولویت داریم و جایگاه Job ها با توجه به رفتار و میزان مصرف CPU تغییر میکنه هدف MLFQ اینه که بدون اینکه از قبل بدونیم هر برنامه چقدر به CPU نیاز داره با بررسی رفتار اون زمان‌ بندی مناسبی انجام بدیم برای مهندسی معکوس هم شناخت این مفاهیم مهمه چون زمان‌ بندی Thread ها میتونه روی Timing رفتار هم‌ زمان برنامه و حتی باز تولید بعضی Race Condition ها تأثیر بذاره نکته مهم اینه که Scheduler سیستم‌ عامل‌ های امروزی دقیقا از همین مدل ساده MLFQ استفاده نمیکنن @reverseengine
24 نوامبر, 14:22

A video of the tool I'm going to show you It may not break the giant's horn, but there is a new obfuscator for the AutoIt3 scripting language, which you can see what kind of trouble a dirty code can do to antiviruses. Windows 11 26h2 is the latest update you're seeing. Although I don't think Defender is that powerful, this obfuscator is bypassing its latest update very easily. It works on one of the most famous RAT outputs, 888. I have plans for other languages, but for now we want to continue with this one🤝 @c3000000c3
23 نوامبر, 23:21

Repost from N/a
یه ویدیو از ابزاری که قراره براتون بزارم خیلی شاخ غول شاید نشکنه ولی یه ابفاسکیتور جدید هست برای زبان اسکریپتی AutoIt3 که خب میتونین ببینید چه بلای سر یک کد کثیف از نظر انتی ویروس میاره اونم ویندوز 11 26h2 اخرین اپدیت هست که دارید میبیند هرچند بنظرم دیفندر انچنان قدرتی نداره اما این ابفاسکیتور خیلی ساده اخرین اپدیتش رو داره بایپس میکنه روی یکی از معروف ترین خروجی رت ها یعنی ۸۸۸ برای زبان های دیگه هم برنامه هایی دارم اما فعلا همین مورد رو میخوایم ادامه بدیم🤝 @c3000000c3
23 نوامبر, 23:21

Repost from N/a
زبانش فارسی هست
21 نوامبر, 17:02

Repost from N/a
یه بد افزار تحلیل کردم الان میزارم
21 نوامبر, 17:02

advanced Windows syscall extraction and analysis framework that automatically discovers, documents, and analyzes system calls across all Windows architectures https://github.com/xaitax/NTSleuth
20 نوامبر, 14:20

DBI Sensor built for Process Hooking & Instrumentation. Supports custom IPC channels, Earlybird Injection & more https://github.com/Ryftenius/SKUGGA/
20 نوامبر, 14:20

RESX is a Windows-focused binary analysis and reverse-engineering toolkit written in Rust, built around problems I’ve repeatedly run into while reversing Windows binaries. https://github.com/Ryftenius/RESX
20 نوامبر, 14:20

20 نوامبر, 14:19

A LoRA adapter for Qwen/Qwen3.8-27B, trained with reinforcement learning to work as the model behind the pi coding agent on software-engineering and terminal tasks. https://huggingface.co/harness-hub/Qwen3.8-27B-pi-adapted
20 نوامبر, 14:19

For example short jobs may have to wait for several other jobs even if they could have finished much earlier On the other hand, if the Quantum is too small it will make many Context Switches So Round Robin also has its limitations Relationship with reverse engineering In analyzing multithreaded programs, Round Robin helps to understand an important issue Threads must not have CPU access until the end of a long section of code For example
Thread A | v Running | v Time Quantum Expires | v Preempted | v Thread B v Running
Later Thread A can continue from the same point where it stopped This becomes important when considering the following
Thread Scheduling Race Condition Timing Behavior Synchronization Context Switching
 Of course, real operating system schedulers do not necessarily use simple Round Robin for all threads Round Robin Allocates a Time Quantum to each Job If the Job does not finish within this time, its execution will stop and return to the end of the Ready queue Important concepts
Time Quantum | v Maximum CPU Time Per Turn Preemption | v Stopping Current Job Round Robin | v
Giving Ready Jobs Repeated Turns The main advantage of this algorithm is more appropriate responsiveness and creating regular execution opportunities for ready jobs The main limitations include the Context Switch overhead, dependence on the Quantum value, and its inappropriateness for optimizing Turnaround Time in all situations @reverseengine
20 نوامبر, 14:17

Round Robin And dividing CPU time between processes If we don't know how much CPU time each job needs, how can we give everyone a fair chance to execute? This is where the Round Robin algorithm comes in The main idea of ​​Round Robin In Round Robin, we assign a specific time interval to each job We call this interval Time Slice or Time Quantum For example, suppose Time Quantum is 10ms Each job has a maximum of 10ms to execute. If it does not finish within this time, its execution stops and returns to the end of the Ready queue Then the Scheduler moves on to the next job General structure
Ready Queue | v Job A | v CPU (10ms) | +---- Finished | | | v | Out of queue | +---- Not Finished | v End of queue | v Job B
A simple example We have three jobs
A = 24ms B = 3ms C = 3ms
All logged in at time zero Assuming
Time Quantum = 4ms
Initial queue
A → B → C
Now we start execution Execution A First A runs for 4ms
A Remaining = 20ms
Since it is not finished yet, it goes to the end of the queue
B → C → A
Execution B Now B takes its turn to run Because it only needs 3ms of CPU time before the Quantum runs out, it finishes its work
B Finished Queue C → A Execution C
C also only needs 3ms So its execution also finishes
C
Finished Queue
A
Execution A again Now A gets the CPU again This time it runs for 4ms A Remaining = 16ms Since it is not finished yet, it goes to the end of the queue again Returns Since only A is left, he gets the CPU again next turn Check the full timeline
0 4 7 10 14 18 22 26 30 |----|----|----|----|----|----|----|
A B C A A A A A
In this example A is executed in how many turns B is completed in the first turn C is also completed in the first turn End time of each Job
A = 30ms B = 7ms C = 10ms
Since everyone enters the system at time zero, the Turnaround Time is equal to the Completion Time of each Job
A = 30ms B = 7ms C = 10ms
Average Turnaround Time (30 + 7 + 10) / 3
= 15.67ms
Note that in this example we assumed that we do not have Context Switch overhead and the initial order of the queue is also specified Why is Round Robin suitable for interactive systems? Suppose several programs are running simultaneously
Browser Terminal Text Editor Music Player
If one program occupies the CPU for a long time, the other programs may not respond properly Round Robin tries to divide the CPU among the ready jobs In this way, each job gets a chance to run in certain time intervals Of course, this does not mean true simultaneous execution on one core But the CPU switches between the jobs very quickly and gives each one a chance to run What is the importance of Time Quantum? One of the most important parameters of Round Robin is the Time Quantum value Suppose
Quantum = 1ms
In this case, the switching becomes more
A → B → C → A → B → C
This can increase the cost of Context Switch Now suppose
Quantum = 1000ms
In this case, each job has a long time in the CPU So the responsiveness to other jobs may be poor So we need to balance between the two issues
Small Quantum | v Shorter Queues | v More Context Switch and Large Quantum | v Longer Queues | v Less Context Switch
As a result, choosing Quantum has a direct impact on the amount of overhead and responsiveness of the system Relationship of Quantum with Response Time Suppose we have N jobs ready to run and all of them are in a Round Robin queue If all jobs are executed to the full Quantum size, in a simple case and assuming no overhead, a job will take its turn to run again after approximately the following time
(N - 1) × Quantum
For example
N = 4 Quantum = 10ms
Then
(4 - 1) × 10 = 30ms
That is, after three more jobs are executed, the first job's turn will come again Of course, this calculation is for simple conditions where the jobs remain ready to run and do not leave the queue before the Quantum ends Is Round Robin always the best choice? No Round Robin Designed for good responsiveness but definitely does not minimize average turnaround time
20 نوامبر, 14:15

مثلا Job های کوتاه ممکنه مجبور بشن منتظر چند Job دیگه بمونن حتی اگر می‌تونستن خیلی زودتر تموم بشن از طرف دیگه اگر Quantum خیلی کوچک باشه Context Switch های زیادی درست میکنه پس Round Robin هم محدودیت‌ های خودش رو داره ارتباط با مهندسی معکوس در تحلیل برنامه‌های چند نخی Round Robin به درک یک موضوع مهم کمک میکنه Thread ها حتما تا اخر اجرای یک بخش طولانی از کد CPU رو در اختیار ندارن مثلا
Thread A
    |
    v
Running
    |
    v
Time Quantum Expires
    |
    v
Preempted
    |
    v
Thread B
    |
    v
Running
بعدا Thread A میتونه از همون نقطه‌ای که متوقف شده بود ادامه بده این موضوع هنگام بررسی موارد زیر اهمیت پیدا میکنه Thread Scheduling Race Condition Timing Behavior Synchronization Context Switching البته Scheduler سیستم‌ عامل‌ های واقعی حتما از Round Robin ساده برای تمام Threadها استفاده نمیکنن Round Robin به هر Job یک Time Quantum اختصاص میده اگر Job در این مدت تموم نشه اجرای اون متوقف میشه و دوباره به انتهای صف Ready برمیگرده مفاهیم مهم
Time Quantum
     |
     v
Maximum CPU Time Per Turn
Preemption
     |
     v
Stopping Current Job
Round Robin
     |
     v
Giving Ready Jobs Repeated Turns
مزیت اصلی این الگوریتم پاسخ‌ گویی مناسب‌تر و ایجاد فرصت اجرای منظم برای Job های آماده هست محدودیت‌های اصلی هم شامل سربار Context Switch وابستگی به مقدار Quantum و نامناسب‌ بودن برای بهینه‌ سازی Turnaround Time در همه شرایط میشه @reverseengine
20 نوامبر, 14:02

ما از کوکی‌ها برای بهبود تجربه مرور شما استفاده می‌کنیم.
با کلیک روی «همگی را قبول می‌کنم»، با سیاست استفاده از کوکی‌ها موافقت می‌کنید.