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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 [7] 8 9 10
61  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 24 Febrero 2015, 02:10 am
Excelente decididamente eres un duro en el tema funciona a la perfección. No pensé que creara tantos obstáculos desde el principio no dar el ejemplo del fichero en cuestión así como no hice mucho casos a que fuera txt o html pero ya veo cuan equivocado estaba.

Ok te voy diciendo como queda todo:
Asi descargo el 1000000 de resultados separados en carpetas de 100000.

Código
  1. On Error Resume Next
  2. For i = 1 To 100000
  3. Set crack = CreateObject("WScript.Shell")
  4. crack.Run "wget -r -nd -P 100000 -A .html -e robots=off --no-check-certificate https://www.xxxxx.com/game/"&i&".html",vbhide
  5. wscript.sleep 500
  6. next
  7. MsgBox "Tarea Finalizada",0,"Download"

Asi paso tu script de ayuda a los 100000 resultados

Código
  1. On Error Resume Next
  2. For i = 1 To 100000
  3. Set cmd = CreateObject("WScript.Shell")
  4. cmd.Run "cscript.exe .\Script.vbs .\game\100000\"&i&".html",vbhide
  5. wscript.sleep 500
  6. next
  7. MsgBox "Tarea Finalizada",0,"Valor"

Tu script

Código
  1. ' Example: RegEx capture in textfile, By Elektro
  2. 'CScript.exe ".\Script.vbs" ".\1.html" ".\2.html" "etc...
  3.  
  4. Option Explicit
  5.  
  6. Dim args, arg, _
  7.    outPath, fullpath, fileName, fileExt, _
  8.    fso, file, fileContent, _
  9.    rgx, rgxMatches, rgxMatch, rgxValue
  10. Set args = WScript.Arguments
  11. If args.Count = 0 Then
  12.   Wscript.Echo("Any filepath specified.")
  13.   Wscript.Quit(1)
  14. End If
  15.  
  16. outPath = ".\Output\100000\"
  17. Set fso = WScript.CreateObject("Scripting.FileSystemObject")
  18. If Not fso.FolderExists(outPath) Then
  19.   Call fso.CreateFolder(outPath)
  20. End If
  21.  
  22. ' El primer grupo de esta expresión captura el string "cash out:" plus el valor decimal.
  23. ' El cuarto grupo de esta expresión captura el valor decimal.
  24. Set rgx = New RegExp
  25.     rgx.Pattern = "Cash.+Out.+\s+<\/\w+>\s+([\w\.]+)"
  26.    rgx.IgnoreCase = True
  27.    rgx.Global     = True
  28.  
  29. For Each arg in args
  30.  
  31.   fullPath    = fso.GetAbsolutePathName(arg)
  32.   fileName    = fso.GetBaseName(fullPath)
  33.   fileExt     = fso.GetExtensionName(fullPath)
  34.   fileContent = fso.OpenTextFile(fullPath, 1).ReadAll
  35.  
  36.   Set rgxMatches = rgx.Execute(fileContent)
  37.   Set file       = fso.CreateTextFile(outPath & "\" & fileName & ".txt")
  38.  
  39.   Wscript.Echo("[+] Processing file: " & fullPath)
  40.   For Each rgxMatch in rgxMatches
  41.      rgxValue = rgxMatch.Submatches(0)
  42.      Wscript.Echo(rgxValue)
  43.      Call file.WriteLine("Cash Out: " & rgxValue)
  44.   Next
  45.  
  46.   file.Close
  47.  
  48. Next
  49.  
  50. Wscript.Quit(0)

Así uno todas las salidas de tu script en un solo fichero con 100000 lineas

Código
  1. On Error Resume Next
  2. For i = 1 To 100000
  3. Fichero = "C:\Play\output\100000\" & i &".txt"
  4. Set objFSO = CreateObject("Scripting.FileSystemObject")
  5. filepath = Fichero
  6. Set objInputFile = objFSO.OpenTextFile(filepath)
  7. tmpStr = objInputFile.ReadLine
  8. Set texto = CreateObject("Scripting.FileSystemObject")
  9. Set salida = texto.CreateTextFile (".\Salida100000.txt", True)
  10. salida.WriteLine (Mid(tmpStr,1,50)) & n
  11. Next
  12. MsgBox "Tarea Finalizada",0,"Play"

Y después puedo realizar el análisis importando Salida100000.txt  a excel pero realmente todo es para ver esto que pregunte aqui http://foro.elhacker.net/scripting/ayuda_con_excel-t430543.0.html, ya que puedo ver mas cosas pero la que mas me interesa aun no se jajajajajajaj.


Que tengo un script en python que lo hace pero me gustaría ver igual como se soluciona en excel ;).

Aquí la versión en español de lo que pasaste para los que no dominen mucho el ingles: http://es.wikipedia.org/wiki/Expresi%C3%B3n_regular
Gracias por todo.
62  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 23 Febrero 2015, 08:31 am
Creo que esto ayuda full a entender la parte mas compleja de tu codigo al menos para mi ;D

http://www.tutorialspoint.com/vbscript/vbscript_reg_expressions.htm
https://www.addedbytes.com/blog/code/vbscript-regular-expressions/
63  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 22 Febrero 2015, 23:10 pm
Moderador disculpe por el doble post pero cada vez que le daba eliminar en la cruz me decía que no se podía porque alguien lo estaba viendo, de todas maneras aceptada por mi parte la alerta de que no se acepta doble post.

Increíble funciona a la perfección para con x y sin x

Código:
<b>Cash Out: </b> 1.97x </p>
<b>Cash Out: </b> 212.34x </p>

Pero al pasarselo a 1.html no funciona :( alguna idea:
Código:
<!DOCTYPE html><html> <head> <title>Play Info -- xxxxxx.com</title> <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="/img/favicon.ico" type="image/x-icon"> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"/>  <link rel="stylesheet" href="/css/cb42743da.css" /> </head><body><div class="wrap"> <header> <nav class="nav-top-bar"> <div class="title"> <a href="/"> <img src="/img/logo.png" alt="logo" width="40px" /> <h1 class="hide-for-small-only">xxxxxx.com</h1> </a> </div>  <div class="show-for-small-up user-login">  <a href="/register">Register</a> <a href="/login">Log in</a>  </div> </nav> </header>  <div class="content">  <div class="row panel radius"> <h4>Game #<strong>1</strong> information</h4> <p> <b>Cash Out: </b> 2.46x </p> <p> <b>Played: </b>Sat Ene 12 2015 00:20:13 GMT+0000 (UTC) <small>7 months ago</small> </p> <hr> <h6>Players</h6> <table class="user-table"> <thead> <tr> <td>Player</td> <td>Bet</td> <td>Cash Out</td> <td>Bonus</td> <td>Profit</td> </tr> </thead> <tbody>  </tbody> </table> <h6><b>Hash:</b> <a href="/faq#fair">null</a></h6> </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-54064423-1', 'auto');  ga('send', 'pageview'); </script></div></body></html>
64  Programación / Scripting / Ayuda con Excel en: 22 Febrero 2015, 19:29 pm
No se si esto va aquí pero no encuentro un mejor lugar para ponerlo:
Se tiene:
Citar
ColumnA ColumnB
1             1,2
2             1,3
3             4,0
4             3,0
5             5,1
6             0,0
7             1,5
8             1,7
9             1,2
10           1,5

Se desea conocer la mayor salida de números consecutivos inferiores a < 2


La Respuesta seria 4 ya que:
Citar
7             1,5
8             1,7
9             1,2
10           1,5

4>2 para la tirada que antecede:
Citar
ColumnA ColumnB
1             1,2
2             1,3

Estoy leyendo =CONTAR.SI(B2:B1000;"<2") pero daria una cuenta de todos los valores menors que 2.
Cualquier recomendacion es bienvenida siguo en google y con la ayuda de Excel.

Gracias.
65  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 22 Febrero 2015, 18:05 pm
Elektro excelente código ya que con el mio no conseguía tan buen resultado. Estoy intentando entenderlo aun ya que contiene un camión de cosas que nunca he usado porque te repito mi nivel es muy básico.
No se si notaste que use:
Código:
Fichero = "C:\Ejemplo\" & i &".txt"
Esto se debe que estamos probando solo con 3 archivos pero en la practica son aproximadamente 1 000 000 de txt.
Como te puedes dar cuenta esto es un problema a la hora de:
CScript.exe ".\Script.vbs" ".\Archivo1.txt" ".\Archivo2.txt" "etc..."



Creo que resuelvo con esto:
Código:
On Error Resume Next
For i = 1 To 100000
Set crack = CreateObject("WScript.Shell")
crack.Run "cscript.exe .\Script.vbs .\input\"&i&".txt",vbhide
wscript.sleep 500
next
MsgBox "Tarea Finalizada",0,"Prueba"

Cual seria la modificación a realizar en tu excelente código Elektro para poder sacar el valor de un Archivo1.txt que contenga:

Citar
<b>Cash Out: </b> 1.97x </p>
<b>Cash Out: </b> 212.34x </p>
Pensé que no seria un problema con el ejemplo que puse que Archivo1.txt era

Citar
asdadasdasdasd asdsadas asdasdasd cash out: 1.97 asdasdas asdasda
asdadasdasdasd asdsadas asdasdasd cash out: 212.34 asdasdas asdasda

para no complicar mucho las cosas.

Pero si es un problema a la hora de aplicarlo al Archivo1.txt en cuestion:

Citar
<b>Cash Out: </b> 1.97x </p>
<b>Cash Out: </b> 212.34x </p>



[MOD]: Está prohibido hacer doble post.
66  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 20 Febrero 2015, 19:26 pm
casi completo de mucha ayuda me sirvio esto

Código:
salida.WriteLine (Mid(tmpStr,899,5)) &" "& (Mid(tmpStr,934+4,25))
67  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 20 Febrero 2015, 18:29 pm
Voy por aquí pero me faltan aun que los ficheros de salida contengan solo el pedazo que me interesa:
Salida1.txt
Cash Out: 232.45

Salida2.txt
Cash Out: 123232.35

Salida3.txt
Cash Out: 42.40

De ahí solo tendría que pasar el bat anteriormente expuesto que lo que hace es pasar todo los ficheros de salida del 1 al 3 en un text 4.

Código
  1. On Error Resume Next
  2. Dim Cadena
  3. Set Carpeta = CreateObject("Scripting.FileSystemObject")
  4. Carpeta.CreateFolder ".\output"
  5. For i = 1 To 3
  6. Fichero = "C:\Ejemplo\" & i &".txt"
  7. 'MsgBox Fichero,0,"Muestra"
  8. 'Set texto = CreateObject("Scripting.FileSystemObject")
  9. 'texto.CopyFile Fichero,".\Salida.txt"
  10. Set objFSO = CreateObject("Scripting.FileSystemObject")
  11. filepath = Fichero
  12. substrToFind = "CashOut:"
  13. Set objInputFile = objFSO.OpenTextFile(filepath)
  14. tmpStr = objInputFile.ReadLine
  15. If InStr(tmpStr, substrToFind) <= 0 Then
  16.   WScript.Echo "No se encontro la cadena en " & i &".txt"
  17. Else
  18. Set texto = CreateObject("Scripting.FileSystemObject")
  19. Set salida = texto.CreateTextFile (".\output\Salida" & i &".txt", True)
  20. salida.WriteLine i
  21. salida.Close
  22. End if
  23. Next
  24.  
68  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 20 Febrero 2015, 16:17 pm
Ok ya estoy de nuevo en ello, gracias por avisar que el find y findstr no puedo hacer capturas de una linea.
69  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 20 Febrero 2015, 08:59 am
Se ve muy bueno esta ayuda lo leere con calma http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
70  Programación / Scripting / Re: Ayuda con Bat o Vbs en: 20 Febrero 2015, 08:55 am
Intente algo como esto pero no me sirve aun

Código:
@echo off
(
findstr "Cash out:" 1.txt
findstr "Cash out:" 2.txt
findstr "Cash out:" 3.txt
) > "4.txt"

Esperaba algo de salida como
Cash out:
Cash out:
Cash out:

Pero nada lo que obtuve no es mas que el contenido de 1.txt+2.txt+3.txt todo uno a continuacion de otro y no es lo deseado.

Tampoco se como tomar el valor numérico que sigue a continuación porque como expuse anteriormente son variables los numeros van desde 0.00 a infinito siempre conservando dos lugares despues del . (.00)

Saludos
Páginas: 1 2 3 4 5 6 [7] 8 9 10
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines