add `lowerpong` criteria

This commit is contained in:
jesopo 2019-07-05 14:19:10 +01:00
parent c3f28176fa
commit 5896d728b1
2 changed files with 17 additions and 4 deletions

View File

@ -9,6 +9,7 @@ Currently (2019-07-04) detects: aicia, androirc, bitchx, burd, hexchat, icechat,
- `PING :123` -> `PONG :123` OR `PONG 123` (`pong_colon`)
- `PONG`ing an invalidly long `PING` (`long_pong`)
- `PING` tokens being cut at space (`spacepong`)
- not recognising `ping` as `PING` (`lowerpong`)
- `NICK` before `USER` (`nick_first`)
- `USER` disused params (`user_hostname` and `user_servername`)
- ERR_NICKNAMEINUSE `<nick>` param being echoed (`nick_echo`)

View File

@ -70,6 +70,7 @@ class Client(object):
"pong_colon": False,
"long_pong": False,
"spacepong": False,
"lowerpong": False,
"user_hostname": "",
"user_servername": "",
@ -225,6 +226,7 @@ def _end(client):
_result(client, "pong_colon", False)
_result(client, "long_pong", False)
_result(client, "spacepong", True)
_result(client, "lowerpong", True)
_result(client, "cap")
if client.criteria["cap"]:
@ -282,11 +284,13 @@ def listen(port: int, verbose: bool):
new_client.snotice("\x0303%s" % line)
new_client.snotice("detectin yr client lmao")
new_client.send("PING :%s" % LONG_PING)
new_client.send("PING :spacepong a")
new_client.send(
":ircfuz 005 * NAMESX :are supported by this server")
new_client.send("PING :%s" % LONG_PING)
new_client.send("ping :lower")
new_client.send("PING :spacepong a")
else:
lines = rsock.recv()
if not lines:
@ -321,12 +325,20 @@ def listen(port: int, verbose: bool):
client.pong_count += 1
if not " " in line.args[0] and " :" in raw_line:
client.criteria["pong_colon"] = True
if line.args[0] == "lower":
client.criteria["lowerpong"] = True
if "spacepong" in line.args[0]:
client.criteria["spacepong"] = " " in line.args[0]
if not client.criteria["lowerpong"]:
client.pong_count += 1
if line.args[0] == LONG_PING:
client.criteria["long_pong"] = True
if client.terminal_pong and client.pong_count == 2:
if client.terminal_pong and client.pong_count == 3:
_end(client)
break