作者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