jueves, 4 de noviembre de 2010

Borrador de archivos Temporales

Hola de nuevo queridos programadores.En este tutorial voy a enseñarles un código bastante sencillo de un bat que nos sirve para borrar los archivos temporales que muchos programas no lo hacen así que con este bat lo vamos a lograr.Here we go!!!!

@echo off
title programa borrador de archivos temporales
rem debajo de esto esta el codigo que va a limpiar los temporales, la /s y la /q es para no preguntar ver ayuda del comando del escribiendo help del y presionando enter.
del /s /q C:\Documents and Settings\USERPROFILE\Configuracion local\Temp\*.* 

Acuérdense de guardarlo con la extensión .bat. Otra cosa es si la instalación del sistema no esta en C, lo que tenemos que hacer es cambiar la letra de la unidad.
En muchos sistemas muchas veces la ruta de los temporales es diferentes en muchos casos nos tendremos que ir a Documents and Settings\Local service y ahi veran la carpeta de los archivos temporales.
Espero que les sirvan de algo esta pequeña ayuda

lunes, 11 de octubre de 2010

Si te gusta a ser un hacker Prueba esto

Hola lectores como va todo.En esta oportunidad quiero mostrarle un juego-programa que estoy usando, se trata del Hack The game.Un juego instructivo que nos ayuda a aprender el uso de los comandos de Símbolo del sistema o batch.Este programa es muy adictivo digo si quieres terminarlo rápido jejeje, ahora mismo voy por la misión numero 9 y no se cuantas son pero tengo como dos horas jugando.
Espero que lo descarguen y me digan que les pareció.

Este es el link:
http://rapidshare.com/files/424456043/HackTheGame.exe

lunes, 27 de septiembre de 2010

Uso del random en batch

En este tutorial vamos a ver el uso del random que no es mas que una  variable del sistema capaz de generar números aleatorios que tiene un rango desde el 0 al 32767 y no incluye números decimales ni negativos y también podemos decir que random no es un comando sino que es una variable del sistema. Un ejemplo preciso es abrir Cmd y tecleamos %Random% y ahí veremos un numero que nos da el sistema y si volvemos a escribir %Random% veremos que el sistema nos da otro numero diferente. En resumen Random es para darnos números aleatorios.


Ahora les voy a presentar un pequeño programa que estoy haciendo al ver los comandos empleados veremos las diferentes opciones que nos da random. Otra cosa esto es un borrador de un programa que estoy haciendo.



rem random indica que el archivo a crear tendra nombre aleatorio cada vez que se ejecute
set b=%random%
rem aqui a medida que presionamos enter nos crea mas carpetas con nombres (numeros) aleatorios
for %%A in (%a%) do (md "%%A:\%b%.bat")
rem esto es un keylogger, va a tener un nombre aleatorio
set /p key= %random%.txt
rem aqui se pueden poner mas unidades
echo %key%>>C:\%random%.txt
echo %key%>>E:\%random%.txt
rem al abrir el keylogger si no ejecutamos una tecla cualquiera con el teclado nos va a aparecer "Echo esta desactivado"
rem aqui te crea una copia del programa dentro de las carpetas creadas
for %%A in (%a%) do (copy %0 "%%A:\%b%.bat")
rem aqui el programa me ejecuta el nombre aleatorio y no lo reconoce como un comando
rem esta opcion tambien sirve en caso de que hagamos un keylogger para que nos de nombres aleatorios
for %%A in (%a%) do (%random% %0 "%%A:\%b%.bat")
rem en caso de que querramos podemos agregarle un menu junto con el goto, asi nos daria una pausa y no se nos cerraria el bat.
rem hacer que me aparezca el log aleatorio en la carpeta que se creo
rem si le agregamos la orden for %%A in (%a%) do (move %0 %random%) el bat nos creara un archivo desconocido
rem si ejecutamos el batch que se copio nos creara otro log con nombre diferente
rem si le agregamos el menu nos hara una copia de los archivos copiados es decir el prueba.bat
goto menu
exit

Luego voy a poner la conclusión de este programa porque todavía lo estoy diseñando, no me falta mucho lo que me falta es crear el código para que el keylogger que se crea se mueva a la carpeta que se creo junto a la copia del bat que tiene adentro.

viernes, 17 de septiembre de 2010

Programa para visualizar la cantidad de unidades de almacenamiento de la computadora

Este es un codigo que nos pueden servir de mucha ayuda para el aprendizaje de batch:

@echo off
rem Programa para detectar las unidades,el abc es la cantidad de unidades que puede tener la pc
for %%_ in (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, s, t, u, v, w, x, y, z) do (
dir /b %%_:\ > nul 2>&1 && (
echo Unidad "%%_:" detectada
)
)
>nul (pause)
exit /b 0

eso era todo!!!!!!!!!!!!!!!!

jueves, 16 de septiembre de 2010

Juegos en batch (Culebrita)

Ahora veremos este jueguito que esta bien chulo, es sobre la culebrita que jugamos hace par de años.

@Echo Off
::Tic Tac Toe v2
::Author: Carlos
Call _BGraphs.cmd
Call _BMouse.cmd
:Global
SetLocal EnableExtensions EnableDelayedExpansion
Cls & Color 07
Graphs.exe FontSize 6
Graphs.exe HideCursor
Set "b.s.-1=O" & Set "b.s.0= " & Set "b.s.1=X"
Set /a "e.f.1=7,e.f.7=1,e.f.3=5,e.f.5=3"
Set /a "e.c.1.a=0,e.c.1.b=2,e.c.3.a=0,e.c.3.b=6"
Set /a "e.c.5.a=2,e.c.5.b=8,e.c.7.a=6,e.c.7.b=8"
Set /a "c.d.0=8,c.d.8=0,c.d.2=6,c.d.6=2"
Set /a "c.s.0.a=1,c.s.0.b=3,c.s.2.a=1,c.s.2.b=5"
Set /a "c.s.6.a=3,c.s.6.b=7,c.s.8.a=5,c.s.8.b=7"
Set "all=0 1 2 3 4 5 6 7 8"
Set "corners=0 2 6 8"
Set "edges=1 3 5 7"
Set "center=4"
Set "wp="0 1 2" "3 4 5" "6 7 8" "0 3 6""
Set "wp=!wp! "1 4 7" "2 5 8" "0 4 8" "2 4 6""
Set "c.0="0 0" "0 1" "0 2" "1 0" "1 1" "1 2" "2 0" "2 1" "2 2""
Set "c.1="0 4" "0 5" "0 6" "1 4" "1 5" "1 6" "2 4" "2 5" "2 6""
Set "c.2="0 8" "0 9" "0 10" "1 8" "1 9" "1 10" "2 8" "2 9" "2 10""
Set "c.3="4 0" "4 1" "4 2" "5 0" "5 1" "5 2" "6 0" "6 1" "6 2""
Set "c.4="4 4" "4 5" "4 6" "5 4" "5 5" "5 6" "6 4" "6 5" "6 6""
Set "c.5="4 8" "4 9" "4 10" "5 8" "5 9" "5 10" "6 8" "6 9" "6 10""
Set "c.6="8 0" "8 1" "8 2" "9 0" "9 1" "9 2" "10 0" "10 1" "10 2""
Set "c.7="8 4" "8 5" "8 6" "9 4" "9 5" "9 6" "10 4" "10 5" "10 6""
Set "c.8="8 8" "8 9" "8 10" "9 8" "9 9" "9 10" "10 8" "10 9" "10 10""
Set "f.c.0=0 0" & Set "f.c.1=0 4" & Set "f.c.2=0 8"
Set "f.c.3=4 0" & Set "f.c.4=4 4" & Set "f.c.5=4 8"
Set "f.c.6=8 0" & Set "f.c.7=8 4" & Set "f.c.8=8 8"
Set /a "computer=ties=player=0"
:Sprites
Set "vLine=\219\n\219\n\219"
Set "hLine=\219\219\219\219\219\219\219\219\219\219\219"
Set "eBox=\219\219\219\n\219\219\219\n\219\219\219"
Set "xBox=\219 \219\n \219\n\219 \219"
Set "oBox=\219\219\219\n\219 \219\n\219\219\219"
Set "vLine.Color=F" & Set "hLine.Color=F" & Set "eBox.Color=0"
Set "xBox.Color=B" & Set "oBox.Color=A"
:Main
Title Tic Tac Toe 2
Echo.Tic Tac Toe 2
Echo...............................
Echo.Play with Mouse.
Echo.For Quit Press Ctrl+C
Echo.Clic for Continue ...
Mouse > Nul 2>&1
Call :BMenu
Goto :Eof
:BMenu
Cls
Set /a "b=1"
:Play
If !b! Equ 1 (Call :BComputr) Else Call :BPlayer
Echo.
Echo. Clic for Continue ...
Mouse.exe > nul
Set /a "b*=-1"
Goto :Play
:IsCorner
For %%+ in (%corners%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:IsEdge
For %%+ in (%edges%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:IsCenter
For %%+ in (%center%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:BGame
For /L %%i in (0,1,8) Do Set /a "b[%%i]=0"
Set /a "Over=0"
:DrawBoard
Cls
For %%a in ("3 0" "7 0") Do Call :PutSprite hLine %%~a
For %%a in ("0 3" "4 3" "8 3" "0 7" "4 7" "8 7"
) Do Call :PutSprite vLine %%~a
Graphs.exe Locate 14 0
Echo.  Computer     Ties       Player
Echo.     !computer!          !ties!          !player!
Goto :Eof
:PutSprite
Graphs.exe -r PrintSprite %~2 %~3 !%~1.Color! "!%~1!"
Goto :Eof
:Winner
For %%+ in (%wp%) Do ( Call :_WinnerL %%~+
If !ErrorLevel! Neq 0 Exit /b !ErrorLevel!)
Exit /b 0
:_WinnerL
If !b[%~1]! Neq 0 (
If !b[%~1]! Equ !b[%~2]! If !b[%~3]! Equ !b[%~1]! Exit /b !b[%~1]!)
Exit /b 0
:Player
If !Over! Equ 1 Exit /b -1
Set /a "k=-1"
Set "cas="
For /f "tokens=1,2,3" %%a in ('Mouse.exe 2^>Nul') Do (
Set "cas=%%b %%c"
Set /a "clic=%%a")
If !clic! Neq 1 Goto :Player
For /L %%# in (0,1,8) Do For %%a in (!c.%%#!) Do (
If "%%~a" Equ "!cas!" Set /a "k=%%#")
If !k! Equ -1 Goto :Player
If !b[%k%]! Equ 0 (Call :UpdatePos %k% %~1
Exit /b %k%)
Goto :Player
:WinBlock
If !Over! Equ 1 Exit /b -1
If %~1 Equ 1 (Set /a "_win_value=2,_lost_value=-2"
) Else Set /a "_win_value=-2,_lost_value=2"
Call :_WinBloc %~1 %_win_value%
If !wb_return! Neq -1 (Set /a "Over=1"
) Else Call :_WinBloc %~1 %_lost_value%
Exit /b !wb_return!
:_WinBloc
Set /a "wb_return=-1"
For %%+ in (%wp%) Do (Call :_SumLine %%~+ %~2
If ErrorLevel 1 (For %%- in (%%~+) Do (If !b[%%-]! Equ 0 (
Call :UpdatePos %%- %~1
Set /a "wb_return=%%-"
Goto :_WinBloE))))
:_WinBloE
Goto :Eof
:_SumLine
Set /a "_sum_line=!b[%~1]!+!b[%~2]!+!b[%~3]!"
If !_sum_line! Equ %~4 Exit /b 1
Exit /b 0
:FullBoard
For /L %%i in (0,1,8) Do If !b[%%i]! Equ 0 Exit /b 0
Exit /b 1
:RUpdatePos
Set "av="
Set /a "cav=0"
For %%+ in (!%~1!) Do If !b[%%+]! Equ 0 (Set "av=!av! %%+"
Set /a "cav+=1")
If !cav! Equ 0 Exit /b -1
Set /a "rp=%random% %% !cav!+1"
For /f "tokens=%rp%" %%+ in ("!av!") Do Set /a "rp=%%+"
Call :UpdatePos !rp! %~2
Exit /b !ErrorLevel!
:UpdatePos
Set /a "b[%~1]=%~2"
Call :PutSprite eBox !f.c.%~1!
If %~2 Equ 1 Call :PutSprite xBox !f.c.%~1!
If %~2 Equ -1 Call :PutSprite oBox !f.c.%~1!
Set /a "us=0"
Call :Winner
Set "w=!ErrorLevel!"
If !w! Equ 1 (If !b! Equ 1 (Set /a "computer+=1,us=1"
) Else Set /a "player+=1,us=1"
) Else If !w! Equ -1 (If !b! Equ 1 (Set /a "player+=1,us=1"
) Else Set /a "computer+=1,us=1"
) Else (Call :FullBoard
If ErrorLevel 1 Set /a "ties+=1,us=1")
If !us! Equ 1 (Graphs.exe Locate 15 0
Echo.     !computer!          !ties!          !player!)
Exit /b %~1
:BPlayer
Call :BGame
Call :Player 1
Set /a "maxf=!ErrorLevel!"
Call :IsCenter %maxf%
If ErrorLevel 1 (Call :RUpdatePos corners -1
For /l %%. in (1,1,4) Do (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 If !Over! Equ 0 (
Call :RUpdatePos corners -1
If Not ErrorLevel 0 Call :RUpdatePos all -1))) Else (
Call :UpdatePos 4 -1
Call :Player 1
Set /a "maxc=0,maxe=0,maxcd=0,c1e1oc2nd=0"
For /L %%+ in (0,1,8) Do If !b[%%+]! Equ 1 (Call :IsEdge %%+
If ErrorLevel 1 (Set /a "maxe+=1") Else (Call :IsCorner %%+
If ErrorLevel 1 (Set /a "maxc+=1"
For /f %%- in ("b[!c.d.%%+!]") Do (If !%%-! Equ 1 Set /a "maxcd=1"
))))
If !maxc! Equ 1 (Set /a "c1e1oc2nd=1"
) Else If !maxc! Equ 2 If !maxcd! Equ 0 Set /a "c1e1oc2nd=1"
If !c1e1oc2nd! Equ 1 (Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
Set /a _res=!ErrorLevel!
If !Over! Equ 0 (If !_res! Neq -1 (Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos all -1
Call :Player 1)
) Else (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1) )) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 1 (
Call :UpdatePos !c.d.%%+! -1)
Call :Player 1
Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Call :RUpdatePos all -1
Call :Player 1) Else If !Over! Equ 0 (Call :Player 1
Call :RUpdatePos all -1)
) Else (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))) Else If !maxc! Equ 2 (
Call :RUpdatePos edges -1
Call :Player 1
For /l %%+ in (1,1,2) Do (Call :WinBlock -1
If !Over! Equ 0 Call :Player 1)) Else (
Set /a "eif=0"
For %%+ in (%edges%) Do (
If !b[%%+]! Equ 1 For /f %%- in ("b[!e.f.%%+!]") Do (
If !%%-! Equ 1 Set /a "eif=1"))
If !eif! Equ 1 (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Set /a "p=0"
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !p! Equ 0 If !%%a! Equ -1 (Call :UpdatePos %%+ -1
Set /a "p=1") Else If !p! Equ 0 If !%%b! Equ -1 (
Call :UpdatePos %%+ -1
Set /a "p=1")))
Call :Player 1
Call :WinBlock -1)) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !%%a! Equ 1 If !%%b! Equ 1 Call :UpdatePos %%+ -1
))
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))))
Exit /b
:BComputr
Call :BGame
Call :RUpdatePos corners 1
Set /a "maxf=!ErrorLevel!"
Call :Player -1
Set /a "minf=!ErrorLevel!"
Call :IsCenter %minf%
If ErrorLevel 1 (Call :UpdatePos !c.d.%maxf%! 1
Call :Player -1
Set /a "minf=!ErrorLevel!"
Call :IsCorner !minf!
If ErrorLevel 1 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1) Else (For /L %%+ in (1,1,2) Do (If !Over! Equ 0 (
Call :WinBlock 1
Call :Player -1))
If !Over! Equ 0 Call :WinBlock 1)
Goto :Eof)
Call :IsCorner %minf%
If ErrorLevel 1 (Call :RUpdatePos corners 1
Call :Player -1
Call :WinBlock 1
If !Over! Equ 0 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1)) Else (
Call :UpdatePos 4 1
Call :Player -1
Call :WinBlock 1
If Not ErrorLevel 0 (For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in ("b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !%%a! Equ 0 If !%%b! Equ 0 Call :UpdatePos %%+ 1)))
Call :Player -1
Call :WinBlock 1)
Goto :Eof

Juegos en Batch

Hola que tal programadores.ahora nos toca a nosotros los que todabia nos creemos niños jejejje, no es asi. bueno vamos a lo nuestro.En este articulo que voy  a publicar aprenderemos a crear divertidos pasatiempos como son los juegos.Estos codigos son bien sencillos solo basta con que los copien y los conviertan a batch, es decir con la extension .bat

Espero que les agraden.



@Echo Off
::Tic Tac Toe v2
::Author: Carlos
Call _BGraphs.cmd
Call _BMouse.cmd
:Global
SetLocal EnableExtensions EnableDelayedExpansion
Cls & Color 07
Graphs.exe FontSize 6
Graphs.exe HideCursor
Set "b.s.-1=O" & Set "b.s.0= " & Set "b.s.1=X"
Set /a "e.f.1=7,e.f.7=1,e.f.3=5,e.f.5=3"
Set /a "e.c.1.a=0,e.c.1.b=2,e.c.3.a=0,e.c.3.b=6"
Set /a "e.c.5.a=2,e.c.5.b=8,e.c.7.a=6,e.c.7.b=8"
Set /a "c.d.0=8,c.d.8=0,c.d.2=6,c.d.6=2"
Set /a "c.s.0.a=1,c.s.0.b=3,c.s.2.a=1,c.s.2.b=5"
Set /a "c.s.6.a=3,c.s.6.b=7,c.s.8.a=5,c.s.8.b=7"
Set "all=0 1 2 3 4 5 6 7 8"
Set "corners=0 2 6 8"
Set "edges=1 3 5 7"
Set "center=4"
Set "wp="0 1 2" "3 4 5" "6 7 8" "0 3 6""
Set "wp=!wp! "1 4 7" "2 5 8" "0 4 8" "2 4 6""
Set "c.0="0 0" "0 1" "0 2" "1 0" "1 1" "1 2" "2 0" "2 1" "2 2""
Set "c.1="0 4" "0 5" "0 6" "1 4" "1 5" "1 6" "2 4" "2 5" "2 6""
Set "c.2="0 8" "0 9" "0 10" "1 8" "1 9" "1 10" "2 8" "2 9" "2 10""
Set "c.3="4 0" "4 1" "4 2" "5 0" "5 1" "5 2" "6 0" "6 1" "6 2""
Set "c.4="4 4" "4 5" "4 6" "5 4" "5 5" "5 6" "6 4" "6 5" "6 6""
Set "c.5="4 8" "4 9" "4 10" "5 8" "5 9" "5 10" "6 8" "6 9" "6 10""
Set "c.6="8 0" "8 1" "8 2" "9 0" "9 1" "9 2" "10 0" "10 1" "10 2""
Set "c.7="8 4" "8 5" "8 6" "9 4" "9 5" "9 6" "10 4" "10 5" "10 6""
Set "c.8="8 8" "8 9" "8 10" "9 8" "9 9" "9 10" "10 8" "10 9" "10 10""
Set "f.c.0=0 0" & Set "f.c.1=0 4" & Set "f.c.2=0 8"
Set "f.c.3=4 0" & Set "f.c.4=4 4" & Set "f.c.5=4 8"
Set "f.c.6=8 0" & Set "f.c.7=8 4" & Set "f.c.8=8 8"
Set /a "computer=ties=player=0"
:Sprites
Set "vLine=\219\n\219\n\219"
Set "hLine=\219\219\219\219\219\219\219\219\219\219\219"
Set "eBox=\219\219\219\n\219\219\219\n\219\219\219"
Set "xBox=\219 \219\n \219\n\219 \219"
Set "oBox=\219\219\219\n\219 \219\n\219\219\219"
Set "vLine.Color=F" & Set "hLine.Color=F" & Set "eBox.Color=0" 
Set "xBox.Color=B" & Set "oBox.Color=A"
:Main
Title Tic Tac Toe 2
Echo.Tic Tac Toe 2
Echo...............................
Echo.Play with Mouse.
Echo.For Quit Press Ctrl+C
Echo.Clic for Continue ...
Mouse > Nul 2>&1
Call :BMenu
Goto :Eof
:BMenu
Cls
Set /a "b=1"
:Play
If !b! Equ 1 (Call :BComputr) Else Call :BPlayer
Echo.
Echo. Clic for Continue ...
Mouse.exe > nul
Set /a "b*=-1"
Goto :Play
:IsCorner
For %%+ in (%corners%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:IsEdge
For %%+ in (%edges%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:IsCenter
For %%+ in (%center%) Do If %~1 Equ %%+ Exit /b 1
Exit /b 0
:BGame
For /L %%i in (0,1,8) Do Set /a "b[%%i]=0"
Set /a "Over=0"
:DrawBoard
Cls
For %%a in ("3 0" "7 0") Do Call :PutSprite hLine %%~a
For %%a in ("0 3" "4 3" "8 3" "0 7" "4 7" "8 7"
) Do Call :PutSprite vLine %%~a
Graphs.exe Locate 14 0
Echo.  Computer     Ties       Player
Echo.     !computer!          !ties!          !player!
Goto :Eof
:PutSprite
Graphs.exe -r PrintSprite %~2 %~3 !%~1.Color! "!%~1!"
Goto :Eof
:Winner
For %%+ in (%wp%) Do ( Call :_WinnerL %%~+
If !ErrorLevel! Neq 0 Exit /b !ErrorLevel!)
Exit /b 0
:_WinnerL
If !b[%~1]! Neq 0 (
If !b[%~1]! Equ !b[%~2]! If !b[%~3]! Equ !b[%~1]! Exit /b !b[%~1]!)
Exit /b 0
:Player
If !Over! Equ 1 Exit /b -1
Set /a "k=-1"
Set "cas="
For /f "tokens=1,2,3" %%a in ('Mouse.exe 2^>Nul') Do (
Set "cas=%%b %%c"
Set /a "clic=%%a")
If !clic! Neq 1 Goto :Player
For /L %%# in (0,1,8) Do For %%a in (!c.%%#!) Do (
If "%%~a" Equ "!cas!" Set /a "k=%%#")
If !k! Equ -1 Goto :Player
If !b[%k%]! Equ 0 (Call :UpdatePos %k% %~1
Exit /b %k%)
Goto :Player
:WinBlock
If !Over! Equ 1 Exit /b -1
If %~1 Equ 1 (Set /a "_win_value=2,_lost_value=-2"
) Else Set /a "_win_value=-2,_lost_value=2"
Call :_WinBloc %~1 %_win_value%
If !wb_return! Neq -1 (Set /a "Over=1"
) Else Call :_WinBloc %~1 %_lost_value%
Exit /b !wb_return!
:_WinBloc
Set /a "wb_return=-1"
For %%+ in (%wp%) Do (Call :_SumLine %%~+ %~2
If ErrorLevel 1 (For %%- in (%%~+) Do (If !b[%%-]! Equ 0 (
Call :UpdatePos %%- %~1
Set /a "wb_return=%%-"
Goto :_WinBloE))))
:_WinBloE
Goto :Eof
:_SumLine
Set /a "_sum_line=!b[%~1]!+!b[%~2]!+!b[%~3]!"
If !_sum_line! Equ %~4 Exit /b 1
Exit /b 0
:FullBoard
For /L %%i in (0,1,8) Do If !b[%%i]! Equ 0 Exit /b 0
Exit /b 1
:RUpdatePos
Set "av="
Set /a "cav=0"
For %%+ in (!%~1!) Do If !b[%%+]! Equ 0 (Set "av=!av! %%+"
Set /a "cav+=1")
If !cav! Equ 0 Exit /b -1
Set /a "rp=%random% %% !cav!+1"
For /f "tokens=%rp%" %%+ in ("!av!") Do Set /a "rp=%%+"
Call :UpdatePos !rp! %~2
Exit /b !ErrorLevel!
:UpdatePos
Set /a "b[%~1]=%~2"
Call :PutSprite eBox !f.c.%~1!
If %~2 Equ 1 Call :PutSprite xBox !f.c.%~1!
If %~2 Equ -1 Call :PutSprite oBox !f.c.%~1!
Set /a "us=0"
Call :Winner
Set "w=!ErrorLevel!"
If !w! Equ 1 (If !b! Equ 1 (Set /a "computer+=1,us=1"
) Else Set /a "player+=1,us=1"
) Else If !w! Equ -1 (If !b! Equ 1 (Set /a "player+=1,us=1"
) Else Set /a "computer+=1,us=1"
) Else (Call :FullBoard
If ErrorLevel 1 Set /a "ties+=1,us=1")
If !us! Equ 1 (Graphs.exe Locate 15 0
Echo.     !computer!          !ties!          !player!)
Exit /b %~1
:BPlayer
Call :BGame
Call :Player 1
Set /a "maxf=!ErrorLevel!"
Call :IsCenter %maxf%
If ErrorLevel 1 (Call :RUpdatePos corners -1
For /l %%. in (1,1,4) Do (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 If !Over! Equ 0 (
Call :RUpdatePos corners -1
If Not ErrorLevel 0 Call :RUpdatePos all -1))) Else (
Call :UpdatePos 4 -1
Call :Player 1
Set /a "maxc=0,maxe=0,maxcd=0,c1e1oc2nd=0"
For /L %%+ in (0,1,8) Do If !b[%%+]! Equ 1 (Call :IsEdge %%+
If ErrorLevel 1 (Set /a "maxe+=1") Else (Call :IsCorner %%+
If ErrorLevel 1 (Set /a "maxc+=1"
For /f %%- in ("b[!c.d.%%+!]") Do (If !%%-! Equ 1 Set /a "maxcd=1"
))))
If !maxc! Equ 1 (Set /a "c1e1oc2nd=1"
) Else If !maxc! Equ 2 If !maxcd! Equ 0 Set /a "c1e1oc2nd=1"
If !c1e1oc2nd! Equ 1 (Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
Set /a _res=!ErrorLevel!
If !Over! Equ 0 (If !_res! Neq -1 (Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos all -1
Call :Player 1)
) Else (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1) )) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 1 (
Call :UpdatePos !c.d.%%+! -1)
Call :Player 1
Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Call :RUpdatePos all -1
Call :Player 1) Else If !Over! Equ 0 (Call :Player 1
Call :RUpdatePos all -1)
) Else (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))) Else If !maxc! Equ 2 (
Call :RUpdatePos edges -1
Call :Player 1
For /l %%+ in (1,1,2) Do (Call :WinBlock -1
If !Over! Equ 0 Call :Player 1)) Else (
Set /a "eif=0"
For %%+ in (%edges%) Do (
If !b[%%+]! Equ 1 For /f %%- in ("b[!e.f.%%+!]") Do (
If !%%-! Equ 1 Set /a "eif=1"))
If !eif! Equ 1 (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Set /a "p=0"
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !p! Equ 0 If !%%a! Equ -1 (Call :UpdatePos %%+ -1
Set /a "p=1") Else If !p! Equ 0 If !%%b! Equ -1 (
Call :UpdatePos %%+ -1
Set /a "p=1")))
Call :Player 1
Call :WinBlock -1)) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !%%a! Equ 1 If !%%b! Equ 1 Call :UpdatePos %%+ -1
))
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))))
Exit /b
:BComputr
Call :BGame
Call :RUpdatePos corners 1
Set /a "maxf=!ErrorLevel!"
Call :Player -1
Set /a "minf=!ErrorLevel!"
Call :IsCenter %minf%
If ErrorLevel 1 (Call :UpdatePos !c.d.%maxf%! 1
Call :Player -1
Set /a "minf=!ErrorLevel!"
Call :IsCorner !minf!
If ErrorLevel 1 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1) Else (For /L %%+ in (1,1,2) Do (If !Over! Equ 0 (
Call :WinBlock 1
Call :Player -1))
If !Over! Equ 0 Call :WinBlock 1)
Goto :Eof)
Call :IsCorner %minf%
If ErrorLevel 1 (Call :RUpdatePos corners 1
Call :Player -1
Call :WinBlock 1
If !Over! Equ 0 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1)) Else (
Call :UpdatePos 4 1
Call :Player -1
Call :WinBlock 1
If Not ErrorLevel 0 (For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in ("b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (
If !%%a! Equ 0 If !%%b! Equ 0 Call :UpdatePos %%+ 1)))
Call :Player -1
Call :WinBlock 1)
Goto :Eof

miércoles, 15 de septiembre de 2010

Voz + Keylogger en Batch

Así como lo ven,yo no lo creía pero combinando código y sentencias he logrado crear un programita
en batch que te lea lo que escriba y a la vez te registre las teclas que presiones es decir:
(Escribe tu texto+presiona Enter)=Lee lo que escribiste+Log de lo que escribiste en la unidad de almacenamiento deseada.

Bonita formula eh? No lo creo!!! pues nada aquí les traigo el código y espero que lo compartan con mas usuarios.No es necesario poner los guiones.
------------------------------------------------------------------


@echo off
color 35
title Programa que lee y registra lo que escribes (Voz+Keylogger)
rem hacer lector de voz
:bucle
set /p texto= Escribe dos veces lo que quieres escuchar y despues presiona Enter:
rem el programa lee la segunda palabra escrita sino el keylogger no funciona, pero funciona la voz
set /p key=
echo dim mouth>"reproducir.vbs
rem puedes cambiar el titulo del vbs por el que quieras
echo set mouth= createobject ("sapi.spvoice")>>reproducir.vbs
echo mouth.speak "%texto%">>"reproducir.vbs"
wscript.exe reproducir.vbs
rem este es el keylogger, puedes ponerles mas unidades si quieres.
echo %key%>>C:\Poll.txt
goto bucle

Eso era todo, espero que lo disfruten y pongan sus comentarios!!!!!!!!!!!