Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Bot cerca nick su irc vb6
Forum - Visual Basic 6 - Bot cerca nick su irc vb6

Avatar
mastergov (Normal User)
Rookie


Messaggi: 22
Iscritto: 26/03/2010

Segnala al moderatore
Postato alle 2:51
Venerdì, 09/12/2011
Codice sorgente - presumibilmente VB.NET

  1. Option Explicit
  2. Sub Pause(ByVal interval As Double)
  3.              
  4.           Dim Current As Double
  5.           Current = Timer
  6.           Do While Timer - Current < interval
  7.           DoEvents
  8.           Loop
  9. End Sub
  10. Private Sub cmdConnect_Click()
  11. Winsock.RemoteHost = "irc.tiscali.it"  ' this is the Ip of the server 127.0.0.1 loops back to your own computer
  12. Winsock.RemotePort = 6667  ' this is the port it must be the same as the server
  13. Winsock.Connect  ' connect!
  14. End Sub
  15.  
  16.  
  17.  
  18. Private Sub cmdSend_click()
  19. Dim info1, info2, info3 As String
  20. Dim nick(5) As String
  21. Dim whois As String
  22.  
  23. info1 = "nick"
  24. info2 = "searchBot"
  25. info3 = "user Code_Master 95.251.39.70 irc.tiscali.it Coder"
  26.  
  27. nick(0) = "zappa"
  28. nick(1) = "cone"
  29. nick(3) = "LosCo"
  30. nick(4) = "Tapparella"
  31. nick(5) = "mitico"
  32. whois = "whois"
  33. Dim i As Integer
  34.  
  35. Dim numeroriga As Integer
  36.  
  37. Dim riga As String, c As Integer
  38. numeroriga = 1
  39.  
  40. For i = 1 To 20
  41. Close #1
  42.  
  43. Open App.Path & "\lista.txt" For Input As #1
  44.  
  45.  Do
  46. c = c + 1
  47. Line Input #1, riga
  48.  
  49. Debug.Print "Mi sto connettendo a questo server :" & riga
  50.  
  51. Winsock.RemoteHost = riga
  52.  
  53.  
  54. Winsock.RemotePort = 6667
  55. Winsock.Connect
  56. Pause 2
  57.  
  58. Winsock.SendData info1 & " " & info2 & vbNewLine  ' sends the data in the textbox
  59.  
  60. txtWindow.Text = txtWindow.Text & vbNewLine & info1 & " " & info2 & vbNewLine & info3 & vbNewLine ' displays data
  61. Winsock.SendData info3 & vbNewLine
  62. Pause 3
  63. Dim fioco As String
  64.  
  65. fioco = txtWindow.Text
  66. Dim h As Integer
  67.  
  68. Open "c:\results.txt" For Append As #2
  69.  
  70. For h = 0 To 5
  71.                 Debug.Print "Sto cercando :" & nick(h)
  72.                 Winsock.SendData whois & " " & nick(h) & vbNewLine
  73.                 Print #2, fioco
  74.                 Pause 5
  75.                
  76.             Next
  77.                 Close #2
  78.                
  79. Loop Until EOF(1) Or c = numeroriga
  80.  
  81. txtWindow.SelStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information!
  82. txtchatBox.Text = "" ' just empties the text box
  83. Winsock.Close
  84. Pause 2
  85.  
  86. Next
  87.  
  88. End Sub
  89.  
  90.  
  91.  
  92. Private Sub Form_Load()
  93. Dim c As Integer
  94.  
  95. c = 1
  96. End Sub
  97.  
  98.  Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
  99.  
  100. Dim incommingData As String
  101.  
  102. Winsock.GetData incommingData
  103.  
  104. txtWindow.Text = txtWindow.Text & vbNewLine & incommingData
  105. txtWindow.SelStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information!
  106. End Sub
  107.  
  108. Private Sub winsock_connect()
  109. Debug.Print "You are connected to  : "
  110. End Sub


In pratica  questo programmino va a leggere una lista di server presente nel file lista.txt tutti i nomi dei server e si collegga a tutti, cercando i nick che sono inseriti. o almeno dovrebbe! :D
però non capisco perchè il primo giro lo fa ammodo  e si collega al primo server quindi fa i whois e salva tutto in un file, al secondo giro mi da errore
su
Winsock.RemoteHost = riga
eppure sopra ho messo un debug.print e come risultato nel debuger torna scritto ammodo, che dite? dove è l'inghippo?

PM
Avatar
nessuno (Normal User)
Guru^2


Messaggi: 6402
Iscritto: 03/01/2010

Up
0
Down
V
Segnala al moderatore
Postato alle 9:13
Venerdì, 09/12/2011
Quale errore ti dà su quella linea?

Che vuol dire in italiano "torna scritto ammodo"?

Il codice della Form_Load non serve a nulla.

torna scritto ammodo nel senso che io al debug.print gli passo la variabile su cui ci sta scritto il nome del server, e nell'debugger vedo che all'interno della variabile cè quello che ci dovrebbe essere. quindi non capisco perchè mi dia errore, visto che poi sulla riga 51 gli passo riga che è l'ho - mastergov - 09/12/11 14:51
Quale errore ti dà??? - nessuno - 09/12/11 15:03
Invalid Operation at current state Run-time '40020', penso che ci sta anche che qualche server magari non è piu attivo quindi dovrò mettere un cilclo che se dopo 5 secondi non si collega passa ad un altro - mastergov - 10/12/11 00:47


Ricorda che nessuno è obbligato a risponderti e che nessuno è perfetto ...
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
PM