rule win_scanline_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.scanline."
        info = "autogenerated rule brought to you by yara-signator"
        tool = "yara-signator v0.6.0"
        signator_config = "callsandjumps;datarefs;binvalue"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.scanline"
        malpedia_rule_date = "20260916"
        malpedia_hash = "53a643781c18e08f4a50949af60172d837a0b6f6"
        malpedia_version = "20260917"
        malpedia_license = "CC BY-SA 4.0"
        malpedia_sharing = "TLP:WHITE"

    /* DISCLAIMER
     * The strings used in this rule have been automatically selected from the
     * disassembly of memory dumps and unpacked files, using YARA-Signator.
     * The code and documentation is published here:
     * https://github.com/fxb-cocacoding/yara-signator
     * As Malpedia is used as data source, please note that for a given
     * number of families, only single samples are documented.
     * This likely impacts the degree of generalization these rules will offer.
     * Take the described generation method also into consideration when you
     * apply the rules in your use cases and assign them confidence levels.
     */


    strings:
        $sequence_0 = { 7e2f 8d43ff 56 8bf7 894508 }
            // n = 5, score = 100
            //   7e2f                 | jle                 0x31
            //   8d43ff               | lea                 eax, [ebx - 1]
            //   56                   | push                esi
            //   8bf7                 | mov                 esi, edi
            //   894508               | mov                 dword ptr [ebp + 8], eax

        $sequence_1 = { 6a04 53 c745f401000000 ff75fc }
            // n = 4, score = 100
            //   6a04                 | push                4
            //   53                   | push                ebx
            //   c745f401000000       | mov                 dword ptr [ebp - 0xc], 1
            //   ff75fc               | push                dword ptr [ebp - 4]

        $sequence_2 = { 6a04 53 c745f401000000 ff75fc ffd7 668b8622050000 66c745e40200 }
            // n = 7, score = 100
            //   6a04                 | push                4
            //   53                   | push                ebx
            //   c745f401000000       | mov                 dword ptr [ebp - 0xc], 1
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   ffd7                 | call                edi
            //   668b8622050000       | mov                 ax, word ptr [esi + 0x522]
            //   66c745e40200         | mov                 word ptr [ebp - 0x1c], 2

        $sequence_3 = { 8bf1 33ff 397e04 c706???????? 7e63 }
            // n = 5, score = 100
            //   8bf1                 | mov                 esi, ecx
            //   33ff                 | xor                 edi, edi
            //   397e04               | cmp                 dword ptr [esi + 4], edi
            //   c706????????         |                     
            //   7e63                 | jle                 0x65

        $sequence_4 = { 77e4 eb13 84db 740f 8819 41 }
            // n = 6, score = 100
            //   77e4                 | ja                  0xffffffe6
            //   eb13                 | jmp                 0x15
            //   84db                 | test                bl, bl
            //   740f                 | je                  0x11
            //   8819                 | mov                 byte ptr [ecx], bl
            //   41                   | inc                 ecx

        $sequence_5 = { 57 e8???????? ff742410 8b4e0c e8???????? 5f 5e }
            // n = 7, score = 100
            //   57                   | push                edi
            //   e8????????           |                     
            //   ff742410             | push                dword ptr [esp + 0x10]
            //   8b4e0c               | mov                 ecx, dword ptr [esi + 0xc]
            //   e8????????           |                     
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi

        $sequence_6 = { 897508 e8???????? 8d85c8feffff 56 }
            // n = 4, score = 100
            //   897508               | mov                 dword ptr [ebp + 8], esi
            //   e8????????           |                     
            //   8d85c8feffff         | lea                 eax, [ebp - 0x138]
            //   56                   | push                esi

        $sequence_7 = { 83fb40 7cb6 5f 5e 5d 5b c3 }
            // n = 7, score = 100
            //   83fb40               | cmp                 ebx, 0x40
            //   7cb6                 | jl                  0xffffffb8
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5d                   | pop                 ebp
            //   5b                   | pop                 ebx
            //   c3                   | ret                 

        $sequence_8 = { ff15???????? 8b4d0c 6a01 8901 58 5f 5e }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   6a01                 | push                1
            //   8901                 | mov                 dword ptr [ecx], eax
            //   58                   | pop                 eax
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi

        $sequence_9 = { 83ec18 56 8bf1 8b4608 85c0 0f84fe000000 53 }
            // n = 7, score = 100
            //   83ec18               | sub                 esp, 0x18
            //   56                   | push                esi
            //   8bf1                 | mov                 esi, ecx
            //   8b4608               | mov                 eax, dword ptr [esi + 8]
            //   85c0                 | test                eax, eax
            //   0f84fe000000         | je                  0x104
            //   53                   | push                ebx

    condition:
        7 of them and filesize < 151552
}