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


Tema destacado: Tutorial básico de Quickjs


  Mostrar Temas
Páginas: 1 ... 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 [87] 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ... 107
861  Programación / .NET (C#, VB.NET, ASP) / Como aplicar cambios al registro y refrescar el sistema sin tener que reiniciar? en: 21 Noviembre 2012, 19:17 pm
Hola,

Como sabreis.. hay muchisimos programas que hacen cambios en el registro (TuneUp por ejemplo) y los cambios tienen efecto enseguida sin necesidad de reiniciar el PC,
Si algunos de esos cambios se hicieran manualmente (batch, o añadiendo la clave desde el regedit) habría que reiniciar la sesión del usuario o el pc para que los cambios surgieran efecto...

Pues yo necesito añadir esta clave al registro:
Código
  1. My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", 1, Microsoft.Win32.RegistryValueKind.DWord)


Y lo que me gustaría es hacer un "system refresh" para que los cambios de esa clave tengan efecto sin tener que reiniciar...



Encontré este ejemplo en C# pero no tengo ni idea de lo que hace, ni tampoco sé si esto sirve para mi propósito.


Código
  1. static class SafeNativeMethods
  2. {
  3. public static IntPtr HWND_BROADCAST = (IntPtr)0xffff;
  4. public static int WM_WININICHANGE = 0x001A;
  5.  
  6. [DllImport("User32.Dll")]
  7. public static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int
  8. lParam);
  9. }
  10.  
  11. public static class Refresher
  12. {
  13. public static void ReloadSettings()
  14. {
  15. SafeNativeMethods.PostMessage(SafeNativeMethods.HWND_BROADCAST,
  16. SafeNativeMethods.WM_WININICHANGE, 0, 5000);
  17. }
  18. }
  19.  
  20. static void ExWin()
  21. {
  22. Form form = new Form();
  23. Refresher.ReloadSettings();
  24. Application.Run(form);
  25. }
862  Programación / .NET (C#, VB.NET, ASP) / (solucionado) La carpeta bin se me llena de dll's que mi app no utiliza en: 21 Noviembre 2012, 17:02 pm


Todas esas dlls controles en realidad mi app no las utiliza, las añadí a mi form para ver lo que hacian y si me podian servir para algún propósito, pero después de eso las eliminé (usando el botón eliminar)

¿Donde debo borrar los rastros que quedan de esas dll's?

¿Hay alguna extensión para VS2012 que haga esto automáticamente por mi?

Saludos
863  Programación / .NET (C#, VB.NET, ASP) / Cuando compilo mi aplicación, no funciona. en: 21 Noviembre 2012, 16:27 pm
Cuando compilo la app y la ejecuto me sale esto:



Pero cuando ejecuto la app desde el IDE no me sale ningún error (Bueno, menos en la consola, me sale una excepción en rojo) pero el programa funciona perfectamente apesar de esa excepción...

¿Hay alguna manera de evitar que salga esa ventana sin tener que investigar dentro del código del form?
864  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) AllowDrop... como narices usarlo? en: 21 Noviembre 2012, 15:01 pm
Hola,

¿Alguien podría darme un ejemplo de como se puede arrastrar una carpeta a un textbox en un winform?

Parece que no es suficiente con la propiedad AllowDrop = True ... y esto tampoco:
Código
  1.       ' Start a drag.
  2.        foldertextbox.DoDragDrop( _
  3.            foldertextbox.Text, _
  4.            DragDropEffects.Copy)

Muchas gracias
865  Programación / .NET (C#, VB.NET, ASP) / (solucionado) Buscar control dentro del form... en: 21 Noviembre 2012, 12:41 pm
He probado así:

Código
  1. If Me.FindControl("Checkbox1") IsNot Nothing Then
'FindControl' is not a member of 'WindowsApplication19.Form1'

Y así:
Código
  1. If Me.Panel1.Contains("Checkbox1") = False Then
Value of type 'String' cannot be converted to 'System.Windows.Forms.Control'.

EDITO: Es un winform

¿Soluciones porfavor?
866  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) Como darle focus a un item al abrir el form en: 21 Noviembre 2012, 10:11 am
Hola,




Los checkboxes de ese form los tengo dentro de un panel, y lo que quiero es que al ejecutar la app poder usar el scroll del mouse para bajar/subir la barra del scroll sin tener que pinchar en un checkbox primero.

No se si lo que debo cambiar es lo del focus, o el tabindex, o las dos cosas, pero he intentado cambiandole el tabindex a los checkboxes y no me funciona:

Código
  1.            With mcheck(i)
  2.                .AutoSize = True
  3.                .TabIndex = 0
  4.                .Location = New Point(0, i * 20)
  5.                .Name = "CheckBox" & i + 1
  6.                .Text = folder.Name
  7.            End With

¿O quizás a lo que debo darle focus/tabindex es al panel y no a los checkboxes? De todas formas el tabindex del panel también lo puse a "0"

No se si el problema es que le doy un valor de "0" a todos los elementos y por eso no me funciona...

EDITO: Cuando abro mi form, y le doy a la tecla "TAB", se pone el foco en el primer checkbox de todos, así que creo que no debo ir por muy mal camino... pero algo me falta.

EDITO 2: la scrollbar del panel no la he creado yo, la hago con la propiedad "autoscroll" del panel...

Un saludo
867  Programación / .NET (C#, VB.NET, ASP) / (solucionado) ¿clonar evento para varios elementos? ¿FOR? en: 18 Noviembre 2012, 12:39 pm
Hola,

Tengo un panel con casi 50 checkboxes (todos siguen un orden de nombre bien enumerado), y por ejemplo este es el sub del chekbox1:

Código
  1.    Public Sub C1CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles C1CheckBox1.CheckedChanged
  2.        If C1CheckBox1.Checked = True Then My.Settings.box1_selected = "Y" Else My.Settings.box1_selected = "N"
  3.        Dim checkedpath1 = C1CheckBox1.Text
  4.    End Sub

Lo que quisiera poder hacer es que ese mismo evento afecte a todos los checkboxes, eso se que se puede hacer añadiendo los checkboxes al "handle", vale, pero no es suficiente, ya que lo que hay dentro del sub del ejemplo solo afectará al checkbox 1 aunque yo añada todos al handle, ¿entienden lo que quiero decir?

Hay alguna forma de no escribir el mismo evento para los 50 checkboxes?

es decir, yo necesito hacer esto:

(Pseudocode)

Public Sub TODOS_LOS_CHECKBOXES_CheckedChanged(sender As Object, e As EventArgs) Handles TODOS_LOS_CHECKBOXES.CheckedChanged
If CUALQUIER_CHECKBOX.Checked = True Then My.Settings.NÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "Y" Else My.Settings.boxNÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "N"
Dim checkedpathNÚMERO_DEL_CHECKBOX _SELECCIONADO = C1CheckBoxNÚMERO_DEL_CHECKBOX _SELECCIONADO.Text
End Sub


Gracias y un saludo...
868  Programación / Scripting / [RUBY] MP3Crank Leecher v0.2 en: 18 Noviembre 2012, 08:27 am
MP3Crank es una página web que actualizan constantemente con albums de muchos estilos... pop, rock, dance, electro, heavy metal, indie, folk, hiphop, r&b etc...
Yo personalmente descargo musica casi todos los días en esta página porque los enlaces están en "potload" y se descargan enseguida usando JDownloader.

La cuestión es que para acceder a un link de descarga primer hay que pasar por 3 páginas, así que para evitar ese tiempo de espera tán incómodo he decidido hacer este pequeño script que parsea las "X" primeras páginas de la página web y guarda los links en un archivo de texto...

Los enlaces que se listen se registran en un archivo log para que no se vuelvan a listar en el próximo uso del script.











- Se puede configurar el máximo de páginas a parsear.
- Se pueden excluir los albumes por "tags", en la configuración del script. por ejemplo si excluimos el tag "pop" no se listará ningún album de estilo pop.
NOTA: Tener en cuenta que muchos albumes de la página tienen varios tags, por ejemplo "pop, rock, indie", si el tag "pop" lo hemos excluido, ese album se omitirá tenga los otros tags que tenga.

- El archivo de salida que obtendremos es algo parecido a este:

Código:
Title   : Layo & Bushwacka! - Rising & Falling
Genre   : House, Techno
Year    : 2012
Page    : http://www.mp3crank.com/layo-bushwacka/rising-falling.htm
Download: http://potload.com/w34j2fem2bra


Title   : Press Gang Metropol - Checkpoint
Genre   : New Wave, Post-punk
Year    : 2012
Page    : http://www.mp3crank.com/press-gang-metropol/checkpoint.htm
Download: http://potload.com/dizvwuf3m3sy


Title   : Porcupine Tree - Octane Twisted (Live) (2CD)
Genre   : Progressive, Rock
Year    : 2012
Page    : http://www.mp3crank.com/porcupine-tree/octane-twisted-live-2cd.htm
Download: http://potload.com/7h1rld0rfz03


Title   : Nightwish - Imaginaerum (The Score)
Genre   : Symphonic Metal
Year    : 2012
Page    : http://www.mp3crank.com/nightwish/imaginaerum-the-score.htm
Download: http://potload.com/eqznab8d44uk


EXECUTABLE: http://exoshare.com/download.php?uid=1Z1TPBQO

MP3Crank.rb:
Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3.  
  4. # MP3Crank Leecher v0.2
  5. #
  6. # By Elektro H@cker
  7.  
  8.  
  9. # Description:
  10. # -----------
  11. #
  12. # MP3Crank Leecher it's a tool that helps you to keep updated your music collection.
  13. #
  14. # This tool is intended for (almost) daily use.
  15. #
  16. # The script retreives all the downloadable links of the first "X" pages from the MP3Crank website,
  17. # And then list the links into a text file for use it with a download managaer like "JDownloader".
  18. #
  19. # All the links are stored permanently into a log file to be excluded at the next use,
  20. # (that's the reason why this tool is intended for daily use).
  21. #
  22. #
  23. # The pass for the links is: mp3crank.com
  24.  
  25.  
  26. require 'net/http'
  27. require 'win32/registry'
  28. require "highline/system_extensions"
  29. include HighLine::SystemExtensions
  30.  
  31.  
  32. exit if Object.const_defined?(:Ocra)
  33.  
  34.  
  35. def logo()
  36. puts "
  37. MP3CRANK Leecher v0.2
  38. By Elektro H@cker"
  39. end
  40.  
  41.  
  42. def main()
  43. puts "\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n[+] Press \"C\" to config or press any other key to start leeching..."
  44. key = get_character
  45. config("") if key.to_s =~ /^67$|^99$/
  46. get_downloads_list()
  47. puts "\n\n\n[+] All links are stored in: #{$mp3crank_leecherfile}\n\n(Remember, the password for the links is: \"mp3crank.com\")"
  48. exit
  49. end
  50.  
  51.  
  52. def get_settings()
  53. begin
  54. $mp3crank_logfile = regread("LOGFILEPATH")
  55. rescue
  56. $mp3crank_logfile = "#{ENV['WINDIR']}\\MP3Crank Leecher LOG.txt"
  57. end
  58.  
  59. begin
  60. $mp3crank_leecherfile = regread("LEECHERFILEPATH") +  "MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  61. rescue
  62. $mp3crank_leecherfile = "#{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  63. end
  64.  
  65. begin
  66. $max_pages = regread("MAXPAGES")
  67. $max_pages = $max_pages.to_i
  68. rescue
  69. $max_pages = 10
  70. end
  71.  
  72. begin
  73. $excluded_tags = regread("EXCLUDED TAGNAMES")
  74. rescue
  75. $excluded_tags = ""
  76. end
  77.  
  78. end
  79.  
  80.  
  81. def config(errorcode)
  82.  
  83. puts "
  84. º---------------------------------º---------------------------------º
  85. | [1] Set the log file path       | [S] Show the current settings   |
  86. | [2] Set the leecher file path   | [R] Reset the settings          |
  87. | [3] Delete the log file         | [Z] Backup all the settings     |
  88. |---------------------------------|---------------------------------|
  89. | [M] Max. Pages to parse         |                                 |
  90. | [T] Tagnames to exclude         | [E] Exit                        |
  91. º---------------------------------º---------------------------------º
  92. "
  93. get_settings()
  94. puts errorcode
  95.  
  96. keystr = "NOTHING"
  97. until keystr =~ /^49$|^50$|^51$|^69$|^80$|^82|^83$|^84$|^90$|^101$|^112$|^114$|^115$|^116$|^122$/
  98. print "\nChoose an option >> "
  99. key = get_character
  100. keystr = key.to_s
  101. end
  102.  
  103. # Log file path
  104. if key == 49
  105. logfilepath = "NOTHING"
  106. until File.directory?(logfilepath)
  107. print "\n\nEnter the path to an existing directory for the logfile: "
  108. logfilepath = STDIN.gets.chomp
  109. end
  110. if logfilepath[-1] == '\\' then logfilepath = logfilepath[0..-2] end
  111. regwrite("LOGFILEPATH", logfilepath + "\\MP3Crank Leecher LOG.txt")
  112. config("[+] Operation completed.")
  113. end
  114.  
  115. # Leecher file path
  116. if key == 50
  117. leecherfile = "NOTHING"
  118. until File.directory?(leecherfile)
  119. print "\n\Enter the path to an existing directory for the leecher file: "
  120. leecherfile = STDIN.gets.chomp
  121. end
  122. if not leecherfile[-1] == '\\' then leecherfile = leecherfile+"\\" end
  123. regwrite("LEECHERFILEPATH", leecherfile)
  124. config("[+] Operation completed.")
  125. end
  126.  
  127. # delete log file
  128. if key == 51
  129. filedel = "NOTHING"
  130. while not filedel =~ /^78$|^89$|^110$|^121$/
  131. print "\n\nWant to delete the log file, Are you sure? [Y/N]: "
  132. filedel = get_character.to_s
  133. end
  134. begin
  135. if filedel =~ /^89$|^121$/ then File.delete($mp3crank_logfile) end
  136. config("[+] Operation completed.")
  137. rescue
  138. config("\n\nERROR\n\nCan't find the logfile.")
  139. end
  140. end
  141.  
  142. # Max pages
  143. if key == 80 or key == 112
  144. maxpages = "NOTHING"
  145. puts "\n\nThis option lets you configure the maximum pages to leech..."
  146. until not maxpages[/[a-z]/i]
  147. print "\nEnter a number for the max pages value: "
  148. maxpages = STDIN.gets.chomp
  149. end
  150. regwrite("MAXPAGES", maxpages)
  151. config("[+] Operation completed.")
  152. end
  153.  
  154. # exclude tagnames
  155. if key == 84 or key == 116
  156. addtag = "NOTHING"
  157. puts "\n\nThis option lets you exclude albums by their genre tagnames..."
  158. until not addtag == "NOTHING"
  159. print "\n\nEnter a tagname (Example: \"Hip Hop\") \nor enter the word \"none\" to reset the exclusions: "
  160. addtag = STDIN.gets.chomp
  161. end
  162. begin
  163. tags=regread("EXCLUDED TAGNAMES")
  164. rescue
  165. tags=""
  166. end
  167. if addtag =~ /^none$/i then regwrite("EXCLUDED TAGNAMES", "") else regwrite("EXCLUDED TAGNAMES", "#{tags};#{addtag}") end
  168. config("[+] Operation completed.")
  169. end
  170.  
  171. # show the current settings
  172. if key == 83 or key == 115
  173. config("
  174.  
  175. Log file path       : #{$mp3crank_logfile}
  176.  
  177. Leecher file path   : #{$mp3crank_leecherfile}
  178.  
  179. Max. pages to parse : #{$max_pages} pages
  180.  
  181. Excluded tagnames   : #{$excluded_tags.gsub(";","|")}
  182.  
  183. ")
  184. end
  185.  
  186. # reset the settings
  187. if key == 114 or key == 82
  188. resetkey = "NOTHING"
  189. while not resetkey =~ /^78$|^89$|^110$|^121$/
  190. print "\n\nWant to reset all the settings, Are you sure? [Y/N]: "
  191. resetkey = get_character.to_s
  192. end
  193. if resetkey =~ /^89$|^121$/
  194. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\", Win32::Registry::KEY_ALL_ACCESS) do |reg|
  195. reg['LOGFILEPATH'] = 'DELETE'
  196. reg.delete_value("LOGFILEPATH")
  197. reg['LEECHERFILEPATH'] = 'DELETE'
  198. reg.delete_value("LEECHERFILEPATH")
  199. reg['MAXPAGES'] = 'DELETE'
  200. reg.delete_value("MAXPAGES")
  201. reg['EXCLUDED TAGNAMES'] = 'DELETE'
  202. reg.delete_value("EXCLUDED TAGNAMES")
  203. end
  204. config("[+] Operation completed.")
  205. end
  206. end
  207.  
  208. # backup the settings
  209. if key == 90 or key == 122
  210. system %[ regedit /e \"%USERPROFILE%\\Desktop\\MP3Crank Leecher settings %DATE:/=-%.reg\" \"HKEY_CURRENT_USER\\Software\\MP3Crank Leecher\" ]
  211. config("\n\n[+] Settings stored in #{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher settings.reg")
  212. end
  213.  
  214. # exit
  215. if key == 69 or key == 101 then main() end
  216.  
  217. end
  218.  
  219.  
  220. def show_info()
  221.  @info = "
  222.  
  223. Title   : #{@album_title}
  224. Genre   : #{@album_tags.to_s.gsub('\\t','').gsub(']','').gsub('[','').gsub('"','').gsub('nil','').gsub(', , ','')}
  225. Year    : #{@year}
  226. Page    : #{@album_page}
  227. Download: #{@potload_url}
  228.  
  229. "
  230.  puts @info
  231. end
  232.  
  233.  
  234. def get_downloads_list()
  235. @page = 0
  236. print "\n\n[+] Leeching pages "
  237. for i in 1..$max_pages do
  238. @page = @page+1
  239. @url  = "http://www.mp3crank.com/page/#{@page}"
  240. print "#{@page}/#{$max_pages}..."
  241. Net::HTTP.get_response(URI.parse(@url)).body.split('<!--/centercol -->').first.split('<div id="centercol">').last.each_line do |line|
  242.  
  243. if (line['class="release"']) then @downloadable = "yes" end
  244.  
  245. if line['class="year"'] then @year = line.split('</').first.split('>').last end
  246.  
  247. if line['class="genres"']
  248. for tag in line.split('rel="tag">').each do
  249. @album_tags = @album_tags, tag.split('<').first.gsub('&amp;','&')
  250. for excluded_tag in $excluded_tags.split(";").each do
  251. if not excluded_tag == "" and tag.split('<').first.to_s.chomp[/^#{Regexp.escape(excluded_tag)}$/i] then @downloadable = "no" end
  252. end
  253. end
  254. end
  255.  
  256. if line['class="album"']
  257. @album_title   = line.split('title="').last.split('">').first.gsub('Free MP3 download ','').gsub('&amp;','&')
  258. @album_page    = line.split('" rel=').first.split('"').last
  259. @download_page = Net::HTTP.get_response(URI.parse(@album_page)).body[/http:\/\/www.mp3crank.com\/download\/album\/[0-9]+/i]
  260. @potload_url   = Net::HTTP.get_response(URI.parse(@download_page)).body[/http:\/\/potload.com\/[a-z0-9]+/i]
  261. if @downloadable == "yes"
  262. filewrite()
  263. end
  264. @album_tags  = nil
  265. end
  266.  
  267. end
  268. end
  269. end
  270.  
  271.  
  272. def regread(keyname)
  273. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname] end
  274. end
  275.  
  276.  
  277. def regwrite(keyname, value)
  278. Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname, Win32::Registry::REG_SZ] = value end
  279. end
  280.  
  281.  
  282. def filewrite()
  283. if not File.exist?($mp3crank_logfile) then File.open($mp3crank_logfile, "w") do |write| write.puts "MP3Crack leeched URLs\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n" end end
  284. if not File.open($mp3crank_logfile, "r").read[@album_page]
  285. show_info()
  286. File.open($mp3crank_logfile,     "a+") do |write| write.puts @album_page end
  287. File.open($mp3crank_leecherfile, "a+") do |write| write.puts @info end
  288. end
  289. end
  290.  
  291.  
  292. logo()
  293. get_settings()
  294. main()
  295.  
  296.  
  297.  
869  Media / Multimedia / Necesito los nombres.exe de Reproductores multimedia conocidos en: 15 Noviembre 2012, 22:06 pm
Hola,

Busco el nombre de los ejecutables de reproductores de audio, es para una mini aplicación que estoy haciendo en VS.

De momento solo tengo estos:

mpc.exe
mpc-hc.exe
mpc-hc64.exe
vlc.exe
winamp.exe
wmp.exe


una ayudita?  :P
870  Programación / Scripting / [RUBY] SoundCloud Leecher v0.5 (Manten al día tu colección de música!) en: 15 Noviembre 2012, 13:29 pm
SoundCloud Leecher v0.5
By Elektro H@cker





















SoundCloud Leecher es una herramienta que te ayudará a mantener al día tu colección de música.

Esta utilidad está pensada para un uso (casi) diario o semanal.

El script obtiene todos los enlaces descargables de las primeras "X" páginas de "X" grupo de Soundcloud, y guarda esos enlaces en un archivo de texto para usarlos más tarde con un gestor de descargas como por ejemplo "JDownloader".

Además, todos los enlaces se listan también en un archivo log para que queden excluidos en el próximo uso del script, esa es la razón de porqué está pensado para el uso diario.

Es muy fácil de configurar.

Espero que a alguien más que a mi le sirva de ayuda. ::)

Un saludo!





Executable: http://exoshare.com/download.php?uid=OFGDPH4C


Soundcloud Leecher.rb:
Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3.  
  4. # SoundCloud Leecher v0.5
  5. #
  6. # By Elektro H@cker
  7.  
  8.  
  9. # Description:
  10. # -----------
  11. #
  12. # SoundCloud Leecher it's a tool that helps you to keep updated your music collection.
  13. #
  14. # This tool is intended for (almost) daily use.
  15. #
  16. # The script retreives all the downloadable links of the first "X" pages from a "X" group of SoundCloud,
  17. # And then list the links into a text file for use it with a download magaer like "JDownloader".
  18. #
  19. # All the links are stored permanently into a log file to be excluded at the next use,
  20. # that's the reason why this tool is intended for daily use.
  21.  
  22.  
  23. # Info:
  24. # ----
  25. #
  26. # SoundCloud unfortunately do not have a date search mode,
  27. # which would be much easier to search/sort by "music style + today's date" than "groups + first sorted pages",
  28. # The site has an advanced search engine that can search by "release date" but that is not the same than "uploaded date",
  29. # So i think the only way to sort by date is by entering a group page because it shows the content sorted by the last date.
  30.  
  31.  
  32. # How to use:
  33. # ----------
  34. #
  35. # Configure your favorite groups and the other settings by entering into the configuration menu.
  36.  
  37.  
  38. require 'net/http'
  39. require 'win32/registry'
  40. require "highline/system_extensions"
  41. include HighLine::SystemExtensions
  42.  
  43.  
  44. exit if Object.const_defined?(:Ocra)
  45.  
  46.  
  47. def logo()
  48. puts "
  49.  _,  _, ,  , ,  , ,_   _ ,    _, ,  , ,_      ,    _, _, _ , ,  _,,_  
  50. (_  / \\ |  | |\\ | | \\ /  |   / \\ |  | | \\     |   /_,/_,/  |_| /_,|_)  
  51.  _) \\_/ \\__| | \\| |_/ \\_ |__ \\_/ \\__| |_/     |__ \\_ \\_ \\_ | | \\_ | \\  
  52. '          `    `       `           `           '   `  `  `' `   `'  
  53.                                                                  v0.5
  54. By Elektro H@cker"
  55. end
  56.  
  57.  
  58. def main()
  59. puts "\n\n[+] Press \"C\" to config or press any other key to start leeching..."
  60. key = get_character
  61. config("") if key.to_s =~ /^67$|^99$/
  62. get_downloads_list()
  63. puts "\n\n\n[+] All links are stored in: #{$leecherfile}"
  64. end
  65.  
  66.  
  67. def get_settings()
  68. begin
  69. $logfile = regread("LOGFILEPATH")
  70. rescue
  71. $logfile = "#{ENV['WINDIR']}\\Soundcloud LOG.txt"
  72. end
  73.  
  74. begin
  75. $leecherfile = regread("LEECHERFILEPATH") +  "Soundcloud Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  76. rescue
  77. $leecherfile = "#{ENV['USERPROFILE']}\\Desktop\\Soundcloud Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  78. end
  79.  
  80. begin
  81. $groups = regread("GROUPS")
  82. rescue
  83. $groups = ""
  84. end
  85.  
  86. begin
  87. $max_pages = regread("MAXPAGES")
  88. $max_pages = $max_pages.to_i
  89. rescue
  90. $max_pages = 5
  91. end
  92.  
  93. begin
  94. $min_duration = regread("MINDURATION")+"00"
  95. $min_duration = $min_duration.to_i
  96. rescue
  97. $min_duration = 130
  98. end
  99.  
  100. begin
  101. $max_duration = regread("MAXDURATION")+"00"
  102. $max_duration = $max_duration.to_i
  103. rescue
  104. $max_duration = 1200
  105. end
  106.  
  107. begin
  108. $max_size = regread("MAXSIZE")+"00"
  109. $max_size = $max_size.to_i
  110. rescue
  111. $max_size = 10000
  112. end
  113.  
  114. begin
  115. $excluded_exts = regread("EXCLUDED EXTENSIONS")
  116. rescue
  117. $excluded_exts = ""
  118. end
  119.  
  120. begin
  121. $excluded_tags = regread("EXCLUDED TAGNAMES")
  122. rescue
  123. $excluded_tags = ""
  124. end
  125.  
  126. begin
  127. $verbose = regread("VERBOSEMODE")
  128. rescue
  129. $verbose = "no"
  130. end
  131.  
  132. end
  133.  
  134.  
  135. def config(errorcode)
  136.  
  137. puts "
  138. º---------------------------------º---------------------------------º
  139. | [1] Set the log file path       | [+] Max. track duration         |
  140. | [2] Set the leecher file path   | [-] Min. track duration         |
  141. | [3] Delete the log file         | [M] Max. track filesize         |
  142. |---------------------------------|---------------------------------|
  143. | [A] Add a group name            | [P] Pages per group to parse    |
  144. | [D] Delete a group name         | [F] Filetypes to exclude        |
  145. | [L] List the group names        | [T] Tagnames to exclude         |
  146. |---------------------------------|---------------------------------|
  147. | [V] Verbose mode (ON/OFF)       | [S] Show the current settings   |
  148. |---------------------------------| [R] Reset the settings          |
  149. | [E] Exit                        | [Z] Backup all the config.      |
  150. º---------------------------------º---------------------------------º
  151.  
  152. "
  153. get_settings()
  154. puts errorcode
  155.  
  156. keystr = "NOTHING"
  157. until keystr =~ /^43$|^45$|^49$|^50$|^51$|^65$|^68$|^69$|^70$|^76$|^77$|^80$|^82$|^83$|^84$|^86$|^90$|^97$|^100$|^101$|^102$|^108$|^109$|^112$|^114$|^115$|^116$|^118$|^121$|^122$/
  158. print "\nChoose an option >> "
  159. key = get_character
  160. keystr = key.to_s
  161. end
  162.  
  163. # Log file path
  164. if key == 49
  165. logfilepath = "NOTHING"
  166. until File.directory?(logfilepath)
  167. print "\n\nEnter the path to an existing directory for the logfile: "
  168. logfilepath = STDIN.gets.chomp
  169. end
  170. if logfilepath[-1] == '\\' then logfilepath = logfilepath[0..-2] end
  171. regwrite("LOGFILEPATH", logfilepath + "\\Soundcloud LOG.txt")
  172. config("[+] Operation completed.")
  173. end
  174.  
  175. # Leecher file path
  176. if key == 50
  177. leecherfile = "NOTHING"
  178. until File.directory?(leecherfile)
  179. print "\n\Enter the path to an existing directory for the leecher file: "
  180. leecherfile = STDIN.gets.chomp
  181. end
  182. if not leecherfile[-1] == '\\' then leecherfile = leecherfile+"\\" end
  183. regwrite("LEECHERFILEPATH", leecherfile)
  184. config("[+] Operation completed.")
  185. end
  186.  
  187. # delete log file
  188. if key == 51
  189. filedel = "NOTHING"
  190. while not filedel =~ /^78$|^89$|^110$|^121$/
  191. print "\n\nWant to delete the log file, Are you sure? [Y/N]: "
  192. filedel = get_character.to_s
  193. end
  194. begin
  195. if filedel =~ /^89$|^121$/ then File.delete($logfile) end
  196. config("[+] Operation completed.")
  197. rescue
  198. config("\n\nERROR\n\nCan't find the logfile.")
  199. end
  200. end
  201.  
  202. # Add groupname
  203. if key == 65 or key == 97
  204. addname = "NOTHING"
  205. until not addname == "NOTHING"
  206. print "\n\nEnter a group name to add\nor enter the word \"none\" to reset the group list: "
  207. addname = STDIN.gets.chomp
  208. end
  209. begin
  210. groups=regread("GROUPS")
  211. rescue
  212. groups=""
  213. end
  214.  
  215. for addgroupname in regread("GROUPS").split(";").sort do
  216. if not addgroupname =~ /^#{Regexp.escape(addname)}$/i then addfinalgroups="#{addfinalgroups};#{addgroupname}" else found = "yes" end
  217. end
  218. if found == "yes" then config("\n\n[+] ERROR\n\nThe groupname already exists.") end
  219. if addname =~ /^none$/i then regwrite("GROUPS", "") else regwrite("GROUPS", "#{groups};#{addname}") end
  220. config("[+] Operation completed.")
  221. end
  222.  
  223. # delete groupname
  224. if key == 68 or key == 100
  225. delnum = "NOTHING"
  226. num=0
  227. for listname in $groups.split(";").each.sort do
  228. num=num+1
  229. puts " [#{num}] #{listname}"
  230. instance_variable_set "@_#{num}", listname
  231. end
  232. until not delnum == "NOTHING"
  233. print "\n\nEnter a reference number to delete the group\nor enter the word \"none\" to reset the group list: "
  234. delnum = STDIN.gets.chomp
  235. end
  236. choose = instance_variable_get "@_#{delnum}"
  237. begin
  238. groups=regread("GROUPS")
  239. rescue
  240. groups=""
  241. end
  242. begin
  243. for delgroupname in regread("GROUPS").split(";").sort do
  244. if not delgroupname =~ /^#{Regexp.escape(choose)}$/i then delfinalgroups="#{delfinalgroups};#{delgroupname}" end
  245. end
  246. rescue
  247. config("\n\n[+] ERROR\n\nCan't find the delgroupname.")
  248. end
  249. regwrite("GROUPS", delfinalgroups[1..-1])
  250. config("[+] Operation completed.")
  251. end
  252.  
  253. # list groupnames
  254. if key == 76 or key == 108
  255. num = 0
  256. puts "\n\n[+] All your groups:\n\n"
  257. for listname in $groups.split(";").each.sort do
  258. num=num+1
  259. puts " [#{num}] #{listname}"
  260. end
  261. puts "\n\n[+] Press any other key to continue..."
  262. get_character
  263.    config("[+] Operation completed.")
  264. end
  265.  
  266. # Max pages
  267. if key == 80 or key == 112
  268. maxpages = "NOTHING"
  269. puts "\n\nThis option lets you configure the maximum pages when leeching a group..."
  270. until not maxpages[/[a-z]/i]
  271. print "\nEnter a number for the max pages value: "
  272. maxpages = STDIN.gets.chomp
  273. end
  274. regwrite("MAXPAGES", maxpages)
  275. config("[+] Operation completed.")
  276. end
  277.  
  278. # Min track duration
  279. if key == 45
  280. puts "\n\nThis option lets you configure the minimum accepted minutes duration when leeching tracks..."
  281. minlenght = "NOTHING"
  282. until minlenght[/^[0-9]+$/]
  283. print "\nEnter a number to set the min. minutes for a track (Example: \"1\"): "
  284. minlenght = STDIN.gets.chomp
  285. end
  286. regwrite("MINDURATION", minlenght)
  287. config("[+] Operation completed.")
  288. end
  289.  
  290. # Max track duration
  291. if key == 43
  292. puts "\n\nThis option lets you configure the maximum accepted minutes duration when leeching tracks..."
  293. maxlenght = "NOTHING"
  294. until maxlenght[/^[0-9]+$/]
  295. print "\nEnter a number to set the max. minutes for a track (Example: \"15\"): "
  296. maxlenght = STDIN.gets.chomp
  297. end
  298. regwrite("MAXDURATION", maxlenght)
  299. config("[+] Operation completed.")
  300. end
  301.  
  302. # Max track filesize
  303. if key == 77 or key == 109
  304. puts "\n\nThis option lets you configure the maximum accepted filesize when leeching tracks..."
  305. maxsize = "NOTHING"
  306. until maxsize[/^[0-9]+$/]
  307. print "\nEnter a number to set the max. MB for a track (Example: \"20\"): "
  308. maxsize = STDIN.gets.chomp
  309. end
  310. regwrite("MAXSIZE", maxsize)
  311. config("[+] Operation completed.")
  312. end
  313.  
  314. # exclude filetypes
  315. if key == 102 or key == 70
  316. addext = "NOTHING"
  317. puts "\n\nThis option lets you exclude tracks by their file extension..."
  318. until not addext == "NOTHING"
  319.  
  320. print "\n\nEnter a file extension (Example: \"wav\") \nor enter the word \"none\" to reset the exclusions: "
  321. addext = STDIN.gets.chomp
  322. end
  323. begin
  324. exts=regread("EXCLUDED EXTENSIONS")
  325. rescue
  326. exts=""
  327. end
  328. if addext =~ /^none$/i then regwrite("EXCLUDED EXTENSIONS", "") else regwrite("EXCLUDED EXTENSIONS", "#{exts};#{addext.gsub(".","")}") end
  329. config("[+] Operation completed.")
  330. end
  331.  
  332. # exclude tagnames
  333. if key == 84 or key == 116
  334. addtag = "NOTHING"
  335. puts "\n\nThis option lets you exclude tracks by a tagname..."
  336. until not addtag == "NOTHING"
  337. print "\n(The tagnames are not case sensitive)\n\nEnter a tagname (Example: \"session\") \nor enter the word \"none\" to reset the exclusions: "
  338. addtag = STDIN.gets.chomp
  339. end
  340. begin
  341. tags=regread("EXCLUDED TAGNAMES")
  342. rescue
  343. tags=""
  344. end
  345. if addtag =~ /^none$/i then regwrite("EXCLUDED TAGNAMES", "") else regwrite("EXCLUDED TAGNAMES", "#{tags};#{addtag}") end
  346. config("[+] Operation completed.")
  347. end
  348.  
  349. # verbose mode
  350. if key == 118 or key == 86
  351. verbkey = "NOTHING"
  352. puts "\n\nThe verbose mode lets you can see more info when leeching the group pages..."
  353. while not verbkey =~ /^78$|^89$|^110$|^121$/
  354. print "\n\nWant to use the verbose mode? [Y/N]: "
  355. verbkey = get_character.to_s
  356. end
  357. if verbkey =~ /^89$|^121$/ then regwrite("VERBOSEMODE", "yes") else regwrite("VERBOSEMODE", "no") end
  358. config("[+] Operation completed.")
  359. end
  360.  
  361.  
  362. # show the current settings
  363. if key == 83 or key == 115
  364. config("
  365.  
  366. Log file path       : #{$logfile}
  367.  
  368. Leecher file path   : #{$leecherfile}
  369.  
  370. Max. pages per group: #{$max_pages} pages
  371.  
  372. Min. track duration : #{$min_duration.to_s[0..-3]} min
  373.  
  374. Max. track duration : #{$max_duration.to_s[0..-3]} min
  375.  
  376. Max. track filesize : #{$max_size.to_s[0..-3]} mb
  377.  
  378. Verbose mode        : #{$verbose}
  379.  
  380. Excluded extensions : #{$excluded_exts.gsub(";","|")}
  381.  
  382. Excluded tagnames   : #{$excluded_tags.gsub(";","|")}
  383.  
  384. ")
  385. end
  386.  
  387. # reset the settings
  388. if key == 114 or key == 82
  389. resetkey = "NOTHING"
  390. while not resetkey =~ /^78$|^89$|^110$|^121$/
  391. print "\n(This not affect to group list)\n\nWant to reset all the settings, Are you sure? [Y/N]: "
  392. resetkey = get_character.to_s
  393. end
  394. if resetkey =~ /^89$|^121$/
  395. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\Soundcloud Leecher\\", Win32::Registry::KEY_ALL_ACCESS) do |reg|
  396. reg['LOGFILEPATH'] = 'DELETE'
  397. reg.delete_value("LOGFILEPATH")
  398. reg['LEECHERFILEPATH'] = 'DELETE'
  399. reg.delete_value("LEECHERFILEPATH")
  400. reg['MAXPAGES'] = 'DELETE'
  401. reg.delete_value("MAXPAGES")
  402. reg['MINDURATION'] = 'DELETE'
  403. reg.delete_value("MINDURATION")
  404. reg['MAXDURATION'] = 'DELETE'
  405. reg.delete_value("MAXDURATION")
  406. reg['MAXSIZE'] = 'DELETE'
  407. reg.delete_value("MAXSIZE")
  408. reg['VERBOSEMODE'] = 'DELETE'
  409. reg.delete_value("VERBOSEMODE")
  410. reg['EXCLUDED EXTENSIONS'] = 'DELETE'
  411. reg.delete_value("EXCLUDED EXTENSIONS")
  412. reg['EXCLUDED TAGNAMES'] = 'DELETE'
  413. reg.delete_value("EXCLUDED TAGNAMES")
  414. end
  415. config("[+] Operation completed.")
  416. end
  417. end
  418.  
  419. # backup the settings
  420. if key == 90 or key == 122
  421. system %[ regedit /e \"%USERPROFILE%\\Desktop\\Soundcloud settings %DATE:/=-%.reg\" \"HKEY_CURRENT_USER\\Software\\Soundcloud Leecher\" ]
  422. config("\n\n[+] Settings stored in #{ENV['USERPROFILE']}\\Desktop\\SoundCloud settings.reg")
  423. end
  424.  
  425. # exit
  426. if key == 69 or key == 101 then main() end
  427.  
  428. end
  429.  
  430.  
  431. def regread(keyname)
  432. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\Soundcloud Leecher\\") do |reg| reg[keyname] end
  433. end
  434.  
  435.  
  436. def regwrite(keyname, value)
  437. Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\Soundcloud Leecher\\") do |reg| reg[keyname, Win32::Registry::REG_SZ] = value end
  438. end
  439.  
  440.  
  441. def filewrite()
  442. if not File.exist?($logfile) then File.open($logfile, "w") do |write| write.puts "SoundCloud leeched URLs\n" end end
  443. if not File.open($logfile, "r").read[@track_url.split("/download").first.split("http://soundcloud.com/").last.gsub("-","").gsub("/","")]
  444. if $verbose == "yes" then puts @info end
  445. File.open($logfile,     "a+") do |write| write.puts @track_url.split("/download").first.split("http://soundcloud.com/").last.gsub("-","").gsub("/","") end
  446. File.open($leecherfile, "a+") do |write| write.puts "Added at #{Time.new.strftime("%H:%M")}: #{@track_url}" end
  447. end
  448. end
  449.  
  450.  
  451. def get_downloads_list()
  452.  
  453. if $verbose == "no"
  454. for name in $groups.split(";").each.sort do
  455. @group = name.chomp
  456. @page  = 0
  457. print "\n\n[+] Group: #{@group}\n[+] Leeching pages "
  458. for i in 1..$max_pages do
  459. @page = @page+1
  460. @url  = "http://soundcloud.com/groups/#{@group}/tracks?page=#{@page}"
  461. print "#{@page}/#{$max_pages}..."
  462. Net::HTTP.get_response(URI.parse(@url)).body.each_line do |line|
  463. if (line['class="info-header"'])
  464. @filename = line.split('</a').first.split('>').last.gsub(/ Artwork$/,'').gsub('&quot;','"').gsub('&amp;','&')
  465. for excluded_tag in $excluded_tags.split(";").each do
  466. if not excluded_tag == "" and @filename[/#{Regexp.escape(excluded_tag)}/i] then @downloadable = "no" end
  467. end
  468. end
  469. if (line['button download']) then @downloadable = "yes" end
  470. if (line['button download']) then @track_url    = "http://soundcloud.com#{line.split('href="').last.split('"').first}\n" end
  471. if (line['This track is not downloadable']) then @downloadable = "no" end
  472. if (line['class="file-type"'])
  473. @ext = line.split('</').first.split('>').last
  474. for excluded_ext in $excluded_exts.split(";").each do
  475. if not excluded_ext == "" and @ext =~ /^#{Regexp.escape(excluded_ext)}$/i then @downloadable = "no" end
  476. end
  477. end
  478. if (line['class="content-size"'])
  479. @size         = line.split('</').first.split('>').last
  480. if @size.gsub(".","").to_i > $max_size then @downloadable = "no" end
  481. end
  482. if (line['class="duration"']) then @duration = line.split('</').first.split('>').last.gsub(".","").to_i end
  483. if (line['class="duration"']) and @downloadable == "yes" and @duration > $min_duration and @duration < $max_duration
  484. filewrite()
  485. end
  486. end
  487. end
  488. end
  489. end
  490.  
  491. if $verbose == "yes"
  492. for name in $groups.split(";").each.sort do
  493. @group = name.chomp
  494. @page  = 0
  495. print "\n\n[+] Group: #{@group}\n[+] Leeching pages "
  496. for i in 1..$max_pages do
  497. @page = @page+1
  498. @url  = "http://soundcloud.com/groups/#{@group}/tracks?page=#{@page}"
  499. print "#{@page}/#{$max_pages}..."
  500. Net::HTTP.get_response(URI.parse(@url)).body.each_line do |line|
  501. if (line['class="info-header"'])
  502. @filename = line.split('</a').first.split('>').last.gsub(/ Artwork$/,'').gsub('&quot;','"').gsub('&amp;','&')
  503. for excluded_tag in $excluded_tags.split(";").each do
  504. if not excluded_tag == "" and @filename[/#{Regexp.escape(excluded_tag)}/i] then @downloadable = "no" end
  505. end
  506. end
  507. if (line['button download']) then @downloadable = "yes" end
  508. if (line['button download']) then @track_url    = "http://soundcloud.com#{line.split('href="').last.split('"').first}\n" end
  509. if (line['This track is not downloadable']) then @downloadable = "no" end
  510. if (line['class="file-type"'])
  511. @ext = line.split('</').first.split('>').last
  512. for excluded_ext in $excluded_exts.split(";").each do
  513. if not excluded_ext == "" and @ext =~ /^#{Regexp.escape(excluded_ext)}$/i then @downloadable = "no" end
  514. end
  515. end
  516. if (line['class="content-size"'])
  517. @size         = line.split('</').first.split('>').last
  518. if @size.gsub(".","").to_i > $max_size then @downloadable = "no" end
  519. end
  520. if (line['class="duration"']) then @duration     = line.split('</').first.split('>').last end
  521. if (line['class="duration"']) and @downloadable == "yes" and @duration.gsub(".","").to_i > $min_duration and @duration.gsub(".","").to_i < $max_duration
  522. @info = "\n\nFilename : #{@filename} \nExtension: #{@ext} \nFilesize : #{@size}  \nDuration : #{@duration} minutes\nURL      : #{@track_url}\n"
  523. filewrite()
  524. end
  525. end
  526. end
  527. end
  528. end
  529.  
  530. end
  531.  
  532.  
  533. logo()
  534. get_settings()
  535. main()
  536.  
  537.  
  538. __END__
  539.  
  540.  
Páginas: 1 ... 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 [87] 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ... 107
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines