{ Copyright (c) 1989 Epiware Inc. } program coded_entry_sequence;{Release 2.44} {**************************************************************************** ** ** ** Integrated Encoded Personal Computer Entry Program (Cerebrus) ** ** Written by; Prometheus Begun Concluded ** ** Assisted by: Epimetheus April 16, 1989 May 08, 1989 ** ** ** ** This program is designed to protect a personal computer from ** ** unwanted users, hackers, and other pests (young children for example) ** ** It functions much like a Bulletin Board System in that it allows for ** ** a logon procedure, record of users, dates, and times, and easy ** ** communication between users. This is especially handy for multi-user ** ** systems, where the users need to update each other on progress, but ** ** do not want someone to come along and "accidentally" destroy any data ** ** vital to the project. ** ** ** ** You will need these files to run this program from pascal: ** ** CHRNUNIT.TPU RECORD.TXT SSN_FILE.TXT ** ** You will only need the two text files to run it from DOS. ** ** ** ****************************************************************************} uses crt,dos,chrnunit; const tab=' '; type size_ssn=string[10]; size_line=string[60]; size_name=string[40]; var y,pause,lim,x,choice,level_,logons_,t:integer; name:array[1..20]of size_name; ssn:array[1..20]of size_ssn; level:array[1..20]of integer; data:text; logons:array[1..20]of integer; line:array[1..100]of size_line; used_name,name_:string[20]; yesno:string[1]; cont,filespec,ssn_:string[10]; procedure create_file;{generates a file of users} begin write('What is the name of the file you wish to create: '); readln(filespec); assign(data,filespec+'.txt'); rewrite(data); clrscr; write('number of entries: '); readln(lim); writeln(data,lim); for x:=1 to lim do begin write('name[',x,']: '); readln(name[x]); writeln(data,name[x]); write('ssn[',x,']: '); readln(ssn[x]); writeln(data,ssn[x]); write('level[',x,']: '); readln(level[x]); writeln(data,level[x]); write('logons[',x,']: '); readln(logons[x]); writeln(data,logons[x]); end;{for..do loop} close(data); end;{create_file procedure} procedure read_file;{opens the file containing all ssns,names,etc...} begin assign(data,'ssn_file.txt'); reset(data); readln(data,lim); for x:=1 to lim do begin readln(data,name[x]); readln(data,ssn[x]); readln(data,level[x]); readln(data,logons[x]); end;{for..do statement} close(data); end;{read_from_file procedure} procedure journal;{create a journal entry each page 60x40} var lines:byte; dandd:string[40]; begin clrscr; write('journal filename: '); readln(filespec); write('How many lines would you like: '); readln(lines); write('Drive and directory: '); readln(dandd); assign(data,dandd+'\'+filespec+'.doc'); rewrite(data); writeln(data,lines); for x:=1 to lines do begin write(x,': '); readln(line[x]); writeln(data,line[x]); end;{for..do loop} end;{journal procedure} procedure make_record;{makes a data file containing the name, time, and date} begin {of whoever logs on the computer} assign(data,'record.txt'); append(data); writeln(data,name_); writeln(data,ssn_); writeln(data,DateString); writeln(data,TimeString); close(data); end;{make_record procedure} procedure rewrite_file;{changes entries in the file} begin assign(data,'ssn_file.txt'); rewrite(data); writeln(data,lim); for x:=1 to lim do begin writeln(data,name[x]); writeln(data,ssn[x]); writeln(data,level[x]); if (ssn[x]=ssn_) and (t=1) then logons[x]:=logons[x]+1; writeln(data,logons[x]); end;{for..do loop} close(data); end;{rewrite_file procedure} procedure listing;{lists out all of the current users, ssns, levels, and logons} begin clrscr; read_file; for x:=1 to lim do begin gotoxy(1,x); writeln(x,':'); gotoxy(5,x); writeln(name[x]); gotoxy(35,x); writeln(ssn[x]); gotoxy(50,x); writeln(level[x]); gotoxy(55,x); writeln(logons[x]); end;{for..do loop} writeln; if pause<>2 then begin gotoxy(10,lim+3); write('press to continue'); readln; end;{if..then statement} end;{listing proceedure} procedure delete;{removes an entry from the user file} begin pause:=2; listing; gotoxy(10,lim+3); write('which number would you like to delete: '); readln(x); if x=lim then begin lim:=lim-1; rewrite_file; end{then part of the if..then..else statement} else begin name[x]:=name[lim]; ssn[x]:=ssn[lim]; level[x]:=level[lim]; logons[x]:=logons[lim]; lim:=lim-1; rewrite_file; end;{else part of the if..then..else statement} end;{delete procedure} procedure change;{edits one of the entries in the data file} begin pause:=2; listing; gotoxy(10,lim+3); write('which number would you like to edit: '); readln(x); write(' name: '); readln(name[x]); write(' ssn: '); readln(ssn[x]); write(' level: '); readln(level[x]); write('logons: '); readln(logons[x]); rewrite_file; end;{change procedure} procedure append_file;{adds a user to the end of the file} var s:string[10]; n:string[40]; l,ls:integer; begin clrscr; writeln(tab:5,'enter the values to be appended to the list'); assign(data,'ssn_file.txt'); append(data); lim:=lim+1; write('name: '); readln(name[lim]); writeln(data,name[lim]); write('ssn: '); readln(ssn[lim]); writeln(data,ssn[lim]); write('level: '); readln(level[lim]); writeln(data,level[lim]); write('logons: '); readln(logons[lim]); writeln(data,logons[lim]); close(data); rewrite_file; read_file; end;{append_file procedure} procedure sysop_logon;{specialized system operator logon menu} const zero='<0> Exit to DOS'; one='<1> Write Journal Entry'; two='<2> Add to User File'; three='<3> Delete from User File'; four='<4> Change Entry in User File'; five='<5> List Entries in User File'; six='<6> Create a User FIle'; begin repeat clrscr; gotoxy(5,2); writeln(zero); gotoxy(5,3); writeln(one); gotoxy(5,4); writeln(two); gotoxy(5,5); writeln(three); gotoxy(5,6); writeln(four); gotoxy(5,7); writeln(five); gotoxy(5,8); writeln(six); gotoxy(10,10); write('coda> '); t:=2; readln(choice); writeln; write(tab:15,'Are you sure (Y/n): '); readln(yesno); if (yesno<>'n') then begin case choice of 0:halt(0); 1:journal; 2:append_file; 3:delete; 4:change; 5:listing; 6:create_file; end;{case..of decision} end; {if..then statement} until(choice=0); end;{sysop menu procedure} procedure message;{displays end message to regualr user} begin clrscr; name_:=copy(name_,1,pos(' ',name_)-1); writeln(tab:5,'Welcome to Epiware Inc, ',name_,'. Since you might encounter a'); writeln('problem while in DOS simply type "HELP" This will give you a menu driven'); writeln('help system no matter what subdirectory you are in. We at Ratsoft sincerely'); writeln('hope you have a pleasant day.'); write('press any key to continue....'); repeat until keypressed; halt(0); end;{message procedure} procedure logon_allowed;{the intermediary between ssn analysis and execution} begin name_:=name[x]; ssn_:=ssn[x]; level_:=level[x]; logons_:=logons[x]; make_record; rewrite_file; if (level_=5) then sysop_logon else message; end;{logon_allowed procedure} procedure ender;{places illegal entrant in an unbreakable endless loop} const a=1; begin clrscr; writeln('you lied'); while a<>2 do begin delay(1000); end;{while..do statement} end;{ender procedure} procedure second_check;{checks ssn if it thinnks you are an invader} begin for x:=1 to lim do begin if (ssn[x]=ssn_) then logon_allowed; if (x=lim) then ender; end;{for..do loop} end;{ssn_check procedure} procedure invader_check;{message for possible invader or hacker} begin clrscr; writeln(tab:5,'It appears that you have failed your first ssn check. At the'); writeln('this time you will be given one final chance to enter your ssn. If you'); writeln('would like to join the Epiware Inc. User Group, please speak to '); writeln('on of our representatives. Please enter your ssn below.'); writeln;writeln; textcolor(red); write('SSN: '); textcolor(black); readln(ssn_); textcolor(white); second_check; end;{invader_check procedure} procedure ssn_check;{checks to see if the ssn you entered matches any in the} begin {data file} for x:=1 to lim do begin if (ssn[x]=ssn_) then logon_allowed; if (x=lim) then invader_check; end;{for..do loop} end;{ssn_check procedure} procedure greeting;{first logon message} begin clrscr; writeln(tab:5,'Welcome to the Epiware Inc IBM AT 80286-6/12. Though we'); writeln('would like to trust everyone who logs on, some people are just...not '); writeln('trustworthy. So, if you would, please enter your social security number'); writeln('in the format 000000000, instead of the usual 000-00-0000.'); writeln;writeln; write(tab:5,'SSN: '); textcolor(black); readln(ssn_); textcolor(white); read_file; ssn_check; end;{greeting procedure} begin{main program} checkbreak:=false; setcbreak(false); t:=1; clrscr; greeting; end.{main program}