3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 17:29:21 +01:00
Commit Graph

962 Commits

Author SHA1 Message Date
James Lu
8ad68023d6 Add tests for pr/inspircd, a common FakeIRC class, and tests for that too 2015-07-03 18:07:47 -07:00
James Lu
fed107b12b main.py: don't assign self.socket twice 2015-07-03 18:07:32 -07:00
James Lu
0c8a30323a proto/inspircd: raise ProtocolError instead of calling sys.exit on errors 2015-07-03 18:07:01 -07:00
James Lu
0f4d3df757 inspircd.py: spawnServer tweaks
- Send ENDBURST from the server, not its uplink
- Check to make sure SID is 3 characters long...
2015-07-03 17:10:32 -07:00
James Lu
991e86a8cb unittests! wow! 2015-07-03 17:05:44 -07:00
James Lu
072cc72602 defaultdict for channels, fix user tracking in {join|part}Client, isInternal* to utils
- collections.defaultdict for simpler channel handling
- proto/inspircd: fix join/partClient not updating the channel's user list
- move isInternal* to utils
2015-06-23 19:29:53 -07:00
James Lu
6370ad492f Add basic command hooks (ref #18) 2015-06-23 19:08:43 -07:00
James Lu
28e7b52ef4 utils.TS6UIDGenerator: initialize SID variable once per instance 2015-06-22 16:51:42 -07:00
James Lu
f37af68e3f utils: tweak TS6UIDGenerator again
Only increment the UID table after we fetch the UID, so that the initial value (AAAAAA) gets used too.
2015-06-21 18:11:17 -07:00
James Lu
6a69ed0459 proto/inspircd: handle RSQUIT for removing PyLink leaves 2015-06-21 17:07:31 -07:00
James Lu
ab1a946364 proto/inspircd: fix ping reply syntax
Although InspIRCd doesn't seem to care, the correct PONG syntax is:

-> :<our sid> PONG <our sid> <their sid>,

and not

-> :<our sid> PONG <our sid>,

which was used prior to this commit.
2015-06-21 15:04:19 -07:00
James Lu
c686523a6e Add pseudoserver spawning, adapting _sendFromServer and spawnClient accordingly.
Now you can spawn multiple servers for a multi-server botnet!

Also, create proto.isInternalServer() / utils.isServerName() checkers.

Closes #22.
2015-06-21 15:03:58 -07:00
James Lu
0a1754dd4b Merge branch 'usermode-handling' 2015-06-20 22:05:01 -07:00
James Lu
c120914c83 Add a LICENSE: MPL 2.0 2015-06-20 21:10:50 -07:00
James Lu
ce249dfe33 uhhh.... let's clear our variables properly 2015-06-20 21:06:45 -07:00
James Lu
aeb53a14e3 Make IrcUser.modes a set 2015-06-20 20:58:25 -07:00
James Lu
d3257f9314 Don't hardcode client usermodes in spawnClient
Still a bit of a WIP here...
2015-06-20 20:54:01 -07:00
James Lu
379f442a14 Add basic user mode tracking (Closes #10) 2015-06-20 20:36:35 -07:00
James Lu
f352166d25 proto/insp: use the client's TS in WHOIS IDLE replies
Use the client's TS, not the global IRC start time. Everything else for client timestamp tracking is basically done, at least for this protocol handler. Closes #11.
2015-06-19 13:18:22 -07:00
James Lu
0db5c4c209 plugins/admin.py: add 'showuser' command 2015-06-19 13:00:23 -07:00
James Lu
d8b562865d plugins/admin.py: this is an exec command, not eval 2015-06-19 10:44:25 -07:00
James Lu
55a5d08378 Use a WORKING TS6 UID generator, adapted from InspIRCd source
Closes #21.
2015-06-19 10:43:42 -07:00
James Lu
93b1a11651 How on earth does this uid generator even work? It badly needs a rewrite... 2015-06-16 21:02:38 -07:00
James Lu
f7244ee6b7 Add basic nick and channel checking (ref #20) 2015-06-16 20:46:01 -07:00
James Lu
f40cb7954a Allow dynamic protocol loading again, and make proto an attribute of Irc()
This should remove the need for plugins, etc. to import proto directly,
which wouldn't work because of dynamic naming.
2015-06-16 20:05:41 -07:00
James Lu
4d763288e5 rename utils._nicktoUid to utils.nickToUid
Consistency in function capitalization is a good thing!!
2015-06-07 19:36:21 -07:00
James Lu
43a46d3d99 Many fixes
- Move _nicktoUid to utils.py
- Make _sendFromUser arguments more consistent (irc, sendfrom, message) instead of (irc, message, sendfrom=None)
- Add admin only kickclient, partclient, and nickclient commands
- proto.joinClient: take UIDs instead of an IrcUser object, in order to be more consistent

Closes #4, Closes #12.
2015-06-07 19:31:56 -07:00
James Lu
8bbf4ba387 Merge branch 'wip/admin-commands' 2015-06-07 18:15:52 -07:00
James Lu
f99000f492 Add internal functions for psuedoclient kick, quit, and nick 2015-06-07 18:15:36 -07:00
James Lu
46095574be proto.py: add kill handler & autorejoin on kick/kill
Closes #19.
2015-06-07 18:08:49 -07:00
James Lu
38df372471 main.py: catch ImportError nicely 2015-06-07 17:04:23 -07:00
James Lu
86c7fd0db1 WIP admin commands 2015-06-07 13:40:18 -07:00
James Lu
36a93320d7 Oops, we need kick handling too! 2015-06-07 10:06:54 -07:00
James Lu
70480b8830 Make IrcChannel.users a set and add part handling
This should be everything needed for basic channel enumeration: closes #13.
2015-06-07 09:43:13 -07:00
James Lu
4b9e7b1937 Fix #17 (netsplit quits)
copy() all the things! Also purge empty channels on quit.
2015-06-07 09:33:35 -07:00
James Lu
6680942424 More code and broken shenanigans
- plugins/commands.py: add admin-only eval command
- add IrcChannel class and basic channel (FJOIN/QUIT) handling
- Move SQUIT/QUIT handling code to a shared removeClient function
    - Unfortunately, this causes a regression where the users and channels indexes aren't purged on a netsplit :(
2015-06-06 23:06:33 -07:00
James Lu
c33d5922c6 Turn spawn pseudoclient and JOIN into its own functions, and move IrcUser/IrcServer to its own module
These classes are protocol independent, so we may as well split them for future protocol modules.
2015-06-06 22:17:45 -07:00
James Lu
a0babeddcd Update README.md, with artwork from @Erenzie 2015-06-06 14:23:20 -07:00
James Lu
0ed1e13115 Remove plugins/hello.py
This was solely a testing module for the plugin/commands system, and serves no purpose anymore. commands.py provides basic commands that are both simple and actually useful.
2015-06-03 16:09:53 -07:00
James Lu
2e94e9a7d2 Allow multiple autojoin channels 2015-06-03 15:47:29 -07:00
James Lu
38bd58f7ff Actually check recvpass field (Closes #9) 2015-06-02 16:55:04 -07:00
James Lu
955ffbd012 Handle /whois replies for pseudoclient (IDLE server command) 2015-06-02 16:39:13 -07:00
James Lu
cac0f106aa config.yml.example: load commands.py by default 2015-06-02 13:37:35 -07:00
James Lu
d9db7e1b9e It's almost June! Updates:
- Move config handling into separate module
- Implement identify and status commands, currently only supporting the admin account defined in the config. Closes #1.
- Move proto.add_cmd to utils.py, rename _msg() to msg()
- Allow sending the command name as an optional argument in add_cmd
- Add catch-all exception handling in plugins to prevent them from crashing the program!
2015-05-31 12:20:09 -07:00
James Lu
0e53a0fee4 Also count ourselves in server enumeration 2015-05-30 23:31:22 -07:00
James Lu
0fcf5ead04 utils.py: Make _msg a shared function (Closes #3) 2015-05-30 23:00:39 -07:00
James Lu
4ead81a66f remove unneeded imports 2015-05-30 22:35:31 -07:00
James Lu
17fc05cc9a WIP: use a proper logging module 2015-05-30 22:35:00 -07:00
James Lu
d158143cea This month's code dump... featuring:
- Server enumeration, with handlers for BURST (introduction to uplink), SERVER (introduction of uplink's other leaf servers), NICK, and SQUIT (closes #2)
- Store UIDs instead of nicks in the user database - this makes the protocol a lot easier to work with.
2015-05-30 22:15:19 -07:00
James Lu
f2fdaf55a1 commands: add a command to print debug info to console 2015-04-24 23:04:33 -07:00