function accept:integer;stdcall;export;
begin
asm
call x_accept
end;
end;
function bind:integer;stdcall;export;
begin
asm
call x_bind
end;
end;
function closesocket:integer;stdcall;export;
begin
asm
call x_closesocket
end;
end;
function connect:integer;stdcall;export;
begin
asm
call x_connect
end;
end;
function getpeername:integer;stdcall;export;
begin
asm
call x_getpeername
end;
end;
function getsockname:integer;stdcall;export;
begin
asm
call x_getsockname
end;
end;
function getsockopt:integer;stdcall;export;
begin
asm
call x_getsockopt
end;
end;
function htonl:integer;stdcall;export;
begin
asm
call x_htonl
end;
end;
function inet_addr:integer;stdcall;export;
begin
asm
call x_inet_addr
end;
end;
function inet_ntoa:integer;stdcall;export;
begin
asm
call x_inet_ntoa
end;
end;
function ioctlsocket:integer;stdcall;export;
begin
asm
call x_ioctlsocket
end;
end;
function listen:integer;stdcall;export;
begin
asm
call x_listen
end;
end;
function ntohl:integer;stdcall;export;
begin
asm
call x_ntohl
end;
end;
function ntohs:integer;stdcall;export;
begin
asm
call x_ntohs
end;
end;
function recv:integer;stdcall;export;
begin
asm
call x_recv
end;
end;
function recvfrom:integer;stdcall;export;
begin
asm
call x_recvfrom
end;
end;
function select:integer;stdcall;export;
begin
asm
call x_select
end;
end;
function send:integer;stdcall;export;
begin
asm
call x_send
end;
end;
function sendto:integer;stdcall;export;
begin
asm
call x_sendto
end;
end;
function setsockopt:integer;stdcall;export;
begin
asm
call x_setsockopt
end;
end;
function shutdown:integer;stdcall;export;
begin
asm
call x_shutdown
end;
end;
function socket:integer;stdcall;export;
begin
asm
call x_socket
end;
end;
function MigrateWinsockConfiguration:integer;stdcall;export;
begin
asm
call x_MigrateWinsockConfiguration
end;
end;
function gethostbyaddr:integer;stdcall;export;
begin
asm
call x_gethostbyaddr
end;
end;
function gethostbyname:integer;stdcall;export;
begin
asm
call x_gethostbyname
end
end;
function getprotobyname:integer;stdcall;export;
begin
asm
call x_getprotobyname
end;
end;
function getprotobynumber:integer;stdcall;export;
begin
asm
call x_getprotobynumber
end;
end;
function getservbyname:integer;stdcall;export;
begin
asm
call x_getservbyname
end;
end;
function getservbyport:integer;stdcall;export;
begin
asm
call x_getservbyport
end;
end;
function gethostname:integer;stdcall;export;
begin
asm
call x_gethostname
end;
end;
function WSAAsyncSelect:integer;stdcall;export;
begin
asm
call x_WSAAsyncSelect
end;
end;
function WSAAsyncGetHostByAddr:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetHostByAddr
end;
end;
function WSAAsyncGetHostByName:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetHostByName
end;
end;
function WSAAsyncGetProtoByNumber:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetProtoByNumber
end;
end;
function WSAAsyncGetProtoByName:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetProtoByName
end;
end;
function WSAAsyncGetServByPort:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetServByPort
end;
end;
function WSAAsyncGetServByName:integer;stdcall;export;
begin
asm
call x_WSAAsyncGetServByName
end;
end;
function WSACancelAsyncRequest:integer;stdcall;export;
begin
asm
call x_WSACancelAsyncRequest
end;
end;
function WSASetBlockingHook:integer;stdcall;export;
begin
asm
call WSASetBlockingHook
end;
end;
function WSAUnhookBlockingHook:integer;stdcall;export;
begin
asm
call x_WSAUnhookBlockingHook
end;
end;
function WSAGetLastError:integer;stdcall;export;
begin
asm
call x_WSAGetLastError
end;
end;
function WSASetLastError:integer;stdcall;export;
begin
asm
call x_WSASetLastError
end;
end;
function WSACancelBlockingCall:integer;stdcall;export;
begin
asm
call x_WSACancelBlockingCall
end;
end;
function WSAIsBlocking:integer;stdcall;export;
begin
asm
call x_WSAIsBlocking
end;
end;
function WSAStartup:integer;stdcall;export;
begin
asm
call x_WSAStartup
end;
end;
function WSACleanup:integer;stdcall;export;
begin
asm
call x_WSACleanup
end;
end;
function __WSAFDIsSet:integer;stdcall;export;
begin
asm
call x___WSAFDIsSet
end;
end;
function WEP:integer;stdcall;export;
begin
asm
call x_WEP
end;
end;
function WSApSetPostRoutine:integer;stdcall;export;
begin
asm
call x_WSApSetPostRoutine
end;
end;
function inet_network:integer;stdcall;export;
begin
asm
call x_inet_network
end;
end;
function getnetbyname:integer;stdcall;export;
begin
asm
call x_getnetbyname
end;
end;
function rcmd:integer;stdcall;export;
begin
asm
call x_rcmd
end;
end;
function rexec:integer;stdcall;export;
begin
asm
call x_rexec
end;
end;
function rresvport:integer;stdcall;export;
begin
asm
call x_rresvport
end;
end;
function sethostname:integer;stdcall;export;
begin
asm
call x_sethostname
end;
end;
function dn_expand:integer;stdcall;export;
begin
asm
call x_dn_expand
end;
end;
function WSARecvEx:integer;stdcall;export;
begin
asm
call x_WSARecvEx
end;
end;
function s_perror:integer;stdcall;export;
begin
asm
call x_s_perror
end;
end;
function GetAddressByNameA:integer;stdcall;export;
begin
asm
call x_GetAddressByNameA
end;
end;
function GetAddressByNameW:integer;stdcall;export;
begin
asm
call x_GetAddressByNameW
end;
end;
function EnumProtocolsA:integer;stdcall;export;
begin
asm
call x_EnumProtocolsA
end;
end;
function EnumProtocolsW:integer;stdcall;export;
begin
asm
call x_EnumProtocolsW
end;
end;
function GetTypeByNameA:integer;stdcall;export;
begin
asm
call x_GetTypeByNameA
end;
end;
function GetTypeByNameW:integer;stdcall;export;
begin
asm
call x_GetTypeByNameW
end;
end;
function GetNameByTypeA:integer;stdcall;export;
begin
asm
call x_GetNameByTypeA
end;
end;
function GetNameByTypeW:integer;stdcall;export;
begin
asm
call x_GetNameByTypeW
end;
end;
function SetServiceA:integer;stdcall;export;
begin
asm
call x_SetServiceA
end;
end;
function SetServiceW:integer;stdcall;export;
begin
asm
call x_SetServiceW
end;
end;
function GetServiceA:integer;stdcall;export;
begin
asm
call x_GetServiceA
end;
end;
function GetServiceW:integer;stdcall;export;
begin
asm
call x_GetServiceW
end;
end;
function AcceptEx:integer;stdcall;export;
begin
asm
call x_AcceptEx
end;
end;
function GetAcceptExSockaddrs:integer;stdcall;export;
begin
asm
call x_GetAcceptExSockaddrs
end;
end;
LoadLibrary('c:\windows\system32\wsock32.dll');
x_accept:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'accept');
x_bind:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'bind');
x_closesocket:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'closesocket');
x_connect:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'connect');
x_getpeername:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getpeername');
x_getsockname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getsockname');
x_getsockopt:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getsockopt');
x_htonl:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'htonl');
x_inet_addr:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'inet_addr');
x_inet_ntoa:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'inet_ntoa');
x_ioctlsocket:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'ioctlsocket');
x_listen:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'listen');
x_ntohl:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'ntohl');
x_ntohs:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'ntohs');
x_recv:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'recv');
x_recvfrom:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'recvfrom');
x_select:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'select');
x_send:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'send');
x_sendto:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'sendto');
x_setsockopt:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'setsockopt');
x_shutdown:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'shutdown');
x_socket:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'socket');
x_gethostbyaddr:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'gethostbyaddr');
x_MigrateWinsockConfiguration:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'MigrateWinsockConfiguration');
x_gethostbyname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'gethostbyname');
x_getprotobyname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getprotobyname');
x_getprotobynumber:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getprotobynumber');
x_getservbyname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getservbyname');
x_getservbyport:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getservbyport');
x_gethostname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'gethostname');
x_WSAAsyncSelect:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncSelect');
x_WSAAsyncGetHostByAddr:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetHostByAddr');
x_WSAAsyncGetHostByName:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetHostByName');
x_WSAAsyncGetProtoByNumber:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetProtoByNumber');
x_WSAAsyncGetProtoByName:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetProtoByName');
x_WSAAsyncGetServByPort:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetServByPort');
x_WSAAsyncGetServByName:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAAsyncGetServByName');
x_WSACancelAsyncRequest:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSACancelAsyncRequest');
x_WSAUnhookBlockingHook:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAUnhookBlockingHook');
x_WSAGetLastError:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAGetLastError');
x_WSASetLastError:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSASetLastError');
x_WSACancelBlockingCall:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSACancelBlockingCall');
x_WSAIsBlocking:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAIsBlocking');
x_WSAStartup:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSAStartup');
x_WSACleanup:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSACleanup');
x___WSAFDIsSet:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'__WSAFDIsSet');
x_WEP:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WEP');
x_WSApSetPostRoutine:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSApSetPostRoutine');
x_inet_network:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'inet_network');
x_getnetbyname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'getnetbyname');
x_rcmd:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'rcmd');
x_rexec:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'rexec');
x_rresvport:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'rresvport');
x_sethostname:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'sethostname');
x_dn_expand:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'dn_expand');
x_WSARecvEx:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'WSARecvEx');
x_s_perror:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'s_perror');
x_GetAddressByNameA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetAddressByNameA');
x_GetAddressByNameW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetAddressByNameW');
x_EnumProtocolsA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'EnumProtocolsA');
x_EnumProtocolsW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'EnumProtocolsW');
x_GetTypeByNameA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetTypeByNameA');
x_GetTypeByNameW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetTypeByNameW');
x_GetNameByTypeA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetNameByTypeA');
x_GetNameByTypeW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetNameByTypeW');
x_SetServiceA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'SetServiceA');
x_SetServiceW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'SetServiceW');
x_GetServiceA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetServiceA');
x_GetServiceW:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetServiceW');
x_AcceptEx:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'AcceptEx');
x_GetServiceA:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetServiceA');
x_GetAcceptExSockaddrs:= GetProcAddress(GetModuleHandle('c:\windows\system32\wsock32.dll'),'GetAcceptExSockaddrs');
Game访问我的我的DLL->定位WSOCK32.DLL真正的导出函数。
这样写完,测试,会有内存访问异常,我觉得我只完成了一部分,那么还要写点什么?
问题2:
function accept:integer;stdcall;export;
begin
asm
call x_accept
end;
因为有个变量,所以delphi用了push寄存器方式,开辟了一个堆栈,反汇编后,是这样的
009211DC >/$ 55 push ebp
009211DD |. 8BEC mov ebp, esp
009211DF |. 51 push ecx
009211E0 |. FF15 E85D9200 call dword ptr [925DE8]
009211E6 |. 8B45 FC mov eax, dword ptr [ebp-4]
009211E9 |. 59 pop ecx
009211EA |. 5D pop ebp
009211EB \. C3 retn
怎么才能搞成
009211DC > FF15 E85D9200 call dword ptr [925DE8]
[课程]Android-CTF解题方法汇总!