每次写pwn题的时候都要去打开虚拟机,感觉非常的麻烦而且很不方便,然后我就发现了win10下的终端神器——windows terminal

在win10商店可以直接免费下载。

通常我们打开的cmd和powershell看起来都比较low而且命令比较少,对于玩惯了linux系统的pwn选手来说非常的不友好,使用起来非常难受,而terminal做到了powershell、cmd、ubuntu的集成,就是可以在terminal同时打开这三个东西而不发生冲突,而且堆terminal进行魔改,工欲善其事必先利其器,一个看起来特别酷而且方便的东西你肯定也很想去使用它。(关于terminal的美化我这里介绍的很少,达不到你的期望可以去百度)

可以看到这和原始的powershell相比炫酷吊炸天,而且win10自带的powshell版本比较老,功能也少,可以直接去下载比较新的powershell使用:https://github.com/PowerShell/PowerShell

(powershell支持大部分平台)

关于powershell的插件:

# 1. 安装 PSReadline 包,该插件可以让命令行很好用,类似 zsh
Install-Module -Name PSReadLine -AllowPrerelease -Force

# 2. 安装 posh-git 包,让你的 git 更好用
Install-Module posh-git -Scope CurrentUser

# 3. 安装 oh-my-posh 包,让你的命令行更酷炫、优雅
Install-Module oh-my-posh -Scope CurrentUser

然后就是关于如何利用ternimal搭建pwn环境,win10下建议同时安装python2_x64和python3_x64两种版本,为了区别在powershell使用不同的python,可以将python2包中的python.exe和pythonw.exe修改为python2.exe和pythonw2.exe然后将python包的路径添加到环境变量path中即可。

首先是下载ubuntu,有不同的版本可以选择,可以在win10商店下载但是默认下载到c盘比较占空间,还有一个方法:

下载安装包,扩展名改为zip,然后解压到你想放的地方,打开ubuntu.exe安装。

https://docs.microsoft.com/en-us/windows/wsl/install-manual

这是我安装后的ubuntu(我没有设置用户和密码所以使用的时候默认root权限)

然后就是一步步安装python3、pip3、pwntools、pwndbg、git等等你你所需要的东西。

这里要说的是尽量不再使用python2,官方已经说明了对python2不再进行维护和更新,而且python2差不多完全已经被python3所代替了。

apt换源:

#备份sources.list文件
cp /etc/apt/sources.list /etc/apt/sources.list.bak
#编辑文件,不存在就新建一个
sudo vim /etc/apt/sources.list
#这里是清华源,根据不同版本自行选择(把里边的内容添加到文件最后就行了)
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
#更新源
sudo apt-get update

python3:

sudo apt install python3

pip3:

sudo apt-get install python3-pip
#更新pip(有时候会报错就把第一个pip改为pip3就行了)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
#换清华源(这里有非常大的可能出现报错,是python的一个bug,官方已经指出)
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
#报错解决办法:从下面的网址下载文件
https://bootstrap.pypa.io/get-pip.py
#执行命令
python get-pip.py或者python3 get-pip.py
#然后再输入换源的命令就成功了
#更新源
pip3 install --upgrade pip或者pip install --upgrade pip

pwntools:

sudo pip3 install pwntools或者sudo pip install pwntools

pwndbg:

#没有git的需要下载git
git clone https://gitee.com/tordan/pwndbg.git
cd pwndbg
./setup.sh

one_gadget:

#这里我建议使用我的方法,ubuntu自带的ruby版本非常低,无法支持one_gadget的使用
#第一种是下载安装包手动安装,我把好几个版本都尝试了没有成功(无聊的可以试试)
http://www.ruby-lang.org/en/downloads/
#第二种方法
#如果你没有听我的使用的是ubuntu自带的命令下载的,看一下版本,如果>2.4那么恭喜你,可以使用one_gadget,如果版本低,那么跟着我输入命令
ruby -v
#添加仓库
sudo add-apt-repository ppa:brightbox/ruby-ng
sudo apt-get update
#删除低版本的 ruby:
sudo apt-get purge --auto-remove ruby
#安装 ruby-2.6/ruby-2.7 版本:(这里我也进行了尝试,可以下载ruby2.7和ruby2.6但是仓库是没有ruby3.0的)
sudo apt-get install ruby2.6 ruby2.6-dev
sudo apt-get install ruby2.7 ruby2.7-dev
#安装one_gadget
sudo gem install one_gadget

LibcSearcher:

git clone https://gitee.com/tordan/LibcSearcher.git
cd LibcSearcher
python setup.py develop/python3 setup.py develop

peda:

git clone https://github.com/longld/peda.git ~/peda
echo "source ~/peda/peda.py" >> ~/.gdbinit
echo "DONE! debug your program with gdb and enjoy

pwn_debug:(dl_runtime_reslove神器)

git clone https://gitee.com/tordan/pwn_debug.git
cd pwn_debug
sudo python setup.py install
# or python setup.py install --user
./build.sh

效果图:

当然,如果你有git bash和kali等等其他好玩的东西也可以放到terminal上面比较方便,有一说一,terminal是真⑧错啊!!!

我的terminal美化:(点击terminal界面的设置打开一个settings.json,我直接贴出我的文件)

github上面有很多主题:

schemes:

https://github.com/mbadolato/iTerm2-Color-Schemes

字体:

https://github.com/be5invis/Iosevka

安装个性化字体,支持特殊符号:

https://github.com/adam7/delugia-code

// This file was initially generated by Windows Terminal 1.5.10411.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",

"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings

// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,

// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,

// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "pwsh",
"source": "Windows.Terminal.PowershellCore",
"commandline": "C:/Program Files/PowerShell/7/pwsh.exe -nologo",
"startingDirectory": ".",
// 启动菜单一定要设置为 <.>,否则后面重要的一步将会无效!
"startingDirectory": ".",
"acrylicOpacity": 0.75,
"backgroundImage": "C:/Users/13972/Pictures/Saved Pictures/14.jpg", //背景图片
"backgroundImageOpacity": 0.6, //背景透明度
// 字体
"fontFace": "Fira Code",
"fontSize": 11,
"historySize": 9001,
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"useAcrylic": true,
"startingDirectory": "D:"
// 颜色
// "colorScheme": "Solarized Dark",
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{1c4de342-38b7-51cf-b940-2309a097f589}",
"hidden": false,
"name": "git-bash",
"commandline": "D:/javaee/代码管理工具Git/Git/bin/bash.exe",
"useAcrylic": true,
"backgroundImage": "C:/Users/13972/Pictures/Saved Pictures/14.jpg", //背景图片
"fontFace": "Fira Code",
"fontSize": 11,
"historySize": 9001,
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"useAcrylic": true,
"backgroundImageOpacity": 0.6, //背景透明度
"startingDirectory": "D:"

},
{
"guid": "{6f9994f0-4403-5e85-9cce-98e5da3839bb}",
"hidden": false,
"name": "Ubuntu-16.04",
"source": "Windows.Terminal.Wsl",
"useAcrylic": true,
"backgroundImageOpacity": 0.6, //背景透明度
"backgroundImage": "C:/Users/13972/Pictures/Saved Pictures/14.jpg"//背景图片
},
]
},

// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
//将我们所有的主题配色在这里写好,我们会在前面用到
"schemes": [
{
"name": "Frost",
"background": "#FFFFFF",
"black": "#3C5712",
"blue": "#17b2ff",
"brightBlack": "#749B36",
"brightBlue": "#27B2F6",
"brightCyan": "#13A8C0",
"brightGreen": "#89AF50",
"brightPurple": "#F2A20A",
"brightRed": "#F49B36",
"brightWhite": "#741274",
"brightYellow": "#991070",
"cyan": "#3C96A6",
"foreground": "#000000",
"green": "#6AAE08",
"purple": "#991070",
"red": "#8D0C0C",
"white": "#6E386E",
"yellow": "#991070"
},
{
"name": "Campbell",
"foreground": "#CCCCCC",
"background": "#0C0C0C",
"cursorColor": "#FFFFFF",
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",
"yellow": "#C19C00",
"blue": "#0037DA",
"purple": "#881798",
"cyan": "#3A96DD",
"white": "#CCCCCC",
"brightBlack": "#767676",
"brightRed": "#E74856",
"brightGreen": "#16C60C",
"brightYellow": "#F9F1A5",
"brightBlue": "#3B78FF",
"brightPurple": "#B4009E",
"brightCyan": "#61D6D6",
"brightWhite": "#F2F2F2"
},
{
"name": "Campbell Powershell",
"foreground": "#CCCCCC",
"background": "#012456",
"cursorColor": "#FFFFFF",
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",
"yellow": "#C19C00",
"blue": "#0037DA",
"purple": "#881798",
"cyan": "#3A96DD",
"white": "#CCCCCC",
"brightBlack": "#767676",
"brightRed": "#E74856",
"brightGreen": "#16C60C",
"brightYellow": "#F9F1A5",
"brightBlue": "#3B78FF",
"brightPurple": "#B4009E",
"brightCyan": "#61D6D6",
"brightWhite": "#F2F2F2"
},
{
"name": "Vintage",
"foreground": "#C0C0C0",
"background": "#000000",
"cursorColor": "#FFFFFF",
"black": "#000000",
"red": "#800000",
"green": "#008000",
"yellow": "#808000",
"blue": "#000080",
"purple": "#800080",
"cyan": "#008080",
"white": "#C0C0C0",
"brightBlack": "#808080",
"brightRed": "#FF0000",
"brightGreen": "#00FF00",
"brightYellow": "#FFFF00",
"brightBlue": "#0000FF",
"brightPurple": "#FF00FF",
"brightCyan": "#00FFFF",
"brightWhite": "#FFFFFF"
},
{
"name": "One Half Dark",
"foreground": "#DCDFE4",
"background": "#282C34",
"cursorColor": "#FFFFFF",
"black": "#282C34",
"red": "#E06C75",
"green": "#98C379",
"yellow": "#E5C07B",
"blue": "#61AFEF",
"purple": "#C678DD",
"cyan": "#56B6C2",
"white": "#DCDFE4",
"brightBlack": "#5A6374",
"brightRed": "#E06C75",
"brightGreen": "#98C379",
"brightYellow": "#E5C07B",
"brightBlue": "#61AFEF",
"brightPurple": "#C678DD",
"brightCyan": "#56B6C2",
"brightWhite": "#DCDFE4"
},
{
"name": "One Half Light",
"foreground": "#383A42",
"background": "#FAFAFA",
"cursorColor": "#4F525D",
"black": "#383A42",
"red": "#E45649",
"green": "#50A14F",
"yellow": "#C18301",
"blue": "#0184BC",
"purple": "#A626A4",
"cyan": "#0997B3",
"white": "#FAFAFA",
"brightBlack": "#4F525D",
"brightRed": "#DF6C75",
"brightGreen": "#98C379",
"brightYellow": "#E4C07A",
"brightBlue": "#61AFEF",
"brightPurple": "#C577DD",
"brightCyan": "#56B5C1",
"brightWhite": "#FFFFFF"
},
{
"name": "Solarized Dark",
"foreground": "#839496",
"background": "#002B36",
"cursorColor": "#FFFFFF",
"black": "#073642",
"red": "#DC322F",
"green": "#859900",
"yellow": "#B58900",
"blue": "#268BD2",
"purple": "#D33682",
"cyan": "#2AA198",
"white": "#EEE8D5",
"brightBlack": "#002B36",
"brightRed": "#CB4B16",
"brightGreen": "#586E75",
"brightYellow": "#657B83",
"brightBlue": "#839496",
"brightPurple": "#6C71C4",
"brightCyan": "#93A1A1",
"brightWhite": "#FDF6E3"
},
{
"name": "Solarized Light",
"foreground": "#657B83",
"background": "#FDF6E3",
"cursorColor": "#002B36",
"black": "#073642",
"red": "#DC322F",
"green": "#859900",
"yellow": "#B58900",
"blue": "#268BD2",
"purple": "#D33682",
"cyan": "#2AA198",
"white": "#EEE8D5",
"brightBlack": "#002B36",
"brightRed": "#CB4B16",
"brightGreen": "#586E75",
"brightYellow": "#657B83",
"brightBlue": "#839496",
"brightPurple": "#6C71C4",
"brightCyan": "#93A1A1",
"brightWhite": "#FDF6E3"
},
{
"name": "Tango Dark",
"foreground": "#D3D7CF",
"background": "#000000",
"cursorColor": "#FFFFFF",
"black": "#000000",
"red": "#CC0000",
"green": "#4E9A06",
"yellow": "#C4A000",
"blue": "#3465A4",
"purple": "#75507B",
"cyan": "#06989A",
"white": "#D3D7CF",
"brightBlack": "#555753",
"brightRed": "#EF2929",
"brightGreen": "#8AE234",
"brightYellow": "#FCE94F",
"brightBlue": "#729FCF",
"brightPurple": "#AD7FA8",
"brightCyan": "#34E2E2",
"brightWhite": "#EEEEEC"
},
{
"name": "Tango Light",
"foreground": "#555753",
"background": "#FFFFFF",
"cursorColor": "#000000",
"black": "#000000",
"red": "#CC0000",
"green": "#4E9A06",
"yellow": "#C4A000",
"blue": "#3465A4",
"purple": "#75507B",
"cyan": "#06989A",
"white": "#D3D7CF",
"brightBlack": "#555753",
"brightRed": "#EF2929",
"brightGreen": "#8AE234",
"brightYellow": "#FCE94F",
"brightBlue": "#729FCF",
"brightPurple": "#AD7FA8",
"brightCyan": "#34E2E2",
"brightWhite": "#EEEEEC"
}
],

// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },

// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
{ "command": "closeWindow", "keys": "alt+f4" },
// 这将打开当前选项卡右侧的选项卡。
{ "command": "nextTab", "keys": "ctrl+tab" },
// 这使您可以进入“聚焦模式”,从而隐藏选项卡和标题栏。
{ "command": "toggleFocusMode" },
// 移动窗格焦点
// 这会根据方向将焦点更改为其他窗格。将设置direction为"previous"会将焦点移到最近使用的窗格。
{ "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+down" },
{ "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" },
{ "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" },
{ "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" },
// 调整字体大小
{ "command": { "action": "adjustFontSize", "delta": 1 }, "keys": "ctrl+=" },
{ "command": { "action": "adjustFontSize", "delta": -1 }, "keys": "ctrl+-" },

// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}