-
Notifications
You must be signed in to change notification settings - Fork 0
/
kill.asm
77 lines (57 loc) · 863 Bytes
/
kill.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
section code vstart=0x200000
[bits 32]
mov ebx,esi ;command line
cld
find:
lodsb
test al,al
jz hint ;no argu show hint
cmp al,0x20
jnz find
;esi -> argu
mov edi,esi
xor edx,edx ;result
getid:
lodsb
test al,0x40
ja .A ;letter
sub al,'0'
js kill ;not number
cmp al,9
ja kill ;not number
.N: ;translate hex
shl edx,4
or dl,al
jmp getid
.A:
and al,0x1F ;toupper
dec al
js kill ;'@' or '`'
cmp al,5
ja kill ;not ABCDEF
add al,0x0A
jmp .N ;translate hex
fail:
mov eax,'fail'
stosd
xor eax,eax
stosd
jmp print
hint:
mov ebx,strhint
jmp print
kill:
push edx ;target ID
mov edx,7
call (5*8):0x0 ;kill
test eax,eax
jz fail
print:
push ebx
xor edx,edx
call (5*8):0x0 ;print
push edx ;0
mov edx,7
call (5*8):0x0 ;kill self
int3 ;never goes here
strhint db 'KILL [hexid]',0