Skip to content

Instantly share code, notes, and snippets.

Created December 24, 2011 10:54
Show Gist options
  • Save anonymous/1517115 to your computer and use it in GitHub Desktop.
Save anonymous/1517115 to your computer and use it in GitHub Desktop.
Python irc
#nibbler.py
import sys
import socket
import string
network = "irc.freenode.net"
port = 6667
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((network, port))
print(irc.recv(4096))
irc.send(b"NICK nibbl3r\r\n")
irc.send(b"USER nibbl3r nibbl3r nibbl3r")
irc.send(b"JOIN #tofaffy")
irc.send(b"PRIVMSG #tofaffy :Hello.\r\n")
while True:
data = irc.recv(4096)
if data.find(b"PING") != -1:
irc.send(b"PONG" + data.split()[1] + b"\r\n")
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment