SLAM3.025: Debug Script Dumper - Pascal Source Code by Virtual Daemon [SLAM]
Debug Script Dumper - Pascal Source Code
by Virtual Daemon
Yo'! Here's a little pascal source that we'll teach ya' how to build your own program that dumps DEBUG scripts from binary files. I'm releasing this shit, bcoz I've seen only one program that create DEBUG scripts. And that program was made by NoWhere Man (NuKE)... I think you all can guess now why I've made this shit... ;-) Btw: I've tested his program, and I think that my program works a little faster then his! :-P
What is a debug script? Hmmm... A debug script is a file that can be used by DEBUG to create a binary file (what a cool explanation!? ;-).
What does this program? Well, you must enter 2 parameters in the command line: the first parameter is the binary file, and the 2nd the debug script file you wanna create. The debug script file will be built from the binary file. What's the purpose of all this? Well, debug scripts can be used to pratically send virii to BBS systems or via Internet. You don't have to upload anything, you just have to copy the debug scripts in your e-mail. Besides that, there are some virus zines that published during the years virii in debug script format. It's pretty cool, bcoz this way you don't have to distribute source files (if you don't want to) or binary files that a simple user might execute and get infected.
One last note... to build a binary file from a debug script use this:
'DEBUG < debug_script'
where debug_script is your file
That's all I have to say... Enjoy the code! Peace! ;)
{$I-,V-}
Uses Dos,Crt;
Type
BufType=Array[0..63999] Of Byte;
S1=String[4];
S2=String[80];
Var
F:File;
Src:Text;
Buffer:BufType;
FName,SrcName,TmpStr:S2;
MemPos,BufPos:Word;
Read:Word;
I,V:Byte;
Function UpStr(S:S2):S2;
Var I:Byte;
Begin
For I:=0 To Length(S) Do S[I]:=UpCase(S[I]);
UpStr:=S;
End;
Function Hex(Value:Word):S1;
Var
Num:S1;
I:Integer;
Begin
If Value<256 Then Begin
Num[0]:=#2;
Num[1]:=Chr((Lo(Value) Div 16)+48);
Num[2]:=Chr((Lo(Value) Mod 16)+48);
End
Else Begin
Num[0]:=#4;
Num[1]:=Chr((Hi(Value) Div 16)+48);
Num[2]:=Chr((Hi(Value) Mod 16)+48);
Num[3]:=Chr((Lo(Value) Div 16)+48);
Num[4]:=Chr((Lo(Value) Mod 16)+48);
End;
For I:=1 To Length(Num) Do
If (Ord(Num[I]))>57 Then Num[I]:=Chr(Ord(Num[I])+7);
Hex:=Num;
End;
Begin
(* Please use CTRL+Y for the following two "WriteLn" lines... If you don't
know what I'm talking about then read the article about VirCap! ;-)) *)
WriteLn('Debug Script Dumper v1.1, Copyright (c) 1997 by Virtual Daemon');
WriteLn('E-mail adress: virtual_daemon@hotmail.com');
If ParamCount=0 Then Begin
WriteLn('Usage: ',FExpand(ParamStr(0)),' file_name script_name');
WriteLn;
Halt;
End;
FName:=ParamStr(1);
SrcName:=ParamStr(2);
Assign(F,FName);
{$I-}
Reset(F,1);
{$I+}
If IOResult<>0 Then Begin
WriteLn('˛ Error opening file '+FName+'!');
Halt;
End;
Assign(Src,SrcName);
{$I-}
ReWrite(Src);
{$I+}
If IOResult<>0 Then Begin
WriteLn('˛ Error creating file '+SrcName+'!');
Halt;
End;
MemPos:=$0100;
TmpStr:='E '+Hex(MemPos);
I:=0;
Writeln(Src,'N '+UpStr(FName));
Write('Creating debug source ',UpStr(SrcName),'...');
Repeat
BlockRead(F,Buffer,SizeOf(Buffer),Read);
For BufPos:=0 To Read-1 Do Begin
If I Mod 17=16 Then Begin
WriteLn(Src,TmpStr);
TmpStr:='';
Inc(MemPos,I);
I:=0;
TmpStr:='E '+Hex(MemPos);
End;
TmpStr:=TmpStr+' '+Hex(Buffer[BufPos]);
Inc(I);
End;
Until Read<64000;
WriteLn(Src,TmpStr);
Inc(MemPos,I);
WriteLn(Src,'RCX');
WriteLn(Src,Hex(MemPos-$0100));
WriteLn(Src,'W');
WriteLn(Src,'Q');
Close(F);
Close(Src);
WriteLn('<done!>');
End.