# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $

PortSystem 1.0
name		metasploit3
version		3.0
revision	0
categories	security
maintainers	darkart.com:opendarwin.org
description	Tools and information for security research and pentesting
homepage	http://metasploit.com/
platforms	darwin

long_description \
		The Metasploit Project goal is to provide useful information to people \
		who perform penetration testing, IDS signature development, and exploit \
		research. This framework was created to fill the gaps in the information \
		publicly available on various exploitation techniques and to create a \
		useful resource for exploit developers. The tools and information are \
		provided for legal security research and testing purposes only.

master_sites	http://framework.metasploit.com/releases/

distfiles	framework-${version}.tar.gz
worksrcdir	framework-${version}

checksums	md5 ab98f0a09b371f9638c7f49f1b83f5c4 \
		sha1 e6636cb5849f2403c8b6a8812205f4a249d63df3

depends_lib	port:ruby \
		port:rb-rails \
		port:readline 

patchfiles	patch-data-msfweb-config-environment.rb	\
		patch-msfcli				\
		patch-msfconsole			\
		patch-msfd				\
		patch-msfencode				\
		patch-msfgui				\
		patch-msfopcode				\
		patch-msfpayload			\
		patch-msfpescan				\
		patch-msfweb				\
		patch-tools-module_license.rb		\
		patch-tools-msf_irb_shell.rb


use_configure   no
build           {
			## remove the .svn/ directories, no need to move them around
			system "cd ${worksrcpath} && find . -type d -name '\.svn' | xargs /bin/rm -rf"
			foreach file [glob -directory ${worksrcpath} msf*] {
				reinplace "s|#!/usr/bin/perl|#!${prefix}/bin/perl|" $file
			}
		}
destroot        { 
			set metasploitTargetDir "libexec/metasploit3"
			xinstall -d -m 755 ${destroot}/${prefix}/${metasploitTargetDir}
			foreach file [glob -directory ${workpath}/${worksrcdir} *]  {
				file copy ${file} ${destroot}/${prefix}/${metasploitTargetDir}
			}
			foreach file [glob -directory ${destroot}/${prefix}/${metasploitTargetDir} msf*]  {
				set useFile [file tail ${file}]
## 'file link' doesn't play nice, it doesn't (seem) to want to do relative paths...
##				file link -symbolic ${useFile} ../${metasploitTargetDir}/${useFile}
## so use 'system "ln -s ..."' instead.
				system "cd ${destroot}/${prefix}/sbin && /bin/ln -s ../${metasploitTargetDir}/${useFile} ${useFile}"
			}
		 }



#
##EOF
