bon salut a tous.

j'essaie depuis quelques jours de faire un client qui se connecte a une chaine irc et lui envoie un message puis recoit ca reponse ..
pour les curieux c'est un challenge de root-me http://www.root-me.org/fr/Challenges...our-au-college

bon voici un code que j'ai trouve dans stackoverflow et que jais inpeu modifiee

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import socket
import sys
 
server = "irc.root-me.org"       #settings
channel = "#Root-Me_Challenge"
botnick = "Mohamed17"
 
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
print "connecting to:"+server
irc.connect((server, 6667))                                                         #connects to the server
irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :This is a fun bot!\n") #user authentication
irc.send("NICK "+ botnick +"\n")                            #sets nick
irc.send("PRIVMSG Candy !ep1\r\n")    #auth        #join the chan
#irc.send("JOIN "+ channel +"\n")
 
while 1:    #puts it in a loop
   text=irc.recv(2040)  #receive the text
   print text   #print text to console
 
   if text.find('PING') != -1:                          #check if 'PING' is found
      irc.send('PONG ' + text.split() [1] + '\r\n') #returnes 'PONG' back to the server (prevents pinging out!)


c'est résolu