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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
format PE console 5.0
include 'include/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 wsadata
push 0x202
call [WSAStartup]
mov cx,port
rol cx,8
mov word [my_sockaddr+2],cx
mov [my_sockaddr],AF_INET
push ip_addr
call [inet_addr]
mov dword [my_sockaddr+4],eax
@@:
push NULL
push lpNumberOfBytesWritten
push 2
push lpBuffer
push [hFile]
call [WriteFile]
push 0
push 0
push 0
push 64
push host
push 16
push my_sockaddr
call [getnameinfo]
push eax
push formh
call [printf]
add esp,8
mov edi,host
call strlen
push NULL
push BytesWrite
push eax
push host
push [hFile]
call [WriteFile]
inc byte [my_sockaddr+5]
jnz @b
inc byte [my_sockaddr+4]
jnz @b
push [hFile]
call [CloseHandle]
push 0
call [ExitProcess]
strlen:
xor eax,eax
xor ecx,ecx
not cx
cld
repnz scasb
not cx
dec cx
mov eax,ecx
ret
;--------------------------------------------------
section '.data' data readable writeable
;--------------------------------------------------
wsadata WSADATA
FilePath db 'file.txt',0
hFile dd 0
BytesWrite dd 0
lpBuffer db 13,10
lpNumberOfBytesWritten dd 0
ip_addr db '1.1.1.1',0
my_sockaddr rb 16
host rb 64
port = 13000
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'
import kernel32,\
CreateFile, 'CreateFileA',\
SetFilePointer, 'SetFilePointer',\
WriteFile, 'WriteFile',\
CloseHandle, 'CloseHandle',\
ExitProcess, 'ExitProcess'
import msvcrt,\
printf, 'printf',\
sprintf, 'sprintf'
import user32,\
MessageBox, 'MessageBoxA' ; (tu peux supprimer si non utilisé)
import wsock32,\
WSAStartup, 'WSAStartup',\
inet_addr, 'inet_addr',\
getnameinfo, 'getnameinfo' |
Partager