├── Support
└── bin
│ ├── smali.jar
│ ├── baksmali.jar
│ ├── split-multiple-smali.perl
│ ├── smali
│ └── baksmali
├── README.md
├── info.plist
└── Commands
├── Import dex as smali.tmCommand
├── Export smali as dex.tmCommand
└── Android NDK Build.tmCommand
/Support/bin/smali.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/Dalvik.tmbundle/master/Support/bin/smali.jar
--------------------------------------------------------------------------------
/Support/bin/baksmali.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/Dalvik.tmbundle/master/Support/bin/baksmali.jar
--------------------------------------------------------------------------------
/Support/bin/split-multiple-smali.perl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | undef $/;
4 | $_ = <>;
5 | $n = 0;
6 |
7 | for $match (split(/(?=[.]class)/)) {
8 | open(O, '>split' . $n++ . '.smali');
9 | print O $match;
10 | close(O);
11 | }
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android Dalvik bytecode hacking with TextMate 2
2 |
3 | * Open a `dex` file in TextMate.
4 | * It'll show you the bytecode as smali code.
5 | * Edit the smali code.
6 | * Save the `dex` file
7 | * It'll convert it back into bytecode
8 |
9 | You can also keep a dex file open in TextMate. When you recompile the dex code it'll update automatically. It's pretty hip, even if I do say so myself ;)
10 |
--------------------------------------------------------------------------------
/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | contactEmailRot13
6 | gubznf@fhogyrtenqvrag.pbz
7 | contactName
8 | Thomas Aylott
9 | description
10 | Dalvik bytecode
11 | name
12 | Android
13 | uuid
14 | DB1F9CDD-56F1-4526-845E-7F47C6BA526E
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Commands/Import dex as smali.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | rm -rf "${TMPDIR}baksmali"
10 | "${TM_BUNDLE_SUPPORT}/bin/baksmali" "$TM_FILEPATH" --output "${TMPDIR}baksmali"
11 | find "${TMPDIR}baksmali" -name *.smali|sort -r|xargs cat
12 |
13 | contentMatch
14 | \Adex
15 | input
16 | document
17 | inputFormat
18 | text
19 | name
20 | Import dex as smali
21 | outputCaret
22 | afterOutput
23 | outputFormat
24 | text
25 | outputLocation
26 | replaceDocument
27 | scope
28 | attr.rev-path.dex, attr.rev-path.odex
29 | semanticClass
30 | callback.document.binary-import
31 | uuid
32 | 5B74760D-DD85-4CA7-940B-FFD745D20D60
33 | version
34 | 2
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Commands/Export smali as dex.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | rm -rf "${TMPDIR}smali"
10 | mkdir "${TMPDIR}smali"
11 | cd "${TMPDIR}smali"
12 |
13 | "${TM_BUNDLE_SUPPORT}/bin/split-multiple-smali.perl"
14 |
15 | "${TM_BUNDLE_SUPPORT}/bin/smali" "${TMPDIR}smali" --output "${TMPDIR}out.dex"
16 |
17 | cat "${TMPDIR}out.dex"
18 |
19 | input
20 | document
21 | inputFormat
22 | text
23 | name
24 | Export smali as dex
25 | outputCaret
26 | afterOutput
27 | outputFormat
28 | text
29 | outputLocation
30 | replaceDocument
31 | scope
32 | attr.rev-path.dex, attr.rev-path.odex
33 | semanticClass
34 | callback.document.binary-export
35 | uuid
36 | 7480A19E-EEAC-4D9A-B0D7-8D78A3DB4B63
37 | version
38 | 2
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Commands/Android NDK Build.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | saveActiveFile
7 | command
8 | #!/usr/bin/env bash -l
9 | cd "$(dirname "$TM_FILEPATH")/.."
10 |
11 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
12 |
13 | echo '<pre>'
14 | echo '<pre style="color:red">' >&2
15 |
16 | ndk-build -j8 && ant debug && ant installd
17 |
18 | echo '</pre>' >&2
19 | echo '</pre>'
20 |
21 | input
22 | none
23 | inputFormat
24 | text
25 | keyEquivalent
26 | @b
27 | name
28 | Android NDK Build and Install
29 | outputCaret
30 | afterOutput
31 | outputFormat
32 | html
33 | outputLocation
34 | newWindow
35 | scope
36 | attr.rev-path.*.*.jni
37 | uuid
38 | 7ABAC393-D924-4BB7-8A7E-36BF60A8E3B2
39 | version
40 | 2
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Support/bin/smali:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (C) 2007 The Android Open Source Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This script is a wrapper for smali.jar, so you can simply call "smali",
18 | # instead of java -jar smali.jar. It is heavily based on the "dx" script
19 | # from the Android SDK
20 |
21 | # Set up prog to be the path of this script, including following symlinks,
22 | # and set up progdir to be the fully-qualified pathname of its directory.
23 | prog="$0"
24 | while [ -h "${prog}" ]; do
25 | newProg=`/bin/ls -ld "${prog}"`
26 | echo ${newProg}
27 |
28 |
29 | newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
30 | if expr "x${newProg}" : 'x/' >/dev/null; then
31 | prog="${newProg}"
32 | else
33 | progdir=`dirname "${prog}"`
34 | prog="${progdir}/${newProg}"
35 | fi
36 | done
37 | oldwd=`pwd`
38 | progdir=`dirname "${prog}"`
39 | cd "${progdir}"
40 | progdir=`pwd`
41 | prog="${progdir}"/`basename "${prog}"`
42 | cd "${oldwd}"
43 |
44 |
45 | jarfile=smali.jar
46 | libdir="$progdir"
47 | if [ ! -r "$libdir/$jarfile" ]
48 | then
49 | echo `basename "$prog"`": can't find $jarfile"
50 | exit 1
51 | fi
52 |
53 | javaOpts=""
54 |
55 | # If you want DX to have more memory when executing, uncomment the following
56 | # line and adjust the value accordingly. Use "java -X" for a list of options
57 | # you can pass here.
58 | #
59 | javaOpts="-Xmx256M"
60 |
61 | # Alternatively, this will extract any parameter "-Jxxx" from the command line
62 | # and pass them to Java (instead of to dx). This makes it possible for you to
63 | # add a command-line parameter such as "-JXmx256M" in your ant scripts, for
64 | # example.
65 | while expr "x$1" : 'x-J' >/dev/null; do
66 | opt=`expr "$1" : '-J\(.*\)'`
67 | javaOpts="${javaOpts} -${opt}"
68 | shift
69 | done
70 |
71 | if [ "$OSTYPE" = "cygwin" ] ; then
72 | jarpath=`cygpath -w "$libdir/$jarfile"`
73 | else
74 | jarpath="$libdir/$jarfile"
75 | fi
76 |
77 | exec java $javaOpts -jar "$jarpath" "$@"
78 |
--------------------------------------------------------------------------------
/Support/bin/baksmali:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (C) 2007 The Android Open Source Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This script is a wrapper around baksmali.jar, so you can simply call
18 | # "baksmali", instead of java -jar baksmali.jar. It is heavily based on
19 | # the "dx" script from the Android SDK
20 |
21 | # Set up prog to be the path of this script, including following symlinks,
22 | # and set up progdir to be the fully-qualified pathname of its directory.
23 | prog="$0"
24 | while [ -h "${prog}" ]; do
25 | newProg=`/bin/ls -ld "${prog}"`
26 | echo ${newProg}
27 |
28 |
29 | newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
30 | if expr "x${newProg}" : 'x/' >/dev/null; then
31 | prog="${newProg}"
32 | else
33 | progdir=`dirname "${prog}"`
34 | prog="${progdir}/${newProg}"
35 | fi
36 | done
37 | oldwd=`pwd`
38 | progdir=`dirname "${prog}"`
39 | cd "${progdir}"
40 | progdir=`pwd`
41 | prog="${progdir}"/`basename "${prog}"`
42 | cd "${oldwd}"
43 |
44 |
45 | jarfile=baksmali.jar
46 | libdir="$progdir"
47 | if [ ! -r "$libdir/$jarfile" ]
48 | then
49 | echo `basename "$prog"`": can't find $jarfile"
50 | exit 1
51 | fi
52 |
53 | javaOpts=""
54 |
55 | # If you want DX to have more memory when executing, uncomment the following
56 | # line and adjust the value accordingly. Use "java -X" for a list of options
57 | # you can pass here.
58 | #
59 | javaOpts="-Xmx256M"
60 |
61 | # Alternatively, this will extract any parameter "-Jxxx" from the command line
62 | # and pass them to Java (instead of to dx). This makes it possible for you to
63 | # add a command-line parameter such as "-JXmx256M" in your ant scripts, for
64 | # example.
65 | while expr "x$1" : 'x-J' >/dev/null; do
66 | opt=`expr "$1" : '-J\(.*\)'`
67 | javaOpts="${javaOpts} -${opt}"
68 | shift
69 | done
70 |
71 | if [ "$OSTYPE" = "cygwin" ] ; then
72 | jarpath=`cygpath -w "$libdir/$jarfile"`
73 | else
74 | jarpath="$libdir/$jarfile"
75 | fi
76 |
77 | exec java $javaOpts -jar "$jarpath" "$@"
78 |
--------------------------------------------------------------------------------