Nuevas NORMAS para el foro

Curso Hacker
Bienvenido(a), Visitante. Favor de ingresar o registrarse.
¿Perdiste tu email de activación? - ſeptiembre 07, 2008, 02:35:58
Boton Buscar
Inicio Ayuda Ingresar Registrarse
Visita: Articulos - Juegos Gratis - Da Foros

Comunidad Underground Hispana  |  Programacion  |  Programación  |  Batch (Moderadores: Espectro Infernal, The Shadow)  |  Tema: Entradas de datos de una manera diferente. 0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: Entradas de datos de una manera diferente.  (Leído 93 veces)
ne0x
Habitual
*****
Desconectado Desconectado

Mensajes: 290



Ver Perfil
« en: Enero 11, 2007, 01:59:56 »

Ya no solo es batch pero es muy funcional.
Vale la pena saber que existe.
Fuente:
Para ver los enlaces debes ser usuario Crear Usuario o Hacer Sesion


Usando VBS y IE.

Citar
@echo off
:: First test to see if we are on NT or similar OS
:: The ony difference is how they handle the ampersand
 > ~userin.vbs echo 1234&rem
type ~userin.vbs | find "rem" > nul
if errorlevel 1 goto WINNT
goto WIN9X

:WIN9X
 > ~userin.vbs echo strUserIn = InputBox("Enter Data")
>> ~userin.vbs echo Set fs = CreateObject("Scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" & strUserIn
>> ~userin.vbs echo ts.Close
goto RUN

:WINNT
 > ~userin.vbs echo strUserIn = InputBox("Enter Data")
>> ~userin.vbs echo Set fs = CreateObject("Scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.ScriptFullName ^& "\..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" ^& strUserIn
>> ~userin.vbs echo ts.Close
goto RUN

:RUN
:: Now run the created script
start /w wscript.exe ~userin.vbs
del ~userin.vbs

:: Now call the created batch file
call ~userin.bat
del ~userin.bat

:: Now display the data!
echo You entered %USERIN%
pause


Usando Html , VBS e IE:

Citar
@echo off
:: This batch file will create a web page, then use
:: Visual Basic Scripting and the Windows Scripting Host
:: to launch Internet Explorer to show that page.
:: Values entered in the web page will be read via
:: scripting, then will be saved as %TEMP%\USERIN.BAT
:: After the USERIN.BAT is CALLed from the main batch
:: (and assuming there is enough room in the environment)
:: environmental variables USERNAME and PASSWORD will be set.
:: It is your responsibility to delete the USERIN.BAT
:: after you CALL it. Because this batch file needs to
:: find itself, you must be sure to call it from your
:: main batch file with a full path and file name.
:: Written and tested under Win95. NT/2000/XP users will
:: have to do some modifications before it will work.
:: For example, %0 changes to %f0
:: Public Domain. Use freely. No guarantees! It may not work!
::
Para ver los enlaces debes ser usuario Crear Usuario o Hacer Sesion

cls
echo Please enter your user name and password in the entry box...
:: See if I can find myself
If not exist %0 goto ERROR
:: Make the web page
type %0 | find "    " | find /v "     " | find /v "Not Me!" > %TEMP%\UserIn.htm
:: Make the VBS code
type %0 | find "     " | find /v "      " | find /v "Not Me!" > %TEMP%\UserIn.vbs
:: Run the vbs code
start /w wscript.exe %TEMP%\UserIn.vbs
:: At this point a batch file "%TEMP%\UserIn.bat" exists and you should
:: call it! If you don't call the batch file here and instead opt to
:: call it from another batch file, be sure NOT to delete it in the
:: "Clean up" code section below!
call %TEMP%\UserIn.bat
echo Your user name is %USERNAME%
echo Your password is %PASSWORD%
:: Clean up
del %TEMP%\UserIn.vbs
del %TEMP%\UserIn.htm
del %TEMP%\UserIn.bat
goto DONE

:ERROR
cls
echo %0 is not the full path and file name
echo for the batch file. You MUST call this
echo batch file with a full path and file name.
goto DONE

:HTML
:: All HTML code MUST be indented exactly four spaces.
:: NOTHING else in this batch file may be indented four spaces.
    <html><body><form>User Name:
    <br><input type=text name=username tabindex=1>
    <br>Password:
    <br><input type=password name=password>
    <br><input type=button
    language=vbscript name=submit
    value=OK onclick='submit.value="Done"'>
    </form></body></html>

:VBS
:: All VBS code MUST be indented exactly five spaces.
:: NOTHING else in this batch file may be indented five spaces.
     Set fs = CreateObject("Scripting.FileSystemObject")
     strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.htm"))
     Set web = CreateObject("InternetExplorer.Application")
     web.Offline = True
     web.AddressBar = False
     web.Height = 200
     web.Width = 250
     web.MenuBar = False
     web.StatusBar = False
     web.Silent = True
     web.ToolBar = False
     web.Navigate strFile
     Do While web.Busy
     Loop
     On Error Resume Next
     Set doc = Nothing
     Do Until Not doc Is Nothing
     Set doc = web.Document
     Loop
     doc.Forms(0).elements("username").focus
     web.Visible = True
     Err.Clear
     Do Until doc.Forms(0).elements("submit").Value <> "OK"
     Wscript.Sleep 100
     If Err.Number <> 0 Then Exit Do
     Loop
     strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.bat"))
     Set ts = fs.OpenTextFile(strFile, 2, True)
     ts.WriteLine "SET USERNAME=" & doc.Forms(0).elements("username").Value
     ts.WriteLine "SET PASSWORD=" & doc.Forms(0).elements("password").Value
     ts.Close
     web.Quit

:DONE

Mediante HTA [ El que prefiero usar a la hora de pedir user / pass ]
Citar
@echo off
:: This batch file will create an HTML Application (HTA).
:: Values entered in the HTA will be saved as %TEMP%\USERIN.BAT
:: After the USERIN.BAT is CALLed from the main batch
:: (and assuming there is enough room in the environment)
:: environmental variables USERNAME and PASSWORD will be set.
:: It is your responsibility to delete the USERIN.BAT
:: after you CALL it. Because this batch file needs to
:: find itself, you must be sure to call it from your
:: main batch file with a full path and file name.
:: Written and tested under Win95. NT/2000/XP users will
:: have to do some modifications before it will work.
:: For example, %0 changes to %f0
:: Public Domain. Use freely. No guarantees! It may not work!
::
Para ver los enlaces debes ser usuario Crear Usuario o Hacer Sesion

cls
echo Please enter your user name and password in the entry box...
:: See if I can find myself
If not exist %0 goto ERROR
:: Make the web page
type %0 | find "    " | find /v "Not Me!" > %TEMP%\UserIn.hta
:: Run the vbs code
start /w %TEMP%\UserIn.hta
:: At this point a batch file "%TEMP%\UserIn.bat" exists and you should
:: call it! If you don't call the batch file here and instead opt to
:: call it from another batch file, be sure NOT to delete it in the
:: "Clean up" code section below!
call %TEMP%\UserIn.bat
echo Your user name is %USERNAME%
echo Your password is %PASSWORD%
:: Clean up
del %TEMP%\UserIn.hta
del %TEMP%\UserIn.bat
goto DONE

:ERROR
cls
echo %0 is not the full path and file name
echo for the batch file. You MUST call this
echo batch file with a full path and file name.
goto DONE

:HTA
:: All HTA code MUST be indented four or more spaces.
:: NOTHING else in this batch file may be indented four spaces.
    <html>
    <head>
    <title>Password Entry</title>
    <hta:application>
    <script language="vbscript">
        window.resizeTo 250,200
        Sub SaveBatch()
            Set fs = CreateObject("Scripting.FileSystemObject")
            strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.bat"))
            Set ts = fs.OpenTextFile(strFile, 2, True)
            ts.WriteLine "SET USERNAME=" & document.Forms(0).elements("username").value
            ts.WriteLine "SET PASSWORD=" & document.Forms(0).elements("password").value
            ts.Close
        End Sub
    </script>
    </head>
    <body>
    <form>
        User Name:
        <br><input type=text name=username tabindex=1>
        <br>Password:
        <br><input type=password name=password>
        <br><input type=button language="vbscript" value="OK"
        onclick="SaveBatch : Window.Close">
    </form>
    <script language=vbscript>
        document.Forms(0).elements("username").focus
    </script>
    </body>
    </html>

:DONE


En línea
Páginas: [1] Ir Arriba Imprimir 
Comunidad Underground Hispana  |  Programacion  |  Programación  |  Batch (Moderadores: Espectro Infernal, The Shadow)  |  Tema: Entradas de datos de una manera diferente. « anterior próximo »
Ir a:  


Ranking-Hits
Powered by SMF 1.1.5 | SMF © 2006-2007, Simple Machines LLC