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


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: 1 ... 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 [948] 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 ... 1254
9471  Programación / Scripting / Re: Problema con script en rar en: 3 Abril 2013, 15:42 pm
¿esta bien hecho?

El fallo más grave es el de la contraseña de ejemplo que has puesto, usas el caracter de procentaje % y no te lo va a reconocer, debes cerrar el string con comillas doblres: -p"pass%word"
De echo deberías cerrar todos los demás argumentos que usas en tu ejemplo.

En el primer comando deberías ordenarle a winrar que debe hacer si encuentra un archivo que al descomprimirlo se llame igual (preguntar o reemplazar archivos al extraer):

Citar
Código:
 y             Assume Yes on all queries

Código:
@Echo OFF
Rar.exe x -r -y -p"aesT322odSXj0Y@#j4ePWL7zVxDyM40W_JUue%LjJTSY$EAAdJ1-ti2m9" "c:\*.*" "c:\"

Yo no lo he entendido muy bien, la verdad, porque en el segundo comando quieres descomprimir en la carpeta original, pero al final indicas que se descompriman todos en "C:\"(destino).

Saludos
9472  Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch] en: 3 Abril 2013, 15:21 pm
Si el texto completo no contiene más tags podrías usar esto: http://foro.elhacker.net/empty-t372497.0.html para eliminar la última línea, y luego añadir el tag.

Ejemplo:

Código:
@Echo OFF

Call :TEXTMAN L- 1 "archivo.txt"
Echo %Variable% >> "Archivo.txt"
Echo [/FORMAT] >> "Archivo.txt"

Pause&Exit

:TEXTMAN
(SET /A "A=0", "LINE=0", "TOTAL_LINES=0")  &  (CALL :%~1 %* || (ECHO Parametro incorrecto & Exit /B 1)) & (GOTO:EOF)
:L-
(FOR /F %%X IN ('TYPE "%~3"') DO (CALL SET /A "TOTAL_LINES+=1")) & (CALL SET /A "TOTAL_LINES-=%~2-1") & (For /F "usebackq tokens=*" %%@ in ("%~3") DO (Call Set /A "LINE+=1" & Call echo "%%LINE%%"|@FIND "%%TOTAL_LINES%%" >NUL) && (CALL :RENAMER "%~3" && GOTO:EOF) || (Echo %%@ >> "%~3.NEW"))
:RENAMER
(REN "%~1" "%~nx1.BAK") & (MOVE /Y "%~1.BAK" "%TEMP%\" >NUL) & (REN "%~1.NEW" "%~nx1") & (GOTO:EOF)

De lo contrario, puedes usar un FOR /F para encontrar la cadena "[/FORMAT]" y reemplazarla por la variable y la cadena de nuevo.

PD: Con ese script también puedes reemplazar palabras.

Saludos
9473  Programación / Scripting / Re: youtube-dl aria2c.exe en: 3 Abril 2013, 15:02 pm
No sé Bash ni he usado aria2 así que no puedo intuir porque carga/usa cookies ni que hace con las cookies aparte de usar la cookie para obtener el nombre del video con youtube-dl, ¿pero realmente cuanto debe acelerar la descarga en total? ¿1-2 segundos? xD

Yo creo que con que uses youtube-dl es más que suficiente...

Un saludo!
9474  Programación / Scripting / Re: Ayuda con código en: 3 Abril 2013, 14:15 pm
Código:
Ping -n 5 localhost >NUL
el 5 es el valor que puedes usar como segundos.


Pero te recomiendo que en lugar de usar Batch uses VBS para lo que intentas hacer, tiene el método Sleep y la función Msgbox es la que usas desde el Bat.

Archivo.vbs
Código
  1. Segundos = 5
  2.  
  3. Set shell = CreateObject("WScript.Shell")
  4. WScript.Sleep Segundos*1000
  5. MsgBox WScript.Arguments.item(1), , WScript.Arguments.item(0)
  6. Wscript.Quit(0)

Código:
Archivo.vbs "Título" "Contenido del box"

Saludos
9475  Programación / Scripting / Re: Ayuda con mi batch en: 3 Abril 2013, 14:01 pm
He visto que desde bach puedes bajar archivos de un servidor FTP, o puedes con un programa externo.
Que programa externo me recomendáis?

Wget
http://www.gnu.org/software/wget/

Puedo pasar un archivo vbs a bat?

No, son dos lenguajes distintos.

Puedes intentar reproducir en un Bat lo que haces en un Vbs, pero sería más sensato hacer lo contrario, porque VBS es un lenguaje que usa Funciones Métodos y Objetos, y Batch solo dispone de comandos (Ni siquiera se le puede llamar lenguaje), muchas veces no podrás reproducirlo.

http://msdn.microsoft.com/en-us/library/aa227499%28v=vs.60%29.aspx

Saludos.
9476  Programación / Scripting / Re: fuerza bruta en: 3 Abril 2013, 13:49 pm
Depende de si es fuerza bruta para WEB o para Archivos...

[Batch] Ice Crack 1.3 (Stealer y craqueador de archivos)

Saludos
9477  Programación / Scripting / Re: [Batch] Problema variable con comillas en: 3 Abril 2013, 13:47 pm
O puedes hacer la conversión fácilmente:

Código:
Copy con "archivo.txt"

(escribes la letra deseada)

Y luego Ctrl+Z

Slaudos.
9478  Programación / .NET (C#, VB.NET, ASP) / [Solucionado] Aplicación de Consola con Timer no funciona en: 3 Abril 2013, 13:33 pm
Este programa lo hice en un WinForm y funcionaba bien, pero luego decidí que me iba a ser más útil por consola así que modifiqué el tipo de proyecto a "consola", añadí un módulo, eliminé el formulario, pegué el código modificando el Timer para que funcionase y añadíendo el sub main...

Creo que no me ha faltado nada por añadir o modificar, pero el timer no me funciona, es decir, el sub que asocio al evento Elapsed no funciona

Código
  1.    ' Lock Tick
  2.    Public Sub Lock_Ticks()
  3.        Console.WriteLine("test")
  4.        'If Running Then Cursor.Position = New Point(Screen_Center_X, Screen_Center_Y)
  5.    End Sub

(No escribe ninguna línea.)

En el form uso dos timers, y en cambio el otro timer ("Executable timer") si que me funciona perféctamente...

Este es el test del segundo timer (el que funciona):


Y este el del que no funciona (no bloquea el mouse, el evento Elapsed de ese timer no se ejecuta):


Me he asegurado de que el intervalo del primer timer es correcto, y en fin no sé que puede estar pasando...

Y como ya digo, si todo esto lo paso a un WinForm, vuelve a funcionar de forma correcta, no lo entiendo!.





Este es el proyecto completo, lo pueden probar:

Código
  1. Module Module1
  2.  
  3. #Region " Vars "
  4.  
  5.    Dim Running As Boolean = False
  6.    Dim Errors As Boolean = False
  7.  
  8.    Dim Executable_Name As String = Nothing
  9.  
  10.    Dim Toogle_Key As System.Windows.Forms.Keys = Nothing
  11.    Dim WithEvents Toogle_Key_Global As Shortcut = Nothing
  12.  
  13.    Dim Executable_Timer As New System.Timers.Timer
  14.    Dim Lock_Timer As New System.Timers.Timer
  15.    Dim Lock_Interval As Int32 = 10
  16.    Dim Lock_Sleep As Int32 = Get_Milliseconds(3)
  17.  
  18.    Dim Screen_Center_X As Int16 = (Screen.PrimaryScreen.Bounds.Width / 2)
  19.    Dim Screen_Center_Y As Int16 = (Screen.PrimaryScreen.Bounds.Height / 2)
  20.  
  21. #End Region
  22.  
  23.    ' Load
  24.    Sub main()
  25.        Pass_Args()
  26.        Sleep()
  27.        Lock()
  28.    End Sub
  29.  
  30.    ' Help
  31.    Private Sub Help()
  32.        Console.WriteLine( _
  33.            "[+] Syntax:" & vbNewLine & _
  34.            vbNewLine & _
  35.            "    MouseLock {Executable Name}" & vbNewLine & _
  36.            vbNewLine & _
  37.            vbNewLine & _
  38.            "[+] Syntax (using optional features):" & vbNewLine & _
  39.            vbNewLine & _
  40.            "    MouseLock {Executable Name} -S {Seconds} -I {Milliseconds} -K {Key}" & vbNewLine & _
  41.            vbNewLine & _
  42.            vbNewLine & _
  43.            "[+] Options:" & vbNewLine & _
  44.            vbNewLine & _
  45.            " -S (or) -Sleep" & vbNewLine & _
  46.            "    The time to wait until MouseLock will be activated." & vbNewLine & _
  47.            "    * Default is ""3000""" & vbNewLine & _
  48.            vbNewLine & _
  49.            " -I (or) -Interval" & vbNewLine & _
  50.            "    The time between the mouse locks" & vbNewLine & _
  51.            "    * Default is ""10"", maybe want to use bigger numbers in slower PC's." & vbNewLine & _
  52.            vbNewLine & _
  53.            " -K (or) -Key" & vbNewLine & _
  54.            "    The key for toogle between Enabled/Disabled while MouseLock is running." & vbNewLine & _
  55.            "    * Valid keys: A-Z, 0-9 (Numpad) and F0-F12." & vbNewLine & _
  56.            "    * All valid keys can be combined with ALT, CTRL or SHIFT." & vbNewLine & _
  57.            vbNewLine & _
  58.            vbNewLine & _
  59.            "[+] Examples:" & vbNewLine & _
  60.            vbNewLine & _
  61.            "    MouseLock Game.exe" & vbNewLine & _
  62.            "    MouseLock Game.exe -S 5" & vbNewLine & _
  63.            "    MouseLock Game.exe -I 250" & vbNewLine & _
  64.            "    MouseLock Game.exe -K F10" & vbNewLine & _
  65.            "    MouseLock Game.exe -Sleep 10 -Interval 500 -Key ALT+Z")
  66.    End Sub
  67.  
  68.    ' Pass arguments
  69.    Private Sub Pass_Args()
  70.  
  71.        ' Empty?
  72.        If My.Application.CommandLineArgs.Count = 0 Then
  73.            Errors = True
  74.            Help()
  75.            End
  76.        End If
  77.  
  78.        ' Executable Name
  79.        If Not My.Application.CommandLineArgs.Item(0).ToLower.EndsWith(".exe") Then
  80.            Console.WriteLine("Bad executable name: " & My.Application.CommandLineArgs.Item(0))
  81.            Errors = True
  82.        Else
  83.            Executable_Name = My.Application.CommandLineArgs.Item(0).Substring(0, My.Application.CommandLineArgs.Item(0).Length - 4)
  84.        End If
  85.  
  86.        For I As Integer = 0 To My.Application.CommandLineArgs.Count - 1
  87.  
  88.            ' Sleep
  89.            If My.Application.CommandLineArgs.Item(I).ToLower = "-s" Or My.Application.CommandLineArgs.Item(I).ToLower = "-sleep" Then
  90.                Try : Lock_Sleep = Get_Milliseconds(My.Application.CommandLineArgs.Item(I + 1))
  91.                Catch
  92.                    Console.WriteLine("Bad argument for -Sleep")
  93.                    Errors = True
  94.                End Try
  95.            End If
  96.  
  97.            ' Interval
  98.            If My.Application.CommandLineArgs.Item(I).ToLower = "-i" Or My.Application.CommandLineArgs.Item(I).ToLower = "-interval" Then
  99.                Try : Lock_Interval = My.Application.CommandLineArgs.Item(I + 1)
  100.                Catch
  101.                    Console.WriteLine("Bad argument for -Interval")
  102.                    Errors = True
  103.                End Try
  104.            End If
  105.  
  106.            ' Key
  107.            If My.Application.CommandLineArgs.Item(I).ToLower = "-k" Or My.Application.CommandLineArgs.Item(I).ToLower = "-key" Then
  108.                Try
  109.  
  110.                    If My.Application.CommandLineArgs.Item(I + 1).ToLower.StartsWith("alt+") Then
  111.                        Toogle_Key = [Enum].Parse(GetType(System.Windows.Forms.Keys), My.Application.CommandLineArgs.Item(I + 1).ToLower.Replace("alt+", ""), True)
  112.                        Toogle_Key_Global = Shortcut.Create(Shortcut.Modifier.Alt, Toogle_Key)
  113.                    ElseIf My.Application.CommandLineArgs.Item(I + 1).ToLower.StartsWith("ctrl+") Then
  114.                        Toogle_Key = [Enum].Parse(GetType(System.Windows.Forms.Keys), My.Application.CommandLineArgs.Item(I + 1).ToLower.Replace("ctrl+", ""), True)
  115.                        Toogle_Key_Global = Shortcut.Create(Shortcut.Modifier.Ctrl, Toogle_Key)
  116.                    ElseIf My.Application.CommandLineArgs.Item(I + 1).ToLower.StartsWith("shift+") Then
  117.                        Toogle_Key = [Enum].Parse(GetType(System.Windows.Forms.Keys), My.Application.CommandLineArgs.Item(I + 1).ToLower.Replace("shift+", ""), True)
  118.                        Toogle_Key_Global = Shortcut.Create(Shortcut.Modifier.Shift, Toogle_Key)
  119.                    Else
  120.                        Toogle_Key = [Enum].Parse(GetType(System.Windows.Forms.Keys), My.Application.CommandLineArgs.Item(I + 1), True)
  121.                        Toogle_Key_Global = Shortcut.Create(Shortcut.Modifier.None, Toogle_Key)
  122.                    End If
  123.  
  124.                Catch
  125.                    Console.WriteLine("Bad argument for -Key")
  126.                    Errors = True
  127.                End Try
  128.            End If
  129.  
  130.        Next
  131.  
  132.        If Errors Then End
  133.  
  134.    End Sub
  135.  
  136.    ' Sleep
  137.    Private Sub Sleep()
  138.        Console.WriteLine("Sleeping for " & (Lock_Sleep \ 1000) & " seconds before start locking the mouse...")
  139.        Dim x As Integer = 0
  140.        While Not x = (Lock_Sleep \ 1000)
  141.            Threading.Thread.Sleep(1000)
  142.            x += 1
  143.        End While
  144.    End Sub
  145.  
  146.    ' Lock
  147.    Private Sub Lock()
  148.        If Process_Is_Running(Executable_Name) Then
  149.            AddHandler Lock_Timer.Elapsed, AddressOf Lock_Ticks
  150.            AddHandler Executable_Timer.Elapsed, AddressOf Executable_Tick
  151.            Lock_Timer.Interval = Lock_Interval
  152.            'Lock_Timer.Interval = 100
  153.            Lock_Timer.Start()
  154.            Executable_Timer.Start()
  155.            Running = True
  156.        Else
  157.            Terminate()
  158.        End If
  159.    End Sub
  160.  
  161.    ' Lock Tick
  162.    Public Sub Lock_Ticks()
  163.        Console.WriteLine("test - funciona el lock timer?")
  164.        If Running Then Cursor.Position = New Point(Screen_Center_X, Screen_Center_Y)
  165.    End Sub
  166.  
  167.    ' Executable Tick
  168.    Private Sub Executable_Tick()
  169.        Console.WriteLine("test - funciona el executable timer?")
  170.        If Not Process_Is_Running(Executable_Name) Then Terminate()
  171.    End Sub
  172.  
  173.  
  174.  
  175.    ' Esta parte no es necesaria para testear
  176.    ' Toogle Key
  177.    'Private Sub Toogle_Key_Global_Press(ByVal s As Object, ByVal e As Shortcut.HotKeyEventArgs) Handles Toogle_Key_Global.Press
  178.    '    Select Case Running
  179.    '        Case False
  180.     '           Running = True
  181.    '            Lock_Timer.Start()
  182.     '       Case True
  183.    '            Running = False
  184.    '    End Select
  185.    'End Sub
  186.  
  187.  
  188.  
  189.    ' Get Milliseconds
  190.    Private Function Get_Milliseconds(ByVal Seconds As Int32) As Int32
  191.        Dim Time_Span As New TimeSpan(TimeSpan.TicksPerSecond * Seconds)
  192.        Return Time_Span.TotalMilliseconds
  193.    End Function
  194.  
  195.    ' Process Is Running
  196.    Public Function Process_Is_Running(ByVal Process_Name As String) As Boolean
  197.        Dim myProcess As Process() = Process.GetProcessesByName(Process_Name)
  198.        If Not myProcess.Length = 0 Then Return True Else Return False
  199.    End Function
  200.  
  201.    ' Terminate
  202.    Private Sub Terminate()
  203.        Console.WriteLine("Application """ & Executable_Name & ".exe"" is not Running.")
  204.        Console.WriteLine("MouseLock finished.")
  205.        Application.Exit()
  206.    End Sub
  207.  
  208. End Module
9479  Programación / .NET (C#, VB.NET, ASP) / Re: Duda con timer en: 3 Abril 2013, 13:26 pm
Regiones, sumários de código XML y Namespaces, todo es para mantener el código ordenado, aunque los Namespaces si que interfieren en el código (se le da un uso más fácil) pero a mi punto de vista es más para organizar el código.

saludos
9480  Programación / Scripting / Re: [AYUDA] Arrastrar archivo dentro de un bat en: 24 Marzo 2013, 20:09 pm
Hola estantaya

1. Deberías haber creado un post y no revivir un tema antiguo

2. Lamentáblemente lo que necesitas no puedes conseguirlo en un lenguaje tán simple como Batch. solo dispone de "set /P" y por obligación hay que pulsar enter, tán simple como eso.

La única alternativa que puedes hacer es arrastrar el archivo al ARCHIVO bat, y de esa manera tu script se iniciaría recibiendo el archivo como argumento %1.

Te recomiendo que te plantees hacer una aplicación gráfica y manejes el evento de arrastrar (Drag&Drop) y ahí ya puedes moldear lo que quieras a tu gusto sin complicaciones, es mucho mejor que comerse la cabeza con el userinput en los lenguajes de scripting.

Si tienes dudas puedes crear un nuevo tema, pero como te digo en Batch es imposible.
Saludos!

PD: Tema cerrado.
Páginas: 1 ... 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 [948] 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 ... 1254
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines