|
7123
|
Programación / Scripting / Re: Programa en batch (Herramientas utiles nivel medio-Avanzado)
|
en: 15 Abril 2014, 20:13 pm
|
echo ß contrasena basica de todas las opciones:17 ß echo ß conexiones y composicion de IP "1001.2213.100.0.1" ß echo ß para hack basico y compuesto de cuentas online "http" ß echo ß para hack basico y compuesto de juegos online "shirp" ß echo ß para hack basico y compuesto de conexiones y redes "FTP" ß echo ß ß echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß echo ß (TUS OPCIONES) ß echo ß 1-Servicio de Ping. ß echo ß 2-Servicio de FTP. ß echo ß 3-informacion de sistema ß echo ß 4-informacion de puertos habilitados y desabilitados ß echo ß 5- ß echo ß 6-abrir los registros de hadwares y software(regedit) ß echo ß 7- ß echo ß 8- ß echo ß 9-Aprende a usar FTP, STP Y HTP ß ( Bueno, daré mi crítica constructiva respecto al código, especialmente la parte de arriba que he citado. ) Esto te lo digo sin ánimo de ofender, pero es la verdad, podría darte muchos motivos por el cual el Script no se puede tomar en serio, pero te comentaré la razón principal: Si quieres que alguien te pueda tomar en serio ...como mínimo debes saber de lo que estás hablando, y lo que estás intentando hacer. 1. El rango máximo de una dirección IPv4 es 255.255.255.255, no " 1001.2213.100.0.1" (¿ eso que es?). 2. Los protocolos " STP" y " HTP" no existen, te debes estar refiriendo a " SFTP" y " HTTP". 3. El comando externo FTP.exe de Microsoft no soporta Secure FTP y tampoco existe nada en Batch para manejar HTTP, por lo tanto esa parte del Script es una tontería. 4. La idea de desarrollar un Keylogger en Batch es simplemente absurda (ya sea un Batch-Script híbrido usando VBS) necesitas usar un lenguaje que pueda usar la API de Windows (Ej: VB.NET). 5. Sobre " hack básico" prefiero ahorrarme demasiados comentarios, pero bueno, todo el mundo se lo puede imaginar... Con un ping no haces " hack", la herramienta ping.exe de Microsoft no sirve para hacer un POD ni ningún otro tipo de ataque, ya que solo envia un par de paquetes, no los envía simultaneamente, y los paquetes no están cifrados, el comando externo ping.exe sirve para hacer Ping, nada más. 6. Teniendo en cuenta los puntos que he mencionado, el título que le pusiste al tema es " Herramientas utiles nivel medio-Avanzado", ¿estás hablando en serio?. Me da la sensación de que has tropezado con la peor piedra del camino, esa pieda que te hace creer saber sobre un tema específico a nivel " avanzado". 7. Para desarrollar un Script y/o aplicación a la que se pueda referir como " Utilidad de "hack" básico y herramientas utiles nivel medio-Avanzado", lo último que se debe utilizar es el simple Batch, no está capacitado, debes usar un lenguaje de verdad. 8. Hay un pequeño error de escritura, donde debería poner Hardware pusiste hadwares (otro detalle a mencionar es que el término Hardware es singular, no plurarl), yo no me puedo tomar un código en serio en donde todos los terminos importantes están mal escritos. 9. Dices que para navegar por el menú o usar no se que opciones hay que especificar una contraseña, pero dicha contraseña la especificas claramente en el menú ... eso no tiene ningún sentido. 10. Si esperas que alguien te facilite el 99% de un código incompleto que resultaría muy laborioso (e imposible) entonces este no es el lugar, aquí ayudamos en todo lo posible, pero no hacemos trabajos. Siento decir muchas cosas negativas y ninguna positiva, pero por más que leo el código no puedo encontrar nada positivo y hay ciertas cosas que me sacan de mis casillas, lo siento mucho. Si decides cambiar tu forma de pensar y sobretodo el lenguaje en el que piensas trabajar entonces ya podré decir dos cosas buenas sobre esto, porque por ahora el código "avanzado" no es más que una noobatada cosa sin sentido (no pretendo ofender, me he tomado minutos en escribir este post con la intención de ayudar y abrirte los ojos). PD: El icono se debe usar cuando un tema haya quedado resuelto, no se debe usar al publicar un tema.Saludos!
|
|
|
7125
|
Programación / Scripting / Re: Ayuda con Batch
|
en: 15 Abril 2014, 04:29 am
|
1. Está prohibido los títulos tipo "ayuda", un título debe ser descriptivo, fíjate en la edición del nuevo título.
la pregunta es, como se puede realizar un bat que lea las 6 direcciones de Targets.txt y las ingrese en cada .doc ? No puedes realizar esa operación de esa manera, un documento doc/docx es un archivo binario, no un archivo de texto plano, olvídate del simple Batch. Aquí está explicado el modo de leer un archivo DOC de manera Raw (byte a byte): http://msdn.microsoft.com/en-us/library/gg615596%28v=office.14%29.aspx#UnderstandMS_DOC_ExtractTextNecesitas usar un lenguaje (un lenguaje de verdad, no Batch) orientado a objetos, que esté capacitado para la tarea y utilizaar las Classes que ofrezca el lenguaje, el componene ActiveX de Word o librerías de terceros que sean capaces de manipular documentos de Office, o como última opción puede añadir bytes de forma manual al documentos. VisualBasic.NET sería una gran opción al ser de Microsoft, compatibilidad y sencillez de uso gracias a sus Classes. Otra opción más simple sería usar VisualBasicScript. Add Formatted Text to a Word Document Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.Documents.Add() Set objSelection = objWord.Selection objSelection.Font.Name = "Arial" objSelection.Font.Size = "18" objSelection.TypeText "Network Adapter Report" objSelection.TypeParagraph() objSelection.Font.Size = "14" objSelection.TypeText "" & Date() objSelection.TypeParagraph()
Cabe mencionar que un requisito esencial (a menos que se usen librerías de terceros capacitadas) es disponer de MSWord instalado (instalación original, nada de portables), ya que este te instala los controles ActiveX ( Word.Application) para la manipulación de documentos usando el lenguaje VBS. Yo no tengo el Office instalado porque no me agrada el producto, así que si vas a usar VisualBasicScript yo solo te puedo indicar el modo de leer y procesar las direcciones IP del archivo de texto que las contiene: File = ".\Targets.txt" IPS = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(File, 1).ReadAll, VBCrlf) For Each IP in IPS Wscript.Echo IP Next Wscript.Quit(0)
Saludos
|
|
|
7126
|
Sistemas Operativos / Windows / Re: Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 1)
|
en: 15 Abril 2014, 04:03 am
|
Entonces WAIK es para versiones windows 7 (funciona para ambas arquitecturas??) y WADK es para windows 8 cierto?? creo que podrias enfatizar ese punto en tus puntos explicatorios, pues se me hace algo confuso que paquete utilizar. WAIK es para windows 7 y anteriores por lo tanto no se recomienda el uso para manipular Windows 8, en mi experiencia las herramientas de DISM del WAIK funcionan para Windows 8, pero por ejemplo otras como WSIM indican que el sistema operativo (Windows 8) es incompatible con la versión actual de WSIM. En resumen, si vas a manipular una ISO de Windows 7, usa WAIK, si vas a manipular Windows +8, usa WADK. Sistemas operativos compatibles con la instalación del paquete Windows ADK:• Windows® 8 • Windows® 7 • Windows Vista® • Windows Server® 2008 • Windows Server® 2008 R2 • Windows Server® 2012 Sistemas operativos compatibles con la instalación del paquete Windows AIK (para Windows 7)• Windows 7 • Windows Vista SP1 • Windows Server 2003 with Service Pack 2 • Windows Server 2008 • Windows Server 2008 R2 (funciona para ambas arquitecturas??) Si, traen herramientas de 32 y 64 Bits. estos son los paquetes necesarios para el WAIK con Windows 7? Solo este: The Windows® Automated Installation Kit (AIK) for Windows® 7 Los otros dos que dijiste solo es documentación del paquete. Realmente hay diferencias entre windows 8 y windows 8.1??? Sabes que hay diferencias de opiniones entre todos los que usamos Windows, por mi parte yo valoro a Windows 7 como el SO estándar perfecto para cualquier PC, pero por otro lado en mi caso el SO perfecto para mis necesidades y uso habitual es Windows 8.1. Windows 8.1 es una actualización (no una Upgrade) que se puede conseguir gratis para los que usan Windows 8 (aquí está explicado: http://windows.microsoft.com/en-us/windows-8/update-from-windows-8-tutorial), y como toda actualización que mejora el SO ...conviene tenerla instalada, así que para ser sinceros el mayor motivo por el cual uso windows 8.1 en lugar de usar Windows 8 es por estar actualizado y usar un SO con el potencial de hoy en día. Pero Windows 8.1 tiene cambios importantes en la personalización, el más popular es el nuevo botón de inicio, que aunque sea una *****, es mucho mejor que no tener nada y esto la gente lo agradecerá, y el resto de cambios la mayoria son para las aplicaciones/interfaz Metro, lo cual a mi la verdad no me interesa en absoluto. · Windows 8.1: A complete list of changes and new featuresPero aparte de eso, hay cambios más internos, Windows 8 instala el framework 4.5 mientras que Windows 8.1 trae .NET Framework 4.5.1 instalado por defecto, y esto me sirve como programador de VB.NET para explotar las nuevas Classes del 4.5.1 (aunque el VisualStudio 2013 te instala este framework via online, prefiero tenerlo instalado por defecto en el SO para poder ejecutar aplicaciones compiladas para el 4.5.1) · Diferencias entre .Net framework 4.5 y .NET Framework 4.5.1· Windows 8.1: New APIs and features for developersyo me sigo quedando con Windows 7 x64 Profesional, por el simple hecho de que es el mejor para juegos. Crees que Windows 8/8.1 apuntara a eso también algún día?? Windows 7 el mejor SO para juegos?, en que sentido? ...para explotar la capacidad Gamer? Donde has leido tal cosa? No me considero muy gamer, aunque tengo cientos de portables antiguos, juegos de emuladores, y me he pasado juegos de última generación como el Tomb Raider, el último Assasin's Creed, el Call of Dutty Ghosts, y otros juegos "del momento" que requieren mucho potencial de Hardware, como ya digo no soy muy gamer pero si que puedo hablar de juegos, y para ser sinceros yo no creo que el SO afecte más de un 10% al rendimiento de un juego, es obvio qu si tienes decenas de programas en ejecución y servicios de Windows inútiles puede influir bastante negatívamente, pero esto no lo veo como algo que dependa del SO, sino más bien del usuario y el modo en que este emplea el SO, así pues en mi opinión teniendo una buena gráfica y una buena configuración de rendimiento en el SO... creo que te va a ir igual de bien ya sea Windows 7 o Windows 8. A mi todos los juegos me van perfectos en Windows 8.1 y puedo exprimir la calidad visual de los gráficos, pero en Windows 7 me iban con los FPS lentos y casi no podia ni jugar, supongo que la mejora tambien se debe a que hice una renovación de los componentes de mi PC xD. Me quede pensando en el DISM, es lo que usas tú no??? Si, es el requisito esencial y te lo instala el WAIK/WADK. PD: ya sea en el lenguaje que sea todas las aplicaciones necesitan usar DISM (como el WinToolkit del que te hablé) Saludos!
|
|
|
7129
|
Programación / Scripting / [APORTE] [BATCH] WIM Resource Replacer
|
en: 14 Abril 2014, 05:51 am
|
Este Script sirve para automatizar la tarea de montar una imagen WIM de Windows y reemplazar recursos de imágenes (bmp/ico) en las librerías de recursos de la instalación de Windows, así como también sirve para reemplazar archivos. Ejemplo de los recursos a los que me refiero: Se necesitan unos requisitos y dependencias para usar este Script: · Saber de lo que estoy hablando. · Conocer el nombre de los recursos que quieres reemplazar y disponer de tus imágenes ya modificados (obviamente). · Dism e ImageX (WAIK/WADK). · Anolis Resourcer > http://www.anol.is/resourcer/Las instrucciones de uso y un extenso tutorial lo publiqué en este otro tema: http://foro.elhacker.net/windows/guia_de_personalizacion_de_imagenes_de_implementacion_de_windows_wim_parte_4-t412468.0.html así que lo haré de nuevo de manera resumida: solo tienen que escribir en un archivo de texto delimitando por puntoycomas los recursos que quieren reemplazar, el nombre del recurso y el índice, así como los archivos que quieran reemplazar, y configurar las variables documentadas del Script (La ubicación de la imagen, el directorio de montaje, etc...) Nota: Ver el ejemplo del archivo delimitado dentro del enlace de abajo o en las instrucciones extendidas del enlace de arriba. Todo lo necesario está incluido en este archivo comprimido: http://www.mediafire.com/download/ktzms7i09qt4n2b/wim+resource+replacer+0.2.rarImágenes: (Código corregido, el otro que subí estaba incompleto) WIM Resource Replacer.cmd REM ================= REM Console Settings: REM ================= Title WIM Resource Replacer - By Elektro Mode Con Cols=150 Lines=50 CHCP 1252 1 >NUL & REM Windows-1252, Spanish-Latin. REM ===== REM Info: REM ===== Echo -------------------------------------------------------------------------------------------------- Echo This script mounts a Windows Image ^(WIM ^) and then replaces image resources inside resource files Echo -------------------------------------------------------------------------------------------------- REM ==================== REM User defined values: REM ==================== REM This value indicates whether the Windows Image should be mounted. REM True = 'DISM' will try to mount the 'WIM' image. REM False = 'DISM' will not try to mount the WIM image. REM Set this value to 'FALSE' if the 'WIM' image is already mounted in the specified mount directory, REM Otherwise, keep it as 'TRUE'. REM This value indicates whether the Windows Image should be unmounted at the end. REM True = 'DISM' will try to unmount the 'WIM' image. REM False = 'DISM' will not try to unmount the WIM image. REM Set this value to 'FALSE' if you want to keep the image mounted to make other changes, REM Otherwise, keep it as 'TRUE'. REM This value indicates whether the Windows Image should be rebuilt at the end. REM True = 'ImageX' will try to rebuild the 'WIM' image. REM False = 'ImageX' will keep the 'WIM' image as is. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes, REM Otherwise, keep it as 'TRUE'. REM This value indicates whether the Windows Image should be cleaned-up at the end. REM True = 'Dism' will try to CleanUp the 'WIM' image components. REM False = 'Dism' will keep the 'WIM' image as is. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes, REM Otherwise, keep it as 'TRUE'. REM This value indicates the 'WIM' image to be mounted. Set "WindowsImage= %UserProfile%\Desktop\win 8 .1\win\sources\Boot.wim" REM This value indicates the Image Index of the 'WIM' image. REM This value indicates the directory where to mount the 'WIM' image. Set "MountDir= %HomeDrive%\WinBootMount" REM This value indicates the ubication of Anolis Resourcer 'Anolis.exe' file. Set "Anolis= %CD%\Tools\Anolis.exe" REM This value indicates the textfile that contains the Recource files to replace. Set "ResourceList= %CD%\Resources.txt" REM This value indicates the ubication of 'ImageX.exe' file. Set "ImageX= %CD%\Tools\Dism\ImageX.exe" REM This value indicates the ubication of a custom 'DISM.exe' file if needed. REM Default ubication: "%SystemRoot%\System32\Dism.exe" Set "Dism= %CD%\Tools\Dism\Dism.exe" REM This value indicates the ubication of the logfile that will record 'DISM' errors. Set "DismLogfile= %CD%\ %~n0 DISM.log" REM This value indicates the logging-level of the 'DISM' process. REM 1 = Errors only REM 2 = Errors and warnings REM 3 = Errors, warnings, and informational REM 4 = All of the information listed previously, plus debug output REM This value indicates the ubication of the logfile that will record Main information. Set "Logfile= %CD%\ %~n0.log" REM ===== REM Main: REM ===== :: Call Methods. CLS REM ======== REM Methods: REM ======== :CreateLogs :: Create the 'DISM' logfile with 'ANSI' encoding, :: this is necessary to record a non-default 'DISM' loglevel such as '1' or '2'. :: Create the Main Logfile and record starting info on it. ( Echo WIM Resource Replacer Echo =========================== Echo %DATE% ^| %TIME:~0,-3% Echo /\/\/\/\/\/\/\/\/\/\/\/\/\/ Echo [i] Mount Image?...: %MountImage% Echo [i] Unmount Image?.: %UnmountImage% Echo [i] CleanUp Image?.: %CleanUp% Echo [i] Rebuild Image?.: %Rebuild% Echo [i] Windows Image..: %WindowsImage% Echo [i] Image Index....: %ImageIndex% Echo [i] Mount Directory: %MountDir% Echo [i] ImageX Path....: %ImageX% Echo [i] Dism Path......: %Dism% Echo [i] Dism Log File..: %DismLogfile% Echo [i] Dism Log Level.: %DismLogLevel% Echo [i] Anolis Path....: %Anolis% Echo [i] Resource List..: %ResourceList% Echo [i] Log File.......: %LogFile% Echo =========================== )>"%Logfile%" :: Display starting log info. Type "%Logfile%" :: Continue writting log. ( )>>"%LogFile%" :EndLog ( Echo [i] WIM Size Before....: %WIMSizeBefore% Echo [i] WIM Size After.....: %WIMSizeAfter% Echo [i] Resources Success..: %ResourceSuccessCount% files. Echo [i] Resources Failed...: %ResourceFailsCount% files. Echo [i] Resources Not Found: %ResourceNotFoundCount% files. Echo [i] Files Added........: %FilesAddedCount% files. Echo [i] Files Failed.......: %FilesFailsCount% files. Echo [i] Files Not Found....: %FilesNotFoundCount% files. Echo [i] Elapsed Time.......: %ElapsedTime% )>>"%LogFile%" :: Display ending information. CLS Type "%LogFile%" :CreateMountDir :: Create the mount directory. ( ) ) || ( Echo [x] Error trying to create the directory " %MountDir%" to mount the Windows Image. Echo [i] Ensure that you have Admin rights to create the directory. Echo [i] Ensure that the directory name does not contains illegal characters. ) :Mount :: Mount the Windows Image into the directory. Echo [+] Mounting WIM Image... If /I " %MountImage%" EQU "True" ( "%Dism%" /Mount-Image /ImageFile:"%WindowsImage%" /Index:"%ImageIndex%" /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" || ( Echo [x] Error mounting the Image Index " %ImageIndex%" in " %MountDir%" Echo [i] Ensure that you have Admin rights to write inside the directory. Echo [i] Ensure that the directory is not already mounted. Echo [i] Ensure that the directory is fully empty. REM Try to unmount the failed image and discard changes. If /I " %UnmountImage%" EQU "True" ( Echo [+] Unmounting and discarding changes... "%Dism%" /Unmount-WIM /Discard /MountDir:"%MountDir%" ) ) ) :CleanUp Echo [+] CleaningUp WIM Image... "%Dism%" /CleanUp-Image /StartComponentCleanUp /Image:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" /Quiet :Unmount :: Unmount the Windows Image commiting changes. Echo [+] Unmounting WIM Image... If /I " %UnmountImage%" EQU "True" ( "%Dism%" /Unmount-WIM /Commit /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" ) :Rebuild Echo [+] Rebuilding WIM image... ("%ImageX%" /Compress Maximum /Export "%WindowsImage%" "*" "%TEMP%\Rebuilt Image.wim" /Check) && ( Del /Q /F " %WindowsImage%" 1 >NUL Move /Y " %TEMP%\Rebuilt Image.wim" " %WindowsImage%" 1 >NUL ) || ( Echo [x] Error rebuilding Image " %WindowsImage%" to " %TEMP%\Rebuilt Image.wim". ) :StartTimer Set "StartingDate= %Date%" Set "StarttingTime= %Time:~0,-3%" :StopTimer ( Echo Minutes = DateDiff ^("n", " %StartingDate% %StarttingTime%", Now ^) )>"%TEMP%\%~n0 MinuteDiff.vbs" For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 MinuteDiff.vbs"' ) :WriteConvertBytesScript ( Echo Suffix = Array ^("Bytes", "KB", "MB", "GB", "TB" ^) Echo Function Convert ^(Bytes ^) Echo Convert = convert0 ^(Bytes, 0 ^) Echo Function Convert0 ^(Bytes, Level ^) Echo Bytes = Round ^(Bytes / 1024, 2 ^) Echo Convert0 = Convert0 ^(Bytes, Level ^) Echo Convert0 = Bytes ^& " " ^& Suffix ^(Level ^) Echo WScript. Echo Convert ^(WScript.Arguments ^(0 ^)^) )>"%TEMP%\%~n0 Convert Bytes.vbs" :GetWIMSizeBefore Call : WriteConvertBytesScript For %%# in (" %WindowsImage%" ) Do (Set "WIMSizeBefore= %%~z#" ) For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeBefore%"' ) Del /Q " %TEMP%\ %~n0 Convert Bytes.vbs" :GetWIMSizeAfter Call : WriteConvertBytesScript For %%# in (" %WindowsImage%" ) Do (Set "WIMSizeAfter= %%~z#" ) For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeAfter%"' ) Del /Q " %TEMP%\ %~n0 Convert Bytes.vbs" :TakeOwn ( Takeown.exe /F "%~f1" ICacls.exe "%~f1" /Grant "%UserName%":"F" Attrib.exe -R -A -S -H -I "%~f1" :ParseResources Set /A "ResourceSuccessCount=0" Set /A "ResourceFailsCount=0" Set /A "ResourceNotFoundCount=0" Set /A "FilesAddedCount=0" Set /A "FilesFailsCount=0" Set /A "FilesNotFoundCount=0" For /F "UseBackQ Tokens=1,2,* Delims=;" %%a In (" %ResourceList%" ) Do ( If /I " %%~xa" EQU ".dll" (Call : ReplaceResource " %MountDir%\ %%~a" " %%~b" " %%~c" ) If /I " %%~xa" NEQ ".dll" (Call : CopyFile " %MountDir%\ %%~a" " %%~b" ) ) :CopyFile Echo Can't locate file to copy from: " %~2" >>" %LogFile%" Set /A "FilesNotFoundCount+=1" ) Call : TakeOwn " %~f1" || ( Echo Unable to grant file permissions in file: " %~1" >>" %Logfile%" Set /A "FilesFailsCount+=1" ) Echo [o] Copying " %~2" to " %~1" Echo Unable to copy file " %~2" >>" %Logfile%" Set /A "FilesFailsCount+=1" ) Set /A "FilesAddedCount+=1" :ReplaceResource Echo Can't locate the resource to copy from: " %~3" >>" %LogFile%" Set /A "ResourceNotFoundCount+=1" ) Echo Can't locate the resource file to edit " %~1" >>" %Logfile%" Set /A "ResourceNotFoundCount+=1" ) Call : TakeOwn " %~f1" || ( Echo Unable to grant file permissions in file: " %~1" >>" %Logfile%" Set /A "ResourceFailsCount+=1" ) Echo [o] Replacing resource with name " %~2" in resource file " %~f1", with " %~3". If /I " %~x3" EQU ".bmp" ( Start /W "Anolis" "%Anolis%" -op:upd -src:"%~f1" -type:Bitmap -name:"%~2" -lang:1033 -file:"%~f3") ) If /I " %~x3" EQU ".ico" ( Start /W "Anolis" "%Anolis%" -op:upd -src:"%~f1" -type:Icon -name:"%~2" -lang:1033 -file:"%~f3") ) Set /A "ResourceSuccessCount+=1" REM ==================== REM File Error Controls: REM ==================== :CheckErrors :: WIM File Error-Check. Echo [x] Windows Image not found at: " %WindowsImage%" | MORE ) :: ResourceList File Error-Check. Echo [x] Resource-List file not found in: " %ResourceList%" | MORE ) :: 'DISM.exe' File Error-Check. Echo [x] 'DISM' process not found at: " %DISM%" | MORE ) :: 'ImageX.exe' File Error-Check. Echo [x] 'ImageX' process not found at: " %ImageX%" | MORE ) :: 'MountImage' Value check. If /I " %MountImage%" NEQ "True" If /I " %MountImage%" NEQ "False" ( Echo [x] Error parsing parameter 'MountImage', Echo value ' %MountImage%' is not a Boolean value. ) :: 'UnmountImage' Value check. If /I " %UnmountImage%" NEQ "True" If /I " %UnmountImage%" NEQ "False" ( Echo [x] Error parsing parameter 'UnmountImage', Echo value ' %UnmountImage%' is not a Boolean value. ) :: 'Rebuild' Value check. If /I " %Rebuild%" NEQ "True" If /I " %Rebuild%" NEQ "False" ( Echo [x] Error parsing parameter 'Rebuild', Echo value ' %Rebuild%' is not a Boolean value. ) :: 'CleanUp' Value check. If /I " %CleanUp%" NEQ "True" If /I " %CleanUp%" NEQ "False" ( Echo [x] Error parsing parameter 'CleanUp', Echo value ' %CleanUp%' is not a Boolean value. ) :: 'DismLogLevel' Value check. Echo " %DismLogLevel%" | Findstr.exe " ^\"[ ^1-4]\"$" 1 >NUL 2 >&1 || ( Echo [x] Error parsing parameter 'DismLogLevel', Echo value ' %DismLogLevel%' is not in range '1-4'. ) :: Anolis Resourcer File Error-Check. Echo [x] Anolis process not found in: " %Anolis%" | MORE )
|
|
|
7130
|
Programación / Scripting / [APORTE] [BATCH] WIM Package Uninstaller
|
en: 14 Abril 2014, 05:50 am
|
Este Script sirve para automatizar la tarea de montar una imagen WIM de Windows y eliminar paquetes de la instalación de Windows. Se necesitan unos requisitos y dependencias para usar este Script: · Saber de lo que estoy hablando. · Conocer el nombre de los paquetes que quieres elimiar (obviamente). · Dism e ImageX (WAIK/WADK). · win6x_registry_tweak > http://www.msfn.org/board/topic/152688-win6x-registry-tweak/Las instrucciones de uso y un extenso tutorial lo publiqué en este otro tema: http://foro.elhacker.net/windows/guia_de_personalizacion_de_imagenes_de_implementacion_de_windows_wim_parte_5-t412551.0.html así que lo haré de nuevo de manera resumida: solo tienen que escribir en un archivo de texto los paquetes que quieren eliminar, y configurar las variables documentadas del Script (La ubicación de la imagen, el directorio de montaje, etc...) Todo lo necesario está incluido en este archivo comprimido: http://www.mediafire.com/download/mq7o7q7brq6h4ca/WIM_Package_Uninstaller.rarImágenes: WIM Package Uninstaller.cmd REM ================= REM Console Settings: REM ================= Title WIM Package Uninstaller - By Elektro Mode Con Cols=150 Lines=50 CHCP 1252 1 >NUL & REM Windows-1252, Spanish-Latin. REM ===== REM Info: REM ===== Echo ---------------------------------------------------------------------------------- Echo This script mounts a Windows Image ^(WIM ^) and then removes pre-installed packages Echo ---------------------------------------------------------------------------------- REM ==================== REM User defined values: REM ==================== REM This value indicates whether the Windows Image should be mounted. REM True = 'DISM' will try to mount the 'WIM' image. REM False = 'DISM' will not try to mount the WIM image. REM Set this value to 'FALSE' if the 'WIM' image is already mounted in the specified mount directory, REM Otherwise, keep it as 'TRUE'. REM This value indicates whether the Windows Image should be unmounted at the end. REM True = 'DISM' will try to unmount the 'WIM' image. REM False = 'DISM' will not try to unmount the WIM image. REM Set this value to 'FALSE' if you want to keep the image mounted to make other changes, REM Otherwise, keep it as 'TRUE'. REM This value indicates whether the Windows Image should be rebuilt at the end. REM True = 'ImageX' will try to rebuild the 'WIM' image. REM False = 'ImageX' will keep the 'WIM' image as is. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes, REM Otherwise, keep it as 'TRUE'. REM This value indicates the 'WIM' image to be mounted. Set "WindowsImage= %UserProfile%\Desktop\win 8 .1\win\sources\install.wim" REM This value indicates the Image Index of the 'WIM' image. REM This value indicates the directory where to mount the 'WIM' image. Set "MountDir= %HomeDrive%\WinMount" REM This value indicates the textfile that contains the names of the packages to remove. Set "PackageList= %CD%\Packages.txt" REM This value indicates the ubication of the 'WIM Registry Tweak Tool.exe' file. Set "WIMRegistryTweakTool= %CD%\Tools\WIM Registry Tweak Tool\WIM Registry Tweak Tool.exe" REM This value indicates the ubication of 'ImageX.exe' file. Set "ImageX= %CD%\Tools\Dism\ImageX.exe" REM This value indicates the ubication of a custom 'DISM.exe' file if needed. REM Default ubication: "%SystemRoot%\System32\Dism.exe" Set "Dism= %CD%\Tools\Dism\Dism.exe" REM This value indicates the ubication of the logfile that will record 'DISM' errors. Set "DismLogfile= %CD%\ %~n0 DISM.log" REM This value indicates the logging-level of the 'DISM' process. REM 1 = Errors only REM 2 = Errors and warnings REM 3 = Errors, warnings, and informational REM 4 = All of the information listed previously, plus debug output REM This value indicates the ubication of the logfile that will record Main information. Set "Logfile= %CD%\ %~n0.log" REM ===== REM Main: REM ===== :: Call Methods. CLS CLS REM ======== REM Methods: REM ======== :CreateLogs :: Create the 'DISM' logfile with 'ANSI' encoding, :: this is necessary to record a non-default 'DISM' loglevel such as '1' or '2'. :: Create the Main logfile and record starting info on it. ( Echo WIM Package Uninstaller Echo =========================== Echo %DATE% ^| %TIME:~0,-3% Echo /\/\/\/\/\/\/\/\/\/\/\/\/\/ Echo [i] Mount Image?...: %MountImage% Echo [i] Unmount Image?.: %UnmountImage% Echo [i] Windows Image..: %WindowsImage% Echo [i] Image Index....: %ImageIndex% Echo [i] Mount Directory: %MountDir% Echo [i] ImageX Path....: %ImageX% Echo [i] Dism Path......: %Dism% Echo [i] Dism Log File..: %DismLogfile% Echo [i] Dism Log Level.: %DismLogLevel% Echo [i] WIMRegistryTool: %WIMRegistryTweakTool% Echo [i] Package List...: %PackageList% Echo [i] Log File.......: %Logfile% Echo =========================== )>"%Logfile%" :: Display starting log info. Type "%Logfile%" :: Continue writting log. ( )>>"%LogFile%" :EndLog ( Echo [i] WIM Image Size Before........: %WIMSizeBefore% Echo [i] WIM Image Size After.........: %WIMSizeAfter% Echo [i] Packages Successfully Removed: %PackagesRemovedCount% Packages. Echo [i] Packages Failed To Remove....: %PackagesFailedCount% Packages. Echo [i] Packages Not Found...........: %PackagesNotFoundCount% Packages. Echo [i] Elapsed Time.................: %ElapsedTime% )>>"%LogFile%" :: Display ending information. CLS Type "%LogFile%" :CreateMountDir :: Create the mount directory. ( ) ) || ( Echo [x] Error trying to create the directory " %MountDir%" to mount the Windows Image. Echo [i] Ensure that you have Admin rights to create the directory. Echo [i] Ensure that the directory name does not contains illegal characters. ) :Mount :: Mount the Windows Image into the directory. Echo [+] Mounting WIM Image... If /I " %MountImage%" EQU "True" ( "%Dism%" /Mount-Image /ImageFile:"%WindowsImage%" /Index:"%ImageIndex%" /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" || ( Echo [x] Error mounting the Image Index " %ImageIndex%" in " %MountDir%" Echo [i] Ensure that you have Admin rights to write inside the directory. Echo [i] Ensure that the directory is not already mounted. Echo [i] Ensure that the directory is fully empty. REM Try to unmount the failed image and discard changes. If /I " %UnmountImage%" EQU "True" ( Echo [+] Unmounting and discarding changes... "%Dism%" /Unmount-WIM /Discard /MountDir:"%MountDir%" ) ) ) :CleanUp Echo [+] CleaningUp WIM Image... "%Dism%" /CleanUp-Image /StartComponentCleanUp /Image:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" /Quiet :Unmount :: Unmount the Windows Image commiting changes. Echo [+] Unmounting WIM Image... If /I " %UnmountImage%" EQU "True" ( "%Dism%" /Unmount-WIM /Commit /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" ) :Rebuild Echo [+] Rebuilding WIM image... ("%ImageX%" /Compress Maximum /Export "%WindowsImage%" "*" "%TEMP%\Rebuilt Image.wim" /Check) && ( Del /Q /F " %WindowsImage%" 1 >NUL Move /Y " %TEMP%\Rebuilt Image.wim" " %WindowsImage%" 1 >NUL ) || ( Echo [x] Error rebuilding Image " %WindowsImage%" to " %TEMP%\Rebuilt Image.wim". ) :StartTimer Set "StartingDate= %Date%" Set "StarttingTime= %Time:~0,-3%" :StopTimer ( Echo Minutes = DateDiff ^("n", " %StartingDate% %StarttingTime%", Now ^) )>"%TEMP%\%~n0 MinuteDiff.vbs" For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 MinuteDiff.vbs"' ) :WriteConvertBytesScript ( Echo Suffix = Array ^("Bytes", "KB", "MB", "GB", "TB" ^) Echo Function Convert ^(Bytes ^) Echo Convert = convert0 ^(Bytes, 0 ^) Echo Function Convert0 ^(Bytes, Level ^) Echo Bytes = Round ^(Bytes / 1024, 2 ^) Echo Convert0 = Convert0 ^(Bytes, Level ^) Echo Convert0 = Bytes ^& " " ^& Suffix ^(Level ^) Echo WScript. Echo Convert ^(WScript.Arguments ^(0 ^)^) )>"%TEMP%\%~n0 Convert Bytes.vbs" :GetWIMSizeBefore Call : WriteConvertBytesScript For %%# in (" %WindowsImage%" ) Do (Set "WIMSizeBefore= %%~z#" ) For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeBefore%"' ) Del /Q " %TEMP%\ %~n0 Convert Bytes.vbs" :GetWIMSizeAfter Call : WriteConvertBytesScript For %%# in (" %WindowsImage%" ) Do (Set "WIMSizeAfter= %%~z#" ) For /F "Tokens=*" %%# In ( 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeAfter%"' ) Del /Q " %TEMP%\ %~n0 Convert Bytes.vbs" :ParsePackages Set /A "PackagesRemovedCount=0" Set /A "PackagesFailedCount=0" Set /A "PackagesNotFoundCount=0" :: Unhide packages and take registry ownership. "%WIMRegistryTweakTool%" /p "%MountDir%" :: Remove Packages. For /F "UseBackQ Tokens=* Delims=" %%# In (" %PackageList%" ) Do ( Echo [+] Removing package: %%~# " %Dism%" /Remove-Package /PackageName:" %%~#" /Image:" %MountDir%" /English /LogPath:" %DismLogfile%" /LogLevel:" %DismLogLevel%" /Quiet 1 >NUL Call Set /A "ExitCode= %%Errorlevel%%" (Call Echo " %%ExitCode%%" | Findstr.exe " ^\"0\"$" 1 >NUL 2 >&1 ) && ( Call Set /A "PackagesRemovedCount+=1" ) (Call Echo " %%ExitCode%%" | Findstr.exe " ^\"5\"$" 1 >NUL 2 >&1 ) && ( Call Set /A "PackagesFailedCount+=1" Echo Failed to remove package: %%~# >>" %LogFile%" ) (Call Echo " %%ExitCode%%" | Find.exe "-2146498555" 1 >NUL 2 >&1 ) && ( Call Set /A "PackagesNotFoundCount+=1" Echo Package is not installed: %%~# >>" %LogFile%" ) ) REM =============== REM Error Controls: REM =============== :CheckErrors :: WIM File Error-Check. Echo [x] Windows Image not found at: " %WindowsImage%" | MORE ) :: PackageList File Error-Check. Echo [x] PackageList not found at: " %PackageList%" | MORE ) :: 'DISM.exe' File Error-Check. Echo [x] 'DISM' process not found at: " %DISM%" | MORE ) :: 'ImageX.exe' File Error-Check. Echo [x] 'ImageX' process not found at: " %ImageX%" | MORE ) :: 'WIM Registry Tweak Tool.exe' File Error-Check. Echo [x] 'WIM Registry Tweak Tool' process not found at: " %WIMRegistryTweakTool%" | MORE ) :: 'MountImage' Value check. If /I " %MountImage%" NEQ "True" If /I " %MountImage%" NEQ "False" ( Echo [x] Error parsing parameter 'MountImage', Echo value ' %MountImage%' is not a Boolean value. ) :: 'UnmountImage' Value check. If /I " %UnmountImage%" NEQ "True" If /I " %UnmountImage%" NEQ "False" ( Echo [x] Error parsing parameter 'UnmountImage', Echo value ' %UnmountImage%' is not a Boolean value. ) :: 'Rebuild' Value check. If /I " %Rebuild%" NEQ "True" If /I " %Rebuild%" NEQ "False" ( Echo [x] Error parsing parameter 'Rebuild', Echo value ' %Rebuild%' is not a Boolean value. ) :: 'DismLogLevel' Value check. Echo " %DismLogLevel%" | Findstr.exe " ^\"[ ^1-4]\"$" 1 >NUL 2 >&1 || ( Echo [x] Error parsing parameter 'DismLogLevel', Echo value ' %DismLogLevel%' is not in range '1-4'. )
|
|
|
|
|
|
|