Skip to content

Commit df9c5f4

Browse files
timwrTim Wright
authored andcommitted
remove unused resources and fix whitespace
1 parent 32bd812 commit df9c5f4

File tree

8 files changed

+124
-156
lines changed

8 files changed

+124
-156
lines changed

external/source/javapayload/androidpayload/app/pom.xml

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<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/maven-v4_0_0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<groupId>com.metasploit</groupId>
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.metasploit</groupId>
55
<artifactId>Metasploit-AndroidPayload</artifactId>
6-
<version>1-SNAPSHOT</version>
7-
<packaging>apk</packaging>
8-
<name>AndroidPayload for Metasploit</name>
6+
<version>1-SNAPSHOT</version>
7+
<packaging>apk</packaging>
8+
<name>AndroidPayload for Metasploit</name>
99

10-
<dependencies>
11-
<dependency>
12-
<groupId>com.google.android</groupId>
13-
<artifactId>android</artifactId>
14-
<version>1.6_r2</version>
15-
<scope>provided</scope>
16-
</dependency>
17-
</dependencies>
18-
<build>
19-
<finalName>${project.artifactId}</finalName>
20-
<sourceDirectory>src</sourceDirectory>
21-
<pluginManagement>
22-
<plugins>
23-
<plugin>
24-
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
25-
<artifactId>android-maven-plugin</artifactId>
26-
<version>3.5.3</version>
10+
<dependencies>
11+
<dependency>
12+
<groupId>com.google.android</groupId>
13+
<artifactId>android</artifactId>
14+
<version>1.6_r2</version>
15+
<scope>provided</scope>
16+
</dependency>
17+
</dependencies>
18+
<build>
19+
<finalName>${project.artifactId}</finalName>
20+
<sourceDirectory>src</sourceDirectory>
21+
<pluginManagement>
22+
<plugins>
23+
<plugin>
24+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
25+
<artifactId>android-maven-plugin</artifactId>
26+
<version>3.5.3</version>
2727

28-
<extensions>true</extensions>
29-
</plugin>
30-
</plugins>
31-
</pluginManagement>
32-
<plugins>
33-
<plugin>
34-
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
35-
<artifactId>android-maven-plugin</artifactId>
36-
<configuration>
37-
<sdk>
38-
<!-- platform or api level (api level 4 = platform 1.6)-->
39-
<platform>3</platform>
40-
</sdk>
41-
</configuration>
42-
</plugin>
43-
</plugins>
44-
</build>
45-
<profiles>
28+
<extensions>true</extensions>
29+
</plugin>
30+
</plugins>
31+
</pluginManagement>
32+
<plugins>
33+
<plugin>
34+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
35+
<artifactId>android-maven-plugin</artifactId>
36+
<configuration>
37+
<sdk>
38+
<!-- platform or api level (api level 4 = platform 1.6)-->
39+
<platform>3</platform>
40+
</sdk>
41+
</configuration>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
<profiles>
4646
<profile>
4747
<!-- deploy built files to Metasploit data directory -->
4848
<id>deploy</id>
@@ -59,13 +59,13 @@
5959
</goals>
6060
<configuration>
6161
<target>
62-
<unzip src="${project.basedir}/target/${project.build.finalName}.apk" dest="${project.basedir}/../../../../../data/android/apk" >
63-
<patternset>
64-
<exclude name="META-INF/**"/>
65-
</patternset>
66-
</unzip>
67-
</target>
68-
</configuration>
62+
<unzip src="${project.basedir}/target/${project.build.finalName}.apk" dest="${project.basedir}/../../../../../data/android/apk" >
63+
<patternset>
64+
<exclude name="META-INF/**"/>
65+
</patternset>
66+
</unzip>
67+
</target>
68+
</configuration>
6969
</execution>
7070
</executions>
7171
</plugin>

external/source/javapayload/androidpayload/library/AndroidManifest.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,4 @@
33
package="com.metasploit.stage"
44
android:versionCode="1"
55
android:versionName="1.0">
6-
<application android:label="@string/app_name">
7-
<activity android:name=".MainActivity"
8-
android:label="@string/app_name">
9-
<intent-filter>
10-
<action android:name="android.intent.action.MAIN" />
11-
<category android:name="android.intent.category.LAUNCHER" />
12-
</intent-filter>
13-
</activity>
14-
</application>
156
</manifest>
Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,60 @@
1-
21
<?xml version="1.0" encoding="UTF-8"?>
32
<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/maven-v4_0_0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.metasploit</groupId>
6-
<artifactId>Metasploit-</artifactId>
7-
<version>1-SNAPSHOT</version>
8-
<packaging>apk</packaging>
9-
<name>Android Meterpreter</name>
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.metasploit</groupId>
5+
<artifactId>Metasploit-</artifactId>
6+
<version>1-SNAPSHOT</version>
7+
<packaging>apk</packaging>
8+
<name>Android Meterpreter</name>
109

11-
<dependencies>
12-
<dependency>
13-
<groupId>com.google.android</groupId>
14-
<artifactId>android</artifactId>
15-
<version>1.6_r2</version>
16-
<scope>provided</scope>
17-
</dependency>
18-
<dependency>
19-
<groupId>com.metasploit</groupId>
20-
<artifactId>Metasploit-JavaPayload</artifactId>
21-
<version>${project.version}</version>
22-
</dependency>
23-
<dependency>
24-
<groupId>com.metasploit</groupId>
25-
<artifactId>Metasploit-Java-Meterpreter</artifactId>
26-
<version>${project.version}</version>
27-
</dependency>
28-
<dependency>
29-
<groupId>com.metasploit</groupId>
30-
<artifactId>Metasploit-Java-Meterpreter-stdapi</artifactId>
31-
<version>${project.version}</version>
32-
</dependency>
33-
</dependencies>
34-
<build>
35-
<finalName>${project.artifactId}</finalName>
36-
<sourceDirectory>src</sourceDirectory>
37-
<pluginManagement>
38-
<plugins>
39-
<plugin>
40-
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
41-
<artifactId>android-maven-plugin</artifactId>
42-
<version>3.5.3</version>
10+
<dependencies>
11+
<dependency>
12+
<groupId>com.google.android</groupId>
13+
<artifactId>android</artifactId>
14+
<version>1.6_r2</version>
15+
<scope>provided</scope>
16+
</dependency>
17+
<dependency>
18+
<groupId>com.metasploit</groupId>
19+
<artifactId>Metasploit-JavaPayload</artifactId>
20+
<version>${project.version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>com.metasploit</groupId>
24+
<artifactId>Metasploit-Java-Meterpreter</artifactId>
25+
<version>${project.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>com.metasploit</groupId>
29+
<artifactId>Metasploit-Java-Meterpreter-stdapi</artifactId>
30+
<version>${project.version}</version>
31+
</dependency>
32+
</dependencies>
33+
<build>
34+
<finalName>${project.artifactId}</finalName>
35+
<sourceDirectory>src</sourceDirectory>
36+
<pluginManagement>
37+
<plugins>
38+
<plugin>
39+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
40+
<artifactId>android-maven-plugin</artifactId>
41+
<version>3.5.3</version>
4342

44-
<extensions>true</extensions>
45-
</plugin>
46-
</plugins>
47-
</pluginManagement>
48-
<plugins>
49-
<plugin>
50-
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
51-
<artifactId>android-maven-plugin</artifactId>
52-
<configuration>
53-
<sdk>
54-
<!-- platform or api level (api level 4 = platform 1.6)-->
55-
<platform>3</platform>
56-
</sdk>
57-
</configuration>
58-
</plugin>
59-
</plugins>
60-
</build>
61-
</project>
43+
<extensions>true</extensions>
44+
</plugin>
45+
</plugins>
46+
</pluginManagement>
47+
<plugins>
48+
<plugin>
49+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
50+
<artifactId>android-maven-plugin</artifactId>
51+
<configuration>
52+
<sdk>
53+
<!-- platform or api level (api level 4 = platform 1.6)-->
54+
<platform>3</platform>
55+
</sdk>
56+
</configuration>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
</project>

external/source/javapayload/androidpayload/library/res/layout/main.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

external/source/javapayload/androidpayload/library/res/values/strings.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

external/source/javapayload/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
<module>javapayload</module>
4747
<module>meterpreter</module>
4848
<module>version-compatibility-check</module>
49-
<module>androidpayload/app</module>
50-
<module>androidpayload/library</module>
49+
<module>androidpayload/app</module>
50+
<module>androidpayload/library</module>
5151
</modules>
5252
<prerequisites>
5353
<maven>3.0</maven>

lib/msf/core/payload/dalvik.rb

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
# -*- coding: binary -*-
22
require 'msf/core'
3-
require 'pp'
4-
require 'rex/ui/text/dispatcher_shell'
53

64
module Msf::Payload::Dalvik
75

86
#
9-
# Fix the dex header checksum and signature
10-
# http://source.android.com/tech/dalvik/dex-format.html
7+
# Fix the dex header checksum and signature
8+
# http://source.android.com/tech/dalvik/dex-format.html
119
#
12-
def fix_dex_header(dexfile)
13-
dexfile = dexfile.unpack('a8LH40a*')
14-
dexfile[2] = Digest::SHA1.hexdigest(dexfile[3])
15-
dexfile[1] = Zlib::adler32(dexfile[2..-1].pack('H40a*'))
16-
dexfile.pack('a8LH40a*')
17-
end
18-
10+
def fix_dex_header(dexfile)
11+
dexfile = dexfile.unpack('a8LH40a*')
12+
dexfile[2] = Digest::SHA1.hexdigest(dexfile[3])
13+
dexfile[1] = Zlib::adler32(dexfile[2..-1].pack('H40a*'))
14+
dexfile.pack('a8LH40a*')
15+
end
16+
1917
#
20-
# We could compile the .class files with dx here
18+
# We could compile the .class files with dx here
2119
#
22-
def generate_stage
23-
end
20+
def generate_stage
21+
end
2422

2523
#
2624
# Used by stagers to construct the payload jar file as a String
2725
#
2826
def generate
29-
generate_jar.pack
27+
generate_jar.pack
3028
end
3129

3230
end

modules/payloads/stagers/android/reverse_tcp.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
require 'msf/core/handler/reverse_tcp'
1010
require 'msf/base/sessions/command_shell'
1111
require 'msf/base/sessions/command_shell_options'
12-
require 'zlib'
13-
require 'digest/sha1'
1412

1513
module Metasploit3
1614

@@ -27,7 +25,7 @@ def initialize(info = {})
2725
'Arch' => ARCH_DALVIK,
2826
'Handler' => Msf::Handler::ReverseTcp,
2927
'Stager' => {'Payload' => ""}
30-
))
28+
))
3129
end
3230

3331
def string_sub(data, placeholder, input)
@@ -39,10 +37,9 @@ def generate_jar(opts={})
3937

4038
classes = File.read(File.join(Msf::Config::InstallRoot, 'data', 'android', 'apk', 'classes.dex'))
4139

42-
string_sub(classes, '127.0.0.1 ', datastore['LHOST'].to_s) if datastore['LHOST']
43-
string_sub(classes, '4444 ', datastore['LPORT'].to_s) if datastore['LPORT']
44-
45-
jar.add_file("classes.dex", fix_dex_header(classes))
40+
string_sub(classes, '127.0.0.1 ', datastore['LHOST'].to_s) if datastore['LHOST']
41+
string_sub(classes, '4444 ', datastore['LPORT'].to_s) if datastore['LPORT']
42+
jar.add_file("classes.dex", fix_dex_header(classes))
4643

4744
files = [
4845
[ "AndroidManifest.xml" ],
@@ -51,8 +48,8 @@ def generate_jar(opts={})
5148
[ "resources.arsc" ]
5249
]
5350

54-
jar.add_files(files, File.join(Msf::Config.install_root, "data", "android", "apk"))
55-
jar.build_manifest
51+
jar.add_files(files, File.join(Msf::Config.install_root, "data", "android", "apk"))
52+
jar.build_manifest
5653

5754
#jar.sign(@key, @cert, @ca_certs) '~/.android/debug.keystore' -sigalg MD5withRSA -digestalg SHA1?
5855

0 commit comments

Comments
 (0)