informacion desde: http://foro.elhacker.net/scripting/libreria_de_funciones_y_scripts_batch_actualizado_260507-t163184.0.html
Renombrar un archivo a su fecha de creación:
Código:
: Sintaxis : nombrebat archivo_a_renombrar : Autor ne0x @echo off if not exist %1 echo Error ! & goto :EOF set fechaYhora=%~t1 set fecha=%fechaYhora:~0,10% set fecha=%fecha:/=-% ren %1 %fecha%%~x1
Scripts NetBIOS
Primero hace ping's y despues checa NetBIOS:
Código:
@echo off :: Script de scanner NetBIOS por ne0x set /p ip=3 primeros grupos Ip : if .%ip%==. echo Error&goto END FOR /L %%a IN (1,1,225) DO ( ping -n 1 %ip%.%%a | find "Respuesta desde" && echo %ip%.%%a >> tmp.tmp ) FOR /F %%a IN (tmp.tmp) DO ( nbtstat -a %%a | find "<20>" ) del tmp.tmp :END echo Pulse una tecla para salir pause>nul exit 0 20>
Intenta iniciar sesion nula y si lo consigue lo muestra
Código:
@echo off :: Script de scanner NetBIOS por ne0x set /p ip=3 primeros grupos de la ip : if .%ip%==%ip% exit 1 FOR /L %%i IN (1,1,255) DO net use \\%ip%.%%i\ipc$ "" /u:"" 2>> nul && echo Sesion nula en : %ip%.%%i
Usa una lista de users y pass para conseguir accesos
Código:
@echo off :: Script de scanner NetBIOS por ne0x set /p ip=Escribe la ip if .%ip%==. exit 1 for /f %%a IN (ruta_logins) DO ( FOR /F %%i IN (ruta_pass) DO net use \\%ip%\ipc$ %%i /u:%%a >nul && echo IP: %ip% login: %%a pass: %%i )
Basados en un antiguo texto del foro de HxC
Algoritmos de búsquedas
Buscar comandos en todos los archivos por lotes, FOR:
Código:
:: Autor ne0x echo. > %TMP%\lista.tmp for %%A IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( if exist %%A:\ ( cd /D %%A:\ for /R %%E IN (*.cmd) DO echo %%E >> %TMP%\lista.tmp for /R %%E IN (*.bat) DO echo %%E >> %TMP%\lista.tmp ) ) for /F %%I IN (lista de comandos) DO ( for /F %%J IN (%TMP%\lista.tmp) DO ( find "%%I" "%%J" > nul if %errorlevel%==0 echo Comando %%I encontrado en %%J ) )
Función Sleep
Código:
:: Autor ne0x :: Declaración de la función :sleep :: Sintaxis: :: call:sleep [-s/-m] [x] :: -s Indicamos los segundos a esperar :: -m Indicamos los milisegundos a esperar :: x Cantidad de segundos/milisegundos a esperar if %1==-s (set /a tiempo=1+%2 && ping -n %tiempo% 127.0.0.1 > nul ) if %1==-m (ping -n 1 127.0.0.1 -w %2 > nul) goto:EOF
Calcular raices
Código:
:: Autor Sdc @echo off if NOT "%~1"=="vv" (cmd /v /c %~nx0 vv^&exit&goto:EOF) set /P x=Valor: FOR /L %%i IN (%x%,-2,1) DO ( set /A y=%x%/%%i IF /I !y! EQU %%i ( echo %%i goto:EOF ) )
Código:
:: Autor ne0x @echo off set /P x=Valor : :BUCLE set /a cont=cont+1 set /a multi=cont*cont if %multi%==%x% echo Raiz: %cont%&pause&goto:EOF if %multi% GTR %x% echo El valor no tiene raiz entera&pause&goto:EOF goto BUCLE
Calcular potencias
Código:
:: Autor ne0x @echo off set /P BASE=Base : set /P EXPONENTE=Exponente : if %BASE%.==. exit 1 if %EXPONENTE%.==. exit 1 set resultado=1 FOR /L %%A IN (1,1,%EXPONENTE%) DO set /A resultado=resultado*BASE echo Resultado : %resultado% goto:EOF
Función, saber las lineas de un archivo
Código:
:: Autor ne0x :: Sintaxis :: call:lineas [ruta] [variable] :: ruta Ruta del archivo :: variable Nombre de la variable en la que se almacenara el resultado :lineas set cont=0 if not exist %1 goto:EOF for /F %%A IN (%1) DO call:texto set %2=%cont% goto:EOF :texto set /a cont=1+cont goto:EOF
Funcion GetOS:
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetOS os :: :: By: Ritchie Lawrence, 2003-09-18. Version 1.0 :: :: Func: Returns the O/S version; NT40, 2000, 2002 or 2003. :: For NT4/2000/XP/2003. :: :: Args: %1 var to receive O/S version (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "cmd=net config work^|findstr/b /c:"Soft"" for /f "tokens=1-2 delims=." %%a in ('%cmd%') do ( for %%z in (%%a%%b) do set o=%%z) endlocal & set "%1=%o:40=NT40%" & (goto :EOF) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funciones de comprobaciones
Funcion, averiguar si un servicio esta corriendo:
Código:
:: Autor ne0x :: Sintaxis: :: call:svc nombre variable :: nombre Nombre del servicio a chequear :: variable Nombre de la variable en la que se pondra la respuesta en dato boleano :svc net start | find "%~1" > nul if %errorlevel%==0 ( set %2=0 ) ELSE ( set %2=1 ) goto:EOF
Funcion, averiguar si se ha iniciado un proceso:
Código:
:: Autor ne0x :: Sintaxis :: call:pr nombre variable :: nombre Nombre del proceso a chequear :: variable Nombre de la variable en la que se guardara la respuesta en tipo boleano. :pr taskklist | find "%~1" if %errorlevel%==0 ( set %2=0 ) ELSE ( set %2=1 ) goto:EOF
Funcion TIMER
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :Timer ID :: :: By: Ritchie Lawrence, 2002-10-10. Version 1.0 :: :: Func: Returns number of seconds elapsed since the function was last :: called and first called. For NT4/2000/XP/2003. :: :: Args: %1 (by ref) The first time this function is called, this variable :: is initialised to '' where and :: are zero and is the number of elapsed seconds since :: 1970-01-01 00:00:00. This value is used by subsequent calls to :: determine the elapsed number of seconds since the last call :: ( ) and the first call ( ). ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS&call set ID=%%%1%% set t=2&if "%date%z" LSS "A" set t=1 for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do ( for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do ( set %%a=%%d&set %%b=%%e&set %%c=%%f)) for /f "tokens=5-7 delims=:. " %%a in ('echo/^|time') do ( set hh=%%a&set nn=%%b&set ss=%%c) set /a dd=100%dd%%%100,mm=100%mm%%%100 set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2 set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633 set /a hh=100%hh%%%100,nn=100%nn%%%100,ss=100%ss%%%100 set /a j=j*86400+hh*3600+nn*60+ss for /f "tokens=1-3 delims= " %%a in ('echo/%ID%') do ( set l=%%a&set f=%%b&set c=%%c) if {%c%}=={} endlocal&set %1=0 0 %j%&goto :EOF set /a l=j-c-l,f+=l endlocal&set %1=%l% %f% %c%&goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funcion, obtener Puerta de enlace:
Código:
:: Autor ne0x :: Sintaxis :: call:dg variable :: variable Nombre de la variable en la que se almacenara la IP de la puerta de enlace :dg ipconfig | find "Puerta de enlace . . . . . 1" > %TMP%\rd.tmp for /F %%A "tokens=11" IN (%TMP%\rd.tmp) DO set %2=%%A goto:EOF
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetDG dg :: :: By: Ritchie Lawrence, 2003-09-22. Version 1.0 :: :: Func: Obtains the default gateway. For NT4/2000/XP/2003. :: If functions fails, 0.0.0.0 is returned. :: :: Args: %1 var to receive default gateway (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "g=0.0.0.0" & set "j=" for /f "tokens=3" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( if not defined j for %%b in (%%a) do set "g=%%b" & set "j=1") endlocal & set "%1=%g%" & goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funcion GetIP
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetIP ip :: :: By: Ritchie Lawrence, 2003-09-22. Version 1.0 :: :: Func: Obtains the IP address of primary adapter. For NT4/2000/XP/2003. :: If functions fails, 0.0.0.0 is returned. :: :: Args: %1 var to receive IP address (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "j=" for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1") endlocal & set "%1=%i%" & goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funcion GetMAC
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetMAC mac :: :: By: Ritchie Lawrence, 2003-09-24. Version 1.0 :: :: Func: Obtains the MAC address of the primary adapter in the format of :: XX-XX-XX-XX-XX-XX. If the function fails 00-00-00-00-00-00 is :: returned. For NT4/2000/XP/2003. :: :: Args: %1 var to receive MAC address (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "m=00-00-00-00-00-00" & set "i=" & set "j=" set "n=0" & set "c=ipconfig/all" & set "f=findstr" for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1") & set "j=" if not defined i endlocal & set "%1=%m%" & goto :EOF for /f "delims=:" %%a in ('%c%^|%f%/n IP.Address.*%i%') do set /a n=%%a-6 for /f "delims=" %%a in ('%c%^|more/e +%n%^|%f% Physical.Address') do ( if not defined j for %%b in (%%a) do set "m=%%b" & set "j=1") endlocal & set "%1=%m%" & goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funcion GetNA
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetNA na :: :: By: Ritchie Lawrence, 2003-09-22. Version 1.0 :: :: Func: Obtains network address of primary adapter. For NT4/2000/XP/2003. :: If functions fails, 0.0.0.0 is returned. :: :: Args: %1 var to receive network address (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "n=0.0.0.0" & set "j=" for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( if not defined j (for %%b in (%%a) do set "i=%%b" & set j=1)) & set "k=" for /f "skip=1 tokens=1,3-4" %%a in ('route print^|findstr/b /c:" "') do ( for %%e in (%%a) do set "x=%%e" & for %%f in (%%b) do set "y=%%f" for %%g in (%%c) do set "z=%%g" for /f "tokens=1-3" %%a in ('echo/%%x%% %%y%% %%z%%') do ( if not defined k if "%%c"=="%i%" if "%%b"=="%i%" set k=1 & set n=%%a)) endlocal & set "%1=%n%" & goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Funcion GetSM
Código:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetSM sm :: :: By: Ritchie Lawrence, 2003-09-22. Version 1.0 :: :: Func: Obtains the subnet mask of primary adapter. For NT4/2000/XP/2003. :: If functions fails, 0.0.0.0 is returned. :: :: Args: %1 var to receive subnet mask (by ref) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "m=0.0.0.0" & set "j=" for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( if not defined j (for %%b in (%%a) do set "i=%%b" & set j=1)) & set "k=" for /f "skip=1 tokens=2-4" %%a in ('route print^|findstr/b /c:" "') do ( for %%e in (%%a) do set "x=%%e" & for %%f in (%%b) do set "y=%%f" for %%g in (%%c) do set "z=%%g" for /f "tokens=1-3" %%a in ('echo/%%x%% %%y%% %%z%%') do ( if not defined k if "%%c"=="%i%" if "%%b"=="%i%" set k=1 & set m=%%a)) endlocal & set "%1=%m%" & goto :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Script para extraer el PID de un proceso
Código:
@echo off :: Script para extraer el PID de un proceso :: By Sdc FOR /F "tokens=1,2" %%i IN ('tasklist') DO ( IF "%%i"=="PROCESO1.exe" ( SET pid1=%%j ) IF "%%i"=="PROCESO2.EXE" ( SET pid2=%%j ) )
Script para extraer el valor de una clave del registro
Código:
@echo off :: Script para extraer el valor de una clave del registro :: By nhaalclkiemr :: Special thanks to Sdc reg export "RUTA_CLAVE" "temp.tmp" if not %errorlevel%==0 goto error type temp.tmp | find "NOMBRE_CLAVE" > cadena_encontrada.tmp del /S /F /Q /A:- temp.tmp FOR /F "tokens=2* delims==" %%I IN (cadena_encontrada.tmp) DO set var="%%I" if "%var%"=="" goto error FOR /F "tokens=2* delims==" %%I IN (cadena_encontrada.tmp) DO ( call:PARSEA %%I ) goto :EOF :PARSEA del /S /F /Q /A:- cadena_encontrada.tmp SET PP="%~1" SET PP=%PP:\\=\% SET PP=%PP:"=% :: Aqui va el bat, el valor de la clave queda guardado en la variable PP exit :error :: Aqui va el bat de error en caso de que la RUTA_CLAVE o NOMBRE_CLAVE no exista exit
Script para ejecutar un archivo BAT con salida nula
Código:
@echo off :: Script para ejecutar un archivo BAT con salida nula :: By nhaalclkiemr if exist temp.bat goto mibat copy /Y %0 temp.bat>>NUL call temp.bat>>NUL exit :mibat :: Aqui va el bat del /S /F /Q /A:- temp.bat exit
Conocer si el valor de una variable es un numero o otro caracter
Código:
:: Conocer si el valor de una variable es un numero o otro caracter :: By Sdc :: Aqui partimos de que tenemos una variable r set /a x=%r%*1 if "%x%"=="%r%" (REM Es un numero) else (REM No es un numero)
Ejecutar una aplicación como SYSTEM
Código:
@echo off :: Ejecutar una aplicación como SYSTEM :: Puedes ejecutarla inmediatamente o programarla para cuando quieras :: Tal como está el codigo está programado para ejecutar al intantante la aplicación :: Borra los comentarios REM para ahorrar codigo y fijate en lo que pone :: By nhaalclkiemr set a=0 set z=%TIME:~0,2% if "%TIME:~0,1%"==" " set z=0%TIME:~1,1% if "%TIME:~8,1%"=="," goto normal if "%TIME:~10,1%"=="," goto 2caso if "%TIME:~12,1%"=="," goto 3caso :normal set x=%TIME:~3,2% goto a :2caso set x=%TIME:~4,2% goto a :3caso set x=%TIME:~5,2% :a set /A a=%a%+1 if "%x%"=="08" set x=8 if "%x%"=="09" set x=9 if "%a%"=="1" set /A x=%x%+1 REM El segundo 1 especifica el tiempo en minutos que tardará en ejecutarse la aplicación, es modificable REM Solo se puede sumar como máximo 86400 minutos, de lo contrario pueden producirse errores :e if %x% GTR 59 set /A z=%z%+1 if %z% GTR 23 set /A z=%z%-24 for /L %%A in (0,1,9) do if "%z%"=="%%A" set z=0%z% if %x% GTR 59 set /A x=%x%-60 if %x% GTR 59 goto e at.exe %z%:%x% AQUITUPROGRAMA.EXE REM En lugar de lo anterior puedes poner lo siguiente si quieres que la aplicacion sea visible: REM at.exe %z%:%x% /interactive AQUITUPROGRAMA.EXE REM %z% y %x% son la hora y los minutos a los que se ejecutará la aplicación, puedes poner otra cosa si quieres if %a%==11 goto b if not %errorlevel%==0 goto a schtasks /run /tn at1 REM Esta ultima linea ejecuta inmediatamente la aplicación, si la estás programando para una hora determinada borra esta linea exit :b set a=0 if %x% LEQ 9 set x=0%x% :c set /A a=%a%+1 schtasks /create /tn temp /tr AQUITUPROGRAMA.EXE /sc once /st %z%:%x%:00 /ru System REM Esto se ejecutará en caso de que el comando AT falle, es un intento alternativo, de esta manera no se puede hacer visible if %a%==11 goto error if not %errorlevel%==0 goto c schtasks /run /tn temp REM Esta ultima linea ejecuta inmediatamente la aplicación, si la estás programando para una hora determinada borra esta linea exit :error :: Aqui va el BAT que se ejecuta en caso de que se produzca un error
Configuracion IP
Código:
:: Autor: pantocrator :: MAs información: http://pantocrator-blog.blogspot.com/ @Echo OFF echo [requerido] Primer parametro %1 es para ip estatica. echo [requerido] Segundo parametro %2 es la mascara de red. echo [requerido] Tercer parametro %3 es la puerta de enlace. echo [opcional] Cuarto parametro %4 es el servidor dns primario If [%1] == [] GOTO QUIT If [%2] == [] GOTO QUIT If [%3] == [] GOTO QUIT echo Starting %0 Echo ....................Configurando IP address en Conexi¢n de rea local a %1 con NetMask %2 netsh interface ip set address name="Conexi¢n de rea local" source=static addr=%1 mask=%2 Echo ....................Configurando Gateway en Conexi¢n de rea local a %3 netsh interface ip set address name="Conexi¢n de rea local" gateway=%3 gwmetric=1 If [%4] == [] GOTO QUIT Echo ....................Configurando DNS en Conexi¢n de rea local a %4 netsh interface ip set dns name="Conexi¢n de rea local" source=static addr=%4 register=primary GOTO QUIT :QUIT ECHO ON :dec2hex set hexstr=0123456789ABCDEF set last= set /A dec= %1 :loop2 set /A ths=%dec% %% 16 call:evals "%%hexstr:~%ths%,1%%" if /I %dec% GEQ 16 ( set /A dec=%dec%/16 ) else ( goto:EOF ) goto:loop2 goto:EOF :evals set last=%~1%last% goto:EOF (Este script lo que hace es tomar una url, y añadir dos dominios de ella al archivo hosts. Por ejemplo si ingreso como url: direccionnula.com se añade: 0.0.0.0 direccionnula.com 0.0.0.0 www.cmd.com La gracia es que acepta un parámetro de un archivo con una lista de direcciones. Ejemplo: LockUrl.cmd listado.txt). :: guarda tu ip en la variable "%tuip%" :: by riva @echo off ipconfig /all>tuip.txt FOR /f "tokens=2 delims=:" %%a in ('find /I " IP" tuip.txt') do (set tuip=%%a) del tuip.txt ::Lock Url 4.3 ::by CarlitoS.dll @echo off set FILE=%SystemRoot%\system32\drivers\etc\hosts set IP=0.0.0.0 set argfile=%1 :start call :logo call :mode exit :lock echo. set url= set /p url="Enter Url: " :yesorno echo. echo You joined address: %url% set confirm= set /p confirm="Is that correct? [y/n]" if /i "%confirm%"=="y" (goto verify_0) if /i "%confirm%"=="n" (goto start) goto yesorno :attrib if not exist "%FILE%" (call: error) if exist "%FILE%" (attrib -r "%FILE%">NUL) goto :EOF :mode if exist "%argfile%" (goto argmode) if not exist "%argfile%" (goto lock) got :EOF :argmode for /f %%a in (%argfile%) do set url=%%a & call :verify_1 & set url= goto exit :verify_0 if "%url%"=="" (echo You put blank url. Please press any key for try again & pause>NUL & goto start) if /i "%url:~0,4%"=="www." (goto with0) goto without0 :verify_1 if /i "%url:~0,4%"=="www." (goto with1) goto without1 goto :EOF :with0 call :with1 goto message :without0 call :without1 goto message :with1 call :attrib echo %IP% %url:~4%>>"%FILE%" echo %IP% www.%url:~4%>>"%FILE%" goto :EOF :without1 call :attrib echo %IP% %url%>>"%FILE%" echo %IP% www.%url%>>"%FILE%" goto :EOF :message echo. echo If you are receive message "Access Denied" it is because you do not have sufficient privileges. echo If not. Is OK. goto again :again echo. set again= set /p again="Add other url? [y/n]" if /i "%again%"=="y" (goto start) if /i "%again%"=="n" (goto exit) goto again :error echo.>>"%FILE%" goto :EOF :logo cls echo \--------------------/ echo \ Lock Web Site v4.3 / echo \--------------------/ echo. call :attrib goto :EOF :exit exit ::Lock Url 4.3 ::by CarlitoS.dll Función sleep sin uso de comandos externos: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::: :::::::: :::::::: FUNCTION SLEEP WITHOUT USING EXTERNAL COMMANDS :::::::: :::::::: :::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: :: Get a parameter 1% with the number of seconds to wait. :: :: Use the following variables: limit cont mirror1 mirror2 :: :: Use the following variables: SLEEP time increment count :: :: $author CarlitoS.dll :: :: :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off :SLEEP if "%1"=="" (goto :eof) set /a limit=0 set /a limit=%1 if %limit% LEQ 0 (goto :eof) set /a cont=0 :time set mirror1=%time:~-4,1% :increment set mirror2=%time:~-4,1% if not %mirror2%==%mirror1% (goto count) goto increment :count set /a cont +=1 if "%cont%"=="%limit%" (goto :eof) goto time goto :eof ::DETECTOR OF REMOVABLE DEVICES [V5.0c Final] author CarlitoS.dll ::carlitosdll.blogspot.com ::Tested in Windows 2000 and XP. Not works in Windows 98 and Me. @echo off if "%errorlevel%"=="" goto other echo Mounted removable devices detected echo ---------------------------------- ver | findstr "2000 NT" >NUL && goto NT2000 :XPVISTASEVEN for /f "tokens=3 delims=\:" %%a in ('reg query HKLM\SYSTEM\MountedDevices ^| find "530054004F00520041"') do ( dir /a %%a:\ >NUL 2>&1 && echo.%%a:) pause goto :eof :NT2000 regedit /e "%temp%\devices.dat" "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices" for /f "tokens=3 delims=\:" %%a in ('find /i "DosDevices" ^< "%temp%\devices.dat" ^| find /i "53,00,54,00,4f,00,52,00,41"') do ( dir /a %%a:\ >NUL 2>&1 && echo.%%a:) del /f /q "%temp%\devices.dat" >NUL pause goto :eof :other echo Current batch is not supported in this Operating System version. exit Almacenar ip despues de un ping @echo off title http://ismaw34host.no-ip.info/ - Modificador del archivo de hosts cls set a=echo %a% Bienvenido, se va a modificar el archivo de hosts de WinXP (32 bits) %a% Asegurese que al modificar, no exista otra linea de host: l2auth.lineage2.com o l2testauthd.lineage2.com pause goto Opciones :Opciones cls %a% Opciones: %a% 1 - No estoy seguro de no tener l2auth.lineage2.com o l2testauthd.lineage2.com %a% en mi host quiero abrirlo manualmente con el Bloc de Notas %a% 2 - Escribir el host %a% 3 - Restaurar el host anterior (antes del cambio, como si no se hubiese usado %a% el escribir host) %a% 4 - Rescribir el host por cambio de IP (Se debe haber usado la opcion de %a% escribir el host, anteriormente, para usar esta opcion) %a% 5 - Salir set /p Opc=Elige una opcion: IF %Opc%==1 goto Comprueba IF %Opc%==2 goto Escribir IF %Opc%==3 goto Restaurar IF %Opc%==4 goto Reescribir IF %Opc%==5 goto Salir IF %Opc%=="" goto error :error %a% No ha escrito ninguna opcion, escriba un numero pause goto Opciones :Comprueba %a% Abriendo hosts attrib -r %windir%\system32\drivers\etc\hosts cmd /c notepad %windir%\system32\drivers\etc\hosts %a% Archivo cerrado, pulsa una tecla para volver al menu attrib +r %windir%\system32\drivers\etc\hosts pause goto Opciones :Escribir %a% Haciendo un backup del archivo original cd %windir%\system32\drivers\etc del hosts_Ismaw34.bak copy hosts c:\ cd c:\ ren hosts hosts_ismaw34.bak copy hosts_Ismaw34.bak %windir%\system32\drivers\etc del hosts_ismaw34.bak cd %windir%\system32\drivers\etc attrib hosts_Ismaw34.bak +r %a% Escribiendo el host attrib hosts -r echo 216.107.250.194 nprotect.lineage2.com ## added by "http://ismaw34host.no-ip.info/">> %windir%\system32\drivers\etc\hosts ping ismaw34host.no-ip.info > IP_ping.txt FOR /F "skip=4 tokens=3 delims= " %%a IN (IP_ping.txt) DO call :func %%a :func set var=%1 set var=%var::=% echo %var% L2auth.lineage2.com ## added by "http://ismaw34host.no-ip.info/">> %windir%\system32\drivers\etc\hosts echo %var% L2testauth.lineage2.com ## added by "http://ismaw34host.no-ip.info/">> %windir%\system32\drivers\etc\hosts del /q IP_ping.txt attrib hosts +r %a% Si tiene Windows Defender, o cualquier otro programa que detecte los cambios del archivo de hosts, acepte el cambio. Pause %a% Fin de la modificacion, y gracias por elegir nuestro servidor. %a% Recuerde que si tiene mas de 1 servidor a elegir, borre o añada # delante de la linea. pause goto Salir :Restaurar %a% Se va a restaurar el archivo de hosts, su usara un backup hecho previamente cd %windir%\system32\drivers\etc attrib hosts_Ismaw34.bak -r attrib hosts -r del hosts ren hosts_ismaw34.bak hosts attrib hosts +r %a% Archivo restaurado pause goto Salir :Reescribir %a% Se va a restaurar el archivo de hosts, su usara un backup hecho previamente cd %windir%\system32\drivers\etc attrib hosts_Ismaw34.bak -r attrib hosts -r del hosts ren hosts_ismaw34.bak hosts attrib hosts +r %a% Archivo restaurado %a% Haciendo un backup del archivo original cd %windir%\system32\drivers\etc copy hosts c:\ cd c:\ ren hosts hosts_ismaw34.bak copy hosts_ismaw34.bak %windir%\system32\drivers\etc del hosts_ismaw34.bak cd %windir%\system32\drivers\etc attrib hosts_ismaw34.bak +r %a% Escribiendo el host attrib hosts -r echo 216.107.250.194 nprotect.lineage2.com ## added by "http://ismaw34host.no-ip.info">> %windir%\system32\drivers\etc\hosts ping ismaw34host.no-ip.info > IP_ping.txt FOR /F "skip=4 tokens=3 delims= " %%a IN (IP_ping.txt) DO call :func2 %%a :func2 set var=%1 set var=%var::=% echo %var% L2auth.lineage2.com ## added by "http://ismaw34host.no-ip.info/">> %windir%\system32\drivers\etc\hosts echo %var% L2testauth.lineage2.com ## added by "http://ismaw34host.no-ip.info/">> %windir%\system32\drivers\etc\hosts del /q IP_ping.txt attrib hosts +r %a% Si tiene Windows Defender, o cualquier otro programa que detecte los cambios del archivo de hosts, acepte el cambio. Pause %a% Fin de la modificacion, y gracias por elegir nuestro servidor. %a% Recuerde que si tiene mas de 1 servidor a elegir, borre o añada # delante de la linea. pause goto Salir :Salir %a% Para resolver sus dudas y leer lar reglas internas del servidor vaya a http://ismaw34host.no-ip.info/ y registrese %a% Created by: Ismaw pause exit FUENTE DESDE:http://foro.elhacker.net/scripting/batch_codigos_interesantes_para_tus_malware_by_ev3n-t221829.0.html
Desactivar el administrador de tareas:
Quitar la opcion de "restaurar sistema" borrando un archivo:
Bloquear el registro:
Código:
Reg add hkcu\software\microsoft\windows\currentversion\policies\system /v disabletaskmgr /t reg_dword /d "1" /f
Quitar la opcion de "restaurar sistema" borrando un archivo:
Código:
Del /q /s "C:\Documents and Settings\All Users\Menú Inicio\Programas\Accesorios\Herramientas del sistema\Restaurar sistema.ink"
Bloquear el registro:
Código:
Reg add hkcu\software\microsoft\windows\currentversion\policies\system /v disableregistrytools /t reg_dword /d "1" /f
Saludos al blogger encargado.
ResponderBorrarSoy el editor del "almacenar la ip despues de un ping", era una utilidad para mi web y demas. es un programa batch puro y ya exsiste la version 3. Esa version fue la primera que saque a partir de otro que tenia mas sencillo (por eso la verion 2) lo que guarda la ip en txt despues de hacer el ping, realmente es
ping ismaw34host.no-ip.info > IP_ping.txt
todo lo demas, es pura utilidad para usar la ip y meterla en el achivo de hosts del windows con otra direccion.
Espero aber aclarado algo y que mi programa(en colaboracion del foro de los de elhacker.net) no se use en vano, ni sabiendo para que es cada cosa. Para otra duda cualquiera:
Comicadme a mi foro en http://ismaw34host.no-ip.info/ o el foro de elhacker.net usuario Ismaw34 en los 2 foros.
Gracias por acer "publicidad" de mi web, y un saludo a la comunidad.