作者zha0 (zha0)
站内ASM
标题[闲聊] Show IP Orz
时间Wed Jun 6 11:59:41 2007
连到 whatsmyip.org 因为在 title tag 里有 public ip
找到那东东後把他 show 出来 XDXD
XD 最近好像还满喜欢用 ASM 写小程式的 XDXD
.586
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
include wininet.inc
includelib user32.lib
includelib kernel32.lib
includelib wininet.lib
.data
szAgent db 'Orz/1.0', 0
szServerName db "whatsmyip.org", 0
szVerb db "GET", 0
;szObjectName db "", 0
szSearchText db "Your IP is ", 0
.data?
hINet dd ??
hConnect dd ??
hData dd ??
dwRead dd ??
szBuffer db 256 dup (?)
.code
; ---------------------------------------------------------------------------
start:
invoke InternetOpen, addr szAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL,
NULL, 0
or eax, eax
jz error1
mov hINet, eax
invoke InternetConnect, hINet, addr szServerName, 80, NULL, NULL,
INTERNET_SERVICE_HTTP, 0, 0
or eax, eax
jz error2
mov hConnect, eax
;invoke HttpOpenRequest, hConnect, addr szVerb, addr szObjectName,
NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0
invoke HttpOpenRequest, hConnect, addr szVerb, NULL, NULL, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION, 0
or eax, eax
jz error3
mov hData, eax
invoke HttpSendRequest, hData, NULL, 0, NULL, 0
Continue:
invoke InternetReadFile, hData, addr szBuffer, sizeof szBuffer - 1, addr
dwRead
mov esi, offset szSearchText
invoke lstrlen, esi
mov ecx, sizeof szBuffer - 1
sub ecx, eax
mov ebx, offset szBuffer
Increase:
push ecx
mov ecx, eax
mov esi, offset szSearchText
mov edi, ebx
_C: mov dl, byte ptr [esi+ecx-1]
cmp dl, byte ptr [edi+ecx-1]
jnz _F
loop _C
jmp short Found
_F: pop ecx
inc ebx
loop Increase
jmp short NoFound
Found:
add edi, eax
push edi
mov ecx, 12+3 ;000.
mov al, '<'
repnz scasb
mov byte ptr [edi-1], 0
pop edi
invoke MessageBox, NULL, edi, edi, 0
jmp short Finish
NoFound:
mov eax, dwRead
or eax, eax
jz Finish
jmp Continue
Finish:
invoke InternetCloseHandle, hData
error3:
invoke InternetCloseHandle, hConnect
error2:
invoke InternetCloseHandle, hINet
error1:
invoke ExitProcess, NULL
end start
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.64.110.97
1F:推 l71cm:.....(昏倒) 还有这样取本机IP 的 06/06 13:24
2F:→ l71cm:人家网站都说不要这样搞啦... 06/06 13:24
3F:→ zha0:请问一下你在 NAT 下,要怎麽取你外部 IP ?___? 06/06 13:47
4F:→ zha0:我只知道连去外面的方式,我知他网站有写啊,只是写好玩的 !! 06/06 13:48
5F:推 jeunder:你越来越像是在干坏事了 :p 06/07 00:18