42 static const char d32[] =
"[\\]^_`abcd$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$efghijklmnopqrstuvwxyz{|}~";
44 static const ut64 pow36[] = { 1, 36, 1296, 46656, 1679616, 60466176, 2176782336,
45 78364164096, 2821109907456, 101559956668416, 3656158440062976,
46 131621703842267136, 4738381338321616896 };
54 eprintf(
"Error: base36_decode supports up to 64-bit values only\n");
57 for (
i = 0;
i <
len;
i++) {
60 if (c < '0' || c >
'z' || (
'9' <
c &&
c <
'a')) {
61 eprintf(
"Error: %s is not a valid base36 encoded string\n",
str);
67 eprintf(
"Error: %s is not a valid base36 encoded string\n",
str);
74 printf(
"Error: base36_decode supports up to 64-bit values only\n");
126 char *port = strchr(host,
':');
133 char *
key = strchr(port,
':');
143 for (
i = 0;
i < 4 &&
key;
key = nkey,
i++) {
144 nkey = strchr(
key,
'.');
152 for (
i = 0;
i < 32;
i++) {
244 ut8 padsize = -(
size + 8) & 0x0F;
287 if (!
_encrypt(obj, encbuf +
sizeof(kdnet_packet_t), encsize -
sizeof(kdnet_packet_t),
type)) {
370 memcpy(resbuf + 2, pokedata + 10, 32);
372 for (
i = 0;
i < 32;
i++) {
374 resbuf[
i + 34] = rand & 0xFF;
406 if ((kdnetdata & 0x80) != 0) {
407 eprintf(
"Error: KdNet wrong direction flag\n");
413 eprintf(
"Error: KdNet sending the response packet\n");
441 kdnet_packet_t pkt = { 0 };
449 if (errno ==
EINTR) {
458 eprintf(
"Error: KdNet bad magic\n");
469 eprintf(
"Error: KdNet failed authentication\n");
477 eprintf(
"Error: KdNet failed to process Control packet\n");
499 eprintf(
"Error: KdNet out-of-bounds read\n");
520 static ut64 seqno = 1;
524 if (
count ==
sizeof(kd_packet_t)) {
528 obj->
write_size =
sizeof(kd_packet_t) + pkt.length;
RZ_API bool rz_crypto_set_iv(RzCrypto *cry, const ut8 *iv, int ivlen)
RZ_API int rz_crypto_final(RzCrypto *cry, const ut8 *buf, int len)
RZ_API const ut8 * rz_crypto_get_output(RzCrypto *cry, int *size)
RZ_API bool rz_crypto_set_key(RzCrypto *cry, const ut8 *key, int keylen, int mode, int direction)
RZ_API void rz_crypto_free(RzCrypto *cry)
RZ_API RzCrypto * rz_crypto_new(void)
RZ_API bool rz_crypto_use(RzCrypto *cry, const char *algo)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API RZ_BORROW const ut8 * rz_hash_cfg_get_result(RZ_NONNULL RzHashCfg *md, RZ_NONNULL const char *name, RZ_NONNULL ut32 *size)
Returns the digest value of the requested algorithm name.
RZ_API void rz_hash_cfg_free(RZ_NONNULL RzHashCfg *md)
RZ_API void rz_hash_free(RzHash *rh)
RZ_API RzHash * rz_hash_new(void)
RZ_API RZ_OWN RzHashCfg * rz_hash_cfg_new_with_algo(RZ_NONNULL RzHash *rh, RZ_NONNULL const char *name, RZ_NULLABLE const ut8 *key, ut64 key_size)
Returns a message digest context with the give algo already configured.
RZ_API bool rz_hash_cfg_update(RZ_NONNULL RzHashCfg *md, RZ_NONNULL const ut8 *data, ut64 size)
Inserts data into each the message digest contextes.
RZ_API bool rz_hash_cfg_final(RZ_NONNULL RzHashCfg *md)
Generates the final value of the message digest contextes.
RZ_API void Ht_() free(HtName_(Ht) *ht)
static const ut64 pow36[]
static bool _initializeDatakey(iobnet_t *obj, ut8 *resbuf, int size)
static bool _processControlPacket(iobnet_t *obj, const ut8 *ctrlbuf, int size)
static int iob_net_write(void *p, const uint8_t *buf, const uint64_t count, const int timeout)
bool _verifyhmac(iobnet_t *obj)
static void * iob_net_open(const char *path)
static bool _decrypt(iobnet_t *obj, ut8 *buf, int size, int type)
static int iob_net_read(void *p, uint8_t *obuf, const uint64_t count, const int timeout)
static bool iob_net_close(void *p)
static ut8 * _createKDNetPacket(iobnet_t *obj, const ut8 *buf, int size, int *osize, ut64 seqno, ut8 type)
static bool _encrypt(iobnet_t *obj, ut8 *buf, int size, int type)
static bool _sendResponsePacket(iobnet_t *obj, const ut8 *pokedata)
static ut64 base36_decode(const char *str)
#define KDNET_HMACKEY_SIZE
#define KDNET_PACKET_TYPE_DATA
#define KDNET_PACKET_TYPE_CONTROL
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
static ut64 rz_read_be64(const void *src)
static void rz_write_at_be8(void *dest, ut8 val, size_t offset)
static ut64 rz_read_at_be64(const void *src, size_t offset)
static void rz_write_le64(void *dest, ut64 val)
static void rz_write_at_be32(void *dest, ut32 val, size_t offset)
static void rz_write_at_be64(void *dest, ut64 val, size_t offset)
static ut32 rz_read_be32(const void *src)
static ut16 rz_read_at_be16(const void *src, size_t offset)
RZ_API int rz_num_rand(int max)
RZ_API int rz_socket_close(RzSocket *s)
RZ_API void RZ_API int rz_socket_read(RzSocket *s, ut8 *read, int len)
RZ_API RzSocket * rz_socket_new(bool is_ssl)
RZ_API int rz_socket_free(RzSocket *s)
#define rz_socket_connect_udp(a, b, c, d)
RZ_API int rz_socket_write(RzSocket *s, void *buf, int len)
#define RZ_STR_ISEMPTY(x)
#define UT64_ADD_OVFCHK(x, y)
ut8 hmackey[KDNET_HMACKEY_SIZE]
RZ_API void rz_th_lock_leave(RZ_NONNULL RzThreadLock *thl)
Releases a RzThreadLock structure.
RZ_API RZ_OWN RzThreadLock * rz_th_lock_new(bool recursive)
Allocates and initialize a RzThreadLock structure.
RZ_API void rz_th_lock_enter(RZ_NONNULL RzThreadLock *thl)
Acquires a RzThreadLock structure.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static unsigned char * obuf