mirror of
https://github.com/CPunch/Laika.git
synced 2025-09-29 05:00:04 +00:00
Added OSTYPE, added OS info to handshake & peer-related packets
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
#define LAIKA_MAX_PKTSIZE 4096
|
||||
|
||||
#define LAIKA_HOSTNAME_LEN 64
|
||||
#define LAIKA_IPV4_LEN 16
|
||||
#define LAIKA_INET_LEN 16
|
||||
#define LAIKA_IPV4_LEN 22
|
||||
#define LAIKA_INET_LEN 22
|
||||
|
||||
#define LAIKA_SHELL_DATA_MAX_LENGTH 256
|
||||
|
||||
@@ -44,6 +44,7 @@ enum {
|
||||
* uint8_t laikaMagic[LAIKA_MAGICLEN]; -- LAIKA_MAGIC
|
||||
* uint8_t majorVer;
|
||||
* uint8_t minorVer;
|
||||
* uint8_t osType;
|
||||
* uint8_t pubKey[crypto_kx_PUBLICKEYBYTES]; -- freshly generated pubKey to encrypt decrypted nonce with
|
||||
* char hostname[LAIKA_HOSTNAME_LEN]; -- can be empty (ie. all NULL bytes)
|
||||
* char inet[LAIKA_INET_LEN]; -- can be empty (ie. all NULL bytes)
|
||||
@@ -77,6 +78,7 @@ enum {
|
||||
* char inet[LAIKA_INET_LEN];
|
||||
* char ipv4[LAIKA_IPV4_LEN];
|
||||
* uint8_t peerType;
|
||||
* uint8_t osType;
|
||||
*/
|
||||
LAIKAPKT_AUTHENTICATED_RMV_PEER_RES, /* notification that a peer has disconnected from the cnc */
|
||||
/* layout of LAIKAPKT_AUTHENTICATED_RMV_PEER_RES
|
||||
|
@@ -8,12 +8,28 @@
|
||||
#include "lsodium.h"
|
||||
|
||||
typedef enum {
|
||||
PEER_UNVERIFIED,
|
||||
PEER_UNKNWN,
|
||||
PEER_BOT,
|
||||
PEER_CNC, /* cnc 2 cnc communication */
|
||||
PEER_AUTH /* authorized peers can send commands to cnc */
|
||||
} PEERTYPE;
|
||||
|
||||
typedef enum {
|
||||
OS_UNKNWN,
|
||||
OS_WIN,
|
||||
OS_LIN
|
||||
} OSTYPE;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define LAIKA_OSTYPE OS_WIN
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#define LAIKA_OSTYPE OS_LIN
|
||||
#else
|
||||
#define LAIKA_OSTYPE OS_UNKNWN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct sLaika_peer;
|
||||
typedef void (*PeerPktHandler)(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
|
||||
|
||||
@@ -37,6 +53,7 @@ struct sLaika_peer {
|
||||
LAIKAPKT_SIZE pktSize; /* current pkt size */
|
||||
LAIKAPKT_ID pktID; /* current pkt ID */
|
||||
PEERTYPE type;
|
||||
OSTYPE osType;
|
||||
int outStart; /* index of pktID for out packet */
|
||||
int inStart; /* index of pktID for in packet */
|
||||
bool setPollOut; /* is EPOLLOUT/POLLOUT is set on sock's pollfd ? */
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include <sys/epoll.h>
|
||||
/* max events for epoll() */
|
||||
#define MAX_EPOLL_EVENTS 128
|
||||
#define LAIKA_USE_EPOLL
|
||||
#define LAIKA_USE_EPOLL
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
Reference in New Issue
Block a user