不用虚拟机,使用windows调试linux内核

1.安装msys2

https://www.msys2.org/

2.打开msys2 ucrt64安装qemu和gdb还有gef

pacman -S mingw-w64-ucrt-x86_64-qemu

pacman -S gdb

pacman -S binutils

用下面的脚本安装gef

bash 复制代码
#!/usr/bin/env bash

set -e

# check dependencies
if [ ! "$(command -v python3)" ]; then
	echo "GEF requires Python3 installed."
	exit 1
fi

# Backup gdbinit if any
if [ -f "${HOME}/.gdbinit" ]; then
    mv "${HOME}/.gdbinit" "${HOME}/.gdbinit.old"
fi

tag=$(python3  -X utf8 -c 'import urllib.request as r,json as j; x=j.loads(r.urlopen("https://api.github.com/repos/hugsy/gef/tags").read()); print(x[0]["name"])')
python3 -X utf8 -c "import urllib.request as r; x=r.urlopen('https://github.com/hugsy/gef/raw/${tag}/gef.py').read(); print(x.decode('utf-8'))" > ${HOME}/.gef-${tag}.py

if [ -f "${HOME}/.gef-${tag}.py" ]; then
    echo "source ~/.gef-${tag}.py" > ~/.gdbinit
    exit 0
else
    echo "GEF was not properly downloaded"
    exit 2
fi

官方版本里面缺少-X utf8会出错。

3.去github下载一键包,如:

https://github.com/bsauce/kernel-exploit-factory/tree/main/CVE-2017-11176

注意start.sh里面的-enable-kvm要去掉,因为windows不支持。

4.在msys2 ucrt64里面运行start.sh

5.打开另一个窗口,运行gdb_kernel.sh

相关推荐
木心月转码ing3 小时前
WSL+Cpp开发环境配置
linux
蝎子莱莱爱打怪1 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
埃博拉酱1 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
崔小汤呀1 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应1 天前
vi编辑器使用
linux·后端·操作系统
何中应1 天前
Linux进程无法被kill
linux·后端·操作系统
何中应1 天前
rm-rf /命令操作介绍
linux·后端·操作系统
何中应1 天前
Linux常用命令
linux·操作系统
葛立国1 天前
从 / 和 /dev 说起:Linux 文件系统与挂载点一文理清
linux
唐宋元明清21882 天前
.NET 本地Db数据库-技术方案选型
windows·c#