elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Librería de funciones y scripts BATCH Actualizado 26/05/07
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] Ir Abajo Respuesta Imprimir
Autor Tema: Librería de funciones y scripts BATCH Actualizado 26/05/07  (Leído 64,092 veces)
bITEBUG

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #10 en: 18 Junio 2011, 04:09 am »

TYPE HEXADECIMAL PARA DOS

Código
  1. @echo off
  2. rem dump.bat
  3. setlocal enabledelayedexpansion
  4. set byte=
  5. set offset=
  6. set op1=
  7. set op2=
  8. if %1==/h goto help
  9. if %1==/p (set op1=%1
  10. shift)
  11. if %1==/pp (set op2=%1
  12. shift)
  13. if not exist %1 (
  14. set errorlevel=1
  15. echo no se encuentra el archivo %1
  16. goto end
  17. )
  18. (
  19. Echo;E %~z1 "%~s1"
  20. Echo;D 0 %~z1
  21. Echo;Q
  22. )>d
  23. debug %~s1<d>dmp
  24. del d
  25. if not defined op1 if not defined op2 (type dmp
  26. del dmp
  27. goto end)
  28. if not defined op1 goto op2
  29. for /f "tokens=*" %%x in (dmp) do (set unformatted=%%x
  30. set formatted=!unformatted:   = ; !
  31. echo !formatted!>>dig)
  32. for /f "eol=; tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" %%a in (dig) do (set offset=%%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m %%n
  33. set offset=!offset:;=!
  34. echo !offset:-= !
  35. )
  36. del dmp
  37. del dig
  38. goto end
  39. :op2
  40. for /f "tokens=*" %%x in (dmp) do (set unformatted=%%x
  41. set formatted=!unformatted:   = ; !
  42. echo !formatted!>>dig)
  43. for /f "eol=; tokens=2,3,4,5,6,7,8,9,10,11,12,13,14,15" %%a in (dig) do (set offset=%%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m
  44. set offset=!offset:;=!
  45. echo !offset:-= !
  46. )
  47. goto end
  48. :Help
  49. echo Muestra el contenido binario de un archivo,
  50. echo.
  51. echo y la sintaxis es la siguiente:
  52. echo Dump ^</p^> ^</pp^> ^<[unidad\ruta\archivo]^>
  53. echo /p Omitira mostrar el texto en ascii
  54. echo /pp Solo mostrara el codigo hexadecimal
  55. :end
  56.  
  57. del dmp
  58. del dig
  59. :end
  60. set byte=
  61. set offset=


« Última modificación: 18 Junio 2011, 04:13 am por bITEBUG » En línea

bITEBUG

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #11 en: 24 Junio 2011, 01:31 am »

Un poquito de juego al caso y de paso sentar la base para aplicaciones graficas dentro de un TUI.
A dar volumen a la cosa con un poco de ayuda  del desvirtuado ASCIIart.

Código
  1. Rem Path3D.bat by biTEBUG
  2. @echo off
  3. set a=%2
  4. set b=%3
  5. set c=%4
  6. set d=%5
  7. set e=%6
  8. set f=%7
  9. set g=%8
  10. set switcha=*
  11. set switchb=*
  12. set switchc=*
  13. set switchd=*
  14. set switche=*
  15. set switchf=*
  16. set switchg=*
  17. :ini
  18. set marco=-1
  19. cls
  20. set door=1
  21. set cvisual=1
  22. set lcenter=
  23. set rcenter=.
  24. set horizon=
  25. set fpoint=x
  26. set infarist=/ \
  27. set height=%1
  28. :umbral
  29. set horizon=%horizon%
  30. set /a cvisual=%cvisual%+1
  31. if not %cvisual%==%height% goto umbral
  32.  
  33.  
  34. :fuga
  35. if not "%marco%"=="1" ( echo %lcenter:.=^|%\%horizon%%horizon%/%lcenter:.= % ) else ( echo.%lcenter:.=^|%%horizon%.%horizon%/%lcenter:.= %)
  36. set horizon=%horizon:~1%
  37. if "%cvisual%"=="%a%" goto door
  38. if "%cvisual%"=="%b%" goto door
  39. if "%cvisual%"=="%c%" goto door
  40. if "%cvisual%"=="%d%" goto door
  41. if "%cvisual%"=="%e%" goto door
  42. if "%cvisual%"=="%f%" goto door
  43. if "%cvisual%"=="%g%" goto door
  44. goto notdoor
  45. :door
  46. (set /a marco=%marco%*-1
  47. set /a door=%door%*0)
  48. :notdoor
  49. if not "%door%"=="1" (set lcenter=%lcenter%.) else (set lcenter=%lcenter% )
  50. set door=1
  51. set /a cvisual=%cvisual%-1
  52. if not %cvisual%==0 goto fuga
  53. echo %lcenter:.=^|%\%horizon%%horizon%/%lcenter:.= %
  54. :captura
  55.  
  56. echo %lcenter:.=^|%/%horizon%%horizon%\%lcenter:.= %
  57. set horizon=%horizon%
  58. set lcenter=%lcenter:~,-1%
  59. set /a cvisual=%cvisual%+1
  60. if not %cvisual%==%height% goto captura
  61. if not %cvisual%==%height% goto captura
  62. endlocal
  63. goto forward
  64. if "%a%" gtr "%1" set switcha=/
  65. if "%b%" gtr "%1" set switchb=/
  66. if "%c%" gtr "%1" set switchc=/
  67. if "%d%" gtr "%1" set switchd=/
  68. if "%e%" gtr "%1" set switche=/
  69. if "%f%" gtr "%1" set switchf=/
  70. if "%g%" gtr "%1" set switchg=/
  71. if "%a%"=="1" set switcha=*
  72. if "%b%"=="1" set switchb=*
  73. if "%c%"=="1" set switchc=*
  74. if "%d%"=="1" set switchd=*
  75. if "%e%"=="1" set switche=*
  76. if "%f%"=="1" set switchf=*
  77. if "%g%"=="1" set switchg=*
  78. :if %a% gtr %1 goto stop
  79.  
  80. if "%a%" gtr "%1" set a=%2
  81. if "%b%" gtr "%1" set b=%3
  82. if "%c%" gtr "%1" set c=%4
  83. echo if "%c%" gtr "%1" set c=%4
  84. if "%d%" gtr "%1" set d=%5
  85. if "%e%" gtr "%1" set e=%6
  86. if "%f%" gtr "%1" set f=%7
  87. if "%g%" gtr "%1" set g=%8
  88. echo if "%c%" gtr "%1" set c=%4
  89. :forward
  90. if defined a set /a a=%a%%switcha%2
  91. if defined b set /a b=%b%%switchb%2
  92. if defined c set /a c=%c%%switchc%2
  93. if defined d set /a d=%d%%switchd%2
  94. if defined e set /a e=%e%%switche%2
  95. if defined f set /a f=%f%%switchf%2
  96. if defined g set /a g=%g%%switchg%2
  97. call wait 2
  98. goto ini
  99. :stop

\                                                / 
  \                                              /   
   \                                            /   
    \                                          /     
     \                                        /     
      \                                      /       
       \                                    /       
        \                                  /         
         \                                /         
          \                              /           
           \                            /           
            \                          /             
             \                        /             
             |           .           /             
             |           .          /               
             | |\                  /                 
             | | \                /                 
             | |  \              /                   
             | |   \            /                   
             | |   |     .     /                   
             | |   ||\        /                     
             | |   || \      /                       
             | |   ||  \    /                       
             | |   ||   \  /                         
             | |   ||    \/                         
             | |   ||    /\                         
             | |   ||   /  \                       
             | |   ||  /    \                       
             | |   || /      \                     
             | |   ||/        \                     
             | |   |/          \                   
             | |   /            \                   
             | |  /              \                 
             | | /                \                 
             | |/                  \               
             | /                    \               
             |/                      \             
             /                        \             
            /                          \           
           /                            \           
          /                              \         
         /                                \         
        /                                  \       
       /                                    \       
      /                                      \     
     /                                        \     
    /                                          \   
   /                                            \   
  /                                              \ 


« Última modificación: 24 Junio 2011, 01:36 am por bITEBUG » En línea

SuperDraco


Desconectado Desconectado

Mensajes: 2.505


Crew Dragon


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #12 en: 29 Junio 2011, 23:16 pm »

Un poquito de juego al caso y de paso sentar la base para aplicaciones graficas dentro de un TUI.
A dar volumen a la cosa con un poco de ayuda  del desvirtuado ASCIIart.

Código
  1. Rem Path3D.bat by biTEBUG
  2. @echo off
  3. set a=%2
  4. set b=%3
  5. set c=%4
  6. set d=%5
  7. set e=%6
  8. set f=%7
  9. set g=%8
  10. set switcha=*
  11. set switchb=*
  12. set switchc=*
  13. set switchd=*
  14. set switche=*
  15. set switchf=*
  16. set switchg=*
  17. :ini
  18. set marco=-1
  19. cls
  20. set door=1
  21. set cvisual=1
  22. set lcenter=
  23. set rcenter=.
  24. set horizon=
  25. set fpoint=x
  26. set infarist=/ \
  27. set height=%1
  28. :umbral
  29. set horizon=%horizon%
  30. set /a cvisual=%cvisual%+1
  31. if not %cvisual%==%height% goto umbral
  32.  
  33.  
  34. :fuga
  35. if not "%marco%"=="1" ( echo %lcenter:.=^|%\%horizon%%horizon%/%lcenter:.= % ) else ( echo.%lcenter:.=^|%%horizon%.%horizon%/%lcenter:.= %)
  36. set horizon=%horizon:~1%
  37. if "%cvisual%"=="%a%" goto door
  38. if "%cvisual%"=="%b%" goto door
  39. if "%cvisual%"=="%c%" goto door
  40. if "%cvisual%"=="%d%" goto door
  41. if "%cvisual%"=="%e%" goto door
  42. if "%cvisual%"=="%f%" goto door
  43. if "%cvisual%"=="%g%" goto door
  44. goto notdoor
  45. :door
  46. (set /a marco=%marco%*-1
  47. set /a door=%door%*0)
  48. :notdoor
  49. if not "%door%"=="1" (set lcenter=%lcenter%.) else (set lcenter=%lcenter% )
  50. set door=1
  51. set /a cvisual=%cvisual%-1
  52. if not %cvisual%==0 goto fuga
  53. echo %lcenter:.=^|%\%horizon%%horizon%/%lcenter:.= %
  54. :captura
  55.  
  56. echo %lcenter:.=^|%/%horizon%%horizon%\%lcenter:.= %
  57. set horizon=%horizon%
  58. set lcenter=%lcenter:~,-1%
  59. set /a cvisual=%cvisual%+1
  60. if not %cvisual%==%height% goto captura
  61. if not %cvisual%==%height% goto captura
  62. endlocal
  63. goto forward
  64. if "%a%" gtr "%1" set switcha=/
  65. if "%b%" gtr "%1" set switchb=/
  66. if "%c%" gtr "%1" set switchc=/
  67. if "%d%" gtr "%1" set switchd=/
  68. if "%e%" gtr "%1" set switche=/
  69. if "%f%" gtr "%1" set switchf=/
  70. if "%g%" gtr "%1" set switchg=/
  71. if "%a%"=="1" set switcha=*
  72. if "%b%"=="1" set switchb=*
  73. if "%c%"=="1" set switchc=*
  74. if "%d%"=="1" set switchd=*
  75. if "%e%"=="1" set switche=*
  76. if "%f%"=="1" set switchf=*
  77. if "%g%"=="1" set switchg=*
  78. :if %a% gtr %1 goto stop
  79.  
  80. if "%a%" gtr "%1" set a=%2
  81. if "%b%" gtr "%1" set b=%3
  82. if "%c%" gtr "%1" set c=%4
  83. echo if "%c%" gtr "%1" set c=%4
  84. if "%d%" gtr "%1" set d=%5
  85. if "%e%" gtr "%1" set e=%6
  86. if "%f%" gtr "%1" set f=%7
  87. if "%g%" gtr "%1" set g=%8
  88. echo if "%c%" gtr "%1" set c=%4
  89. :forward
  90. if defined a set /a a=%a%%switcha%2
  91. if defined b set /a b=%b%%switchb%2
  92. if defined c set /a c=%c%%switchc%2
  93. if defined d set /a d=%d%%switchd%2
  94. if defined e set /a e=%e%%switche%2
  95. if defined f set /a f=%f%%switchf%2
  96. if defined g set /a g=%g%%switchg%2
  97. call wait 2
  98. goto ini
  99. :stop

\                                                / 
  \                                              /   
   \                                            /   
    \                                          /     
     \                                        /     
      \                                      /       
       \                                    /       
        \                                  /         
         \                                /         
          \                              /           
           \                            /           
            \                          /             
             \                        /             
             |           .           /             
             |           .          /               
             | |\                  /                 
             | | \                /                 
             | |  \              /                   
             | |   \            /                   
             | |   |     .     /                   
             | |   ||\        /                     
             | |   || \      /                       
             | |   ||  \    /                       
             | |   ||   \  /                         
             | |   ||    \/                         
             | |   ||    /\                         
             | |   ||   /  \                       
             | |   ||  /    \                       
             | |   || /      \                     
             | |   ||/        \                     
             | |   |/          \                   
             | |   /            \                   
             | |  /              \                 
             | | /                \                 
             | |/                  \               
             | /                    \               
             |/                      \             
             /                        \             
            /                          \           
           /                            \           
          /                              \         
         /                                \         
        /                                  \       
       /                                    \       
      /                                      \     
     /                                        \     
    /                                          \   
   /                                            \   
  /                                              \ 


Este me ha gustado, mucha imaginación en el code,pero lo he copiado tal cual y no me funciona :/...

saludos
En línea

No he vuelto, solo estoy de paso.
bITEBUG

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #13 en: 6 Julio 2011, 02:10 am »

Este me ha gustado, mucha imaginación en el code,pero lo he copiado tal cual y no me funciona :/...

saludos
Recien me hice un tiempo para leer tu mensaje:

Mira no lo he revisado correctamente pero si es la misma version que tengo en mi pc a mi me anda sin problemas.

Si hay un error proba cerrar el bucle con un goto end despues del endlocal.

Decime que entrada le diste.

Se supone que tiene que admitir estos parametros: Art [tamaño en numero de lineas] [<numero de puerta n1> <numero de puerta n2>...]

Art 22 15 13 8 5 crea un diseño de 22 lineas en pantalla una puerta de 3 caracteres en el 8o caracter desde el centro y otra puerta de dos caracteres en el 13o desde el centro.

Es cierto que se me pierden algunas aristas pero el desplazamiento parece correcto

por cierto no se si viste ese "call wait.bat 2" sin ese archivo se temina el proceso abruptamente podes remarcar el comando o hacerte un batch de espera del tipo @ping -w 1000 127.0.0.1>nul
« Última modificación: 6 Julio 2011, 02:37 am por bITEBUG » En línea

Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ayuda con funcion de libreria de funciones u.u
Scripting
FranciskoAsdf 0 2,232 Último mensaje 9 Septiembre 2008, 04:15 am
por FranciskoAsdf
Python, funciones o libreria ?
Scripting
EvilGoblin 2 6,383 Último mensaje 11 Julio 2010, 20:35 pm
por xーいぱ
Ayuda con Scripts Batch. Por favor.
Scripting
legolas266 1 2,907 Último mensaje 25 Febrero 2013, 17:05 pm
por Eleкtro
Make Batch Files - software para crear tus batch-scripts de forma sencilla
Scripting
Eleкtro 3 3,147 Último mensaje 2 Marzo 2018, 15:11 pm
por **Aincrad**
[APORTES][SHELL SCRIPT][ACTUALIZADO] Interfaz CLI + Scripts varios.
Scripting
W17CH3R 8 3,802 Último mensaje 1 Abril 2020, 18:53 pm
por W17CH3R
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines