1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
format PE console 5.0
include 'include/windows/win32a.inc'
entry start
;--------------------------------------------------
section '.text' code readable executable
;--------------------------------------------------
start:
push NULL
push FILE_ATTRIBUTE_NORMAL
push OPEN_ALWAYS
push NULL
push NULL
push GENERIC_WRITE
push FilePath
call [CreateFile]
mov [hFile],eax
push FILE_END
push 0
push 0
push [hFile]
call [SetFilePointer]
push ip_addr
call [inet_addr]
mov [sockaddr],AF_INET
mov dword [sockaddr+4],eax
@@:
push 0
push 0
push 0
push 64
push host
push 16
push sockaddr
call [getnameinfo]
mov edi,host
call strlen
push NULL
push BytesWrite
push eax
push host
push [hFile]
call [WriteFile]
inc byte [sockaddr+6]
jnz @b
inc byte [sockaddr+5]
jnz @b
push [hFile]
call [CloseHandle]
push 0
call [ExitProcess]
strlen:
xor ecx,ecx
not cx
cld
repnz scasb
not cx
dec cx
mov eax,ecx
ret
;--------------------------------------------------
section '.data' data readable writeable
;--------------------------------------------------
FilePath db 'file.txt',0
hFile dd 0
BytesWrite dd 0
ip_addr db '*.*.*.*',0
sockaddr rb 16
host rb 64
formh db '%08x',13,10,0
formd db '%d',13,10,0
forms db '%s',13,10,0
formc db '%c',13,10,0
;--------------------------------------------------
section '.idata' import data readable writeable
;--------------------------------------------------
library kernel32,'kernel32.dll',\
msvcrt,'msvcrt.dll',\
user32,'user32.dll',\
wsock32,'ws2_32.dll'
include 'include\windows\api\kernel32.inc'
include 'include\windows\api\user32.inc'
include 'include\windows\api\wsock32.inc'
import msvcrt,\
printf,'printf',\
sprintf,'sprintf' |
Partager