[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

318.0. "Find all terminals?" by REGENT::MINOW (Martin Minow -- DECtalk Engineering) Thu Sep 25 1986 19:39

I would like to write a .com file that looks at all terminals
on a system.  The obvious first try,

	$ loop:	device = f$search("TT*:")
	$	if device .eqs. "" then exit
	$	write sys$output device		! to be extended
	$	goto loop

doesn't work -- but I didn't expect it to either.

I'll have privileges on the "real" system, if that helps matters.
All the interesting terminals are hard-wired.

Any suggestions?

T.RTitleUserPersonal
Name
DateLines
318.1Once you've got the PID the world's yours SHEILA::BRODRIBBFri Sep 26 1986 01:059
        $ context = ""
$ start_1:
$ 	pid = f$pid(context)
$ 	if pid .eqs. "" then exit
$ 	term = f$getjpi( pid, "terminal")
$	if term .eqs. "" then goto start_1
$ 	write sys$output "Terminal in use... ", term
$ 	goto start_1

318.2Birds do it, bees do it ...CLT::GILBERTeager like a childFri Sep 26 1986 03:371
    SHOW DEVICE does it.  Duplicate the code, or parse its output.
318.3try this?FROST::HARRIMANDEC 41-BLANK-03, Harriman,Paul J., qty 1Fri Sep 26 1986 17:5350
    try f$getdvi, it has all sorts of things to look for terminals with.
    
    did you want to look at un-allocated terminals? then .1 won't find
    them (un-allocated terminals have no PID's)
    
    anyway, you could try a looping thing if you already know the
    terminal unit/driver (i.e. TTA0, TXB5, TTC3)... Put together a string
    out of the units, and a string version of the channel number, and
    go for it...
    
    $ start:
    $!
    $	unit_list = "A,B,C,D,E,F"
    $   chan_list = "1,2,3,4,5,6,7"
    $	unit_count = 1
    $	chan_count = 1
    $!
    $ outer_loop:
    $!
    $ 	if unit_count .gt. 6 then goto end_it
    $!
    $ inner_loop:
    $!
    $	if chan_count .gt. 7 then goto reset_loop
    $!
    $	tt_string = "TT" + f$element(unit_count,",",unit_list) -
      			 + f$element(chan_count,",",chan_list)
    $!
    $	whatever = f$getdvi(tt_string,"whatever_you_want")
    $!
    $	write sys$Output whatever
    $!
    $	chan_count = chan_count + 1
    $!
    $ goto inner_loop
    $!
    $ reset_loop:
    $!
    $	unit_count = unit_count + 1
    $	chan_count = 1
    $	goto outer_loop
    $!
    $ end_it:
    $	exit
    
    
    like that, maybe?
    
    /pjh
    
318.4Not all terminals start with TTREGINA::OSMANand silos to fill before I feep, and silos to fill before I feepFri Sep 26 1986 21:014
    Use SHOW DEVICE.  Not all terminals start with "TT" necessarily.
    Use F$GETDVI and see if their DEV_CLASS is 66.
    
    /Eric
318.5THEBAY::MTHOMASThe Mad HackerSat Sep 27 1986 20:5144
    Here's a command file I use.  (yet a another hack)  It won't find
    LT or VT terminals, only ones found by SYSGEN AUTO ALL.

$		say = "write sys$output"
$		devmm = "_TX,_TT"
$		devices = 0
$		!
$ next_devmm:	if  devmm .eqs. ""  then goto end
$		dd = f$extract(0,f$locate(",",devmm),devmm)
$		devmm = f$extract(f$locate(",",devmm)+1,f$length(devmm),devmm)
$		c = "A"		! start off fresh
$		!
$ next_cont:	label = "next_devmm"
$		c[0,8] = f$cvui(0,8,c) + 1
$		u = 0
$		!
$ loop:		terminal = dd + c + f$string(u) + ":"
$		if  .not.  f$getdvi(terminal,"exists")  then goto 'label'
$		if  .not.  f$getdvi(terminal,"tt_modem")  then goto next_unit
$		if  .not.  f$getdvi(terminal,"avl")  then goto next_unit
$		!
$		vprot = f$getdvi(terminal,"vprot")
$		prot = f$extract(f$locate("WORLD=",vprot)+6,4,vprot) - "L" - "P"
$		if  "''prot'" .eqs. ""  then goto next_unit
$		!
$		string = " (unallocated)"
$		if  f$getdvi(terminal,"refcnt") .gt. 0  then -
$		    string =	" (allocated to PID "+-
				f$getdvi(terminal,"pid")+-
				")"
$		say  "Found:	"+terminal+string
$		devices = devices + 1
$		!
$ next_unit:	label = "next_cont"
$		u = u + 1
$		goto loop
$		!
$		!
$ end:		if  devices .eq. 0 then goto none
$		say	f$fao("Total:	!UL terminal!%S found.",devices)
$		exit
$		!
$ none:		say	"No terminals where found."
$		exit
318.6OK, but can u tell what modem it is?3984::RUSZKOWSKITrust me, I know what I'm doing. Thu Oct 02 1986 13:4020
    
    	Maybe I should start a new note with this but it is similar.
    
    	Taking the logic one step further here. Does anyone out there
    	have any routine that will fiqure out what is on the other side
    	of the line.
    
    	I need to locate all modems attached to lines, fiqure out what
    	type of modem they are and then determine the baud rate.
    
    
    	I thought about sending a Control B and waiting for ready to
    	indentify DEC modems and sending AT for Hayes compatible. Since
    	this has to be done at each Baud rate it would be nice to see
    	what pitfalls may await me. 
    
    	Anyone out there played with something like this before ?
    
    
    					Steve
318.7UFP::MURPHYRick Murphy WA1SPT/4 341-2985Sun Oct 05 1986 00:097
    If the "lines" are DMF-32's, forget it. You won't get back any response
    from the modem (actually, there will be a response; the DMF will
    send it to the bit-bucket).
    I've written code for MODEM that figures out the mode type (DF03
    vs DF100 series.. you could add Hayes support.) Send me MAIL, or
    grab the sources from MAASWS::SYS$PUBLIC:MODEM040.A, .B.
    	-Rick
318.8Some more ideas....FROST::HARRIMANDEC 41-BLANK-03, Harriman,Paul J., qty 1Tue Oct 07 1986 12:1239
    re: .-2
    
    It really depends what you are looking for. There are a NUMBER of
    different things that can be attached to the other end of the line.
    
    For instance, SET TERM/INQUIRE will usually tell the terminal to
    identify itself and set your terminal characteristics and terminal
    type to some "known" VMS entity. Now if you are trying to tell if
    the "currently connected process" is a dial-in line, you should
    do something like the following:
    
    1) Don't connect your dialin lines to a terminal connection matrix,
    like a MICOM or GANDALF. You lose traceability.
    
    2) If your "lines" are hard-wired to something like a DMF-32, just
    the fact that you are connected to that line should tell you what
    you need to know (what dial-in line are you connected to? It's
    hard-wired!) 
    
    3) Since most times a dialin line group is intended for use on more
    than one machine, we are implementing the following:
    
        a) We are using DECserver's and LAT technology.
    
    	b) We are connecting our dialin lines to specific ports on a
           specific DECserver.
    
    	c) I have a "snoop" which extracts the LTAxxx -> server, port
           names. This runs under LAT+ V1.1 or 1.2. Therefore when a
           user logs in it can be determined if the user is on a dialin
           line.
    
    If you really want to go hog-wild over security, you can get trace-back
    installed on the dialin lines, so you can even tell what number
    dialed into your dial-in lines. We aren't that paranoid, but we
    did want to tell who/what was coming over the dial-in lines.
    
    
    /pjh
318.9finding a DSV Port...LOTUS::ATTWOOLA legend in his own lunch timeTue Oct 14 1986 17:0057
    Subj: Findding LAT Lines  and Decservers Ports..
    
    Here is something i knocked up together in 5 mins to find out which
    decserver/LAT  and which port ( only on DSV's ) people were coming from...
    
     Ok, I know, if they happen to login under a general account you
    can't tell who the Hell they are.. but .. anyway,...
    
    
$	!    
$	! LATPORT jka 14-Oct-86    
$	!
$ assign/user port.out sys$output
$ mc latcp sho port
$	write sys$output "       LAT,DECSERVER USER TRACE FACILTY     "
$open_files:
$	open/read in_port port.out
$port_loop:
$	read/end_of_file=port_eof in_port record_line
$	term_type = f$extract(f$locate("<",record_line) + 1 -
	, f$locate(">",record_line) - f$locate("<",record_line) - 1,record_line)
$
$	lcl_term = f$extract(f$locate("Local Port Name ",record_line) -
	, f$locate("<", record_line ),record_line)
$	lcl_term = f$extract(f$locate("=",lcl_term)+1 -
	, f$locate(":",lcl_term) - f$locate("=",lcl_term)+1,lcl_term)
$	lcl_term = f$edit(lcl_term,"TRIM")
$	if lcl_term .nes. "" then goto display_term
$	rtm_node = f$extract(f$locate("Remote Node Name ",record_line) -
	, 80 ,record_line)
$	rtm_node = f$extract(f$locate("=",rtm_node) + 1 ,50,rtm_node)
$	rtm_node = f$edit(rtm_node,"TRIM")
$	if rtm_node .nes. "" then goto display_node
$	dsv_port = f$extract(f$locate("PORT_",record_line),50,record_line)
$	dsv_port = f$edit(dsv_port,"TRIM")
$	if dsv_port .nes. "" then goto display_port
$	goto port_loop
$display_term:
$	lcl_term = lcl_term - "A"
$	pid = f$getdvi(lcl_term, "PID")
$	if pid .eqs. "" then user = " NO USER "
$	if pid .eqs. "" then goto disp_cont
$	user = f$getjpi( pid ,"USERNAME")
$disp_cont:
$	write sys$output ""
$	write sys$output "Terminal ''lcl_term'  User : ''user' Type: ''term_type'"
$	goto port_loop
$display_node:
$	write sys$output "LAT or DECSERVER device name : ''rtm_node'"
$	goto port_loop
$display_port:
$	write sys$output "DECSERVER Physical port : ''dsv_port'"
$	goto port_loop
$port_eof:
$	close in_port
$	del port.out.
318.10TLA's cause confusionRDGENG::MACKAYKit KyeTue Oct 21 1986 07:514
Re: .-1

The mnemonic "DSV" also stands for a Q-Bus device the DSV11 which is out in 
Field Test - makesure that your TLA's don't cause confusion.
318.11COOKIE::GARDNERWed Nov 05 1986 19:1742
    The following .COM fragment does a "show device", then walks through
    the list of devices and figures out what's there.  As written, it
    recognizes terminals, disks, and workstation interfaces, but can
    be extended to recognize other kinds of devices through suitable
    f$getdvi and/or recognizing device names.
    
    i is a list of uninteresting devices that should be ignored.  It's
    used here to ensure that remote, virtual, and emulated terminals
    are not included in the list of terminals.
    
    One thing to watch out for, on a large macho-Vax the list of disks
    or list of terminals might become longer than the maximum length
    DCL string.  Coping with this is left as an exercise for the reader.
    Also, I've never used this on a cluster, so it probably doesn't
    cope with allocation classes very well.
    
$
$	disks = ""
$	terms = ""
$	qvss = "NO"
$	qdss = "NO"
$
$	i = ":LTA:OPA:RTA:RTB:VTA:TKA:WTA:"
$	show device /output=sys$scratch:configure_system.tmp
$	open/read tmp sys$scratch:configure_system.tmp
$dev_loop:
$	read/end=dev_done tmp lin
$	x = f$locate(":",lin)
$	if x .eq. f$length(lin) then goto dev_loop
$	x = "_" + f$extract(0,x,lin) + ": "
$	y = ":" + f$extract(1,3,x) + ":"
$	if f$locate(y,i) .lt. f$length(i) then goto dev_loop
$	if y .eqs. ":VAA:" then qdss = "YES"
$	if y .eqs. ":VCA:" then qvss = "YES"
$	if f$getdvi(x,"devclass") .eq.  1 then disks = disks + (x-"_")
$	if f$getdvi(x,"devclass") .eq. 66 then terms = terms + (x-"_")
$	goto dev_loop
$
$dev_done:
$	close tmp
$	delete sys$scratch:configure_system.tmp;*
$