-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjohn.asm
202 lines (180 loc) · 2.49 KB
/
john.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
;
; This file is part of John the Ripper password cracker,
; Copyright (c) 1996-98 by Solar Designer
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted.
;
; There's ABSOLUTELY NO WARRANTY, express or implied.
;
.model tiny
.code
.startup
.8086
mov sp,400h
push sp
pop ax
cmp ax,sp
jne No386
.186
push 0F200h
popf
pushf
pop ax
test ax,0F000h
jnz Is386
No386:
mov dx,offset MsgNo386
ShowMsg:
push cs
pop ds
mov ah,9
int 21h
int 20h
Error:
mov dx,offset MsgError
jmp short ShowMsg
Is386:
.386
mov ah,4Ah
mov bx,es
mov bh,-43h
neg bx
int 21h
jc Error
mov ah,48h
mov bx,112*1024/16
int 21h
jc Error
mov es,ax
FillHoles:
mov ah,48h
int 21h
jnc FillHoles
shr bx,1
jnz FillHoles
mov ah,49h
int 21h
jc Error
mov es,word ptr ds:[2Ch]
push es
pop ds
xor di,di
xor ax,ax
mov cx,0FFFCh
Search1:
repne scasb
cmp word ptr [di],100h
loopne Search1
jne Error
lea dx,[di+3]
mov al,'.'
Search2:
repne scasb
cmp dword ptr [di],'MOC'
loopne Search2
jne Error
mov al,'\'
lea cx,[di+2]
sub cx,dx
lea bx,[di-2]
std
repne scasb
mov cx,bx
sub cx,di
cmp cx,5
jb Error
lea bx,[di+2]
push cx
push cs
pop es
mov di,0FFh
mov si,di
sub si,cx
add cs:[80h],cl
sub cx,7Fh
neg cx
segcs
rep movsb
pop cx
mov si,bx
mov di,81h
cld
LinkName:
lodsb
or al,20h
stosb
loop LinkName
mov al,' '
dec di
stosb
mov di,bx
mov dword ptr [di],'NHOJ'
mov dword ptr [di+4],'NIB.'
mov byte ptr [di+8],cl
mov ax,3D00h
int 21h
jc Error2
xchg ax,bx
xor cx,cx
mov dx,14h
mov ax,4200h
int 21h
jc Error2
mov cl,2
mov dx,EntryOfs
push cs
pop ds
mov ah,3Fh
int 21h
jc Error2
xor cx,ax
jnz Error2
mov dx,200h
mov ax,4200h
int 21h
jc Error2
mov ax,cs
add ax,50h
mov al,0F0h
mov es,ax
mov cl,80h
xor si,si
xor di,di
segcs
rep movsw
add ax,10h
mov ds,ax
xor dx,dx
mov ch,8
mov ah,3Fh
int 21h
jc Error2
cmp ax,cx
jne Error2
mov ah,3Eh
int 21h
jc Error2
xor di,di
mov al,0EBh
push es
push ds
pop es
Search3:
repne scasb
cmp dword ptr [di],21CD4AB4h
loopne Search3
pop es
jne Error2
mov byte ptr ds:[di+2],0Ch
push ds
EntryOfs = offset $ + 1
push 8000h
retf
Error2:
jmp Error
MsgNo386:
db 'At least a 386 CPU is required', 13, 10, '$'
MsgError:
db 'Unable to load main program', 13, 10, '$'
end