From 5f6f3bcf50405312c56b84b6ed408a59dba266d5 Mon Sep 17 00:00:00 2001 From: Naim A <227396+naim94a@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:24:39 +0000 Subject: [PATCH] initial ida 8.3 support --- common/src/rpc/messages.rs | 11 +++++++++++ common/src/rpc/mod.rs | 4 ++++ lumen/src/main.rs | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/common/src/rpc/messages.rs b/common/src/rpc/messages.rs index d45cbf3..20da2c0 100644 --- a/common/src/rpc/messages.rs +++ b/common/src/rpc/messages.rs @@ -105,3 +105,14 @@ pub struct DelHistory<'a> { pub struct DelHistoryResult { pub deleted_mds: u32, } + +#[derive(Debug, Deserialize, Serialize)] +pub struct HelloResult<'a> { + pub unk0: Cow<'a, str>, + pub unk1: Cow<'a, str>, + pub unk2: Cow<'a, str>, + pub unk3: Cow<'a, str>, + pub unk4: u32, + pub unk5: u64, + pub unk6: u32, +} diff --git a/common/src/rpc/mod.rs b/common/src/rpc/mod.rs index 826162d..25a6b7b 100644 --- a/common/src/rpc/mod.rs +++ b/common/src/rpc/mod.rs @@ -118,6 +118,7 @@ pub enum RpcMessage<'a> { PushMetadataResult(PushMetadataResult<'a>), DelHistory(DelHistory<'a>), DelHistoryResult(DelHistoryResult), + HelloResult(HelloResult<'a>), } impl<'a> serde::Serialize for RpcMessage<'a> { @@ -141,6 +142,7 @@ impl<'a> serde::Serialize for RpcMessage<'a> { RpcMessage::PushMetadataResult(msg) => tuple.serialize_element(msg)?, RpcMessage::DelHistory(msg) => tuple.serialize_element(msg)?, RpcMessage::DelHistoryResult(msg) => tuple.serialize_element(msg)?, + RpcMessage::HelloResult(msg) => tuple.serialize_element(msg)?, } tuple.end() @@ -193,6 +195,7 @@ impl<'a> RpcMessage<'a> { 0x11 => RpcMessage::PushMetadataResult(Self::deserialize_check(payload)?), 0x18 => RpcMessage::DelHistory(Self::deserialize_check(payload)?), 0x19 => RpcMessage::DelHistoryResult(Self::deserialize_check(payload)?), + 0x31 => RpcMessage::HelloResult(Self::deserialize_check(payload)?), _ => { trace!("got invalid message type '{:02x}'", msg_type); return Err(Error::InvalidData); @@ -225,6 +228,7 @@ impl<'a> RpcMessage<'a> { PushMetadataResult(_) => 0x11, DelHistory(_) => 0x18, DelHistoryResult(_) => 0x19, + HelloResult(_) => 0x31, } } } diff --git a/lumen/src/main.rs b/lumen/src/main.rs index f629262..239cd6c 100644 --- a/lumen/src/main.rs +++ b/lumen/src/main.rs @@ -5,7 +5,7 @@ #![deny(clippy::all)] use common::async_drop::AsyncDropper; -use common::rpc::{RpcHello, RpcFail}; +use common::rpc::{RpcHello, RpcFail, HelloResult}; use native_tls::Identity; use clap::Arg; use log::*; @@ -199,7 +199,20 @@ async fn handle_client(state: &SharedState, m } } - let resp = rpc::RpcMessage::Ok(()); + let resp = match hello.protocol_version { + 0..=4 => rpc::RpcMessage::Ok(()), + + // starting IDA 8.3 + 5.. => rpc::RpcMessage::HelloResult(HelloResult { + unk0: "".into(), + unk1: "".into(), + unk2: "".into(), + unk3: "".into(), + unk4: 0, + unk5: 0, + unk6: 0, + }) + }; resp.async_write(&mut stream).await?; loop {