-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhts8.py
46 lines (36 loc) · 1.48 KB
/
hts8.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
from irc_bot import irc_bot
import time
import hashlib
import argparse
parser = argparse.ArgumentParser(description='Complete HackThisSite programming challenge 8. ')
parser.add_argument('--server', default="irc-hub.hackthissite.org", help="irc server to connect to. defaults to irc-hub.hackthissite.org")
parser.add_argument('--nick', help="Nickname to use on login", required=True)
parser.add_argument('--password', help="password for nick. Must have previously registered this nick and linked to HTS account (use an alternate client)", required=True)
args = parser.parse_args()
server = args.server
#server = "irc.5ci.net"
nick = args.nick
irc_password = args.password
irc = irc_bot(server, nick=nick, password=irc_password)
"""-------------------------------------------------------------------
main
------------------------------------------------------------------"""
irc.hold_for_response("NOTICE")
irc.message("nickserv", "identify " + irc_password)
irc.hold_for_response("recognized")
irc.send_command("JOIN #perm8")
irc.hold_for_response("End of /NAMES list")
def reflect_md5(data):
global irc
md5 = hashlib.md5()
md5.update(bytes(data[data.find("!md5 ")+5:-2], 'ascii'))
irc.notice("moo", "!perm8-result " + md5.hexdigest())
def attack(data):
irc.join_channel("#takeoverz")
time.sleep(.5)
irc.send_command("KICK #takeoverz moo")
irc.add_listener("!md5",reflect_md5)
irc.add_listener("!perm8-attack", attack)
irc.notice("moo", "!perm8")
while True:
time.sleep(1)