使用到的环境
clion:2022.1.2
ndk
ADB
配置Toolchains
根据图片里面的文件夹路径,把自己NDK对应的make.exe clang.exe clang++.exe配置上去
配置CMake的配置文件
如图,clion的CMake的配置文件填写方式
编写代码
CMakeList.txt
#include "HttpReq.h"
#include <string.h>
#include "MemoryTools.h"
void sendPostMessage(){
HttpRequest* Http;
char http_return[4096] = {0};
char http_msg[4096] = {0};
strcpy(http_msg, "http://192.168.8.103:8080/postCppMessage");
std::cout << http_msg << std::endl;
const char *json = R"({"message":"hello world"})";
// 打印*json
std::cout <<"json"<< json << std::endl;
if(Http->HttpPost(http_msg,json, http_return)){
std::cout << http_return << std::endl;
}
}
/*
void sendGetMessage(std::string message){
HttpRequest* Http;
char http_return[4096] = {0};
char http_msg[4096] = {0};
std::string url = "http://192.168.8.103:8080/getCppMessage?message=" + message;
strcpy(http_msg, url.c_str());
std::cout << http_msg << std::endl;
if(Http->HttpGet(http_msg, http_return)){
std::cout << http_return << std::endl;
}
}*/
int main(void)
{
int gs;
killGG();
PACKAGENAME *bm="com.carrot.iceworld";
BypassGameSafe();
SetSearchRange(C_ALLOC);//设置C_ALLOC
SetTextColor(COLOR_SKY_BLUE);//设置文字颜色
//搜索
MemorySearch(bm,"1135869952",&gs,DWORD);//搜索内存
MemoryOffset(bm,"1071120384",-4,&gs,DWORD);//搜索内存
MemoryOffset(bm,"1071120384",-8,&gs,DWORD);//搜索内存
MemoryOffset(bm,"1142947840",-12,&gs,DWORD);//搜索内存
PMAPS result=GetResults();//获取搜索结果
ADDRESS realAddress= result->addr+104;//获取真实地址
ClearResults();
//
// 一直循环打印直到按下ESC键
while (true) {
void *aaa=SearchAddress(bm,realAddress);//搜索地址;
int num=*(int *)aaa;
printf("%d\n",num);
}
return 0;
}
ADB传输文件
把编译好的文件传输过去就可以在手机上进行操作了
使用adb shell 获取手机的shell进行操作
在执行命令之前需要注意一些事项:
1、不要把文件放在Sdcard文件夹里面,android有一个规范好像,不允许Sdcard里面的二进制文件单独运行,不过你可以使用MT管理器打开,再用linux脚本命令的形式强制运行,但是很麻烦。
2、使用之前先chmod 777 把权限给全
语雀:https://www.yuque.com/docs/share/a4d03cb4-a7d6-4dd8-b1d6-531c1a497a92?# 《拒绝C4ndroid使用clion进行android CPP编程》