路由器逆向分析------在Linux上安装IDA Pro

01.在Linux系统上安装Linux版本的IDA Pro

Linux版本的IDA Pro比较稀少,很幸运的是吾爱破解论坛已经有大牛分享了Linux版本的IDA Pro,具体的详细介绍见地址:http://www.52pojie.cn/thread-450156-1-1.html。Linux版本的IDA Pro的爱盘下载地址为:http://down.52pojie.cn/Tools/Disassemblers/IDA_Pro_v6.4_(Linux)_and_Hex-Rays_Decompiler_(ARM).zip。分享的作者已经对该IDA Pro进行了path,去掉了局域网检测的校验。下载该Linux版本IDA Pro直接解压,在 Linux 32bit 系统上可以直接使用,但是在 Linux 64bit 的系统上需要安装一些依赖库文件才能正常使用该IDA Pro。

根据IDA Pro官方的说明文档了解到:在Linux 64bit系统上,使用IDA Pro需要安装 Linux 32bit的支持库才能正常使用。

IDA Pro官方的说明文档的地址:http://www.hexblog.com/?p=958。IDA Pro官方文档的安装使用说明如下:

Installing IDA 6.9 on Linux

IDA is still, as of this writing (December 23rd, 2015), a 32-bit application and both IDA & its installer(*) require certain 32-bit libraries to be present on your Linux system before they can run.

Here is the list of commands you will have to run in order to install those dependencies, for the following systems:

Debian & derivative systems such as Ubuntu, Xubuntu, …

Red Hat Enterprise Linux 7.2 (and likely other versions as well)

Note: we cannot possibly install & try IDA on all flavors/versions of all Linux distributions, but we will do our best to update this post with relevant information, whenever we learn of a distribution requiring special attention.

(*) that is: if you want the installer to run a graphical interface, instead of a command-line one.

Debian & Ubuntu

Common dependencies

The following should allow IDA to run on most Linux systems deriving from Debian distributions:

$ sudo dpkg --add-architecture i386

$ sudo apt-get update

$ sudo apt-get install libc6-i686:i386 libexpat1:i386 libffi6:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libglib2.0-0:i386 libice6:i386 libpcre3:i386 libpng12-0:i386 libsm6:i386 libstdc++6:i386 libuuid1:i386 libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386 libxext6:i386 libxrender1:i386 zlib1g:i386 libx11-xcb1:i386 libdbus-1-3:i386 libxi6:i386 libsm6:i386 libcurl3:i386

Xubuntu 15.10

It is necessary to also run those commands, for IDA to present a usable GUI on Xubuntu 15.10

$ sudo apt-get install libgtk2.0-0:i386 gtk2-engines-murrine:i386 gtk2-engines-pixbuf:i386

Red Hat Enterprise Linux 7.2

IDA will require the following packages to be installed, in order to run properly on RHEL 7.2 (and probably any other RPM-based distribution) :

redhat-lsb-core.i686

glib2.i686

libXext.i686

libXi.i686

libSM.i686

libICE.i686

freetype.i686

fontconfig.i686

dbus-libs.i686

在 ubuntu 16.04 amd64 的系统上成功运行Linux版IDA Pro 6.4的结果截图如下:

02.通过wine在Linux系统上安装windows版本的IDA Pro

wine程序提供了能在Linux下安装windows程序的功能,丰富了Linux下的程序资源,很多windows平台不错的常见应用在wine的帮助下,可以在Linux正常使用。wine的使用教程比较多,也比较杂,下面是wine官方提供的安装和使用教程整理。

ubuntu官方提供wine的安装和使用教程的参考地址:https://help.ubuntu.com/community/Wine(英文)

wiki.ubuntu提供的wine安装和配置的详细参考地址:http://wiki.ubuntu.org.cn/UbuntuHelp:Wine/zh(推荐)

wiki.ubuntu提供的wine的详细的用户使用指南地址:http://wiki.ubuntu.org.cn/WineGuide

wine官方提供wine的源码下载和编译详细过程的地址:https://wiki.winehq.org/Building_Wine

通过git下载wine不同版本源码和进行编译的参考地址:https://wiki.winehq.org/Git_Wine_Tutorial

wine官方提供的wine下载和说明的地址:https://www.winehq.org/download

wine官方提供的下载和安装的步骤地址:https://wiki.winehq.org/Ubuntu(推荐)

wiki.ubuntu提供的wine的安装和使用教程:http://wiki.ubuntu.org.cn/Wine(推荐)

(1)在ubuntu下安装wine官方教程的步骤:

install Wine on Ubuntu

WineHQ only builds binary packages for the development and staging branches, in order to encourage widespread testing of bugfixes and new features by ordinary users. Binary packages for the stable branch are the responsibility of the distros. If you are looking for an updated stable package, ask your distro where to find it.

Installing WineHQ packages

If you have previously installed a Wine package from another repository, please remove it and any packages that depend on it (e.g., wine-mono, wine-gecko, winetricks) before attempting to install the WineHQ packages, as they may cause dependency conflicts.

If your system is 64 bit, enable 32 bit architecture(架构) (if you haven't already):

sudo dpkg --add-architecture i386

Add the repository(资源库):

wget https://dl.winehq.org/wine-builds/Release.key

sudo apt-key add Release.key

sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

Update packages:

sudo apt-get update

Then install one of the following packages:

Stable branch(稳定版)

sudo apt-get install --install-recommends winehq-stable

Development branch(开发版)

sudo apt-get install --install-recommends winehq-devel

Staging branch(过渡版)

sudo apt-get install --install-recommends winehq-staging

If apt-get complains about missing dependencies, install them, then repeat the last two steps (update and install).

If you have previously used the distro(发行) packages, you will notice some differences in the WineHQ ones:

Files are installed to /opt/wine-devel.

Menu items are not created for Wine's builtin programs (winecfg, etc.), and if you are upgrading from a distro package that had added them, they will be removed. You can recreate them yourself using your menu editor.

Binfmt_misc registration is not added. Consult your distro's documentation for update-binfmts if you wish to do this manually.

WineHQ does not at present packagewine-geckoorwine-mono. When creating a new wine prefix, you will be asked if you want to download those components. For best compatibility, it is recommended to click Yes here. If the download doesn't work for you, please follow the instructions on the Gecko and Mono wiki pages to install them manually(手动).

Installing without Internet

To install Wine on an Ubuntu machine without internet access, you must have access to a second Ubuntu machine (or VM) with an internet connection to download theWine .deb package and its dependencies.

The procedure goes like this: On the machine with internet, add the WineHQ PPA, then cache just the necessary packages without actually extracting them:

sudo add-apt-repository ppa:wine/wine-builds

sudo apt-get update

Then cache just the packages necessary for installing wine, without extracting them:

sudo apt-get clean

sudo apt-get --download-only install winehq-devel

sudo apt-get --download-only dist-upgrade

Copy all of the .deb files in /var/cache/apt/archives to a USB stick:

cp -R /var/cache/apt/archives/ /media/usb-drive/deb-pkgs/

Finally, on the machine without internet, install all of the packages from the flash drive:

cd /media/usb-drive/deb-pkgs

sudo dpkg -i *.deb

The same instructions can also be used for an offline installation of the `winehq-staging` packages.

Compiling WoW64

Ubuntu's implementation of Multiarch is still incomplete, so for now you can't simply install 32-bit and 64-bit libraries alongside each other. If you're on a 64-bit system, you'll have to create an isolated environment for installing and building with 32-bit dependencies. SeeBuilding Biarch Wine On Ubuntu for detailed instructions for Ubuntu using LXC, and Building Wine for general information.

(2)wiki.ubuntu提供的wine安装和配置步骤:

安装源中的wine

sudo apt-get install wine

因为版本比较旧,所以通常不用,改用PPA中的wine。

==安装最新版 wine==

ubuntu 官方自带了 wine ,但是推荐用 winehq 官方提供的最新版本 wine ,新版本解决了很多以前显得麻烦的问题。

PPA地址:https://launchpad.net/~wine/+archive/ubuntu/wine-builds

sudo add-apt-repository ppa:wine/wine-builds

(这里应该在(ubuntu14.10)“设置→软件和更新→其他软件”里给上面的那个地址打对勾)然后安装:

sudo apt-get update

sudo apt-get install wine-devel

要注意,若安装 wine 包是老的稳定版,新开发版本是 wine-devel ,经常有不少优化和修正。

如果愿意安装比 devel 稍微更 devel 的 staging 版本的话,可以试试 wine-staging。

配置

winecfg

中文问题

字体

Wine原生支持中文

在wine1.4版本以后,官方修改了中日韩字体的渲染方式 ,默认只需要系统安装了"WenQuanYi Micro Hei"字体,大多数中日韩语言的unicode程序都能正常显示。 在2012年Red Hat提交的CJK字体补丁[1]。

不再需要修改注册表"FontSubstitutes"和"MS Shell Dlg 2"键值,也不需要复制字体到~/.wine/drive_c/windows/fonts/目录中。

输入法的问题

目前,最新版16.04系统中wine程序可以正常输入汉字。 旧版本系统中,有时出现Fcitx输入法无法光标跟随的问题。 fcitx输入法在wine程序中不能输入,可以向~/.bashrc中添加以下代码

export XMODIFIERS="@im=fcitx"

export GTK_IM_MODULE="fcitx"

export QT_IM_MODULE="fcitx"

(3)wine程序的其他配置问题

初始设置

通过全局菜单,应用程序 - >附件 - >终端 ,输入命令: winecfg 这将在你的家目录中创建一个隐藏文件夹(.wine),其中包含类似于在Windows中的虚拟C:驱动器以及注册表文件。一旦该目录中创建完,wine配置窗口将出现。该窗口将允许您定制wine的各种设置,其中包括Windows版本,DLL替换,显示设置,驱动器映射,以及应用程序的特定设置。单击OK按钮关闭该窗口。

安装Windows应用程序

使用wine安装应用程序,可以按照以下步骤:

从某个地址下载Windows应用程序.exe(可执行文件).

把它放在一个方便的目录(例如,桌面或个人文件夹)

打开终端,并且切换到.exe文件所在的目录。

输入命令 wine application-name.ext (例如, wine realplayer.exe).

这将使用Wine启动.EXE。如果它是一个安装程序,它应该像在windows一样的运行。如果应用程序要求的目录来安装应用程序,选择把它放在 C:\Program Files 。

使用wine运行Windows程序

在安装使用上述应用程序后,这些应用程序可以启动,并通过输入wine programname.exe(例如wine realplayer.exe)使用。完成后,关闭该应用程序为一体通常会。您必须运行安装可执行文件,默认情况下将通过wine,创建的虚拟Windows驱动器在 ~/.wine/drive_c。一般的程序将根据Windows约定,安装在虚拟Windows驱动器里面Program Files下的某处。

您还可以使用 Wine 文件浏览器,通过在终端运行 Winefile。点击在工具栏C:\按钮将打开一个窗口,您可以浏览.wine创建的虚拟Windows驱动器。在wine文件浏览器双击可执行文件将在wine中运行它。

而不必总是进入终端或使用winefile文件浏览器,你也可以创建一个桌面图标,使用该图标启动一个应用程序。要做到这一点,右击桌面,选择“创建一个启动器。”如果你愿意,请从可用图标列表中选择一个图标(或浏览到你想使用的图标),填写该请求(名称,通用名等)等信息。对于命令,键入 wine /PathToProgram/Program.exe文件(例如 wine /home//.wine/realplayer.exe 创建一个启动器的最重要的部分就是命令,通用名称并不重要。只要确保你去选??择“在终端中运行。”此结束处理。

在某些情况下,应用程序需要被从一个特定位置上运行。在这种情况下创建命令启动

sh -c "cd /home/USER/.wine/drive_c/Program Files/APPDIR; wine game.exe"

当然,你需要用正确的数据替换USER和APPDIR。

如果你希望面板上有该程序的图标,选择创建的面板上的启动器。通过右键单击面板做到这一点,选择“添加到面板”,然后选择“自定义应用程序启动器”。这将像以前一样要求您提供相同的信息。

卸载 Wine 安装的应用程序

打开一个终端窗口,键入一下命令。 wine uninstaller 这将打开一个类似于Windows的程序“添加/删除程序”控制面板,让您卸载wine安装的应用程序。通过 wine 直接运行卸载程序也应该正常工作。或者,您也可以简单地删除应用程序的文件夹中。

配置 Wine

运行应用程序,或在命令行键入 winecfg

03.Linux下安装IDA Pro的步骤整理(以 ubuntu16.04为例)

1.Linux下直接安装IDA Pro

# 添加i386的支持依赖包源

$ sudo dpkg --add-architecture i386

# 软件更新

$ sudo apt-get update

# 安装需要的i386的依赖包

$ sudo apt-get install libc6-i686:i386 libexpat1:i386 libffi6:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libglib2.0-0:i386 libice6:i386 libpcre3:i386 libpng12-0:i386 libsm6:i386 libstdc++6:i386 libuuid1:i386 libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386 libxext6:i386 libxrender1:i386 zlib1g:i386 libx11-xcb1:i386 libdbus-1-3:i386 libxi6:i386 libsm6:i386 libcurl3:i386

# 解压Linux版本的IDA Pro,就可以使用IDA Pro了。

2.使用wine安装windows版本的IDA Pro

# 添加i386的支持依赖包源

$ sudo dpkg --add-architecture i386

# 添加资源库

$ wget https://dl.winehq.org/wine-builds/Release.key

$ sudo apt-key add Release.key

$ sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

# 更新软件安装包

$ sudo apt-get update

# 任选一个wine的版本进行安装(这里选择wine开发版进行安装)

$ sudo apt-get install --install-recommends winehq-devel

# 配置wine--在配置的过程中,可能会出现提示安装 Gecko、Mono,选择安装

$ winecfg

# wine程序的安装和卸载

$ wine uninstaller

wine程序的卸载步骤参考地址:https://wiki.winehq.org/FAQ#How_do_I_uninstall_Wine.3F

3.《揭秘家用路由器0day漏洞挖掘技术》这本书提供的IDA Pro的安装方法

# 安装依赖库文件

$ sudo apt-get install gnome-control-center

# 安装Wine程序

$ sudo apt-get install wine

# 将windows上的IDA Pro的所有文件拷贝到Linux系统的/opt/目录下,在IDA Pro的根目录下,编下如下的IDA Pro启动脚本 ida.sh:

#!/bin/sh

wine /opt/IDA的根目录/idaq.exe

# 使用以下的命令在IDA Pro的根目录下启动IDA Pro。

$ sh ida.sh

# 如果wine在Linux下运行出现缺少DLL文件的情况,需要自行在windows上找到对应的动态库文件,将其复制到IDA的根目录下。

————————————————

版权声明:本文为CSDN博主「Fly20141201」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/QQ1084283172/article/details/69665905

你可能感兴趣的:(路由器逆向分析------在Linux上安装IDA Pro)