Commit Graph

53 Commits

Author SHA1 Message Date
CPunch 7ec814525c minor refactoring 2022-09-29 16:36:19 -05:00
CPunch 6ab280d010 lsocket.[ch]: refactored writeInt && readInt
- switched to laikaS_readu* && laikaS_writeu*
- this gets rid of the ugly malloc() for platforms that don't support VLAs
2022-09-07 17:53:49 -05:00
CPunch b23057b219 Refactoring: reorganized files 2022-09-01 20:00:37 -05:00
CPunch 44086f563b cnc: migrate to new vector API 2022-09-01 19:12:13 -05:00
CPunch af09e74263 lmem.h: new laikaM_*Vector macros
- these will slowly replace laikaM_*array
- lpeer.[ch] has been migrated
2022-09-01 18:47:29 -05:00
CPunch 3034c3bd8b minor refactoring, only call laikaT_getTime() once 2022-08-03 15:39:15 -05:00
CPunch 770e34463e CNC: use laikaC_iterPeersNext for sweepPeersTask 2022-08-03 15:20:00 -05:00
CPunch 68f8e80c75 laikaC_iterPeers now uses hashmap_iter
TODO:
- refactor codebase to use laikaC_iterPeersNext instead of laikaC_iterPeers where appropriate
2022-08-02 11:22:06 -05:00
CPunch 18a6fdd124 Lib: Variadic packets now use the 'size' field as a minimum requirement 2022-06-30 20:19:35 -05:00
CPunch bc071c10d2 Lib: added PEER_PEER type for uninitalized peers
- defined LAIKA_PING_INTERVAL for the ping task
2022-06-30 20:19:35 -05:00
CPunch 8092a636ca CNC, Lib, Bot, Shell: New 2nd stage handshake
- New packet, LAIKAPKT_PEER_LOGIN_REQ
- All peers must prove they have access to the sent pubkey by passing a challenge. A salt is now sent on the handshake response packet, which must be encrypted and sent back through the PEER_LOGIN packet
- Protcol minor version incremented to 0.4
2022-06-30 20:19:35 -05:00
CPunch 48fa8935c3 Added .clang-format, formatted codebase 2022-06-27 18:57:00 -05:00
CPunch 1d6ce15b3d Minor comments refactoring 2022-06-27 18:20:23 -05:00
CPunch c4c5bc9ce5 Lib: Added support for IPV6 connections 2022-06-04 10:11:28 -05:00
CPunch 0fdca35f87 Shell: minor refactoring, cnc supports mutiple shells per auth clients
- while cnc supports multiple shells per auth client, the LaikaShell still only supports 1 concurrent shell at a time.
	this feature is just preparing boilerplate for future features. shell treats all SHELL_* packets for the same shell, regardless of shellID
2022-05-20 14:10:53 -05:00
CPunch 7d96f3252c Major shell packet refactoring
- can now open multiple shells per peer (change LAIKA_MAX_SHELLS)
- more sanity checking for public keys (new peers with duplicate keys are killed
- misc. refactoring, added cnc/cpeer.[ch]
2022-05-07 20:09:42 -05:00
CPunch c3c42e298f Windows: use COMSPEC environment variable to grab the shell
- shells on windows are now opened from the COMSPEC env variable
- cnc will now ignore malformed shell packets from bots instead of killing them
2022-04-20 10:10:44 -05:00
CPunch dac99ddd85 Bot: Only run shell task when shell is open
- since the shell task is only ran when the shell is open, i decreased the delta to 50ms. this should improve latancy while improving performance for 99% of the time. yay!
2022-04-14 12:11:29 -05:00
CPunch 9694ae67d8 Added LAIKAPKT_PINGPONG
- shell now has it's own task service, it's polled in shellC_poll()
- default timeout for peers is 60 seconds, to change this edit the LAIKA_PEER_TIMEOUT in cnc.h
2022-04-13 12:19:06 -05:00
CPunch e228c98c80 Added config inis, key refactoring
- CNC can accept multiple different auth keys now
- laikaK_checkAuth() added
- shell defaults to using shell.ini config file
- CNC doesn't require a config file however it's highly recommended
2022-04-05 23:57:37 -05:00
CPunch 3515d10b1c Minor refactoring 2022-04-01 14:10:06 -05:00
CPunch 4594e6194b Removed redundant packets 2022-03-28 20:28:39 -05:00
CPunch a4dc723e15 Added Tunnel & Tunnel Connection boilerplate to lib 2022-03-28 15:49:50 -05:00
CPunch 7baced7b8f Refactored polling, lpolllist.c now handles poll events & flushes the poll queue
- Sockets now have event callbacks, onPollIn, onPollOut & onPollFail. If these are set to NULL they're ignored
2022-03-24 10:26:06 -05:00
CPunch 30f7ffb73b Added lsodium.c, laikaK_loadKeys, laikaK_genKeys 2022-03-21 15:24:05 -05:00
CPunch 6f60c7a5b7 Added OSTYPE, added OS info to handshake & peer-related packets 2022-03-17 23:05:18 -05:00
CPunch e1ce053aa8 Added termsize 'cols & rows' to SHELL_OPEN packets 2022-03-07 15:16:46 -06:00
CPunch 0c2d4968d9 Refactored LAIKAPKT_HANDSHAKE_REQ, laikaS_acceptFrom
- added inet member to peer structs
2022-03-04 20:17:03 -06:00
CPunch e6dbada6ec Handled edgecase of shell peer disconnecting
- minor refactor of shell client, added shellC_isShellOpen()
2022-03-03 10:28:43 -06:00
CPunch 8ab3033bf3 Added 'shell' command to LaikaShell
- another major refactoring
2022-03-02 10:38:16 -06:00
CPunch 8438378560 Major refactoring
lots and lots of changes. too many to list tbh, might rebase this commit later if i get bored enough.
2022-02-28 16:27:55 -06:00
CPunch c092d5a9a0 Deprecated panel, added shell, lrsa.h -> lsodium.h
- Refactoring
2022-02-24 22:13:05 -06:00
CPunch 5c31fb861b Added LAIKAPKT_SHELL_*, fixed variadic packets
- added bot/shell.[ch]
- simple demo cnc which runs 'ls -a' on the connect peer
2022-02-21 17:25:49 -06:00
CPunch c21be8dfee Added hostname, ip info to handshake
- Panel now lists bots by hostname & ip instead of public key
2022-02-15 16:57:21 -06:00
CPunch fb71dfb3c3 Added panel!
- minor refactoring
- TODO: panel & cnc should really use unique keys. maybe add config file?
2022-02-14 00:22:36 -06:00
CPunch e7265ad15b Added laikaP_pushOutQueue, minor refactoring
- sLaika_pollList now holds an outQueue, if events are sent to a peer,
	the pollList will keep track so the caller (cnc, bot, etc)
	can handle each pollOut for the queued peers.
2022-02-13 23:55:30 -06:00
CPunch a442f2f493 Added cnc's panel list, minor refactoring of packets 2022-02-12 18:21:59 -06:00
CPunch 85d6cdcba1 refactored laikaS_*Packet functions, added debugging output 2022-02-03 20:51:32 -06:00
CPunch dd173ee422 Key exchange refactoring!
- LAIKAPKT_HANDSHAKE_REQ now only sends the bot's pub key
	a shared key is generated using the other peer's pub key,
	allowing for fully encrypted packet bodies, (packet ID is
	left in plain-text)
- laikaS_startOutPacket(), laikaS_endOutPacket(),
	laikaS_startInPacket() & laikaS_endInPacket() have been
	added.
- laikaS_setSecure() has been added to turn on/off encrypted packets.
- genKey now generates kx keypairs
- major refactoring for relevant packet handlers
- variadic packets have been temporarily disabled
2022-02-03 16:25:49 -06:00
CPunch 6d799a7532 Fixed poll() path in lpolllist.c, fixed laikaM_rmvarray() 2022-01-31 13:27:12 -06:00
CPunch 9291dbf823 added default peer::type, PEER_UNVERIFIED 2022-01-30 19:22:02 -06:00
CPunch 282516797e Minor lpeer refactoring
- Packets are now dispatched based on a packet function handler map which is passed to laikaS_newPeer()
2022-01-30 19:10:10 -06:00
CPunch 6fb8aa9b8a Refactored how CMake passes version & settings info
- keys can now be passed per-build passing -DLAIKA_PUBKEY=[pubkey] & -LAIKA_PRIVKEY=[pubkey] to `cmake -B`
- if those definitions aren't passed, the default public & private key will be used (for quick testing)
2022-01-30 01:15:51 -06:00
CPunch 56c6db1d62 Added laikaS_readENC laikaS_writeENC, minor refactoring 2022-01-29 00:26:15 -06:00
CPunch a023929190 Added key exchange to LAIKA_HANDSHAKE_*
- test keys are defined in laika.h
- bug fixes & refactoring with laikaM_growarray()
2022-01-27 19:55:28 -06:00
CPunch 203b5ce38f Added LibSodium, new tools/, genKey, sLaika_peer::type
- sLaika_peer has a new member, (PEERTYPE)type
- LibSodium dependency added
2022-01-27 13:36:36 -06:00
CPunch 22df7e3702 Added LAIKAPKT_VAR_REQ, enabling variable packets
- additional minor refactoring
2022-01-25 13:53:17 -06:00
CPunch 2a0e34dd5a Added LAIKAPKT_HANDSHAKE_REQ support to cnc.c
- minor refactoring
- fixed CMakeLists.txt for cnc & bot
2022-01-25 12:13:04 -06:00
CPunch 1bccc78117 First actual runnable version
- many warnings & bug fixes
- added bot/ source
2022-01-24 21:46:29 -06:00
CPunch 0dee6fe3fc Added new sLaika_peer member, 'uData'
- pktHandler was updated to pass 'uData'
2022-01-24 20:57:54 -06:00