不用root账号能装perl 安装模块的模块吗

随笔- 244&
转载自&在本博客中,所有的软件安装都在服务器上,且无root权限。理论上适合所有的用户。
我的安装目录 cd /home/zilhua/software
1、在官方网站下载新版本的源码包:
,版本自己选择,我下载的是perl-5.18.0.tar.gz
tar zxvf perl-5.18.0.tar.gz
3.进入解压目录
cd /home/zilhua/software/perl-5.18.0
./Configure –help的提示如下:
./Configure -des -Dprefix=/home/zilhua/software/perl-5.18.0 -Dusethreads
make //这个过程会比较久,因为源码文件有那么大。&make install&等待这个命令完成后,基本安装就完成了。
5.更改路径
vim ~/.bashrc
在里面添加:
export PATH=/home/zilhua/software/perl-5.18.0/bin:$PATH
保存,更新路径:source ~/.bashrc
==============================================
这样就能保证你安装不需要root权限,在以后安装模块时,也不需要root权限了。
那么怎么在无root的情况下安装模块了?
方法一:安装上面的方法安装perl之后,安装模块用cpan也不需要root权限了:
perl -MCPAN -e shell
方法二:手动安装模块:
进入模块所在路径,就是你的模块安装到哪里,你就cd进去,然后执行下面的命令…&perl Makefile.PL PREFIX=/home/zilhua/software/perl-5.18.0/lib&&&make install&注意PREFI的格式,必须要写成这几个字,前面不能加-或者–,不能小写&2. 设置环境变量,使当前系统的perl程序能够自动找到安装的模块&vim ~/.bashprofile 添加&export PATH=/home/zilhua/software/perl-5.18.0/lib&保存并关闭.bash_profile文件
按照上面的方法更新路径
注意:一般手动安装的模块最后还需要自己重新改一下名字的。
方法3:使用模块 local::lib(不推荐)
先手动安装这个模块,然后再用这个模块安装其他模块。
以下是详细步骤:
tar -xzf local-lib-2.000004.tar.gz&cd local-lib-2.000004.tar.gz&下一步,将local::lib加入至bootstrap当中去。这一步会在用户HOME目录下新建一个perl5的目录,并且指定它为将来安装perl模块的目录。
perl Makefile.PL –bootstrap&而后安装local::lib
make&make test&make install&而后试运行一下perl
perl -MCPAN -e shell&一路选择默认值,然后退出。这一步,perl会将本地的模块搜索目录放入至.bashrc文件尾部。
安装其它perl模块&这个时候我们就可以进行非root权限的perl模块安装了。我们首先需要从先前的terminal窗口中退出来,重开一个terminal窗口,这样就会过一遍.bashrc文件。试着安装一个模块,
perl -MCPAN -eshell&nolock_cpan[1]& install File::ReadBackwards&一切OK。
为cluster扩展library path&可以简单的在qsub文件中运行perl之前加入PERL5LIB的搜索路径
echo $PERL5LIB&然后将传回的值写入qsub当中去
PERL5LIB=/home/path/lib:/usr/another/path/ export PERL5LIB&也可在执行命令中加入-I参数
perl -I /home/path/lib -I /usr/another/lib script.pl&或者在pl文件头里加入lib的路径
!/usr/bin/perl
use lib “/home/path/lib”;&use lib “/usr/another/lib”;&use MyCustomM
阅读(...) 评论()Windows下的Perl activeperl安装步骤
无论你是想在Windows操作系统上学习Perl语言的核心功能,还是想了解下面这类面向Windows的Perl集成工具,你都必须从同一个地方开始,这就是在Windows上安装Perl。
1.下载并安装Perl-5.8-win32-bin.exe及近似版本;
授权:免费软件 大小:23.9M 语言: 英文
本周共下载 257 次
2.安装apache 2.0以上版本
授权:免费软件 大小:4.9M 语言: 英文
本周共下载 188 次
3.通过命令行安装mod_perl,命令如下:
C:& ppm install http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd
4,更改apache配置文件conf/ httpd.conf
在loadmodule处添加如下两行:
LoadFile "c:/perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
在配置文件最后添加:
Alias /perl/ "c:/perl/"PerlModule ModPerl::Registry&Location /perl&SetHandler perl-scriptPerlHandler ModPerl::RegistryOptions ExecCGIallow from allPerlSendHeader On&/Location&
此处"c:/perl/"为activeperl的安装目录,建议安装在盘符根目录下。
&!--[if !supportEmptyParas]--& &!--[endif]--&
然后重起apache,就可以在c:/perl目录下编写自己的perl CGI程序了。
&!--[if !supportEmptyParas]--& &!--[endif]--&E.g.:hello.pl#!/usr/bin/perluse CGI;my $query = new CGI;print $query-&print $query-&start_html(-title=&"show hello");print "&h1&";print "hello,world!!";print "&/h1&";print $query-&end_exit(0);&!--[if !supportEmptyParas]--& &!--[endif]--&&!--[if !supportEmptyParas]--& &!--[endif]--&
template模块windows环境下的安装及测试如下:
1.命令行安装:
ppm2 install http://theoryx5.uwinnipeg.ca/ppms/Apache-Template.ppd
或者使用ppm,(just test it!)
2.创建template.pl于c:/perl下:
&!--[if !supportEmptyParas]--& &!--[endif]--&use T&!--[if !supportEmptyParas]--& &!--[endif]--&my ($type) = "text/ charset=gbk";print "Content-type: ", $type, "";&!--[if !supportEmptyParas]--& &!--[endif]--&my $config = {INCLUDE_PATH =& 'C:/test',EVAL_PERL  =& 1,};&!--[if !supportEmptyParas]--& &!--[endif]--&my $template = Template-&new($config);&!--[if !supportEmptyParas]--& &!--[endif]--&my $replace = "要放入模板的";my $vars = {var =& $replace,};&!--[if !supportEmptyParas]--& &!--[endif]--&my $temp_file = 'template.html';my $$template-&process($temp_file, $vars, $output)|| die $template-&error();&!--[if !supportEmptyParas]--& &!--[endif]--&print $&!--[if !supportEmptyParas]--& &!--[endif]--&
创建template.html于c:/test下
&html&&head&&title&Arthur Dent: Greet the Planet&/title&&/head&&body&dfsdf [% var %]&/body&&/html&&!--[if !supportEmptyParas]--& &!--[endif]--&
这样我们就可以在浏览器中输入:http://localhost/perl/template.pl来测试我们的程序。
&!--[if !supportEmptyParas]--& &!--[endif]--&
&!--[if !supportEmptyParas]--& &!--[endif]--&
&!--[if !supportEmptyParas]--& &!--[endif]--&
&!--[if !supportEmptyParas]--& &!--[endif]--&
阅读本文后您有什么感想? 已有
人给出评价!
10-01-2009-11-0409-11-0404-11-0704-11-0704-11-0704-10-1504-10-08
注:您的评论需要经过审核才会显示出来
Copyright &
PC6下载(www.pc6.com).All Rights Reserved
备案编号:湘ICP备号查看perl已经安装的模块
Posted by:
Advertisement
#!/usr/bin/perl
use ExtUtils::I
my $instmod = ExtUtils::Installed-&new();
foreach my $module ($instmod-&modules()) {
my $version = $instmod-&version($module) || "???";
print "$module -- $versionn";一款功能丰富的Perl后门程序分析
*本文原创作者douwanhu,属于FreeBuf原创奖励计划,禁止转载
最近通过Cowrie蜜罐捕获一枚有趣的后门程序,此程序用perl语言编写。功能包括:DDoS(udpflood、tcpflood、httpflood、sqlflood)、hacking(端口扫描、信息收集、本地root、日志清理等)情报信息搜集(packetstorm、milw0rm)等
一、样本信息:
蜜罐日志显示黑客使用密码猜解成功登陆SSH后用wget命令下载了程序:
文件信息:
CRC-32 fb9cfdcb
MD5 Hash 5cb2e6baca38
SHA1 Hash aaf4e7454fd3fecf7c
SHA256 Hash a424c0fc1ac52e34e6bfd148a8dcc1dcf24aa7bf8b
VirusTotal 检测信息
二、行为分析:
程序启动后调用conectar函数建立与远程服务器的连接,服务器IP地址:118.178.190.138 端口:9981
测试机运行效果:
然后读取远程服务器端传入的指令:
调用parse函数解析指令,并调用bfunc函数执行相应的任务。此程序核心内容皆在bfunc函数里,因此后续主要分析这个函数。bfunc函数依据传入的指令参数有如下功能:
①结束进程:
②列出可处理的指令:
③进行常见的DDoS攻击:
可以看到访问hxxp://server.perpetual.pw/syn.c下载源文件然后调用GCC编译器进行编译,删除后使用命令行./syn + []+[]+[]执行DDoS攻击。经测试这个下载站点已经失效。
可以看到如果收到的指令包含 udp ,则根据收到的IP地址构造UDP包,持续向目标地址和端口发包,直至给定的结束时间。
如果收到的指令包含tcpflood ,则调用tcpflooder函数进行持续时间为 的tcpflood攻击,tcpflooder函数如下:
实现方法很简单,即根据传入的IP地址、端口、持续时间利用socket方法构造TCP包在持续时间内连续对目标发送建立连接的请求。
如果传入的指令包含:sqlflood ,则根据接收的IP地址建立至目标IP地址3306端口的TCP连接,持续时间为 。
Httpflood:
如果传入的指令包含:httpflood ,则根据接收的IP地址建立至目标IP地址80端口的TCP连接,持续时间为 。
④进行常见的hacking功能,如:端口扫描、socks5代理、本地root提权、Google hacking等。
端口扫描:
如果解析出指令包含portscan ,则根据给定IP地址对端口列表进行创建tcp连接遍历,获得开放的端口号。
Socks5代理:
可以看出如果收到的指令为socks5,则下载mocks安装包,并调用system函数执行命令自动化mock的安装与配置完成socksv5的安装,然后获取IP地址:
简单的通过调用ifconfig命令获取,提示可以连接的IP地址和端口。
本地root提权:
如果读取的指令包含rootme则调用”uname -r”和”whoami”命令查看Linux版本号及当前用户。然后根据版本号寻找可用的root工具,版本号列表及对应的root工具存在名为”h”的哈希中:
由于太长只截取一部分,剩余的rootexploits还有:”elfdump”,” expand_stack” ,” h00lyshit”,” kdump”,” km2”,” krad”,”krad3”,” krad3”,” loko”,” mremap_pte”,” newlocal”,” ong_bak”,” ptrace”,”ptrace_kmod”,” ptrace24”,” pwned”,” py2”,” raptor_prctl”,” prctl3”,” remap”,”rip”,” stackgrow2”,” uselib24”,” uselib24”,” smpracer”,” smpracer”,” exp.sh”,”kmdx”,” raptor”,” raptor2”。这部分功能该脚本仅是查询到宿主系统可以用列表中的哪个exploit工具提权,没有后续的提权动作。
发送邮件:
可以看出程序利用linuxsendmail发送邮件,接收指令格式为:sendmail 。
利用各搜索引擎dork技巧查询情报(googlehacking、yahoo、msn、fireball等)
如果接收的指令为 multiscan ,则根据给定的vuln和查询字段dork遍历各大搜索引擎的搜索结果。
由于各个函数原理相同只是查询的url和条数略有区别,因此这里只拿Google做说明,其他类似,google函数:
查询记录条数限制在100条。其他函数皆类似。
擦除痕迹,清理日志:
使用system函数调用rm命令删除日志信息和历史文件。
⑤情报搜集:
安全站点news搜集
如果接收的指令为” milw0rm”则会访问milw0rm站点搜集最新的exploits信息,同样的如果接收到指令packetstorm,则会访问www.packetstormsecurity.org获取最新情报
利用google hacking技术搜集含有sql漏洞的站点
接收指令:sql2 ,然后调用之前google hacking讲到的那些诸如google、msn函数进行查询,返回查询结果
然后构造sql语句测试漏洞情况
至此该脚本的大部分主要功能都已分析完毕,接下来进行简单的溯源。
三、简单溯源
脚本在最开始不传入参数的情况下默认与IP地址为118.178.190.138的server建立连接,查询该IP地址信息如下:
Kail 下nmap扫描该主机,没得到有用信息,估计有防护措施,扫描不到有用的结果:
猜测是部署在阿里云上的云主机,尝试浏览器访问此IP得到如下页面:
显示为“向向游戏平台”。至于是这台server也沦陷了还是….就不得而知了。
这个后门程序类似于之前网上有报过的名为” DDoS Perl Bot v1.0”的后门程序,只是功能上要丰富许多,作者应该是国外的,被国内黑客通过修改远程server的IP进行定制,从而实现与自己的C&C server交互。可以跨平台,对于安装了Perl解释器的Windows系统同样可以实现部分功能,不过主要还是针对Linux系统威胁较大,用于渗透后植入后门。总的来说功能虽多但实现的质量和方法确实不高,作为案例分享和思路启发还是有一定意义的。
*本文原创作者douwanhu,属于FreeBuf原创奖励计划,禁止转载
责任编辑:
声明:本文由入驻搜狐号的作者撰写,除搜狐官方账号外,观点仅代表作者本人,不代表搜狐立场。
今日搜狐热点(三)开源IT资产管理系统--&OCS(unix)客户端代理安装
(三)开源IT资产管理系统--&OCS(unix)客户端代理安装
安装Linux/Uuix平台代理的客户端
[root@localhost ~]# yum install -y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-Digest-MD5 perl-Net-SSLeay perl-Crypt-S...
安装Linux/Uuix平台代理的客户端
[root@localhost ~]# yum install -y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-Digest-MD5 perl-Net-SSLeay perl-Crypt-SSLeay perl-XML-SAX perl-XML-LibXML Perl-Proc-Daemon perl-PID-File
安装过程提示无法yum到包
Setting up Install Process
No package Perl-Proc-Daemon available.
No package perl-PID-File available.
Package perl-Digest-MD5 is obsoleted by perl, trying to install 4:perl-5.8.8-32.el5_5.2.i386 instead
Resolving Dependencies
直接运行以下命令:
[root@localhost ~]# perl -MCPAN -e 'install Proc::Daemon'
注意:第一次运行perl –MCPAN命令来实现自动安装模块,会提示安装CPAM,一路回车下去,直接最后设置镜像,再选择镜像地址就OK
(Comprehensive Perl Archive Network(CPAN),CPAN 可以以两种方式工作:通过交互 shell 或通过一系列函数,可以将这些函数用作范围较广泛的基于 Perl 脚本的解决方案的一部分。最简单地说,可以使用 CPAN,只通过输入 perl -MCPAN -e "install modulename" 来安装模块,其中 modulename是要安装的包、绑定或完整 Perl 模块的名称)
[root@localhost ~]# perl -MCPAN -e 'install Proc::PID::File'
从镜像点下载下来的包会保存在以下目录
[root@localhost ~]# ll /root/.cpan/build/
drwxr-xr-x 4 root root
01:22 Proc-Daemon-0.07
drwxr-xr-x 2 500 users
01:24 Proc-PID-File-1.27
[root@localhost ~]# cd /root/soft/
[root@localhostsoft]#Wget http://launchpad.net/ocsinventory-unix-agent/stable-2.0/2.0rc2/+download/Ocsinventory-Agent-2.0rc2.tar.gz
速度很慢!要有点耐心哦
[root@localhost soft]# tar -zxvf Ocsinventory-Agent-2.0rc2.tar.gz
[root@localhost soft]# cd Ocsinventory-Agent-2.0rc2
[root@localhost Ocsinventory-Agent-2.0rc2]# ll
-rw-r--r-- 1
289 02-12 04:27 AUTHORS
-rw-r--r-- 1 114 02-12 04:27 Changes
drwxr-xr-x 2
04:29 contrib
drwxr-xr-x 7
drwxr-xr-x 3
drwxr-xr-x 3
-rw-r--r-- 1 987 02-12 04:27 LICENSE
-rw-r--r-- 1
04:27 Makefile.PL
-rw-r--r-- 1 728 02-12 04:29 MANIFEST
-rw-r--r-- 1
04:27 memconf
-rw-r--r-- 1
646 02-12 04:29 META.yml
-rwxr-xr-x 1
04:27 ocsinventory-agent
-rwxr-xr-x 1 655 02-12 04:27 postinst.pl
-rw-r--r-- 1
04:27 README
drwxr-xr-x 4
04:29 resources
-rw-r--r-- 1
0 02-12 04:29 run-postinst
-rw-r--r-- 1
04:27 THANKS
drwxr-xr-x 3
04:29 tools
[root@localhost Ocsinventory-Agent-2.0rc2]# perl Makefile.PL
Please install Compress::Zlib if you use an OCS server prior 1.02.
Please install Crypt::SSLeay if you want to use SSL.
Please install Net::SSLeay if you want to use the software deployment.
Please install nmap or ipdiscover if you want to use the network discover feature.
Net::IP is strongly recommended since it's required to retrieve network information
Please install Proc::Daemon and Proc::PID::File if you want to use the daemon monde.
Checking if your kit is complete...
Looks good
Warning: prerequisite ExtUtils::MakeMaker 6.42 not found. We have 6.30.
Warning: prerequisite LWP 0 not found.
Warning: prerequisite XML::Simple 0 not found.
Writing Makefile for Ocsinventory::Agent
注意:ExtUtils直接更新一下新版本就OK
然后perl Makefile.pl make make install
郁闷的是,centos最小化安装尽然没带make命令,提示
[root@localhost Ocsinventory-Agent-2.0rc2]# make
-bash: make: command not found
解决办法:yum -y install gcc automake autoconf libtool make
接着解决LWP XML-Simple问题,由于XML-Simple的安装包关联到LWP(perl-libwww-perl)包,所以直接yum install perl-XML-Simple就会自动安装上LWP模块
接着重新运行以上命令
[root@localhost Ocsinventory-Agent-2.0rc2]# perl Makefile.PL
Please install Crypt::SSLeay if you want to use SSL.
Please install Net::SSLeay if you want to use the software deployment.
Net::IP is strongly recommended since it's required to retrieve network information
Please install Proc::Daemon and Proc::PID::File if you want to use the daemon monde.
Writing Makefile for Ocsinventory::Agent
问题都解决了,下一步直接编译
[root@localhost Ocsinventory-Agent-2.0rc2]#make;make install
以下提示一路回车
Do you want to configure the agent
Please enter 'y' or 'n'?& [y]
Where do you want to write the configuration file?
0 -& /etc/ocsinventory
1 -& /usr/local/etc/ocsinventory
2 -& /etc/ocsinventory-agent
?& 2 (选择配置文件存放目录)
Do you want to create the directory /etc/ocsinventory-agent?
Please enter 'y' or 'n'?& [y]
[info] The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,
What is the address of your ocs server?& [ocsinventory-ng] 192.168.50.92(输入ocsinventory-server的ip地址)
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?& [n]
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?& [y] (该服务器是否使用管理标签)
(显示在web管理控制界面中)
ocsinventory agent presents: /usr/bin/ocsinventory-agent
Where do you want the agent to store its files? (You probably don't need to change it)?& [/var/lib/ocsinventory-agent]
Do you want to create the /var/lib/ocsinventory-agent directory?
Please enter 'y' or 'n'?& [y]
New settings written! Thank you for using OCS Inventory
Should I remove the old linux_agent
Please enter 'y' or 'n'?& [n]
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?& [y]
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?& [y]
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?& [y]
[info] Accountinfo file doesn't exist. I create an empty one.
-& Success!
看到以上信息,说明安装成功
[root@localhost Ocsinventory-Agent-2.0rc2]# ocsinventory-agent –debug
………………………………………….省略
[debug] Calling handlers : `end_handler'
如果没提示error说明安装OK!
登录OCS服务器端,界面会显示刚刚加入的设备
显示更多信息,可以自己随意加载专栏模块,如下图
本文转自viong 51CTO博客,原文链接:http://blog.51cto.com/viong/503694,如需转载请自行联系原作者
用云栖社区APP,舒服~
【云栖快讯】新手小白必看!编程语言系列讲座火爆进行中,与行业资深专家一起学习Python、C++、JavaScript、Java!从入门到进阶&&
文章22141篇
一种高性能、高可靠、可平滑扩容的分布式内存数据库服务。
通过在客户自己的数据中心内交付完整的阿里云软件堆栈,阿里云专有云帮助政企客户向混合云架构平滑...
为金融行业提供量身定制的云计算服务,具备低成本、高弹性、高可用、安全合规的特性。帮助金融客户...
为您提供简单高效、处理能力可弹性伸缩的计算服务,帮助您快速构建更稳定、安全的应用,提升运维效...
订阅广场全新上线

我要回帖

更多关于 perl 查看安装模块 的文章

 

随机推荐