[閒聊] Show IP Orz
連到 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
推
06/06 13:24, , 1F
06/06 13:24, 1F
→
06/06 13:24, , 2F
06/06 13:24, 2F
→
06/06 13:47, , 3F
06/06 13:47, 3F
→
06/06 13:48, , 4F
06/06 13:48, 4F
推
06/07 00:18, , 5F
06/07 00:18, 5F
ASM 近期熱門文章
PTT數位生活區 即時熱門文章