rule win_pcshare_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pcshare."
        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.pcshare"
        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 = { eb76 8b4624 33ff 85c0 741a }
            // n = 5, score = 100
            //   eb76                 | jmp                 0x78
            //   8b4624               | mov                 eax, dword ptr [esi + 0x24]
            //   33ff                 | xor                 edi, edi
            //   85c0                 | test                eax, eax
            //   741a                 | je                  0x1c

        $sequence_1 = { 7425 0fb601 0fb6fa 3bc7 7714 8b55fc 8a9250220610 }
            // n = 7, score = 100
            //   7425                 | je                  0x27
            //   0fb601               | movzx               eax, byte ptr [ecx]
            //   0fb6fa               | movzx               edi, dl
            //   3bc7                 | cmp                 eax, edi
            //   7714                 | ja                  0x16
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]
            //   8a9250220610         | mov                 dl, byte ptr [edx + 0x10062250]

        $sequence_2 = { 8b542438 c1e105 8b4c1108 8b5008 81e2ffff2f00 }
            // n = 5, score = 100
            //   8b542438             | mov                 edx, dword ptr [esp + 0x38]
            //   c1e105               | shl                 ecx, 5
            //   8b4c1108             | mov                 ecx, dword ptr [ecx + edx + 8]
            //   8b5008               | mov                 edx, dword ptr [eax + 8]
            //   81e2ffff2f00         | and                 edx, 0x2fffff

        $sequence_3 = { 84c0 741a 3cff 7416 85ed }
            // n = 5, score = 100
            //   84c0                 | test                al, al
            //   741a                 | je                  0x1c
            //   3cff                 | cmp                 al, 0xff
            //   7416                 | je                  0x18
            //   85ed                 | test                ebp, ebp

        $sequence_4 = { 84c0 742e 8b54241c 8b442420 8bce }
            // n = 5, score = 100
            //   84c0                 | test                al, al
            //   742e                 | je                  0x30
            //   8b54241c             | mov                 edx, dword ptr [esp + 0x1c]
            //   8b442420             | mov                 eax, dword ptr [esp + 0x20]
            //   8bce                 | mov                 ecx, esi

        $sequence_5 = { 33c9 3bea 896e24 0f95c1 8bf9 895628 }
            // n = 6, score = 100
            //   33c9                 | xor                 ecx, ecx
            //   3bea                 | cmp                 ebp, edx
            //   896e24               | mov                 dword ptr [esi + 0x24], ebp
            //   0f95c1               | setne               cl
            //   8bf9                 | mov                 edi, ecx
            //   895628               | mov                 dword ptr [esi + 0x28], edx

        $sequence_6 = { 0f8547ffffff 8bc6 8088e184061008 40 3dff000000 72f1 53 }
            // n = 7, score = 100
            //   0f8547ffffff         | jne                 0xffffff4d
            //   8bc6                 | mov                 eax, esi
            //   8088e184061008       | or                  byte ptr [eax + 0x100684e1], 8
            //   40                   | inc                 eax
            //   3dff000000           | cmp                 eax, 0xff
            //   72f1                 | jb                  0xfffffff3
            //   53                   | push                ebx

        $sequence_7 = { 56 57 83c004 8bf9 50 897c2420 e8???????? }
            // n = 7, score = 100
            //   56                   | push                esi
            //   57                   | push                edi
            //   83c004               | add                 eax, 4
            //   8bf9                 | mov                 edi, ecx
            //   50                   | push                eax
            //   897c2420             | mov                 dword ptr [esp + 0x20], edi
            //   e8????????           |                     

        $sequence_8 = { 0fb6c8 42 f681e184061004 7466 837c241c00 7518 }
            // n = 6, score = 100
            //   0fb6c8               | movzx               ecx, al
            //   42                   | inc                 edx
            //   f681e184061004       | test                byte ptr [ecx + 0x100684e1], 4
            //   7466                 | je                  0x68
            //   837c241c00           | cmp                 dword ptr [esp + 0x1c], 0
            //   7518                 | jne                 0x1a

        $sequence_9 = { c6042800 85ff 7447 8b4c2418 }
            // n = 4, score = 100
            //   c6042800             | mov                 byte ptr [eax + ebp], 0
            //   85ff                 | test                edi, edi
            //   7447                 | je                  0x49
            //   8b4c2418             | mov                 ecx, dword ptr [esp + 0x18]

    condition:
        7 of them and filesize < 893708
}