免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 7670 | 回复: 16
打印 上一主题 下一主题

[推荐] 几个Solaris下用的HexEditor和汇编工具 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-30 14:51 |只看该作者 |倒序浏览
发信人: Wwashington (Jacky), 信区: NewSoftware
标  题: [推荐] 几个Solaris下用的HexEditor和汇编工具
发信站: 水木社区 (Tue May 30 14:43:23 2006), 站内

Docs Title: [推荐] 几个Solaris下用的HexEditor和汇编工具
Publish On: 2006/05/30
Written By: Wwashington AT newsmth.org

前言:想必大家对 Win32 下的 Hex Editor 如 UltraEdit, WinHex, Hiew 等工具都
很熟悉了吧,这里介绍的是几个 Unix 下的工具,Hex Editor 是 shed, heme, biew,
Assembler 常用的是 yasm 和 nasm,还有一个是 Unix Disassembler,叫做 Udis86。
gdb 和 objdump 只能看 ELF 格式的,biew 和 udcli 则可以反汇编硬盘引导区。

说明:这个文档是我自己下载和编译时做的笔记,方便将来使用。发出来分享吧,在
格式上就没那么讲究了,大家按顺序往下看,自然就明白了。编译平台是 Solaris 9
U8 x86,以及 Companion CD 9U7。其中一些 alias 是来自我前几天那篇文章的附件,
需要的朋友这里下载,http://bbs.chinaunix.net/viewthread.php?tid=759675

-----------------------------------------------------------------------------

http://www.tech-faq.com/hex-editor.shtml
What is a hex editor?

http://www.rocketaware.com/spec/infotool/binedit/
Binary Editors

http://www.cspltd.ndirect.co.uk/programing/editors.htm
PROGRAMERS EDITORS

http://www.linuxmine.com/410.html
sed中如何替换出新行来

-----------------------------------------------------------------------------

http://swforum.sun.com/jive/thread.jspa?threadID=86603
MySQL 3.23 Installalation fails on Solaris 8

http://www.dbforums.com/showthread.php?t=529866
smpeg-0.4.3 will not compile on Solaris 8 X86

Gary Gibbings writes: --->

Assembler:
"/var/tmp/ccHuhxs7.s", line 1 : Illegal mnemonic
"/var/tmp/ccHuhxs7.s", line 1 : Syntax error
"/var/tmp/ccHuhxs7.s", line 3 : Illegal mnemonic
"/var/tmp/ccHuhxs7.s", line 3 : Syntax error
*** Error code 1

Juergen Keil writes: --->

This looks like a problem with the usage of the Sun assembler
/usr/ccs/bin/as vs. the GNU assembler gas. the following hack
should work to force gcc to use the gnu assembler:

cd /usr/ccs/bin
ln -s /opt/sfw/bin/gas gas
mv as as.sun

ln -s gas as

(or: ln -s as.sun as)

By changing the symbolic link /usr/ccs/bin/as to either point to the
original "as.sun" (Sun's assembler) or "gas" (GNU as) you can select
which version of the assembler is used during a GCC compilation.

-----------------------------------------------------------------------------

http://www.enlight.ru/qview/main.htm
Release 2.69.03 and update 2.80.01 are now available (DOS version only)!

http://rhack.sourceforge.net/
Hack is an hex editor designed to run under Win32 operating systems

http://www.technologismiki.com/en/index-h.html
Hackman Disassembler 9.0 is an ultra fast multi processor disassembler

http://biew.sourceforge.net/en/biew.html
BIEW- is multiplatform portable viewer of binary files with built-in editor

http://ag.qnx.org.ru/biew/
Here are present Binary vIEW (by Nick Kurshev) ported on QNX4 and on QNX6.

http://sourceforge.net/projects/nasm/
http://www.tortall.net/projects/yasm/releases/

-----------------------------------------------------------------------------

http://mirrors.kernel.org/gnu/gengetopt/gengetopt-2.16.tar.gz
http://ovh.dl.sourceforge.net/sourceforge/shed/shed-1.12.tar.gz
http://ovh.dl.sourceforge.net/sourceforge/heme/heme-0.4.tar.gz

http://www.tortall.net/projects/yasm/releases/yasm-0.4.0.tar.gz
http://ovh.dl.sourceforge.net/so ... 6/udis86-1.0.tar.gz
http://ovh.dl.sourceforge.net/so ... asm-0.98.39.tar.bz2
http://ovh.dl.sourceforge.net/sourceforge/biew/biew562.tar.bz2

cd /home/postgres/PgSrc
gzip -dc gengetopt-2.16.tar.gz | tar -xvf -
gzip -dc shed-1.12.tar.gz | tar -xvf -
gzip -dc heme-0.4.tar.gz | tar -xvf -
gzip -dc yasm-0.4.0.tar.gz | tar -xvf -
gzip -dc udis86-1.0.tar.gz | tar -xvf -
bunzip2 -dc nasm-0.98.39.tar.bz2 | tar -xvf -
bunzip2 -dc biew562.tar.bz2 | tar -xvf -

-----------------------------------------------------------------------------

cd gengetopt-2.16
./configure --prefix=/opt/sfw
make
make install
cp -pf src/getopt*.o /opt/sfw/share/gengetopt
ln -s gnugetopt.h /opt/sfw/share/gengetopt/getopt.h
ll /opt/sfw/share/gengetopt
cd ..

-----------------------------------------------------------------------------

cd shed-1.12
cp -pf /opt/sfw/share/gengetopt/getopt*.o .
export C_INCLUDE_PATH="/opt/sfw/include:/opt/sfw/share/gengetopt"

./configure --prefix=/opt/sfw

cat Makefile | grep "shed_OBJECTS ="
mv Makefile Makefile.old
cat Makefile.old | sed s/"shed_OBJECTS ="/"shed_OBJECTS = getopt.o getopt1.o"/g > Makefile
cat Makefile | grep "shed_OBJECTS ="

make
make install
cd ..

-----------------------------------------------------------------------------

cd heme-0.4
export C_INCLUDE_PATH="/opt/sfw/include"

cat heme.c | grep "curses.h"
mv heme.c heme.c.old
cat heme.c.old | sed s/"curses.h"/"ncurses.h"/g > heme.c
cat heme.c | grep "curses.h"

cat Makefile | /usr/xpg4/bin/grep -e "LDFLAGS =" -e "PREFIX =" -e "CC =" -e "install"
mv Makefile Makefile.old
cat Makefile.old | sed s/"LDFLAGS = -lcurses"/"LDFLAGS = -lncurses"/g > Makefile.1
cat Makefile.1 | sed s/"PREFIX = \/usr\/local"/"PREFIX = \/opt\/sfw"/g > Makefile.2
cat Makefile.2 | sed s/"TARGET = heme"/"TARGET = heme]CC = gcc"/g| tr ']' '\n' > Makefile.3
cat Makefile.3 | sed s/"install -s"/"install"/g > Makefile.4
cat Makefile.4 | sed s/"install -m"/"ginstall -m"/g > Makefile
rm -f Makefile.1 Makefile.2 Makefile.3 Makefile.4
cat Makefile | /usr/xpg4/bin/grep -e "LDFLAGS =" -e "PREFIX =" -e "CC =" -e "install"

make
make install
cd ..

-----------------------------------------------------------------------------

First you must upgrade these 3 components, compile and install them.
Otherwise the compiler or installer will make some strange mistakes.
By the way, we choose the most stable version instead of latest one.

ftp://ftp.sunfreeware.com/pub/fr ... sol9-intel-local.gz
http://mirrors.kernel.org/gnu/automake/automake-1.9.6.tar.gz
http://mirrors.kernel.org/gnu/libtool/libtool-1.5.20.tar.gz

cd /home/postgres/PgPkg
gzip -d  gettext-0.14.1-sol9-intel-local.gz
pkgadd -d gettext-0.14.1-sol9-intel-local

gzip -dc automake-1.9.6.tar.gz | tar -xvf -
gzip -dc libtool-1.5.20.tar.gz | tar -xvf -

cd automake-1.9.6
./configure
make
make install
cd ..

cd libtool-1.5.20
./configure
make
make install
cd ..

-----------------------------------------------------------------------------

cd /home/postgres/PgSrc
cd yasm-0.4.0
loc
hash -r

aclocal
autoconf
automake

export CPPFLAGS="-I/opt/sfw/include"
./configure --prefix=/opt/sfw
make
make install
yasm --version | grep yasm
cd ..

exit
bash
cd /home/postgres/PgSrc

cd udis86
export CPPFLAGS="-I/opt/sfw/include"
./configure --prefix=/opt/sfw
make
make install
udcli -h
cd ..

cd nasm-0.98.39
export CPPFLAGS="-I/opt/sfw/include"
./configure --prefix=/opt/sfw
make everything
make install_everything
nasm -v
cd ..

cds
cd ../Sun09/Old
udcli -16 PBoot
heme PBoot
shed PBoot

-----------------------------------------------------------------------------

echo "Prepare compiler environment to avoid Illegal mnemonic and Syntax error"
cd /usr/ccs/bin
ln -s /opt/sfw/bin/gas gas
[ -r as.sun ] || mv as as.sun
ln -s gas as

cd /usr/bin
ln -s /opt/sfw/bin/granlib granlib
ln -s granlib ranlib

cd /home/postgres/PgSrc
cd biew-562
mv makefile Makefile.old
cat Makefile.old | /usr/xpg4/bin/grep -e INCS -e LIBS
cat Makefile.old | sed s/"INCS ="/"INCS = -I\/opt\/sfw\/include"/g > Makefile.1
cat Makefile.1 | sed s/"LIBS ="/"LIBS = \/usr\/lib\/librt.so"/g > Makefile
rm -f Makefile.1
cat Makefile | /usr/xpg4/bin/grep -e INCS -e LIBS

cp ./biewlib/sysdep/generic/unix/vio.c vio.c.old
cat vio.c.old | grep curses.h
cat vio.c.old | sed s/"curses.h"/"ncurses.h"/g  > vio.c.tmp
mv vio.c.tmp ./biewlib/sysdep/generic/unix/vio.c
cat ./biewlib/sysdep/generic/unix/vio.c | grep curses.h

make
cp -pf biew /opt/sfw/bin
mkdir -p /usr/local/share/biew/
cp -pf ./bin_rc/biew.hlp /usr/local/share/biew/
cp -pf ./bin_rc/skn/*.skn /usr/local/share/biew/
cp -pf ./bin_rc/syntax/*.stx /usr/local/share/biew/
ll /usr/local/share/biew/
biew -?
cd ..

[Notes] Error Messages if you don't modify Makefile and vio.c

Undefined                       first referenced
symbol                             in file
initscr32                           ./biewlib/libbiew.a(vio.o)
nanosleep                           ./biewlib/libbiew.a(os_dep.o)
w32addch                            ./biewlib/libbiew.a(vio.o)
acs32map                            ./biewlib/libbiew.a(vio.o)
ld: fatal: Symbol referencing errors. No output written to biew
collect2: ld returned 1 exit status
make: *** [biew] Error 1

for i in /usr/include/*.h ; do echo $i; grep nanosleep $i; done
<-----
/usr/include/time.h
extern int nanosleep(const struct timespec *, struct timespec *);
----->
for i in /usr/lib/* ; do echo $i; grep nanosleep $i; done
<-----
/usr/lib/llib-lrt
int     nanosleep(const struct timespec *, struct timespec *);
----->
for i in /usr/lib/*rt* ; do echo $i; done

-----------------------------------------------------------------------------

bash-2.05# which shed
/opt/sfw/bin/shed
bash-2.05# which heme
/opt/sfw/bin/heme

bash-2.05# shed /usr/platform/i86pc/lib/fs/ufs/pboot
bash-2.05# heme /usr/platform/i86pc/lib/fs/ufs/pboot

bash-2.05# gobjdump -D /usr/platform/i86pc/lib/fs/ufs/pboot
gobjdump: /usr/platform/i86pc/lib/fs/ufs/pboot: File format not recognized
bash-2.05# gobjdump -D /opt/sfw/bin/shed | less

-----------------------------------------------------------------------------

bash-2.05# gdb /opt/sfw/bin/shed
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.9"...
(gdb) disas main
Dump of assembler code for function main:
0x8052b14 <main>:       push   %ebp
0x8052b15 <main+1>:     mov    %esp,%ebp
0x8052b17 <main+3>:     push   %edi
0x8052b18 <main+4>:     push   %esi
0x8052b19 <main+5>:     sub    $0x100,%esp
0x8052b1f <main+11>:    and    $0xfffffff0,%esp
0x8052b22 <main+14>:    mov    $0x0,%eax
0x8052b27 <main+19>:    sub    %eax,%esp
0x8052b29 <main+21>:    lea    0xffffff98(%ebp),%edi
0x8052b2c <main+24>:    mov    $0x8054f50,%esi
0x8052b31 <main+29>:    cld   
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) quit

-----------------------------------------------------------------------------

It's not recommended to upgrade binutils, sometimes C lib is not compatible.
When a program really need gnu-ld, please set LD and NM, then run configure.

cd binutils-2.15
make
make install
cd ..

cd binutils-2.15
make uninstall
/* the uninstall target is not supported in this tree */

find . -name Makefile | xargs -i make -f {} uninstall
cd ..

/*******************************************
export LD=/opt/sfw/bin/gld
export NM=/opt/sfw/bin/gnm
export CPPFLAGS="-I/opt/sfw/include"

./configure --prefix=/opt/sfw --with-gnu-ld
*******************************************/

-----------------------------------------------------------------------------

[ 本帖最后由 wwashington 于 2006-6-8 13:45 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-05-30 15:20 |只看该作者
这是通过SecureCRT使用Biew的图一。

Biew_01.jpg (194.08 KB, 下载次数: 98)

Biew_01.jpg

论坛徽章:
0
3 [报告]
发表于 2006-05-30 15:24 |只看该作者
这是通过SecureCRT使用Biew的图二。

Biew_02.jpg (180.06 KB, 下载次数: 92)

Biew_02.jpg

论坛徽章:
0
4 [报告]
发表于 2006-05-30 15:30 |只看该作者
这是通过SecureCRT使用Biew的图三。说明:原先在SecureCRT里的Character
是Default,这导致乱码现象很严重,现在设置为None,略有进步。我推断,如果
能找一个纯英文的SSH Client,一定可以完全消除乱码现象。如果文字终端确实无
法做到,那就干脆用 Xwin 登陆好了。

[ 本帖最后由 wwashington 于 2006-5-31 13:40 编辑 ]

Biew_03.jpg (181.32 KB, 下载次数: 83)

Biew_03.jpg

论坛徽章:
0
5 [报告]
发表于 2006-05-30 15:34 |只看该作者
这是通过SecureCRT使用Biew的图四。说明:原先在SecureCRT里的Character
是Default,这导致乱码现象很严重,现在设置为None,略有进步。我推断,如果
能找一个纯英文的SSH Client,一定可以完全消除乱码现象。如果文字终端确实无
法做到,那就干脆用 Xwin 登陆好了。

[ 本帖最后由 wwashington 于 2006-5-31 13:40 编辑 ]

Biew_04.jpg (183.69 KB, 下载次数: 92)

Biew_04.jpg

论坛徽章:
0
6 [报告]
发表于 2006-05-30 15:58 |只看该作者
这是通过SecureCRT使用Heme的图一。

Heme_01.jpg (183.94 KB, 下载次数: 92)

Heme_01.jpg

论坛徽章:
0
7 [报告]
发表于 2006-05-30 16:00 |只看该作者
这是通过SecureCRT使用Shed的图一。

Shed_01.jpg (182.94 KB, 下载次数: 85)

Shed_01.jpg

论坛徽章:
0
8 [报告]
发表于 2006-05-30 16:05 |只看该作者
强!
不是小强,而是大强!

论坛徽章:
0
9 [报告]
发表于 2006-05-30 22:23 |只看该作者
这是通过SecureCRT使用Biew的图五。说明:原先在SecureCRT里的Character
是Default,这导致乱码现象很严重,现在设置为None,略有进步。我推断,如果
能找一个纯英文的SSH Client,一定可以完全消除乱码现象。如果文字终端确实无
法做到,那就干脆用 Xwin 登陆好了。

首先补充一点,在 bash 里用 export TERM=?? 来设置终端类型。目前已经查明,
在 Solaris 的 Console 里,TERM 为 dtterm、xterm-color 时功能正常,菜单
里有少量乱码,其中 dtterm 可以支持 vi,TERM 为 scoansi 时按 F2、F7 自动
退出。SSH Secure Shell 情况与 Solaris 的 Console 完全一样。在 F-Secure
SSH Client 里 TERM 为 qnx 基本正常,菜单较多乱码,TERM 为 xterm-color
以及 dtterm 时菜单非常漂亮,但是按 F2 就会自动退出。

在 SecureCRT 里当 TERM 为 scoansi、linux 时基本正常,不支持 vi,其他的
TERM 类型如 dtterm、xterm-color 都不能正常工作。在 SecureNetTerm 里,
TERM 为 scoansi 时按 F2、F7 自动退出,TERM 为 dtterm、xterm-color 时
功能正常,看起来最美观,但按 F2 会自动退出,也就是说无法切换 View Mode,
而搜索是正常的,跟 F-Secure SSH Client 的情况类似。

[ 本帖最后由 wwashington 于 2006-5-31 13:20 编辑 ]

Biew_05.jpg (182.95 KB, 下载次数: 99)

Biew_05.jpg

论坛徽章:
0
10 [报告]
发表于 2006-05-31 13:21 |只看该作者
这是通过Xwin远程登陆使用Biew的图六。说明:暂时不打算花时间研究 SSH Client
的 biew 显示了,其实 biew 在 Solaris Console,或通过 Exceed、Xmanager
远程登陆,使用都是正常的。

[ 本帖最后由 wwashington 于 2006-5-31 13:38 编辑 ]

Biew_06.jpg (180.75 KB, 下载次数: 92)

Biew_06.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP