Skip to content

Getting Started

xwings edited this page Jul 6, 2025 · 2 revisions

Getting Started

This guide provides a basic introduction to using the Qiling Framework to emulate a simple program.

Your First Qiling Script

Let's start by emulating a simple "Hello, World!" program for Linux. First, create a file named hello.c with the following content:

#include <stdio.h>

int main() {
    printf("Hello, Qiling!\n");
    return 0;
}

Compile this program for Linux x86_64:

gcc -o hello hello.c

Now, create a Python script named emulate_hello.py to emulate this binary:

from qiling import Qiling

if __name__ == "__main__":
    # Initialize Qiling with the path to the binary and the rootfs
    ql = Qiling(["hello"], "/path/to/your/rootfs/x8664_linux")

    # Run the emulation
    ql.run()

Replace /path/to/your/rootfs/x8664_linux with the actual path to your root filesystem. You can download pre-built root filesystems from the Qiling releases page.

Running the Script

Execute the Python script:

python emulate_hello.py

You should see the following output:

Hello, Qiling!

This demonstrates the basic workflow of using Qiling to emulate a binary. From here, you can explore more advanced features like hooking, debugging, and interacting with the emulated environment.

Clone this wiki locally