恶意代码分析实战 安装INetSim在CentOS 7上

perl 安装Cpan yum install perl-CPAN 阅读详情

CentOS 7安装INetSim


注: 博主对Perl不太熟,所以搜狗了半天(拒绝百度,从我做起)


官方安装步骤

inetsim documentation

不过写的比较笼统,可以参考参考


1.下载安装文件

从这里下载一个源文件

http://www.inetsim.org/downloads.html

然后放入centos里面,解压,然后用root运行setup.sh

发现报错

Group 'inetsim' does not exist! Aborting

缺少了一个组叫inetsim

我们执行命令

groupadd inetsim

然后再执行,就不会报错了

然后现在这是我们的软件的根目录

[root@localhost inetsim-1.2.6]# ls -il
total 68
 4557160 -rw-r--r--.  1 nobody   65534  4353 Aug 29  2016 CHANGES
 4557159 -rwxr-xr-x.  1 nobody   65534  1116 Aug 29  2016 cleanup.sh
12959504 drwxr-xr-x.  2 nobody   65534    26 Aug 29 20:08 conf
 4557161 drwxr-xr-x.  2 nobody   65534   162 Aug 29  2016 contrib
 4557169 -rw-r--r--.  1 nobody   65534 17982 Aug 29  2016 COPYING
  408925 drwxr-xr-x. 10 nobody inetsim   105 Aug 29  2016 data
 4557151 -rw-r--r--.  1 nobody   65534  1236 Aug 29  2016 DISCLAIMER
12993996 drwxr-xr-x.  2 nobody   65534   104 Aug 29  2016 doc
 4557158 -rwxr-xr-x.  1 nobody   65534   552 Aug 29  2016 inetsim #启动inetsim
 8452339 drwxr-xr-x.  3 nobody   65534    39 Aug 29  2016 lib
 4557157 -rw-r--r--.  1 nobody   65534 12172 Aug 29  2016 LIESMICH
 8944999 drwxrwx---.  2 nobody inetsim     6 Aug 29  2016 log
  408987 drwxr-xr-x.  5 nobody   65534    40 Aug 29  2016 man
 4557156 -rw-r--r--.  1 nobody   65534 10652 Aug 29  2016 README
  442180 drwxrwx---.  2 nobody inetsim     6 Aug 29  2016 report
 4557143 -rwxr-xr-x.  1 nobody   65534  1197 Aug 29  2016 setup.sh

但是启动之后我们会发现报错

[root@localhost inetsim-1.2.6]# ./inetsim 
Can't locate IPC/Shareable.pm in @INC (@INC contains: ./lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at lib/INetSim/Config.pm line 18.
BEGIN failed--compilation aborted at lib/INetSim/Config.pm line 18.
Compilation failed in require at lib/INetSim.pm line 20.
BEGIN failed--compilation aborted at lib/INetSim.pm line 20.
Compilation failed in require at ./inetsim line 20.
BEGIN failed--compilation aborted at ./inetsim line 20.

大概意思就是我们缺了一个Shareable.pm文件,然后一查,这是个perl的运行库

那我们就安装这个库吧,用perl的安装方式

先进入交互模式

perl -MCPAN -e shell
但是这里也会报错
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.

我们检查一下这个包有没有在系统里面了

rpm -q perl-CPAN

显示

package perl-CPAN is not installed

OK,那我们就装呗

yum install perl-CPAN

大概要装这么多依赖包

Installed:
  perl-CPAN.noarch 0:1.9800-291.el7                                                                                                                                                           

Dependency Installed:
  gdbm-devel.x86_64 0:1.10-8.el7                 glibc-devel.x86_64 0:2.17-157.el7_3.5          glibc-headers.x86_64 0:2.17-157.el7_3.5         kernel-headers.x86_64 0:3.10.0-514.26.2.el7   
  libdb-devel.x86_64 0:5.3.21-19.el7             perl-Data-Dumper.x86_64 0:2.145-3.el7          perl-Digest.noarch 0:1.17-245.el7               perl-Digest-SHA.x86_64 1:5.85-3.el7           
  perl-ExtUtils-Install.noarch 0:1.58-291.el7    perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7    perl-ExtUtils-Manifest.noarch 0:1.61-244.el7    perl-ExtUtils-ParseXS.noarch 1:3.18-2.el7     
  perl-Test-Harness.noarch 0:3.28-3.el7          perl-devel.x86_64 4:5.16.3-291.el7             perl-local-lib.noarch 0:1.008010-3.el7          pyparsing.noarch 0:1.5.6-9.el7                
  systemtap-sdt-devel.x86_64 0:3.0-7.el7        

Complete!

OK,我们执行安装

perl -MCPAN -e shell

然后就开始第一次的配置

安装

一直回车默认配置就行了

然后他会查找最近的镜像,这个过程有点慢感觉

Mirrors

你也可以手动配置这么几个Mirrors

Final

最后它会出现这么一个交互界面

我们输入

install IPC::Shareable

完成

这样就算安装完成了

然后我们再启动INetSim看看

还是报错
Base class package "Net::Server" is empty.
    (Perhaps you need to 'use' the module which defines that package first,
    or make that module available in @INC (@INC contains: ./lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5).

安照上面的方法再装一个试试

perl -MCPAN -e shell
install Net::Server
还有个包没装
Can't locate Net/DNS.pm in @INC (@INC contains: ./lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at lib/INetSim/DNS.pm line 19.

一样的

install Net::DNS

something error

这是这个模块的依赖(dependency)没有好,我们安装提示安装这两个包

install Digest::MD5

无

这个失败了

但是我们可以通过YUM的方式来安装

yum安装

yum install perl-Digest-MD5

这里有个小技巧,聪明的同学应该看出来了,module名和yum仓库的包名对应关系

install Digest::HMAC

这个成功了

然后我们再去修复那个DNS的问题

install Net::DNS

然后现在安装就可以安装上了,再看看还缺了什么依赖

然后我再启动

启动

可以看出这里有个logfile打不开的问题

在配置文件(如果把安装包直接丢/root/下面了,因为运行时候会用不是root的账号去运行,所以会出现Permission denied)

/home/inetsim/inetsim-1.2.6/conf/inetsim.conf

里面,有这么一行配置文件

#########################################
# service_run_as_user
#
# User to run services
#
# Syntax: service_run_as_user <username>
#
# Default: nobody
#
#service_run_as_user     inetsim

把下面这个注释去掉,用inetsim这个用户来运行这个软件,之前Default: nobody嘛

这个nobody用户不在组inetsim里面

所以会报错

改完配置之后,我们添加用户inetsim

useradd inetsim -g inetsim

然后回到目录

/home/inetsim/
chown -R inetsim:inetsim inetsim-1.2.6

为了保证运行时所需的任何权限,我们也加上这步骤(虽然这会存在很大的安全问题,但是我们又不挂在公网上面,只是内网虚拟机分析,可以容忍,如果不这样做,启动的时候会一堆的缺少写或者读(r/w)权限问题

chmod 777 -R inetsim-1.2.6

这样

就像这样的

1

2

然后就可以运行了
这个smtp启动失败不知道是什么原因…(玄学问题吧)

配置

配置inetsim

这里我只是说一下我的配置方式,不一定非要安装我的来配,仅供参考

service_bind_address    127.0.0.1

然后这个刚刚说过了

service_run_as_user     inetsim

然后这里按照你分析的恶意代码需求来配

dns_static      www.foo.com     10.10.10.10
dns_static      ns1.foo.com     10.70.50.30
dns_static      ftp.bar.net     10.10.20.30

也可以用ApateDNS来做这个DNS

不过要注意就是ApateDNS只能在Windows机器上使用

这里不要使用Default的版本号,就怕恶意代码作者会做一些反逆向分析措施

dns_version "9.2.4"

然后这里也是一样的

http_version            "Microsoft-IIS/4.0"

然后这里安装你的需求来设置欺骗路径

http_fakefile           txt     sample.txt      text/plain
http_fakefile           htm     sample.html     text/html
http_fakefile           html    sample.html     text/html
http_fakefile           php     sample.html     text/html
http_fakefile           gif     sample.gif      image/gif
http_fakefile           jpg     sample.jpg      image/jpeg
http_fakefile           jpeg    sample.jpg      image/jpeg
http_fakefile           png     sample.png      image/png
http_fakefile           bmp     sample.bmp      image/x-ms-bmp
http_fakefile           ico     favicon.ico     image/x-icon
http_fakefile           exe     sample_gui.exe  x-msdos-program
http_fakefile           com     sample_gui.exe  x-msdos-program

这里看你分析的恶意代码有没有下载exe文件的需求了,如果有,随便丢一个小程序放在你自己的某个目录下,然后编辑这里来使起生效

#http_static_fakefile   /path/                  sample_gui.exe  x-msdos-program
#http_static_fakefile   /path/to/file.exe       sample_gui.exe  x-msdos-program

然后这个https的pem文件,最偷懒的办法就是复制原来的default_*.pem文件为新的这个文件,如https_key.pem等等,然后取消相应的注释就行了(这些文件在data/cert/下面)

https_ssl_keyfile      https_key.pem

然后我们可以通过下面这个命令生成https_dh1024.pem

openssl gendh -5 -out https_dh1024.pem 1024

然后取消注释

https_ssl_dhfile        https_dh1024.pem

下面的smtp_ssl也是照这个思路来

然后改完之后记得增加perl的这个模块
yum install openssl-devel openssl-libs
perl -MCPAN -e shell
install IO::Socket::SSL

如果安装完上面这些这个还不行,不过还是建议你用下面这种方法
试试这个

yum install perl-IO-Socket-SSL

这个

然后可以看见现在没有not SSL support了,支持SSL了

然后还有就是注意这个(尽量CentOS 7 不要使能这个选项,因为CentOS 7没有iptables的libipq.h这个头文件,没法支持)

#redirect_enabled        yes

把重定向地址改成自己

redirect_external_address       127.0.0.1

然后记得安装这几个库如果想开重定向的话

perl -MCPAN -e shell
install IPTables::IPv4::IPQueue

为了安装上这些东西,你还需要

yum install gcc iptables-devel

但是这个我没安装成功,建议还是不要重定向了

然后到此位置,你的INetSim已经安装完成(但是我的smtp没法启动是什么鬼)

(2017-8-30)事后查明是配置文件中这里不要用127.0.0.1,smtp就可以很好启动了

配置

smtp

下一步就是开放需要的端口

这个因为是我是centos7,所以就不说了,其他发行版的都有自己的方法

Forking services...
  * dummy_1_tcp - started (PID 2718)
  * ident_113_tcp - started (PID 2704)
  * syslog_514_udp - started (PID 2705)
  * echo_7_tcp - started (PID 2710)
  * discard_9_udp - started (PID 2713)
  * quotd_17_tcp - started (PID 2714)
  * finger_79_tcp - started (PID 2703)
  * discard_9_tcp - started (PID 2712)
  * ntp_123_udp - started (PID 2702)
  * time_37_tcp - started (PID 2706)
  * daytime_13_tcp - started (PID 2708)
  * echo_7_udp - started (PID 2711)
  * chargen_19_tcp - started (PID 2716)
  * chargen_19_udp - started (PID 2717)
  * dummy_1_udp - started (PID 2719)
  * irc_6667_tcp - started (PID 2701)
  * time_37_udp - started (PID 2707)
  * quotd_17_udp - started (PID 2715)
  * tftp_69_udp - started (PID 2700)
  * daytime_13_udp - started (PID 2709)
  * dns_53_tcp_udp - started (PID 2691)
  * smtps_465_tcp - started (PID 2695)
  * ftps_990_tcp - started (PID 2699)
  * ftp_21_tcp - started (PID 2698)
  * pop3_110_tcp - started (PID 2696)
  * smtp_25_tcp - started (PID 2694)
  * https_443_tcp - started (PID 2693)
  * pop3s_995_tcp - started (PID 2697)
  * http_80_tcp - started (PID 2692)

我做好了一个centos7版本的INetSim镜像,为了方便其他的恶意代码分析,在百度云上,下载地址在这里

链接: http://pan.baidu.com/s/1c6NqqU 密码: gj4i

镜像是VirtualBox 导出的ovf1.0版本,不保证VMware能导入成功,但保证VirtualBox能导入成功

系统的默认IP是192.168.0.107(记得在/home/inetsim/inetsim-xx/conf/inetsim.conf里面更改一下ip地址,改成你现在机器DHCP所得的IP

用户名root
密码test

/root/目录下有个一个inetsim启动的软链接(这个后来我发现没法用,因为是在/root/的目录下,然后程序用inetsim这个用户运行的时候会报错,但是导都导了,传都传了,大家就去/home/inetsim/inetsim-1.2.6/下,执行inetsim这个可执行文件就可以启动,和一个打开所有端口的脚本openport.sh(这个可以正常用)

安装文件在/root/下有个原版压缩包,解压后放在了/home/inetsim/下、

本文完

dhcpstatus-开源 DHCPStatus是用于浏览存储在DHCPD的.conf和.leases文件中的信息的查询工具。 它将.conf文件中的子网详细信息与DHCPD的.lease记录相关联。 它既可以作为CGI程序运行,也可以作为基于文本的命令行实用程序运行。 立即下载

相关推荐

perl-CPAN-1.9800-299.el7_9.noarch.rpm

官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装

CentOS7下安装perl-CPAN

-- 安装CPAN yum -y install perl-CPAN

ringliwei 2985

单端至混合模式转换

例如,S12 是从端口 1 流出的电压与流入端口 2 的电压之比,而 S21 是从端口 2 流出的电压与流入端口 1 的电压之比。虽然没有标记 4 端口或更多端口 DUT 的行业标准,但一种实用的方法是使用所示的端口顺序,以便 2 端口 DUT 是 4 端口 DUT 左上象限的子集。1 端口和 2 端口 S 参数与图 3 中绘制的 4 端口 S 参数包含在同一图中。图 1 显示了 1 端口、2 端口和 4 端口 DUT 的示例,以及它们各自的 S 参数矩阵,这些矩阵表示具有各自端口索引标签的均匀传输线。

jkh920184196的博客 1078

centos 7 | 安装和使用cpan

照常,运行下面这句,即安装成功 yum install perl-CPAN 然而我古怪的电脑没有给我安装依赖包。 yum install perl-YAML perl-Term-ReadLine perl-version perl-libs perl-devel perl-Test-* perl-Pod-* perl-ExtUtils-* perl-CGI perl -MCPAN -e sh...

我是一块小石头 2069

X猫免费小说安卓逆向分析

七猫免费小说安卓逆向分析 难度(♥♥) 文章目录七猫免费小说安卓逆向分析 难度(♥♥)1. 查壳2. 抓包分析3. sign1. Frida-rpc2. Native函数分析快3点了. 睡觉~ 白天再继续写! 1. 查壳 我这边使用的是ApkTool, 拖进去显示未加壳。 2. 抓包分析 POST https://xiaoshuo.wtzw.com/api/v1/login/index HTTP/1.1 net-env: 1 channel: qm-cbcpa056_wm is-white: 0 platf

Qiled的博客 4383

solidworks vba二次开发配合问题

solidworks vba二次开发配合问题二次开发装配的步骤 二次开发装配的步骤 solidworks可以使用宏录制配合过程从而得到配合的vba代码,步骤如下: 1.选择两个配合的面(点、线等) 2. 建立配合 例如将两个圆柱面同心(图中高亮): 配合后 我们看一下宏录制的代码: Sub main() //激活solidworks接口 Set swApp = Application.SldWorks Set Part = swApp.ActiveDoc //选择两个圆柱面,注意此处是根据坐标选择,不

Alejandro123的博客 3414

恶意代码分析实战 Lab 3-1 习题笔记

Lab 3-1问题1.找出这个恶意代码的导入函数于字符串列表。解答: (动态分析建议用winxp pro 32bit,下面你就知道为什么这么建议了)我们用Dependency Walker会发现这个程序只有很少的导入函数,第一是怀疑是不是加壳了然后我们PEiD来看,的确是加壳了然后就开始尝试脱壳了万能脱壳这次不是万能的了目前我们知道的唯一个导入函数就是ExitProcess然后查看一下字符串 前面

isinstance的博客 5994

画个板子玩一玩STM32F030F4P6,也许是最便宜的32bit MCU

前言,什么是STM32F030F4P6 STM32目前最便宜的芯片之一应该就是这一块,STM32F030F4P6,这一个芯片没有USB,但是其他都有,引脚少,价格低廉,如果找不到原厂,可以买替代的国产芯片,性能也一样。 不管怎么样也是Cortex-M0,比8bit和16bit的性能都强,总的来说就是低价,引脚少,体积小的同时,还容易开发,有很多模拟输入可玩,还有SPI,硬件I2C等等 所以,这一款MCU真的是从理论来说又便宜又好用,非常适合把玩。 画个板,最小系统 STM32F030其..

arenascat的博客 2万+

inetsim安装

linux下的权限管理做得是很好的,经常会有需要管理员权限才能安装或者修改的东西第一种姿势:sudo ***(然后输入的是当前用户的密码)第二种姿势:su以root权限来登陆但是这里会出现的情况是:当你一直没有设置过root密码的时候,会一直验证失败的需要:sudo passwd root然后输入当前用户密码,再设置root密码如图:...

ACdream 805

【Mac+CLion+STM32+JLink】从零到一:在macOS上构建高效STM32开发与调试工作流

本文详细介绍了在macOS上使用CLion、STM32CubeMX和JLink搭建高效STM32开发与调试工作流的完整指南。从环境准备、CLion深度配置到STM32CubeMX工程实战,再到JLink烧录避坑和串口调试技巧,帮助开发者快速掌握Mac平台下的嵌入式开发全流程。

weixin_28278377的博客 259

AI视频生成提示词工程:结构化公式与实战案例详解

在实际使用 AI 生成视频或图像时,最常遇到的困惑是:为什么我的提示词(Prompt)生成的画面总是不理想?是模型能力不足,还是我的描述有问题?答案往往是后者。提示词工程(Prompt Engineering)并非简单的“翻译”需求,而是一门需要结构化思维和精准描述的技能。它决定了 AI 能否准确理解你的意图,并生成符合预期的视觉内容。 本文将通过两个核心案例,深入拆解提示词的构建逻辑。第一个案例聚焦于“文生视频”,我们将学习如何将一个简单的想法,如“小猫在雪地里玩雪球”,通过结构化公式扩展为一段富有细节和

weixin_30800987的博客 573

centos虚拟机中装openssl解决报错问题

openssl安装报错

m0_52766105的博客 3328

Open3D (C++) 计算点云坐标最值及其索引

使用C++版本的Open3D计算点云最值点及其对应的下标索引

点云侠的博客 734

CentOS 安装webmin

CentOS 安装webmin

.NET 人工智能实践 1688

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Perl-Perl模块1

Perl综合典藏网(Comprehensive Perl Archive Network, CPAN) 1. 寻找模块 perl的模块有2种来源 随perl发行版本一同打包的 要从CPAN下载 可以在CPAN Search网站或MetaCPAN网站上搜索那些没有随perl发布的模块 在开始寻找模块前,先检查本地是否已经安装该模块 $ perldoc Digest::SHA 如果查看未安装的模块,会看到错误提示 $ perldoc Llamas No documents found for "Llama

Arkardia的博客 618

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

webmin安装

https://www.cnblogs.com/phpk/p/10514910.html webmin-1.930-1.noarch.rpm [root@localhost yayi]# rpm -ivh webmin-1.930-1.noarch.rpm 警告:webmin-1.930-1.noarch.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 11f63c51: N...

唐心的博客 2138

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

虚拟服务器INetSim的安装,以及配置

INetSim官网给出的安装方法:http://www.inetsim.org/packages.html总结一下是4条指令:1、# echo "deb http://www.inetsim.org/debian/ binary/" &gt; /etc/apt/sources.list.d/inetsim.list2、# wget -O - http://www.inetsim.org/inets...

yellow的博客 4418

编译升级OpenSSL报错:Can‘t locate IPC/Cmd.pm

首次进入需要配置shell,按照提示操作即可,我这里是一路回车。安装成功后,重新编译OpenSSL即可。

没刮胡子的程序员专栏 6462

CentOS7 内网安装Webmin

Webmin安装教程

坚信努力一定会有回报! 484

Centos7.2 安装perl环境

Centos7.2 安装perl环境 1、运行环境 [x] centos7.2 [x] 腾讯云 [x] lnmp 2、操作背景 应工作需要,某一软件需要perl的一些模块支持 但是由于centos自带的perl版本与需求不服 所以进行perl环境的安装 3、安装步骤 3.1 perl安装 3.11 安装 # 下载安装包 wget http://s

backkom_jiu的博客 8282

恶意代码分析:虚拟网络环境配置

创建主机网络模式: 主机模式(Host-only)网络,可以在宿主操作系统和客户操作系统之间创建一个隔离的私有局域网,在进行恶意代码分析时,这是通常采用的联网方式。主机模式的局域网并不会连接到互联网,这意味着恶意代码会被包含在虚拟机里,同时也允许某些网络连接。 自定义配置: 让两个虚拟机相互连接。一个虚拟机可以同来运行恶意代码,而第二个虚拟机则提供一些必要的网络服务。两个虚拟机都被...

weixin_30920513的博客 5591

OpenSSH&OpenSSL至最新版本

openssh&openssl升级

qq_49081692的博客 7221

linux perl 报错 Can‘t locate CPAN.pm in @INC (@INC contains: inc /usr/local/lib64/perl5 /usr.... 解决方法

环境:CentOS release 6.5 错误情况:部署mysql 5.6 MHA执行到perl Makefile.PL的时候,报错Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5...... 解决办法: yum install cpan perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y cpan ExtUtils::Install

whatday的专栏 3784

linux恶意代码实验报告,如何在CentOS 7上安装Linux恶意软件检测(LMD)和ClamAV

Linux恶意软件检测(LMD)是用于Linux的恶意软件检测器和扫描仪,专为共享托管环境而设计。 LMD是根据GNU GPLV2许可证发布的,它可以安装在cPanel WHM和Linux环境中,并配有其他检测工具,如ClamAV。Clam AntiVirus(ClamAV)是一种开源的防病毒解决方案,用于检测木马,恶意软件,病毒和其他恶意软件。 ClamAV支持多种平台,包括Linux,Wi...

weixin_34966346的博客 1562
上一篇: 恶意代码分析实战 Lab 3-1 习题笔记
下一篇: 恶意代码分析实战 Lab 3-2 习题笔记
isinstance
博客等级 码龄11年 222粉丝 99原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址