-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcustom_rules.xml
86 lines (77 loc) · 4.03 KB
/
custom_rules.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<xmlproperty file="AndroidManifest.xml" prefix="mymanifest" collapseAttributes="true"/>
<property name="libs.dir" value="libs" />
<property name="svmp-protocol-def" value="svmp-protocol-def" />
<property name="build.libs.dir" value="build-libs" />
<property name="client.truststore.file" value="res/raw/client_truststore.bks" />
<!-- Must match the value of TRUSTSTORE_PASSWORD in src/org/mitre/svmp/Constants.java -->
<property name="client.truststore.password" value="changeme_clienttstorepass" />
<target name="-pre-build" depends="import_client_truststore_certs" />
<target name="-pre-compile">
<echo>ORIGINAL jars.path : ${toString:project.all.jars.path}</echo>
<path id="project.all.jars.path.temp">
<path path="${toString:project.all.jars.path}" />
<path path="${svmp-protocol-def}/protobuf-2.5.0/protobuf-java-2.5.0.jar" />
</path>
<path id="project.all.jars.path">
<path path="${toString:project.all.jars.path.temp}" />
</path>
<echo>HACKED jars.path : ${toString:project.all.jars.path}</echo>
</target>
<target name="get_bouncycastle">
<mkdir dir="${build.libs.dir}" />
<get src="http://central.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.51/bcprov-jdk15on-1.51.jar"
dest="${build.libs.dir}/bcprov.jar"
verbose="true"
usetimestamp="true" />
</target>
<target name="create_client_truststore" depends="get_bouncycastle">
<echo>Creating empty keystore ${client.truststore.file}</echo>
<mkdir dir="res/raw/" />
<exec executable="keytool" failonerror="true">
<arg line="-genkey -alias foo -dname 'CN=nobody' -keypass 123456"/>
<arg line="-keystore ${client.truststore.file}" />
<arg line="-storetype BKS" />
<arg line="-providerclass org.bouncycastle.jce.provider.BouncyCastleProvider" />
<arg line="-providerpath ${build.libs.dir}/bcprov.jar" />
<arg line="-storepass ${client.truststore.password}" />
</exec>
<exec executable="keytool" failonerror="true">
<arg line="-delete -alias foo" />
<arg line="-keystore ${client.truststore.file}" />
<arg line="-storetype BKS" />
<arg line="-providerclass org.bouncycastle.jce.provider.BouncyCastleProvider" />
<arg line="-providerpath ${build.libs.dir}/bcprov.jar" />
<arg line="-storepass ${client.truststore.password}" />
</exec>
<exec executable="keytool" failonerror="true">
<arg line="-list" />
<arg line="-keystore ${client.truststore.file}" />
<arg line="-storetype BKS" />
<arg line="-providerclass org.bouncycastle.jce.provider.BouncyCastleProvider" />
<arg line="-providerpath ${build.libs.dir}/bcprov.jar" />
<arg line="-storepass ${client.truststore.password}" />
</exec>
</target>
<target name="import_client_truststore_certs" depends="create_client_truststore">
<echo>Importing server_certs/*.pem to client_truststore.bks</echo>
<apply executable="keytool" verbose="true">
<arg line="-import -v -noprompt -trustcacerts" />
<arg line="-keystore ${client.truststore.file}" />
<arg line="-storetype BKS" />
<arg line="-providerclass org.bouncycastle.jce.provider.BouncyCastleProvider" />
<arg line="-providerpath ${build.libs.dir}/bcprov.jar" />
<arg line="-storepass ${client.truststore.password}" />
<arg value="-alias" />
<targetfile/>
<arg value="-file" />
<srcfile/>
<fileset dir="server_certs" includes="*.pem" casesensitive="false"/>
<mapper type="glob" from="*.pem" to="*" />
</apply>
</target>
<target name="-pre-clean">
<delete file="${client.truststore.file}" verbose="true"/>
</target>
</project>