1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-12-21 05:35:54 +01:00
metasploit-payloads/java/javapayload/pom.xml
Michael Schierl 216c85996e Fix relative paths to Metasploit repository
As this repo it is no longer in external/source directory, the deploy
targets need to know where the Framework repository is. This defaults to
../metasploit-framework, but can be changed via -D deploy.path= command
line switch.
2013-06-12 23:44:57 +02:00

145 lines
4.8 KiB
XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-JavaPayload</artifactId>
<parent>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-JavaPayload-parent</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<name>JavaPayload for Metasploit</name>
<url>http://www.metasploit.com/</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- deploy built files to Metasploit data directory -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="${project.basedir}/../${deploy.path}/data/java">
<fileset dir="${project.basedir}/target/classes">
<exclude name="metasploit/PayloadApplet.class" />
<exclude name="rmi/**" />
<exclude name="metasploit.dat" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- build example JARs -->
<id>examples</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- example: spawning bind -->
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
<entry key="Spawn" value="2" />
<entry key="LPORT" value="5555" />
</propertyfile>
<jar destfile="${project.basedir}/example-spawn-bind.jar">
<manifest>
<attribute name="Main-Class" value="metasploit.Payload" />
</manifest>
<fileset dir="${project.basedir}/target/classes">
<include name="metasploit/Payload.class" />
<include name="metasploit.dat" />
</fileset>
</jar>
<delete file="${project.basedir}/target/classes/metasploit.dat" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- build dummy jar used for capturing communication and for testing RMI injection -->
<id>buildrmi</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
<entry key="LPORT" value="4444" />
<entry key="LHOST" value="127.0.0.1" />
</propertyfile>
<mkdir dir="${project.basedir}/target/rmi/build" />
<jar destfile="${project.basedir}/target/rmi/rmidummy.jar">
<manifest>
<attribute name="Main-Class" value="metasploit.Payload" />
</manifest>
<fileset dir="${project.basedir}/target/classes">
<include name="metasploit/RMILoader.class" />
<include name="metasploit/RMIPayload.class" />
<include name="metasploit/Payload.class" />
<include name="metasploit.dat" />
</fileset>
</jar>
<delete file="${project.basedir}/target/classes/metasploit.dat" />
<!-- rename local metasploit/RMILoader.class to ensure a classloader
URL will be serialized -->
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" />
<!-- run the capture server -->
<java classpath="${project.basedir}/target/classes" classname="rmi.RMICaptureServer" dir="${project.basedir}/target/rmi" fork="true" />
<!-- rename back -->
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>