Skip to content

Commit

Permalink
Show url after page load in omnibox. Allow for a second scriptable br…
Browse files Browse the repository at this point in the history
…owser. Change default webpage
  • Loading branch information
StringManolo committed Jul 20, 2024
1 parent e263e0f commit c8dc53d
Show file tree
Hide file tree
Showing 45 changed files with 254 additions and 39 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Panther/app/build/classes/com/stringmanolo/panther/R$id.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Panther/app/build/classes/com/stringmanolo/panther/R$style.class
Binary file not shown.
Binary file modified Panther/app/build/dexedClasses/classes.dex
Binary file not shown.
37 changes: 19 additions & 18 deletions Panther/app/build/generated/source/R.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,25 @@ int drawable ic_launcher 0x7f020005
int drawable panthera 0x7f020006
int drawable panthera2 0x7f020007
int drawable patair 0x7f020008
int id RectanguloMenuIcono 0x7f070005
int id buttonIr 0x7f07000a
int id buttonUA 0x7f07000f
int id consoleInput 0x7f070003
int id consoleOutput 0x7f070002
int id executeButton 0x7f070004
int id favicon 0x7f070008
int id listView 0x7f070006
int id listaHacking 0x7f07000c
int id listaMotores 0x7f070010
int id logsOutput 0x7f070001
int id progressbar 0x7f07000b
int id textView 0x7f070007
int id textoHacking 0x7f07000d
int id textoMotores 0x7f070011
int id url 0x7f070009
int id userAgent 0x7f07000e
int id webkit 0x7f070000
int id RectanguloMenuIcono 0x7f070006
int id buttonIr 0x7f07000b
int id buttonUA 0x7f070010
int id consoleInput 0x7f070004
int id consoleOutput 0x7f070003
int id executeButton 0x7f070005
int id favicon 0x7f070009
int id listView 0x7f070007
int id listaHacking 0x7f07000d
int id listaMotores 0x7f070011
int id logsOutput 0x7f070002
int id progressbar 0x7f07000c
int id scriptable 0x7f070000
int id textView 0x7f070008
int id textoHacking 0x7f07000e
int id textoMotores 0x7f070012
int id url 0x7f07000a
int id userAgent 0x7f07000f
int id webkit 0x7f070001
int layout activity_main 0x7f030000
int layout layout_hacking 0x7f030001
int layout layout_motor_de_busqueda 0x7f030002
Expand Down
37 changes: 19 additions & 18 deletions Panther/app/build/generated/source/com/stringmanolo/panther/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,25 @@ public static final class drawable {
public static final int patair=0x7f020008;
}
public static final class id {
public static final int RectanguloMenuIcono=0x7f070005;
public static final int buttonIr=0x7f07000a;
public static final int buttonUA=0x7f07000f;
public static final int consoleInput=0x7f070003;
public static final int consoleOutput=0x7f070002;
public static final int executeButton=0x7f070004;
public static final int favicon=0x7f070008;
public static final int listView=0x7f070006;
public static final int listaHacking=0x7f07000c;
public static final int listaMotores=0x7f070010;
public static final int logsOutput=0x7f070001;
public static final int progressbar=0x7f07000b;
public static final int textView=0x7f070007;
public static final int textoHacking=0x7f07000d;
public static final int textoMotores=0x7f070011;
public static final int url=0x7f070009;
public static final int userAgent=0x7f07000e;
public static final int webkit=0x7f070000;
public static final int RectanguloMenuIcono=0x7f070006;
public static final int buttonIr=0x7f07000b;
public static final int buttonUA=0x7f070010;
public static final int consoleInput=0x7f070004;
public static final int consoleOutput=0x7f070003;
public static final int executeButton=0x7f070005;
public static final int favicon=0x7f070009;
public static final int listView=0x7f070007;
public static final int listaHacking=0x7f07000d;
public static final int listaMotores=0x7f070011;
public static final int logsOutput=0x7f070002;
public static final int progressbar=0x7f07000c;
public static final int scriptable=0x7f070000;
public static final int textView=0x7f070008;
public static final int textoHacking=0x7f07000e;
public static final int textoMotores=0x7f070012;
public static final int url=0x7f07000a;
public static final int userAgent=0x7f07000f;
public static final int webkit=0x7f070001;
}
public static final class layout {
public static final int activity_main=0x7f030000;
Expand Down
Binary file modified Panther/app/build/output/app-debug.apk
Binary file not shown.
Binary file modified Panther/app/build/output/app-unsigned-debug.apk
Binary file not shown.
Binary file modified Panther/app/build/resources.ap_
Binary file not shown.
66 changes: 66 additions & 0 deletions Panther/app/src/main/assets/panther_scriptable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head prefix="og:http://ogp.me/ns#">
<meta charset="utf-8">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<title>Panther Scriptable</title>
<meta property="og:type" content="website">
<meta name="theme-color" content="#ffffff">
</head>

<body>
<h1>Panther Scriptable</h1>
<section>
<article>
<button id="npa">New Protonmail Account</button>
</article>
</section>


<script>
console.log("Starting connection to ws://127.0.0.1:13370 ... ");
const socket = new WebSocket("ws://localhost:13370");

socket.addEventListener("open", function (event) {
console.log("Connected to WebSocket server");
socket.send("Hello Server!");
});

socket.addEventListener("message", function (event) {
console.log("Message from server: ", event.data);
// Do stuff here (using interfaces?)
});

socket.addEventListener("close", function (event) {
console.log("Disconnected from WebSocket server");
});

socket.addEventListener("error", function (event) {
console.error("WebSocket error: ", event);
});


/* API */
const navigate = url => {
console.log("Navigating to ", url);
if (scriptable.test()) {
scriptable.open(url, '_blank');
} else {
console.log("Scriptable interface is not available");
}
}

/* SCRIPTS */
/* PROTONMAIL ACCOUNT */
const newProtonMailAccount = (username, password) => {
navigate("https://account.proton.me/mail/signup?plan=free&ref=mail_plus_intro-mailpricing-2&currency=EUR");
}
document.querySelector("#npa").addEventListener("click", () => {
newProtonMailAccount("test", "test123");
});


</script>
</body>
</html>

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import android.os.Looper;

import java.net.URL;
import android.webkit.JavascriptInterface;


public class MainActivity extends Activity {
Intent intentArchivos = null;
Expand All @@ -65,6 +67,7 @@ public class MainActivity extends Activity {
private static final int CODEHackingIntent = 0;

private WebView Panther;
private WebView Scriptable;
private ProgressBar progressBar;
private EditText url;
private EditText omnibox;
Expand All @@ -90,13 +93,15 @@ public class MainActivity extends Activity {
boolean jsEnabled = true;
boolean blockerEnabled = true;
boolean blockFingerprintEnabled = false;
boolean scriptableEnabled = false;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Panther = (WebView) findViewById(R.id.webkit);
Scriptable = (WebView) findViewById(R.id.scriptable);

logsOutput = (TextView) findViewById(R.id.logsOutput);

Expand Down Expand Up @@ -187,6 +192,18 @@ public void onItemClick(AdapterView < ? > adapterView, View view, int position,
}


if (value.equals("Scriptable")) {
if (scriptableEnabled) {
scriptableEnabled = false;
Scriptable.setVisibility(View.INVISIBLE);
} else {
scriptableEnabled = true;
Scriptable.setVisibility(View.VISIBLE);
Panther.loadUrl("file:///android_asset/panther_scriptable.html");
}
}



if (value.equals("Exit")) {
Panther.clearCache(true);
Expand Down Expand Up @@ -219,6 +236,7 @@ public void onItemClick(AdapterView < ? > adapterView, View view, int position,
consoleOutput.setVisibility(View.INVISIBLE);
consoleInput.setVisibility(View.INVISIBLE);
executeButton.setVisibility(View.INVISIBLE);
Scriptable.setVisibility(View.INVISIBLE);

if (Build.VERSION.SDK_INT < 18) {
/* Panther.getSettings().setRenderPriority(RenderPriority.HIGH); */
Expand All @@ -240,6 +258,15 @@ public void onItemClick(AdapterView < ? > adapterView, View view, int position,
Panther.getSettings().setLoadWithOverviewMode(true);
Panther.getSettings().setBuiltInZoomControls(true);

/* Sxriptable webview */
Scriptable.getSettings().setJavaScriptEnabled(true);
Scriptable.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
Scriptable.getSettings().setUserAgentString(userAgentModificado);
Scriptable.setWebViewClient(new WebViewClient());
Scriptable.setWebChromeClient(new WebChromeClient());
Panther.addJavascriptInterface(new SCRIPTABLE(), "scriptable");


consoleOutput.setText("Use the url #clearconsole to clear\n\n\n\n\n\n\n\n");
logsOutput.setText("! Use the url #clearlogs to clear. #list to list available urls\n\n\n");

Expand Down Expand Up @@ -396,6 +423,14 @@ public void run() {
});

Panther.setWebChromeClient(new WebChromeClient() {
/* @Override
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, android.os.Message resultMsg) {
// TODO: Manage new windows
return true;
}
*/


@Override
public void onPermissionRequest(final PermissionRequest request) {
final String[] requestedPermissions = request.getResources();
Expand Down Expand Up @@ -665,4 +700,26 @@ private String readStream(InputStream inputStream) throws IOException {
reader.close();
return result.toString();
}

/* For Scriptable WebView */
public class SCRIPTABLE {
@JavascriptInterface
public boolean test() {
return true;
}

@JavascriptInterface
public void open(final String url, String dummy) {
final Handler scriptableHandler = new Handler(Looper.getMainLooper());
scriptableHandler.post(new Runnable() {
@Override
public void run() {
// logsOutput.append("+ Request for " + url + "\n");
Scriptable.loadUrl(url);
}
});
}

}

}
13 changes: 12 additions & 1 deletion Panther/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@
android:background="@drawable/barrabusquedaurl"
>



<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<WebView
android:id="@+id/scriptable"
android:layout_width="200dp"
android:layout_height="400dp"
android:elevation="8dp"
android:layout_centerInParent="true"
android:layout_marginTop="100dp"
/>


<WebView
android:id="@+id/webkit"
Expand All @@ -19,7 +30,7 @@
android:layout_marginTop="46dp"
/>

<TextView
<TextView
android:id="@+id/logsOutput"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion Panther/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
<item>Favorites</item>
<item>Computer View</item>
-->
<item>Hacking</item>
<item>Hacking</item>
<item>Scriptable</item>
<item>Exit</item>
</string-array>

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Panther is a privacy-focused Android browser based on WebView.


### Features
- Scriptable
- Allows you to control a second brower embeeded inside Panther
- Allows you to control the second browser using scripting languages like js, python, lua ...
- Read the section at the end if you interested in the Status of this feature

- Blocker
- Blocks common AD servers by replacing the downloaded AD by a custom file
- Blocks common Trackers by replacing the downloaded javascript by a custom file
Expand Down Expand Up @@ -61,4 +66,16 @@ Panther is a privacy-focused Android browser based on WebView.
- `#clearconsole` - Clear the console
- `#clearlogs` - Clear the logs
- `#url` - Shows Current Url
<br>

### Scriptable
#### Scriptable Status
- Early development, only able to control it using the console calling it's api methods

#### Scriptable API
##### open
- Description: Open a webpage in the scriptable browser
- Syntaxis:
```javascript
scriptable.open("https;//www.google.com/search?q=car", "");
```
21 changes: 21 additions & 0 deletions panther_scriptable/node_version/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const WebSocket = require("ws");

const wss = new WebSocket.Server({ port: 13370 });

wss.on("connection", ws => {
console.log("Panther is connected");
ws.on("message", message => {
console.log(`Received message: ${message}`);
// Handle commands / send instructions
ws.send(`Server received: ${message}`);
});

ws.on("close", () => {
console.log("Panther disconnected");
});

ws.send("Panther is now connected to Panther_Scriptable_Node");
});

console.log(`Panther Scriptable is Ready. Start the connection from Panther`);

Loading

0 comments on commit c8dc53d

Please sign in to comment.