-
Notifications
You must be signed in to change notification settings - Fork 0
/
cApp_9.asm
82 lines (70 loc) · 1.43 KB
/
cApp_9.asm
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
.686
.model flat, stdcall
option casemap:none
include std.inc
.data
szTitle db "Asesh", 0h
szChatRoomTitle db "Hackers' lounge:1 -- chat", 0h
szAppTitle1 db "Asesh", 0h
.code
start:
push offset szTitle
call SetConsoleTitle
call main
mainLoop:
push 01Bh
call GetAsyncKeyState
cmp eax, 0h
jne exitMainLoop
push 064h
call Sleep
jmp mainLoop
exitMainLoop:
ret
main proc
local hThread:DWORD
local dwProcessId:DWORD, dwBaseAddress:DWORD, dwBytesRead:DWORD, dwThreadId:DWORD
local context:CONTEXT
mov dwBaseAddress, 40100Ah
lea eax, dwProcessId
push eax
push offset szChatRoomTitle
push 0h
call FindWindow
cmp eax, 0h
je _exit
push eax
call GetWindowThreadProcessId
mov dwThreadId, eax
print chr$("Process id: ")
print str$(dwProcessId)
print chr$(" Thread id: ")
print str$(dwThreadId)
push dwThreadId
push 0h
push THREAD_ALL_ACCESS
call OpenThread
cmp eax, 0h
je _exit
mov hThread, eax
mov context.ContextFlags, CONTEXT_FULL
lea eax, context
push eax
push hThread
call GetThreadContext
cmp eax, 0h
je _exit
mov eax, context.regEip
push eax
print chr$(0Ah, "The value of the specified register: ")
pop eax
print str$(eax)
_exit:
push hThread
call CloseHandle
; push hProcess
; call CloseHandle
xor eax, eax
ret
main endp
end start