GalaxyVPN v1.2.3版本的 MD5 值为:642e5f69966a3849933084f3c0fba1d5
以下内容为反编译后的 HostnameFinder.java 源代码,内容仅作参考
package com.neko.hostnamefinder;
import android.content.ClipboardManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import com.v2ray.ang.R;
import com.v2ray.ang.ui.BaseActivity;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Random;
import org.json.JSONArray;
import org.json.JSONObject;
public class HostnameFinder extends BaseActivity {
private static final int PERMISSION_REQUEST_CODE = 1;
private ImageView Copiar;
private EditText Ipscan;
private int REQUEST_MANAGE_EXTERNAL_STORAGE = 3123;
private EditText Result;
private TextView ResultCont;
private Button btn;
private Handler mHandler;
private CompoundButton salvelocal;
public class AnonymousClass7 implements Runnable {
final String val$ip;
AnonymousClass7(String str) {
this.val$ip = str;
}
@Override
public void run() {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://domains.yougetsignal.com/domains.php").openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("X-Requested-With", "XMLHttpRequest");
httpURLConnection.setDoOutput(true);
httpURLConnection.getOutputStream().write(("remoteAddress=" + URLEncoder.encode(this.val$ip, "UTF-8")).getBytes("UTF-8"));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
final String readLine = bufferedReader.readLine();
if (readLine != null) {
HostnameFinder.this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(readLine);
try {
JSONObject jSONObject = new JSONObject(readLine.toString());
String string = jSONObject.getString(NotificationCompat.CATEGORY_STATUS);
if (!string.contains("Success")) {
if (string.contains("Fail")) {
String string2 = jSONObject.getString("message");
HostnameFinder.this.Result.setText(string2);
if (string2.contains("Daily reverse IP check limit reached")) {
HostnameFinder.this.ResultCont.setText(Html.fromHtml("<span style=\"color:#ff0000\">Daily query limit reached</span>"));
return;
} else if (string2.contains("Invalid remote address.")) {
HostnameFinder.this.ResultCont.setText(Html.fromHtml("<span style=\"color:#ff0000\">Invalid remote address</span>"));
return;
} else {
return;
}
}
return;
}
JSONArray jSONArray = jSONObject.getJSONArray("domainArray");
String string3 = jSONObject.getString("domainCount");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < jSONArray.length(); i++) {
String replace = jSONArray.getString(i).replace("[\"", "").replace("\",\"\"]", "");
sb.append(replace + "\n");
}
HostnameFinder.this.Result.setText(sb.toString());
TextView textView = HostnameFinder.this.ResultCont;
textView.setText("Results Found: " + string3);
if (HostnameFinder.this.salvelocal.isChecked()) {
HostnameFinder.this.checkfolder(sb.toString(), String.format("%05d", Integer.valueOf(new Random().nextInt(100000))));
}
} catch (Exception e) {
HostnameFinder.this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(e.toString());
HostnameFinder.this.ResultCont.setText("");
e.printStackTrace();
}
});
}
}
});
}
bufferedReader.close();
} catch (Exception e) {
HostnameFinder.this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(e.toString());
HostnameFinder.this.ResultCont.setText("");
e.printStackTrace();
}
});
}
}
}
public void CopieText(final String str) {
try {
((ClipboardManager) getSystemService("clipboard")).setText(str);
this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(str.toString());
Toast.makeText(HostnameFinder.this, "Results have been copied", 1).show();
}
});
} catch (Exception e) {
e.printStackTrace();
this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(str.toString());
Toast.makeText(HostnameFinder.this, e.toString(), 1).show();
}
});
}
}
private void checkfile(File file, String str, String str2) {
File file2 = new File(file, String.format("%s.%s", str2, "txt"));
if (!file2.exists()) {
try {
try {
file2.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
} catch (IOException unused) {
throw new IOException("Error creating file");
}
}
savefile(file2, str);
}
public void checkfolder(String str, String str2) {
File file = new File(Environment.getExternalStorageDirectory(), "Hostname Finder");
if (!file.exists()) {
file.mkdir();
}
checkfile(file, str, str2);
}
public boolean requestPermissionInfo() {
if (Build.VERSION.SDK_INT < 30) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
return true;
}
ActivityCompat.requestPermissions((BaseActivity) this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1);
return false;
} else if (Environment.isExternalStorageManager()) {
return true;
} else {
Intent intent = new Intent("android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION");
intent.setData(Uri.fromParts("package", getPackageName(), null));
startActivityForResult(intent, this.REQUEST_MANAGE_EXTERNAL_STORAGE);
return false;
}
}
private void savefile(File file, String str) {
try {
FileWriter fileWriter = new FileWriter(file, true);
fileWriter.write(str);
fileWriter.close();
Toast.makeText(this, "Saved in: " + file.toString(), 1).show();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void scan() {
try {
String obj = this.Ipscan.getText().toString();
if (obj.isEmpty()) {
this.mHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(HostnameFinder.this, "Please enter the IP or Hostname first", 0).show();
}
});
} else {
this.Result.setText("");
this.ResultCont.setText("Searching...");
this.mHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(HostnameFinder.this, "Searching...", 0).show();
}
});
new Thread(new AnonymousClass7(obj)).start();
}
} catch (Exception e) {
this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(e.toString());
HostnameFinder.this.ResultCont.setText("");
e.printStackTrace();
}
});
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.uwu_hostname_finder);
this.Ipscan = (EditText) findViewById(R.id.Ipscan);
this.Result = (EditText) findViewById(R.id.Textresult);
this.ResultCont = (TextView) findViewById(R.id.ResultCont);
this.btn = (Button) findViewById(R.id.button);
this.Copiar = (ImageView) findViewById(R.id.copy);
this.mHandler = new Handler();
this.salvelocal = (CompoundButton) findViewById(R.id.save);
this.btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
HostnameFinder.this.scan();
} catch (Exception e) {
HostnameFinder.this.mHandler.post(new Runnable() {
@Override
public void run() {
HostnameFinder.this.Result.setText(e.toString());
HostnameFinder.this.ResultCont.setText("");
e.printStackTrace();
}
});
}
}
});
this.Copiar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
HostnameFinder hostnameFinder = HostnameFinder.this;
hostnameFinder.CopieText(hostnameFinder.Result.getText().toString());
}
});
this.salvelocal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (z) {
if (!HostnameFinder.this.requestPermissionInfo()) {
HostnameFinder.this.salvelocal.setChecked(false);
return;
}
File file = new File(Environment.getExternalStorageDirectory(), "Hostname Finder");
if (file.exists()) {
return;
}
file.mkdir();
HostnameFinder.this.mHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(HostnameFinder.this, "A folder named Hostname Finder has been created on your storage.", 1).show();
}
});
}
}
});
}
}