diff --git a/build/misc.tcl b/build/misc.tcl index 9678b758..63536aa7 100644 --- a/build/misc.tcl +++ b/build/misc.tcl @@ -695,6 +695,10 @@ respond "SUBJECT:" "COOKIE\r" respond "NAME:" "BEAR\r" expect ":KILL" +# Cookie Bear (this one actually works) +respond "*" ":midas eak;ts bear_eak;bear\r" +expect ":KILL" + # LOGOUT TIMES cleanup program. respond "*" ":midas sys3;ts lotcln_sysen1; lotcln\r" expect ":KILL" diff --git a/build/timestamps.txt b/build/timestamps.txt index 42504e28..3c44ce50 100644 --- a/build/timestamps.txt +++ b/build/timestamps.txt @@ -367,6 +367,8 @@ eak/file.2 198102151946.24 eak/lims.7 198304301601.54 eak/limser.19 198304100834.46 eak/macros.36 198007121123.43 +eak/bear.9 198007150232.37 +eak/fscopy.46 197810100208.19 eb/dsk8.33 198105211814.47 eb/errmac.84 198111112102.45 eb/signal.31 198105211819.00 diff --git a/src/eak/bear.9 b/src/eak/bear.9 new file mode 100644 index 00000000..bdde42c0 --- /dev/null +++ b/src/eak/bear.9 @@ -0,0 +1,454 @@ +; -*-MIDAS-*- +TITLE COOKIE BEAR + + +if1 [ +.insrt syseng;$call macro +.insrt eak;macros + +call=:pushj p, +return=:popj p, + +ttyoch==1 ; TTY output channel +clich==2 ; CLI channel +clach==3 ; CLA channel + +disb==t_6+8. ; save ACs T-T2, A-E on interrupt + +] ; end of if1 + + +lpdl==100 ; size of stack +var pdl(lpdl) ; stack + +lcmd==80./5 ; size of command buffer +var cmd(lcmd) ; command buffer + +var mname ; name of machine we're on +var cmdp ; BP into command buffer + +var uname ; our uname +var victim(10.) ; uname of person to bother +var vicl + +litem==40. +var item(litem/5) +var iteml + +ldesc==80. +var desc(ldesc/5) +var descl + + +flag notty ; Set if job doesn't have a TTY + + +bear: move p,[-lpdl,,pdl-1] ; setup stack ptr + .suset [.roption,,f] ; get OPTION variable + tlo f,%opint+%opopc ; turn on new interrupts + .suset [.soption,,f] ; ... + $call sstatu,,[t,t,t,t,t,mname] ; get machine name + .lose %lssys + .open ttyoch,[.uao,,'tty] ; open TTY + tro f,%fnotty ; if no TTY then set bit +; Set default values + move a,[440700,,[ascii "cookie"]] + move b,[440700,,item] + movei c,6 + movem c,iteml + call fscopy + move t,[sixbit /bear/] + movem t,uname + move a,[440700,,[ascii "A VERY HUNGRY BEAR"]] + move b,[440700,,desc] + movei c,18. + movem c,descl + call fscopy +; Read the command line + tlnn f,%opcmd ; superior have command for us? + jrst nocmd ; no, complain + .break 12,[5,,cmd] ; get command line into buffer + move t,[440700,,cmd] ; BP to command buffer + movem t,cmdp +; Process command line + move b,[440700,,victim] ; CASC arg1: BP to victim buffer + movei c,40 ; CASC arg2: delimiter + call casc ; pickup next arg as victim name + jrst nocmd ; no command line, describe ourselves + movem b,vicl ; CASC val: victim name length + move b,[440700,,item] ; CASC arg1: BP to item buffer + movei c,40 ; CASC arg2: delimiter + call casc ; pickup next arg as thing to ask for + jrst bother ; no item, off we go + movem b,iteml ; CASC val: item length + call csix ; pickup next arg as sixbit cookie bear name + jrst bother ; no bear name, off we go + movem b,uname ; CSIX val: sixbit cookie bear name + move b,[440700,,desc] ; CASC arg1: BP to description buffer + movei c,-1 ; CASC arg2: delimiter + call casc ; pickup rest of command line as description + jrst bother ; no description, off we go + movem b,descl ; CASC val: description length + jrst bother + + +; Complain if a user name is not specified. +nocmd: trne f,%fnotty ; do we have a TTY? + jrst quit ; no, just give up if no command line + sout #ttyoch,,"Usage is :BEAR [ [ []]] +" ; explain usage if no command line + jrst quit + + +; Read next arg from command line, convert to sixbit word. Word is returned +; in B. +csix: call arg ; move to next argument on command line + return ; no more, return1 + aos (p) ; there's an arg, use return2 + move c,[440600,,b] ; sixbit BP + movei b,0 ; start off zero sixbit word +cs1: call cmduc ; get next command character + return + cain a,40 ; space? + return + cain a,^Q ; ^Q? + ildb a,cmdp ; yes, quote next character + subi a,40 ; convert from ASCII to SIXBIT + tlne c,760000 ; filled victim yet? + idpb a,c ; no, add this sixbit char + jrst cs1 + + +; Read arg and store as ASCII text. Arg is delimited by an arbitrary +; character. + +; ARGS: VALS: +; B: BP to buffer B: length +; C: delimiter + +casc: call arg ; move to next argument + return ; no more, return1 + movei d,0 ; start character count at zero +ca1: call cmdc ; get next character from command line + jrst ca2 ; no more command line + camn a,c ; delimiter? + jrst ca2 ; yes, stop + cain a,^Q ; quote character? + ildb a,cmdp ; yes, get next character + idpb a,b ; store character in buffer + aoja d,ca1 ; keep character count +ca2: move b,d ; set return val to arg length + aos (p) ; return2 + return + + +; Skip over spaces in command line to get next arg. +arg: call cmdc ; get character + return ; return1 if no more + cain a,40 ; space? + jrst arg + call cmdbu ; backup over character just read + aos (p) ; character not a space, return2 + return + + +cmduc: call cmdc + return + aos (p) + cail a,"a ; lower case? + caile a,"z + return ; no, return + subi a,40 ; convert to upper case + return + +; Get next character from command line. +cmdc: move t,cmdp + ildb a,t ; get character from command line + cain a,^M ; Stop on CR, ^C, or ^_ + return + caie a,^C + cain a,^_ + return + movem t,cmdp + aos (p) ; return2 if not termination character + return + + +; Backup over character just read. +cmdbu: move t,cmdp ; get command BP + add t,[70000,,] ; decrement it + jumpge t,.+2 ; ... + sub t,[430000,,1] ; ... + movem t,cmdp ; set command BP + return + +bother: .close ttyoch, ; no more need for TTY + tlne f,%opddt ; superior DDT? + .value [asciz "15 "] ; if so make us toplevel + .suset [.rsuppro,,a] ; see if we're toplevel + jumpge a,bot1 ; if not then don't try changing UNAME/JNAME + move t,[-8.,,[ + .runame ? move uname + .rxunam ? move uname + .rsname ? move uname + .rjname ? move [sixbit /hactrn/] + ]] + $call usrvar,[#%jself,t] ; give us new UNAME, JNAME etc. + .lose %lssys +bot1: .suset [.simask,,[%picli]] ; turn on CLI interrupts + move c,[-nmsgs,,msgs] ; get AOBJN ptr to list of messages + movei d,45.*30. ; initial wait is 45 seconds +try: call send + move t,d + .sleep t, + subi d,30. + aobjp c,.+1 + aobjn c,try + jrst quit + +xxx=sixbit/>/ +send: $call open,[#clich,[sixbit /dsk/],[sixbit /mail/],[xxx],[sixbit /.mail./]][][#.uao] + jrst [ movei t,60.*30. ; can't send to user so wait + .sleep t, ; one minute and try again + jrst send + ] + sout #clich,,"FROM-PROGRAM:BEAR +FROM-XUNAME:" + move b,uname + call ssix + sout #clich,," +FROM-UNAME:" + move b,uname + call ssix + sout #clich,," +AUTHOR:" + move b,uname + call ssix + sout #clich,," +HEADER-FORCE:NULL +RCPT:(" + move a,[440700,,victim] + move b,vicl + $call siot,[#clich,a,b] + .lose %lssys + sout #clich,," (R-MODE-SEND -1)) +TEXT;-1 +" + sout #clich,,"MESSAGE FROM " + ; send rubout to prevent DDT's MESSAGE FROM ... + move a,[440700,,desc] ; get description + move b,descl ; ... + $call siot,[#clich,a,b] ; put description into msg + .lose %lssys + .iot clich,[15] ; put out CRLF + .iot clich,[12] + move b,uname ; SSIX arg: sixbit word + call ssix ; put our UNAME into msg + .iot clich,["@] ; put @ between UNAME and machine name + move b,mname ; SSIX arg: sixbit word + call ssix ; put machine name into msg + .iot clich,[40] ; a space + .rtime b, ; get current time in SIXBIT + move a,[440600,,b] ; get BP to time + call tdig ; put hours into msg + .iot clich,[":] + call tdig ; put minutes into msg + .iot clich,[":] + call tdig ; put seconds into msg + .iot clich,[40] + move a,0(c) + move b,1(c) +s1: move t1,a + move t2,b +s2: ildb t,t1 + caie t,^X + sojn t2,s2 + exch b,t2 + sub t2,b + $call siot,[#clich,a,t2] + .lose %lssys + jumpe b,s3 + move t1,[440700,,item] + move t2,iteml + $call siot,[#clich,t1,t2] + .lose %lssys + ibp a + soja b,s1 +s3: .close clich, + return + + +ssix: movei a,0 ; clear A for LSHC + lshc a,6 ; get next character of mname + addi a,40 ; convert to ASCII + .iot clich,a ; put into message + jumpn b,ssix ; do until whole name sent + return + + +tdig: ildb t,a + addi t,40 + .iot clich,t + ildb t,a + addi t,40 + .iot clich,t + return + +lclabuf==8 +var clabuf(lclabuf) ; buffer for CLA input +var clacnt ; no. of characters left in buffer +var claend ; end of message reached + +cliint: .open clach,[.bai,,'cla] + jrst dismis + jrst clii7 ; for now + setzm claend + call gcla + addi d,2 ; move BP over first two words + movni t,10. ; subtract 10 from CLACNT since we're skipping + addm t,clacnt ; first two words + move a,clabuf + came a,victim + jrst clscla + move a,clabuf+1 + came a,[sixbit /hactrn/] + jrst clscla +clii1: call getc + jrst clscla + caie a,": + jrst clii1 +clii2: call getc + jrst clscla + caie a,": + jrst clii2 +clii3: call getc + jrst clscla + caie a,40 + jrst clii3 +clii4: call getc + jrst clscla + caie a,15 + cain a,12 + jrst clii4 + cain a,40 + jrst clii4 + move b,[440700,,item] + move c,iteml + jrst clii6 +clii5: call getc + jrst clscla +clii6: ildb t,b + came a,t + jrst clscla + sojn c,clii5 +clii7: .close clach, + movei c,[string "Oh thank you, thank you for giving me ! Goodbye! +"] + call send + jrst quit + +clscla: .close clach, + jrst dismis + +getc: sosl clacnt ; more characters left in buffer? + jrst gc1 + skipe claend ; no, more left to read? + return ; nope, return1 to show end of message + call gcla ; more left to read, fill buffer +gc1: ildb a,d ; get character from buffer + cain a,^C + jrst getc ; ignore ^C's + aos (p) ; return2 + caig a,"z ; lower case? + caige a,"a + return + subi a,40 ; convert to upper case + return + + +gcla: move d,[-lclabuf,,clabuf] ; read in more cruft + .iot clach,d ; ... + movei d,-clabuf(d) ; find no. of words read + caie d,lclabuf ; filled whole buffer? + setom claend ; no, set flag to show end of message read + imuli d,5 ; multiply by five to get character count + movem d,clacnt ; save character count + move d,[440700,,clabuf] ; set BP to beginning of buffer + return + + +dismis: $call dismis,p,,#disb + .lose %lssys + + +.insrt eak;fscopy + +subttl Messages sent to victim + + +; ITEM will be substituted for each . +msgs: string "? +" + string "Will you give me ? +" + string "I want . Please give me ? +" + string "Don't you want to give me ? +" + string "I want ! Please give me . +" + string "Please give me . Any kind is OK with me. +" + string "Aren't you going to give me ? +" + string "I want !!!!!! +" + string "    !!!!! +" + string "You old meany! Come on, give me ! +" + string "!!!!!!!!!!!!!!!! +" + string "You'd better give me , or else! +" + string "You miserable hacker! Give me ! +" + string ", , I want ! +" + string "You better give me , or I'll tell my +uncle GFR on you! (uncle GFR = GR*M F*L* R**P*R) +" + string |&"%$"@*^"@&$%!!!! I WANT !!! GIMME !!! +| + string " +(OR (GIVEP YOU ME '||) + (COND ((ZEROP (BOOLE 1 1 (RANDOM))) + (GFR-DESTROY (DIRECTORY-OF YOU))) + (T (GUN YOU 'HACTRN)))) +" + string "You've got one last chance to give me ! +" + string "OK for you! I don't want  from you anyway! +" + +nmsgs==.-msgs + +subttl End + +quit: .logout 1, ; go away + +intblk: loc 42 + -lintblk,,intblk + +loc intblk + disb,,p + %picli ? 0 ? %picli ? 0 ? cliint +lintblk==.-intblk + + + constants + variables + +pat: patch: block 100 + +end bear diff --git a/src/eak/fscopy.46 b/src/eak/fscopy.46 new file mode 100644 index 00000000..5c51988b --- /dev/null +++ b/src/eak/fscopy.46 @@ -0,0 +1,125 @@ +; -*-MIDAS-*- + +subttl Fast String Copy + +; FSCOPY copies N 7 bit bytes from a source to a destination. Both are +; specified by BPs which will increment to point to the first byte to +; transfer or store into. + +; Arguments: +; A source BP +; B destination BP +; C no. of bytes +; Results: +; A updated source BP +; B updated destination BP + +; Assumes C,D and T1,T2 are contiguous. Clobbers T1 and T2. + +fscopy: caile c,18. ; compare N to breakeven point + jrst fscpy2 ; hairy copy is faster + jumple c,[popj p,] ; N <= 0 does no moving + +; N is less than breakeven point. + +; Use ILDB/IDPB loop. +fscpy1: ildb t1,a ; get byte of source + idpb t1,b ; deposit in destination + sojg c,fscpy1 ; do N bytes + popj p, + +; N greater than breakeven point. +fscpy2: push p,d ; save AC + jumpge b,fsc2 ; if not 440700 then enter byte copy loop + sub b,[430000,,1] ; 440700, convert to 10700 + jrst fsc3 ; skip byte copy loop, we're already there + +; First deposit in destination until destination BP will increment to point +; to the first byte of a word. +fsc1: ildb t1,a ; load byte from source + idpb t1,b ; deposit in destination +fsc2: tlne b,320000 ; ready to increment to new word? + soja c,fsc1 ; decrement count, keep going +; B+1 is now address of next destination word +fsc3: idivi c,5 ; no. of words in C, leftover chars in D + tlnn a,320000 ; source BP 440700 or 10700? + jrst fscblt ; yes, use BLT! + +; Non-BLT copy. + skipn kl10 ; KL10? + jrst fscka ; no, use ACs + move t1,(a) ; read word source BP points to + lsh t1,-1 ; put into low 35 bits + addi a,(c) ; add word count to source BP + addi b,(c) ; add word count to destination BP + hrrm a,fscl+0 ; make MOVE T2,SOURCE+COUNT(C) + hrrm b,fscl+2 ; make MOVEM T1,DESTINATION+COUNT(C) + ldb t2,[360600,,a] ; get bit position from source BP + movei t2,-2(t2) + hrrm t2,fscl+3 + movni t2,-35.(t2) + hrrm t2,fscl+1 + movn c,c ; negate count + aojle c,fscl ; start loop + jrst @fsclt(d) + +; String copy loop. +bvar ; this code is impure!! +fscl: move t2,0(c) + lshc t1,0 ; shift into place + movem t1,0(c) + lshc t1,0 + aojle c,fscl ; increment count, keep going until zero + jrst @fsclt(d) +evar + + +; KA10 version - use ACs. +fscka: addi a,(c) ; add word count to source BP + addi b,(c) ; add word count to destination BP + move t1,[7,,fscacs] + blt t1,fscacs+16-7 + movsi 11,(move 10,0(c)) ; make MOVE T2,SOURCE+COUNT(C) + hrri 11,(a) ; ... + movsi 13,(movem 7,0(c)) ; make MOVEM T1,DESTINATION+COUNT(C) + hrri 13,(b) + ldb 14,[360600,,a] ; get bit position from source BP + add 14,[-1000000] + movni 12,-35.(14) + hrli 12,(lshc 7,) + move 16,[jrst fsck1] + movn c,c ; negate count + move 7,@11 + lsh 7,-1 + move 15,.+1 + aojle c,11 ; start loop +fsck1: move c,[fscacs,,7] + blt c,16 + jrst @fsclt(d) + +var fscacs(16-7+1) ; room to save ACs 7-16 + + +; Use BLT! +fscblt: jumpge a,.+2 ; 10700 or 440700? + sub a,[430000,,1] ; it's 440700, convert to 10700 + movsi t1,1(a) ; BLT AC: source address in LH + hrri t1,1(b) ; and destination address in RH + addi a,(c) ; bump up BP to last word of source + addi b,(c) ; get BLT stop address + blt t1,(b) ; move words from source to destination + jrst @fsclt(d) + +fsclt: fscl0 ? fscl1 ? fscl2 ? fscl3 ? fscl4 + +; Copy remaining bytes to last destination word. +fscl4: ildb t1,a ; load byte from source + idpb t1,b ; deposit byte in destination +fscl3: ildb t1,a ; load byte from source + idpb t1,b ; deposit byte in destination +fscl2: ildb t1,a ; load byte from source + idpb t1,b ; deposit byte in destination +fscl1: ildb t1,a ; load byte from source + idpb t1,b ; deposit byte in destination +fscl0: pop p,d ; restore AC + popj p,