Skip to content

Instantly share code, notes, and snippets.

@rcky844
Created August 3, 2024 14:43
Show Gist options
  • Save rcky844/32dc3e074df6334182e6b510367efdee to your computer and use it in GitHub Desktop.
Save rcky844/32dc3e074df6334182e6b510367efdee to your computer and use it in GitHub Desktop.
Decompilation of Google Play Store's amazing Bussin WebX
package com.retiredlake.napture;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.material.textfield.TextInputEditText;
import org.json.JSONException;
import org.json.JSONObject;
public class MainActivity extends AppCompatActivity {
/* access modifiers changed from: private */
public static final String TAG = "com.retiredlake.napture.MainActivity";
private String api;
private Button btnHome;
private Button btnSubmit;
private String bussUrl = "buss://retiredlake.dev";
/* access modifiers changed from: private */
public String gitHub = "https://htmlpreview.github.io/?";
/* access modifiers changed from: private */
public String homeSite = "https://raw.githubusercontent.com/retiredlake9230/retiredlake9230/main/index.html";
private RequestQueue mRequestQueue;
private StringRequest mStringRequest;
/* access modifiers changed from: private */
public WebView myWebView;
private String searchEngineHtml = "https://raw.githubusercontent.com/face-hh/dingle-frontend/main/index.html";
/* access modifiers changed from: private */
public TextInputEditText txtInput;
private String url = "https://api.buss.lol";
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView((int) R.layout.activity_main);
this.btnHome = (Button) findViewById(R.id.homeButton);
this.btnSubmit = (Button) findViewById(R.id.submitButton);
this.txtInput = (TextInputEditText) findViewById(R.id.urlInput);
WebView webView = (WebView) findViewById(R.id.webView);
this.myWebView = webView;
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
this.myWebView.getSettings().setBlockNetworkImage(true);
this.myWebView.getSettings().setLoadsImagesAutomatically(false);
this.myWebView.getSettings().setAllowFileAccess(false);
this.myWebView.getSettings().setBlockNetworkImage(false);
this.myWebView.getSettings().setLoadsImagesAutomatically(true);
this.myWebView.getSettings().setJavaScriptEnabled(true);
this.myWebView.loadUrl(this.gitHub + this.homeSite);
this.txtInput.setMaxLines(1);
this.txtInput.setEllipsize(TextUtils.TruncateAt.END);
this.txtInput.setSingleLine(true);
this.myWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(final WebView webView, String str) {
new Handler().postDelayed(new Runnable() {
public void run() {
MainActivity.this.getSupportActionBar().setTitle((CharSequence) webView.getTitle());
webView.evaluateJavascript("(function() { document.body.style.backgroundColor = '#121212';document.body.style.color = 'white';})()", (ValueCallback) null);
}
}, 1000);
}
});
this.btnSubmit.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
String splitDomain = UrlParser.splitDomain(MainActivity.this.txtInput.getText().toString());
MainActivity.this.sendAndRequestResponse(splitDomain);
Log.v("MainActivity", "Finished: " + splitDomain);
}
});
this.btnHome.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
MainActivity.this.myWebView.loadUrl(MainActivity.this.gitHub + MainActivity.this.homeSite);
MainActivity.this.myWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(final WebView webView, String str) {
new Handler().postDelayed(new Runnable() {
public void run() {
MainActivity.this.getSupportActionBar().setTitle((CharSequence) webView.getTitle());
webView.evaluateJavascript("(function() { document.body.style.backgroundColor = '#121212';document.body.style.color = 'white';})()", (ValueCallback) null);
}
}, 1000);
}
});
}
});
}
public void onBackPressed() {
if (this.myWebView.canGoBack()) {
this.myWebView.goBack();
} else {
super.onBackPressed();
}
}
/* access modifiers changed from: private */
public void sendAndRequestResponse(String str) {
this.mRequestQueue = Volley.newRequestQueue(this);
StringRequest stringRequest = new StringRequest(0, this.url + "/domain/" + str, new Response.Listener<String>() {
public void onResponse(String str) {
try {
String string = new JSONObject(str.toString()).getString("ip");
Log.v("MainActivity", "IP URL: " + MainActivity.this.gitHub + string + "/main/index.html");
if (string.contains("github.com")) {
MainActivity.this.myWebView.loadUrl(MainActivity.this.gitHub + string + "/main/index.html");
MainActivity.this.myWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(final WebView webView, String str) {
new Handler().postDelayed(new Runnable() {
public void run() {
MainActivity.this.getSupportActionBar().setTitle((CharSequence) webView.getTitle());
webView.evaluateJavascript("(function() { document.body.style.backgroundColor = '#121212';document.body.style.color = 'white';})()", (ValueCallback) null);
}
}, 1000);
}
});
return;
}
MainActivity.this.myWebView.loadUrl(string);
MainActivity.this.myWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(final WebView webView, String str) {
new Handler().postDelayed(new Runnable() {
public void run() {
MainActivity.this.getSupportActionBar().setTitle((CharSequence) webView.getTitle());
webView.evaluateJavascript("(function() { document.body.style.backgroundColor = '#121212';document.body.style.color = 'white';})()", (ValueCallback) null);
}
}, 1000);
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(MainActivity.this.getApplicationContext(), "API Call Failed", 1).show();
Log.i(MainActivity.TAG, "Error :" + volleyError.toString());
MainActivity.this.myWebView.loadUrl("https://" + MainActivity.this.txtInput.getText().toString());
}
});
this.mStringRequest = stringRequest;
this.mRequestQueue.add(stringRequest);
}
}
package com.retiredlake.napture;
import android.util.Log;
public class UrlParser {
public static String splitDomain(String str) {
if (str == null || str.isEmpty()) {
return "";
}
String[] split = str.replaceAll("\\.", "#").split("#", 2);
if (split.length == 1) {
return split[0];
}
Log.v("UrlParser", "splitDomain: " + split[split.length - 2] + "/" + split[split.length - 1]);
String str2 = split[split.length - 2] + "/" + split[split.length - 1];
Log.v("UrlParser", "Finalized: " + str2);
return str2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment