千家信息网

怎么在AIX和Power架构上运行Metasploit Framework

发表于:2025-02-23 作者:千家信息网编辑
千家信息网最后更新 2025年02月23日,怎么在AIX和Power架构上运行Metasploit Framework,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
千家信息网最后更新 2025年02月23日怎么在AIX和Power架构上运行Metasploit Framework

怎么在AIX和Power架构上运行Metasploit Framework,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

我已在我的笔记本电脑上使用qemu-system-ppc64完成了所有这些工作,它非常适合在真正的硬件上进行tinkering(意为探究和动手体验)和测试。另外,请确保你为qemu模拟处理器分配至少4 GB的内存,否则你将无法运行metasploit(它会一直尝试加载)这是我的qemu加载器脚本。

附:对于新的qemu-system-ppc64版本和AIX 7.2可能会存在一些问题。我使用的版本可以正常顺利的工作,因此这里我将其命名为qemu-system-ppc64-old

QEMU模拟器版本为3.0.50 (v3.0.0-614-g19b599f766-dirty)

./qemu-system-ppc64-old -cpu POWER8 -machine pseries -m 4096 -serial stdio -drive file=disk.img,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom aix.iso -prom-env boot-command='boot disk: ' -net nic -net tap -display vnc=:1

首先,我们需要安装一些依赖项。我将通过yum从Aixtoolbox public repo中包含我已安装在系统中的所有RPM。

AIX-rpmSDLSDL-develSDL_mixerSDL_ttfSDL_ttf-develaudiofileaudiofile-develautoconfautomakebashbzip2bzip2-develca-certificatescmakecoreutilscupscups-libscurlcyrus-sasldbdbusesoundesound-develexpatexpat-develexpectflacfontconfigfontconfig-develfreetype2freetype2-develgccgcc-c++gcc-cppgcc-gogdbmgdbm-develgettextgettext-develglibglib-develglib2glib2-develgmpgmp-develgnutlsgrepgtk+infolesslibXftlibXft-devellibXrandrlibXrenderlibXrender-devellibffilibffi-devellibgcclibgcryptlibgcrypt-devellibgolibgo-devellibgpg-errorlibgpg-error-devellibiconvlibjpeglibmikmodlibmpclibogglibogg-devellibpcaplibpcap-devellibpnglibpng-devellibssh3libssh3-devellibstdc++libstdc++-devellibtasn1libtoollibvorbislibvorbis-devellibxml2libxml2-devellibxml2-pythonlibxsltlibxslt-develluam4mpfrncursesncurses-develnettlenmapopenldapp11-kitpatchpcrepcre-develperlpkg-configpostgresqlpostgresql-develpostgresql-libspthpysqlitepythonpython-cryptographypython-develpython-iniparsepython-passlibpython-pyasn1python-pycurlpython-sixpython-toolspython-urlgrabberpython3readlinereadline-develrenderprotorsyncsedsmpegsmpeg-libssqlitesqlite-develtartcltcshtightvnc-servertkunzipwgetxzxz-develxz-libsyumyum-metadata-parserzlibzlib-devel

由于来自https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/ruby/的ruby-2.5.1和ruby-devel-2.5.1 RPM在编译Metasploit所依赖的gem时无法正常工作,因此我选择在AIX上从源码构建Ruby。这并不难(我们将安装到 /usr/local以和/opt/freeware分开)。

在本例中,我使用Ruby 2.5.1版本,但你也可以使用2.5.5或2.6.3版效果是一样的。

$ wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz$ tar -zxvf ruby-2.5.1.tar.gz$ cd ruby-2.5.1$ ./configure$ make$ su - # make install

一旦我们安装了Ruby(确保在你的配置文件中已包含/usr/local),我们就可以继续从git下载Metasploit快照。我之所以选择获取ZIP快照,是因为它在ppc64模拟器下速度会更快。

$ wget  https://github.com/rapid7/metasploit-framework/archive/master.zip$ unzip master.zip $ cd metasploit-framework-master

下一步是在metasploit目录中运行bunlde install,但我们现在将跳过此步骤,因为我们需要在本地自定义2个gem,并在AIX 7.2上编译和构建它们。

nokogiri-1.10.3.gembcrypt-3.1.13

由于nokogiri不会在AIX上构建,因为缺少vasprintf()函数,它不是POSIX接口,并且不在AIX中的C库中,如果不修改构建过程gem将构建和编译,但最终库将不起作用,并出现以下错误:

bash-5.0# /usr/local/bin/gem install nokogiri-1.10.3.gemBuilding native extensions. This could take a while...Successfully installed nokogiri-1.10.3Parsing documentation for nokogiri-1.10.3Done installing documentation for nokogiri after 49 seconds1 gem installedbash-5.0# /usr/local/bin/nokogiriTraceback (most recent call last):8: from /usr/local/bin/nokogiri:23:in 
' 7: from /usr/local/bin/nokogiri:23:in load' 6: from /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/bin/nokogiri:6:in ' 5: from /usr/local/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require' 4: from /usr/local/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require' 3: from /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri.rb:28:in ' 2: from /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri.rb:32:in rescue in ' 1: from /usr/local/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require' /usr/local/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': load failed - /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri/nokogir.so. Please issue below command for detailed reasons: (LoadError) /usr/sbin/execerror ruby "(ld 3 1 vasprintf /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri/nokogiri.so"

我们可以通过运行命令来检查错误的详细信息:

bash-5.0# /usr/sbin/execerror ruby "(ld 3 1 vasprintf /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri/nokogiri.so"exec(): 0509-036 Cannot load program ruby because of the following errors:rtld: 0712-001 Symbol vasprintf was referenced from module/usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.3/lib/nokogiri/nokogiri.so(),but a runtime definition of the symbol was not found.

可以看到缺少vasprintf符号并被调用。

让我们为Ruby gem创建一个工作目录并下载nokogiri。

$ mkdir GEMS$ cd GEMS$ gem fetch nokogiri Fetching: nokogiri-1.10.3.gem (100%)Downloaded nokogiri-1.10.3$ gem spec nokogiri-1.10.3.gem --ruby > nokogiri.gemspec$ gem unpack nokogiri-1.10.3.gemUnpacked gem: '/home/root/LOCAL-GEMS/TT/nokogiri-1.10.3'$ mv nokogiri.gemspec nokogiri-1.10.3$ cd  nokogiri-1.10.3$ cd ext/nokogiri

现在,我们将修改extconf.rb文件以包含构建过程,并在AIX上创建一个工作的nokogiri.so共享库并定位到nix? $CFLAGS <<

修改为:

$CFLAGS << " -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF "

保存并返回到构建nokogiri gem

$ cd ../.. $ gem build nokogiri.gemspec WARNING:  ports/archives/libxml2-2.9.9.tar.gz is not world-readableWARNING:  ports/archives/libxslt-1.1.33.tar.gz is not world-readableWARNING:  no homepage specifiedWARNING:  pessimistic dependency on mini_portile2 (~> 2.4.0) may be overly strict  if mini_portile2 is semantically versioned, use:    add_runtime_dependency 'mini_portile2', '~> 2.4', '>= 2.4.0'WARNING:  pessimistic dependency on racc (~> 1.4.14, development) may be overly strict  if racc is semantically versioned, use:    add_development_dependency 'racc', '~> 1.4', '>= 1.4.14'WARNING:  pessimistic dependency on rake-compiler (~> 1.0.3, development) may be overly strict  if rake-compiler is semantically versioned, use:    add_development_dependency 'rake-compiler', '~> 1.0', '>= 1.0.3'WARNING:  pessimistic dependency on rexical (~> 1.0.5, development) may be overly strict  if rexical is semantically versioned, use:    add_development_dependency 'rexical', '~> 1.0', '>= 1.0.5'WARNING:  See http://guides.rubygems.org/specification-reference/ for help  Successfully built RubyGem  Name: nokogiri  Version: 1.10.3  File: nokogiri-1.10.3.gem$ su # gem install  nokogiri-1.10.3.gem

经过一段时间后最终它将被构建(在qemu下它的速度很慢)我们可以通过执行gem本身来检查最终的nokogiri gem是否真的已经工作。

# gem install bcrypt Fetching: bcrypt-3.1.13.gem (100%)Building native extensions. This could take a while...ERROR:  Error installing bcrypt:        ERROR: Failed to build gem native extension.    current directory: /usr/local/lib/ruby/gems/2.5.0/gems/bcrypt-3.1.13/ext/mri/usr/local/bin/ruby -r ./siteconf20190624-6029732-1f0poah.rb extconf.rbcreating Makefilecurrent directory: /usr/local/lib/ruby/gems/2.5.0/gems/bcrypt-3.1.13/ext/mrimake "DESTDIR=" cleancurrent directory: /usr/local/lib/ruby/gems/2.5.0/gems/bcrypt-3.1.13/ext/mrimake "DESTDIR="compiling bcrypt_ext.ccompiling crypt_blowfish.ccompiling crypt_gensalt.ccompiling wrapper.clinking shared-object bcrypt_ext.sogcc: error: x86.o: No such file or directorymake: 1254-004 The error code from the last command is 1.Stop.make failed, exit code 2Gem files will remain installed in /usr/local/lib/ruby/gems/2.5.0/gems/bcrypt-3.1.13 for inspection.Results logged to /usr/local/lib/ruby/gems/2.5.0/extensions/powerpc-aix-7/2.5.0-static/bcrypt-3.1.13/gem_make.out

在ppc64 AIX平台上使用x86.o对象文件也出现了一些问题...但修复起来也很容易,你只需重复上面的操作获取gem并修改构建过程就行了。

$ gem fetch bcrypt Fetching: bcrypt-3.1.13.gem (100%)Downloaded bcrypt-3.1.13$ gem spec bcrypt-3.1.13.gem --ruby > bcrypt.gemspec$ gem unpack bcrypt-3.1.13.gem$ mv bcrypt.gemspec bcrypt-3.1.13 $ cd bcrypt-3.1.13$ cd ext/mri

让我们再次编辑extconf.rb文件并删除x86引用

删除x86.o保存并重新生成gem

$ cd ../.. $ gem build bcrypt.gemspecWARNING:  open-ended dependency on rspec (>= 3, development) is not recommended  if rspec is semantically versioned, use:    add_development_dependency 'rspec', '~> 3'WARNING:  See http://guides.rubygems.org/specification-reference/ for help  Successfully built RubyGem  Name: bcrypt  Version: 3.1.13  File: bcrypt-3.1.13.gem$ su # gem install bcrypt-3.1.13.gemBuilding native extensions. This could take a while...Successfully installed bcrypt-3.1.13Parsing documentation for bcrypt-3.1.13Installing ri documentation for bcrypt-3.1.13Done installing documentation for bcrypt after 26 seconds1 gem installed

现在,我们应该已将所有Metasploit框架所需的缺失gem都安装上了,所以只需从metasploit根目录运行bundle install即可

$ cd metasploit-framework-master$ bundle install

因为这需要一些时间,因此你可以泡杯咖啡/茶慢慢品尝。在这个时间里我打算去外面转转。

现在,你是否已准备好在AIX 7.2上运行Metasploit框架了?我想说是的!

我们可以运行./msfconsole(这在qemu下可能需要一些时间)

甚至可以对up2date windows 10 1903(10.0.18362.175)执行一些实时测试,并在运行时绕过MS Defender;)


看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

运行 工作 文件 时间 版本 过程 只需 可以通过 快照 框架 模拟器 目录 速度 错误 问题 帮助 检查 测试 编译 选择 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 怎么守好企业网络安全 索尼媒体服务器怎么才能注册进去 服务器上的安全性资料没有此 导航连接不上服务器怎么办 数据库系统工程师题库软题库 查车软件开发 12123 服务器 党委党组网络安全工作责任制办法 仿牌网站服务器 国家什么部门统筹网络安全 计算机网络技术的展望论文 java软件开发金华 饥荒服务器一直开机的吗 东莞市南城网络安全保卫部门 网络安全屏障 青少年 安卓软件开发优势 怎样比较两个数据库 医院的网络安全测试多久测试一次 航天交换北京网络技术有限公司 服务器部署十二要素应用 数据库中有换行符吗 安徽联想服务器维修维保价格 静安区参考网络技术服务代理价格 为什么软件开发要建模 怎么看网站数据库在哪里 开展网络安全意识培训 某软件开发企业为 萌小萌互联网科技有限公司官网 怀化市点通网络技术有限公司 软件开发项目构思
0