# DCprof.ctl:105:Collects the User Profile # $Id: DCprof.ctl,v 1.10 2015/01/14 13:56:38 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OS/DCprof.ctl,v 1.10 2015/01/14 13:56:38 RDA Exp $ # # Change History # 20150113 KRA Include 'User Information' on Windows. =head1 NAME OS:DCprof - Collects the User Profile =head1 DESCRIPTION This module collects the configuration of the user profile. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing OS.PROF module ...',tput('off') # Initialization var $HOME = ${ENV.HOME} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:User Profile' # Load the common macros run RDA:library() =head2 env - Environment Variables Lists defined environment variables. =cut debug ' Inside PROF module, getting environment variables' report env if or(isWindows(),isCygwin()) call writeMsinfo('Environment Variables','SWEnvEnvVars') else {write '---+ Environment Variables' write '|*Variable*|*Value*|' loop $key (grepEnv('.')) write '|',$key,'|',replace(replace(getEnv($key),'\|','|',true),\ '[\012\015]+','%BR%',true),' |' } if isCreated() toc '2:[[',getFile(),'][rda_report][Environment Variables]]' =head1 FOR VMS SYSTEMS =head2 profiles - Profile settings Collects both system and user login scripts and the Oracle environment settings. =cut if isVms() {debug ' Inside PROF module, getting login scripts' report profiles write '---+!! Profile Settings' write $TOC prefix write '---+ SYS$STARTUP:SYLOGIN.COM' call writeFile('SYS$STARTUP:SYLOGIN.COM') if hasOutput(true) write $TOP prefix write '---+ SYS$LOGIN:LOGIN.COM' call writeFile('SYS$LOGIN:LOGIN.COM') if hasOutput(true) write $TOP prefix write '---+ Oracle Environment Settings' if !writeFile('ORACLE_HOME:ORAUSER.COM') # Unix file structure {if getSid(${SET.DB.DB.T_ORACLE_SID/P},${SET.DB.DB.T_DB_NAME/P}) call writeFile(concat('ORA_DB:ORAUSER_',last,'.COM')) } if hasOutput(true) write $TOP if isCreated(true) toc '2:[[',getFile(),'][rda_report][Profile Settings]]' =head2 user - User Information Reports user information. =cut debug ' Inside PROF module, getting user information' report user var $cmd = 'show proc/all' write '---+ User Information' write '---## Using: ',encode($cmd) call writeCommand($cmd) toc '2:[[',getFile(),'][rda_report][User Information]]' } =head1 FOR MICROSOFT WINDOWS SYSTEMS =head2 set - Set Variables Extracts the variables reported by the F command. =cut elsif or(isWindows(),isCygwin()) {debug ' Inside PROF module, getting set variables' report set prefix {write '---+ Set Variables' write '|*Variable*|*Value*|' } if !?testFile('f',$cmd = getGroupFile('D_CWD','cmd.exe')) var $cmd = 'cmd.exe' loop $lin (grepCommand(concat(quote($cmd),' /c set'),'=')) write '|',key($lin),'|',replace(value($lin),'\|','|',true),'|' if isCreated() toc '2:[[',getFile(),'][rda_report][Set Variables]]' =head2 user - User Information Reports user information. =cut debug ' Inside PROF module, getting user information' report user var $pgm = concat(quote($cmd),' /c net user %USERNAME%') write '---+ User Information' write '---## Using: ',encode($pgm) call writeCommand($pgm) toc '2:[[',getFile(),'][rda_report][User Information]]' } =head1 FOR OTHER SYSTEMS =for stopwords Ulimit =head2 ulimit - Ulimit Reports user limits. =cut else {if ?$shl = shell('SHELL') {debug ' Inside PROF module, getting user limits' report ulimit loop $cmd (concat($shl,' -f -c "ulimit -a"'),\ 'csh -f -c limit',\ concat($shl,' -f -c ulimit')) {prefix {write '---+ Ulimit' write '---## Using: ',encode($cmd) } break writeCommand($cmd) } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Ulimit]]' =for stopwords Umask =head2 umask - Umask Reports the user file creation mode mask. =cut debug ' Inside PROF module, getting umask information' report umask loop $cmd (concat($shl,' -f -c umask'),\ 'csh -f -c umask') {prefix {write '---+ Umask' write '---## Using: ',encode($cmd) } break writeCommand($cmd) } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Umask]]' } =head2 profiles - Hidden Files in HOME Lists hidden files in F<$HOME>. =cut debug ' Inside PROF module, listing hidden files in home directory' report profiles prefix write '---+ Home Directory Hidden Files' if statFile('b',grepDir($HOME,'^\.','np')) toc '2:[[',getFile(),'][rda_report][Hidden Files in HOME]]' =pod Handles the hidden files of interest that were found. =cut debug ' Inside PROF module, getting hidden files of interest' pretoc '2:Hidden Files of Interest' call cat_report($HOME,'.alias','dot') call cat_report($HOME,'.cshrc','dot') call cat_report($HOME,'.bashrc','dot') call cat_report($HOME,'.kshrc','dot') call cat_report($HOME,'.login','dot') call cat_report($HOME,'.dtlogin','dot') call cat_report($HOME,'.rhosts','dot') call cat_report($HOME,'.my.cnf','dot','^(\s*password\s*=).*$','%R:PASSWORD%') unpretoc =pod Handles the profile files of interest that were found. =cut debug ' Inside PROF module, getting profile files of interest' pretoc '2:Profile Files of Interest' call cat_report('/etc','profile','etc_') call cat_report($HOME,'.profile','dot') call cat_report($HOME,'.dtprofile','dot') call cat_report($HOME,'.bash_profile','dot') call cat_report('/etc','rc.config','etc_') call cat_report('/etc','config.d','etc_') unpretoc } =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.10: John Whitaker. =item RDA 4.20: Tony Mitri. =item RDA 4.22: Grant Hayden. =item RDA 4.27: Jesper Krogh. =item RDA 8.00: Adriana Dominguez. =item RDA 8.07: Harm ten Napel. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut