当前位置:网站首页>1.赋值语句
1.赋值语句
2022-07-23 02:49:00 【小鸡岛~】
mov指令

C++代码
gi = 0x12345678;
汇编指令
mov dword ptr ds:[001202DCh],12345678h
机器指令
00115718 C7 05 DC 02 12 00 78 56 34 12
提出问题
- 内存00AB02DCh真的是gi的地址吗?
- mov指令真的存放在地址为00115718内存中吗?
发现规律
计算机上表示的整数在内存中是按字节倒序存储的
知识点:大小端存储方式(Intel计算机时小端机)
结论:指令就是一些字节的组合
提出问题:我们可以自己构建指令来执行呢?
#include <iostream>
#include <Windows.h>
int gi{
};
void* address;
void* buildCode();
int main() {
void* codeAdr = buildCode();
_asm mov address, offset _adr;
DWORD oldProtect{
};
VirtualProtect(codeAdr, 16, PAGE_EXECUTE_READWRITE, &oldProtect);
gi = 1;
printf("gi = %d\n", gi);
_asm jmp codeAdr;
gi = 13;
_adr:
printf("gi = %d\n", gi);
getchar();
}
void* buildCode()
{
char* code = (char*)malloc(16);
char* pMov = (char*)code;
char* pJmp = (char*)code + 10;
char* pAddress = pMov + 2;
//C7 05 B0 00 94 00 01 00 00 00
pMov[0] = 0xC7;
pMov[1] = 0x05;
*((int*)pAddress) = (int)&gi;
*((int*)(pAddress + 4)) = 2;
//FF 25 88 01 7B 00
pJmp[0] = 0xFF;
pJmp[1] = 0x25;
*((int*)(&pJmp[2])) = (int)&address;
return code;
}
边栏推荐
- 今天的码农女孩学习了关于node下的Express框架的知识
- 567. Arrangement of strings
- Is it safe for CITIC futures to open an account online and will it be cheated?
- Perlin 噪声与随机地形
- Several important problems of port completion
- MySQL数据库UDF提权学习
- How can a platform enterprise solve the business of ledger accounting?
- 并发编程中volatile面试总结
- PHP converts ASCII code to string, and string converts ASCII code
- Airiot Q & A issue 5 | how to use low code business flow engine?
猜你喜欢

本地提权的学习

Peptide nucleic acid coupled polypeptide ile Glu Gly Arg PNA (s-2222) | BOC Leu Gly Arg PNA

Technology sharing | big transaction blocking show master status

DigiCert代码签名证书

实现多层级条件查询(类似京东多层级添加查询)

亿级流量下的分布式锁优化方案!太好用了~

系统安全测试要怎么做,详细来说说

PNA PNA modified polypeptide bz- (DL) - Arg PNA | z-ala-ala-leu-pna | suc ala ala ala PNA

数组中的逆序对

面试官:解释一下ThreadLocal 核心原理
随机推荐
A convnet for the 2020s paper reading
隐藏网站服务器响应头中 PHP 版本信息
[learning notes] node -- from 0 foundation to actual enterprise official website
ACM SIGIR 2022 | 美团技术团队精选论文解读
海通证券场内基金开户怎么样安全吗
毕业1年,放弃实习机会,在家自学软件测试,同学实习刚结束,我已成月薪12k测试工程师
Visual full link log tracking
ES6 related interview question 3
目前都有哪些年利率6%左右的保本理财产品?
PHP RSA generates public key and private key PSA2 encryption and decryption
How to deal with the computer pressing keys all the time
Matplotlib保存图片到文件
【Node基础入门】----node中间层做接口转发,实现跨域请求
C——结构体
Hfish蜜罐的搭建与测试
南京银行提前批金融科技岗
Tsinghua, air, Tencent | 3D isovariant molecular map pre training
seatunnel 架构
解密 Redis 助力双 11 背后电商秒杀系统
用现代化的开发方法和思维,打跑遗留系统“拦路虎”