forked from ZerooCool/newbiecontest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
33 lines (31 loc) · 1.07 KB
/
Copy pathfunctions.py
File metadata and controls
33 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# coding: utf-8
import requests
import config
import irc.client
def get(url, returnRequests=False):
print('functions | get URL ', url)
r = requests.get(url, cookies={config.COOKIE_KEY:config.COOKIE_VAL})
if returnRequests:
return r
else:
return r.text
class IrcSolver(irc.client.SimpleIRCClient):
def __init__(self):
irc.client.SimpleIRCClient.__init__(self)
self.server = 'irc.newbiecontest.org'
self.port = 6667
self.nickname = 'MisterBob-bot'
self.channel = '#nc-irc-challs'
self.target = 'Daneel'
self.debug_all_events = 0
self.STEP = 1
self.reactor.add_global_handler("all_events", self.my_dispatcher, -10)
def connect_and_start(self):
self.connect(self.server, self.port, self.nickname)
self.start()
def on_welcome(self, connection, event):
connection.join(self.channel)
def my_dispatcher(self, connection, event):
if self.debug_all_events:
if event.type != 'all_raw_messages':
print('my_dispatcher:', event)