source: client/engine/PostConfEAC.lib @ 4e51cb0

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 4e51cb0 was f84f649, checked in by adv <adv@…>, 14 years ago

version1.0.1 $407 funicones EAC acceso registro - seguimiento inicio windows

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2003 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 11.0 KB
Line 
1#!/bin/bash
2
3#         ogLoadHiveWindows int_ndisk int_partiton
4#@brief   Localiza los hive del registro de windows (de sistema y usuarios)
5#@param   int_ndisk      nº de orden del disco
6#@param   int_partition     nº de particion
7#@return 
8#@exception OG_ERR_FORMAT    Formato incorrecto.
9#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
10#@version 0.9 - Adaptación a OpenGNSys.
11#@author  Antonio J. Doblas Viso. Universidad de Málaga
12#@date    2009-09-24
13#*/ ##
14
15
16function ogLoadHiveWindows () {
17# Variables locales.
18local PART DISK
19
20# Si se solicita, mostrar ayuda.
21if [ "$*" == "help" ]; then
22    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition" \
23           "$FUNCNAME 1 1 "
24    return
25fi     
26
27# Error si no se reciben 2 parámetros.
28[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
29
30DISK=$1; PART=$2;
31
32ogDiskToDev $DISK $PART || return $(ogRaiseError $OG_ERR_PARTITION "particion de windows no detectada"; echo $?)
33ogGetOsType $DISK $PART | grep "Windows" || return $(ogRaiseError $OG_ERR_NOTOS "no es windows"; echo $?)
34VERSION=$(ogGetOsVersion $DISK $PART)
35
36if ogGetPath $DISK $PART WINDOWS
37then
38        SYSTEMROOT="Windows"
39elif ogGetPath $DISK $PART WINNT
40then
41        SYSTEMROOT="winnt"
42else
43        return $(ogRaiseError $OG_ERR_NOTOS "version windows no detectada"; echo $?)
44fi
45
46hiveSAM=$(ogGetPath 1 1 /${SYSTEMROOT}/system32/config/SAM) && export hiveSAM || return $(ogRaiseError $OG_ERR_NOTOS " hive SAM  no detectada"; echo $?)
47hiveSYSTEM=$(ogGetPath 1 1 /${SYSTEMROOT}/system32/config/system) && export hiveSYSTEM || return $(ogRaiseError $OG_ERR_NOTOS "hive SYSTEM  no detectada"; echo $?)
48hiveSOFTWARE=$(ogGetPath 1 1 /${SYSTEMROOT}/system32/config/software) && export hiveSOFTWARE || return $(ogRaiseError $OG_ERR_NOTOS "hive SOFTWARE no detectada"; echo $?)
49export TEMPhive=/tmp/tmpregistry
50
51export particion=`ogMount $1 $2`
52mkfifo pipe 2>/dev/null
53declare -i count
54declare -A HivePathUser
55count=3
56LISTUSERS=$(drbl-chntpw -l $hiveSAM | grep RID | awk -F"<" '{print $2}' | awk -F">" '{print $1}')
57for user in $LISTUSERS
58do     
59                if find ${particion}/ -type f -name NTUSER.DAT > pipe| cat pipe | grep $user > /tmp/path.txt.$count
60                then
61                echo pefil de $user encontrado, para utilizar este usuario con funciones utilizar id_hive= $count o \$usuario
62                read camino < /tmp/path.txt.$count
63                echo $camino | sed -e 's/ /\\ /g' > /tmp/path.txt.$count
64                camino2=$(echo $camino | sed -e 's/ /\\ /g')
65                echo $camino2 | sed -e 's/\\/\\\\/g' > /tmp/path.txt.$count
66                export `echo $user=hiveUSER$count`
67                export `echo hiveUSER$count`="$camino2"
68                count=${count}+1
69                fi
70done
71count=0   
72}
73
74
75#         ogUpdateHiveWindows 
76#@brief   Actualiza los hive de windows.
77#@param   int_ndisk       
78#@param   int_partition     
79#@return 
80#@exception OG_ERR_FORMAT    Formato incorrecto.
81#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
82#@version 0.9 - Adaptación a OpenGNSys.
83#@author  Antonio J. Doblas Viso. Universidad de Málaga
84#@date    2009-09-24
85#*/ ##
86
87
88function ogUpdateHiveWindows (){
89# Variables locales.
90local PART DISK FILE
91
92#TODO detectar llamada a ogLoadHiveWindows
93
94# Si se solicita, mostrar ayuda.
95if [ "$*" == "help" ]; then
96    ogHelp "$FUNCNAME" "$FUNCNAME " \
97           "$FUNCNAME  "
98    return
99fi     
100
101echo drbl-chntpw -f $TEMPhive $hiveSAM $hiveSYSTEM $hiveSOFTWARE $hiveUSER3 $hiveUSER4 $hiveUSER5 $hiveUSER6 $hiveUSER7 $hiveUSER8 $hiveUSER9> /tmp/run.sh
102cat /tmp/run.sh
103sh /tmp/run.sh
104rm -fr $TEMPhive
105rm /tmp/run.sh
106
107unset hiveSAM
108unset hiveSYSTEM
109unset hiveSOFTWARE
110unset TEMPhive
111
112}
113
114
115
116function ogHiveNTRunMachine () {
117#echo sintaxis:  PathScripts idScripts
118#echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1
119#echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
120#echo "identifica 0=$hiveSAM 1=$hiveSystem 2=$hiveSoftware 3=$HiveUser3"
121
122local PART DISK FILE
123
124# Si se solicita, mostrar ayuda.
125if [ "$*" == "help" ]; then
126    ogHelp "$FUNCNAME" "$FUNCNAME PathScripts|command keyName " \
127           "$FUNCNAME c:\\\\Windows\\\\crearusuarios.cmd scripts_crearUsuarios "\
128           "$FUNCNAME "cmd /c del c:\ogboot.*" ogcleanboot "\
129           "$FUNCNAME Requiere la previa ejecución de ogLoadHive int_disk int_part"\
130           "$FUNCNAME Despues requiere el ogUpdateHive"
131    return
132fi     
133       
134
135# Error si no se reciben al menos 1 parámetros.
136[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)   
137
138
139cat >> $TEMPhive << EOF
140h 2
141cd \Microsoft\Windows\CurrentVersion\Run
142nv 1 $2
143ed $2
144$1
145EOF
146#ogGetRegistryValue /mnt/sda1 software '\Microsoft\Windows\CurrentVersion\Run\og3'
147}
148
149function ogNTPolUserOn () {
150
151# Si se solicita, mostrar ayuda.
152if [ "$*" == "help" ]; then
153    ogHelp "$FUNCNAME" "$FUNCNAME id_hive_user " \
154           "$FUNCNAME NombreUsuario"\
155           "$FUNCNAME "
156    return
157fi             
158
159drbl-chntpw -l $hiveSAM | grep RID | grep -w $1 || return 22
160
161HIVEID=$(echo ${!1} | tr -d "hiveUSER")
162#echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
163echo $HIVEID
164#cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
165
166cat >> $TEMPhive << EOF
167h $HIVEID
168cd \Control Panel\Desktop
169ed Wallpaper
170C:\\WINDOWS\\fondo.bmp
171
172cd \Software\Microsoft\Windows\CurrentVersion\Policies
173nk Explorer
174cd Explorer
175
176nv 4 NoDesktop
177ed NoDesktop
1781
179
180nv 4 NoSimpleStartMenu
181ed NoSimpleStartMenu
1821
183nv 4 NoWindowsUpdate
184ed NoWindowsUpdate
1851
186
187nv 4 NoSMConfigurePrograms
188ed NoSMConfigurePrograms
1891
190
191nv 4 NoChangeStartMenu
192ed NoChangeStartMenu
1931
194
195nv 4 Intellimenus
196ed Intellimenus
1971
198
199nv 4 NoRun
200ed NoRun
2011
202
203nv 4 NoRecentDocsHistory
204ed NoRecentDocsHistory
2051
206EOF
207}
208
209
210
211
212
213##########################################################
214##########################################################
215#####librerias de PostConfiguracion v0.1para Advanced Deploy enViorenment###########
216# Liberado bajo licencia GPL <http://www.gnu.org/licenses/gpl.html>################
217############# 2008 Antonio Jes�s Doblas Viso  adv@uma.es ##########################
218########### Universidad de Malaga (Spain)############################
219##########################################################
220
221
222
223
224
225function NTChangeName () {
226if [ $# = 0 ]
227then
228echo sintaxis: NTChangeNAME str_$var
229echo ejemplos: NTCHangeName adi${IPcuatro}-xp
230fi
231cat >> $temporal << EOF
232h 1
233ed ControlSet001\Control\ComputerName\ComputerName\ComputerName
234$1
235ed ControlSet001\Services\Tcpip\Parameters\Hostname
236$1
237ed ControlSet001\Services\Tcpip\Parameters\NV Hostname
238$1
239h 2
240cd \Microsoft\Windows NT\CurrentVersion\Winlogon
241ed DefaultDomainName
242$1
243EOF
244}
245
246
247
248function NTSetGroupName () {
249if [ $# = 0 ]
250then
251echo sintaxis: NTSetGroupName str_$var
252echo ejemplos: NTSetGroupName adi
253fi
254cat >> $temporal << EOF
255h 2
256ed \Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName
257$1
258EOF
259}
260
261
262function NTSetOwner (){
263if [ $# = 0 ]
264then
265echo sintaxis: NtSetOwner str_propietario str_organizacion
266echo ejemplos: NTSetOwner eu\ politecnica universidad\ de\ malaga
267fi
268cat >> $temporal << EOF
269h 2
270ed \Microsoft\Windows NT\CurrentVersion\RegisteredOwner
271$1
272ed \Microsoft\Windows NT\CurrentVersion\RegisteredOrganization
273$2
274EOF
275}
276
277
278function NTAutoLogon (){
279if [ $# = 0 ]
280then
281echo sintaxis: Int_Activar Int_nves str_usuario str_passwd str_equipo
282echo ejemplos: 1 2 administrador 3451 $equipo
283echo IMPORTANTE: cuando AutoLogonCount llegue a 0, activa el AutoAdminLogon a 0. Pero no borra los valores de DefaultPassword
284return 2
285fi
286echo la pass es $4
287export temporal=/tmp/tmpregistry
288cat >> $temporal << EOF
289hive 2
290cd \Microsoft\Windows NT\CurrentVersion\Winlogon
291nv 1 AutoAdminLogon
292ed AutoAdminLogon
293$1
294nv 1 AutoLogonCount
295ed AutoLogonCount
296$2
297nv 1 DefaultUserName
298ed DefaultUserName
299$3
300nv 1 DefaultDomainName
301ed DefaultDomainName
302$5
303EOF
304if [ "$4" == none ]
305then
306echo "debe aparecer done" $4
307cat >> $temporal << EOF
308dv DefaultPassword
309
310
311EOF
312else
313cat >> $temporal << EOF
314nv 1 DefaultPassword
315ed DefaultPassword
316$4
317EOF
318fi
319}
320
321function NTStatusRatonTeclado (){
322if [ $# = 0 ]
323then
324echo sintaxis: Int-StatusRaton Int-StatusTeclado
325echo ejemplos:  int=1 activo   int=4 desactivado
326return 2
327fi
328cat >> $temporal << EOF
329hive 1
330cd \ControlSet001\Services\Mouclass
331ed Start
332$1
333cd \ControlSet001\Services\Kbdclass
334ed Start
335$2
336EOF
337}
338
339function NTRunOnceMachine () {
340if [ $# = 0 ]
341then
342echo sintaxis:  PathScripts idScripts
343echo "ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1"
344echo "IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\"
345return 2
346fi
347export temporal=/tmp/tmpregistry
348cat >> $temporal << EOF
349h 2
350cd \Microsoft\Windows\CurrentVersion\RunOnce
351nv 1 $2
352ed $2
353$1
354EOF
355}
356
357function NTRunMachine () {
358if [ $# = 0 ]
359then
360echo sintaxis:  PathScripts idScripts
361echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1
362echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
363return 2
364fi
365export temporal=/tmp/tmpregistry
366cat >> $temporal << EOF
367h 2
368cd \Microsoft\Windows\CurrentVersion\Run
369nv 1 $2
370ed $2
371$1
372EOF
373}
374
375function NTRunUser () {
376if [ $# = 0 ]
377then
378echo sintaxis:  str_PathWINScripts str_idScripts Int_hive||\$usuario
379echo ejemplo:   c:\\\\WINDOSWS\\\\crearusuarios.bat  scripts1 3
380echo IMPORTANTE: el pathWIN debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
381echo IMPORTANTE: el pathLinux si lleva espacios debe escaparse con una barra \\
382echo IMPORTANTE Int_hive: 3 para el primer usuario, 4 para el segundo usuario
383echo requiere export un HiveUser3=/mnt/windows/Document\ and\ Seeting\alumnmos\NTUSER.dat
384return 2
385fi
386cat >> $temporal << EOF
387h $3
388cd \Software\Microsoft\Windows\CurrentVersion\Run
389nv 1 $2
390ed $2
391$1
392EOF
393}
394
395
396
397function NTPolUserOn () {
398if [ $# = 0 ]
399then
400Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
401echo "sintaxis:  Int_hive"
402echo "ejemplo: NTPolUserOn 3"
403echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
404return 2
405fi
406cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
407cat >> $temporal << EOF
408h $1
409cd \Control Panel\Desktop
410ed Wallpaper
411C:\\WINDOWS\\fondo.bmp
412
413cd \Software\Microsoft\Windows\CurrentVersion\Policies
414nk Explorer
415cd Explorer
416
417nv 4 NoDesktop
418ed NoDesktop
4191
420
421nv 4 NoSimpleStartMenu
422ed NoSimpleStartMenu
4231
424nv 4 NoWindowsUpdate
425ed NoWindowsUpdate
4261
427
428nv 4 NoSMConfigurePrograms
429ed NoSMConfigurePrograms
4301
431
432nv 4 NoChangeStartMenu
433ed NoChangeStartMenu
4341
435
436nv 4 Intellimenus
437ed Intellimenus
4381
439
440nv 4 NoRun
441ed NoRun
4421
443
444nv 4 NoRecentDocsHistory
445ed NoRecentDocsHistory
4461
447EOF
448}
449
450function NTPolUserOFF () {
451if [ $# = 0 ]
452then
453Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
454echo "sintaxis:  Int_hive"
455echo "ejemplo: NTPolUserOFF 3"
456echo "IMPORTANTE:  la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
457return 2
458fi
459cat >> $temporal << EOF
460h $1
461cd \Control Panel\Desktop
462ed Wallpaper
463C:\\WINDOWS\\web\\wallpaper\\Felicidad.bmp
464
465cd \Software\Microsoft\Windows\CurrentVersion\
466rdel Policies
467nk Policies
4681
469EOF
470}
471
472
473function NTStatusBootChk () {
474if [ $# = 0 ]
475then
476echo sintaxis: Int-Status
477echo ejemplos:  int=0 desactivado int=1 activado
478return 2
479fi
480[ $1 = 0 ] && valor="none"
481[ $1 = 1 ] && valor="autocheck autochk *"
482cat >> $temporal << EOF
483hive 1
484cd \ControlSet001\Control\Session Manager
485ed BootExecute
486$valor
487--n
488EOF
489}
490
Note: See TracBrowser for help on using the repository browser.