Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color, UI and README changes #9

Merged
merged 7 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ Frida Manager is an Android Application made to make the installation and manage
- [USB](#usb)
- [Remote](#remote)
- [Images](#images)
- [Tested Device](#tested-devices)
- [Tested Devices](#tested-devices)
- [Physical](#physical)
- [Emulator](#emulator)
- [Contributors](#contributors)
- [Common Errors](#common-errors)
- [need Gadget to attach on jailed Android; ...](#need-gadget-to-attach-on-jailed-android-)
- [unexpectedly timed out while waiting for signal from process with PID XXX](#unexpectedly-timed-out-while-waiting-for-signal-from-process-with-pid-xxx)

## Functionality

Expand All @@ -33,37 +38,52 @@ If your device is connected via USB then proceed [here](#usb). If you currently
### USB

If you've used Frida before then you'll be the most familiar with this method, the following test command should work as expected:

```bash
frida -U -f sh.damon.fridamgr
```

`-U` : stands for USB connected device, optionally if multiple devices are connected you may need to specify this with the `--device=` flag

### Remote

If you've enabled **Listen on Network Interface** in the FridaMgr app then you'll be able to connect to the Frida Server on the device remotely as long as you're within the same LAN.

```bash
frida -H 192.168.88.7:27055 -f sh.damon.fridamgr
```

`-H` : tells Frida that you want to connect to a network connected device.

## Images

![Frida Mgr Installation Screen](docs/imgs/install_screen.png)
- Before installing Frida Server

![Frida Mgr Installation Screen](docs/imgs/install_screen.png)

![Frida Mgr Post-Installation Screen](docs/imgs/post_install_screen.png)
- When Frida Server is installed and running

![Frida Mgr Post-Installation Screen](docs/imgs/post_install_screen.png)

## Tested Devices

The following list of physical and emulated devices have been tested and verified to be working.

### Physical

- Samsung Galaxy Z Fold3 (sdk33)
- One Plus 11 5G (sdk33)
- One Plus 6 (sdk30)

### Emulator

- Google Pixel 8 (sdk33)

### Contributors

- [Yimura](https://x.com/Yimura9)
- [drop](https://x.com/dropn0w)

## Common Errors

### need Gadget to attach on jailed Android; ...
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/java/sh/damon/fridamgr/FridaServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public enum State {
private final DownloadState mDownloadState = new DownloadState();
private State mState = State.UNKNOWN;

private int mPid = -1;

public FridaServer(File baseDir) {
mName = "frida-server";
mBinary = new File(baseDir, mName);
Expand Down Expand Up @@ -309,7 +311,7 @@ public void updateState() {
try {
if (ShellUtil.runAsSuperuser(String.format("test -e %s", mBinary)).isFail()) {
mState = State.NOT_INSTALLED;

mPid = -1;
return;
}

Expand All @@ -318,16 +320,24 @@ public void updateState() {
final ShellUtil.ProcessResponse res = ShellUtil.runAsSuperuser(String.format("pgrep %s", mName));
if (res.isFail()) {
mState = State.STOPPED;
mPid = -1;
}
else {
mState = State.RUNNING;
try {
mPid = Integer.parseInt(res.out.trim());
} catch (NumberFormatException e) {
mPid = -1;
}
}
}
finally {
} finally {
emit();
}
}

public int getPid() {
return mPid;
}

private static FridaServer instance = null;
public static FridaServer init(File baseDir) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/sh/damon/fridamgr/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ private void updateElements() {
fridaStateLbl.setText(String.format(getString(R.string.frida_server_state_label), getString(server.getStateStringId())));
fridaVersionLbl.setText(String.format(getString(R.string.frida_version), server.getVersion()));

TextView fridaPidLbl = findViewById(R.id.frida_pid);
if (server.getState() == FridaServer.State.RUNNING && server.getPid() != -1) {
fridaPidLbl.setText(String.format(getString(R.string.frida_server_pid), String.valueOf(server.getPid())));
} else {
fridaPidLbl.setText(String.format(getString(R.string.frida_server_pid), getString(R.string.not_running)));
}

btnUpdateInstallFrida.setEnabled(true);
btnServerStateSwitch.setEnabled(true);
btnUpdateInstallFrida.setText(R.string.btn_update_frida);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/color/thumb_color_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#EF6456" android:state_checked="true" />
<item android:color="#BDBDBD" /> <!-- Default color when off -->
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/color/track_color_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#FFB3AB" android:state_checked="true" />
<item android:color="#E0E0E0" /> <!-- Default color when off -->
</selector>
87 changes: 62 additions & 25 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,86 +9,123 @@
tools:context=".MainActivity">

<TextView
android:id="@+id/frida_server_state"
android:id="@+id/frida_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/frida_server_state_label"
android:text="@string/frida_version"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_toggle_server"
app:layout_constraintVertical_bias="0.82" />

<TextView
android:id="@+id/frida_pid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/frida_server_pid"
app:layout_constraintBottom_toTopOf="@+id/btn_install_update_server"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.139" />
app:layout_constraintTop_toBottomOf="@+id/frida_server_state"
app:layout_constraintVertical_bias="0.321" />

<Button
android:id="@+id/btn_install_update_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#EF6456"
android:text="@string/btn_update_frida"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/frida_server_state"
app:layout_constraintVertical_bias="0.07999998" />
app:layout_constraintVertical_bias="0.166" />

<Button
android:id="@+id/btn_toggle_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#EF6456"
android:text="@string/btn_kill_frida_server"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_install_update_server"
app:layout_constraintVertical_bias="0.04000002" />
app:layout_constraintVertical_bias="0.046" />

<TextView
android:id="@+id/frida_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/frida_version"
app:layout_constraintBottom_toBottomOf="parent"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_start_on_boot"
android:layout_width="260dp"
android:layout_height="48dp"
android:text="@string/start_on_boot"
android:textColor="@color/text_color"
app:layout_constraintBottom_toTopOf="@+id/frida_version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_toggle_server"
app:layout_constraintVertical_bias="0.98" />
app:layout_constraintVertical_bias="0.274"
app:trackTint="@color/track_color_selector" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_listen_on_network"
android:layout_width="260dp"
android:layout_height="48dp"
android:text="@string/listen_on_network_interface"
android:textColor="@color/text_color"
app:layout_constraintBottom_toTopOf="@+id/frida_version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.50"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/switch_start_on_boot"
app:layout_constraintVertical_bias="0" />
app:layout_constraintVertical_bias="0.021"
app:trackTint="@color/track_color_selector" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_start_on_boot"
android:layout_width="260dp"
android:layout_height="48dp"
android:text="@string/start_on_boot"
app:layout_constraintBottom_toTopOf="@+id/frida_version"
<TextView
android:id="@+id/frida_server_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/frida_server_state_label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_toggle_server"
app:layout_constraintVertical_bias="0.18" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.342" />

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_port_number"
android:imeOptions="actionDone"
android:layout_width="270dp"
android:layout_height="48dp"
android:hint="@string/port_number_hint"
android:imeOptions="actionDone"
android:inputType="number"
app:layout_constraintBottom_toTopOf="@+id/frida_version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch_listen_on_network"
app:layout_constraintVertical_bias="0.0">
app:layout_constraintVertical_bias="0.032">


</com.google.android.material.textfield.TextInputEditText>

<ImageView
android:id="@+id/imageView"
android:layout_width="154dp"
android:layout_height="130dp"
android:contentDescription="@string/main_logo"
app:layout_constraintBottom_toTopOf="@+id/frida_server_state"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.504"
app:srcCompat="@mipmap/ic_launcher" />

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="text_color">@color/white</color>
</resources>
14 changes: 9 additions & 5 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.FridaManager" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
<resources>
<!-- Optional: You can leave this empty or match the light theme -->
<style name="Base.Theme.FridaManager" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowBackground">@color/dark_background</item>
<item name="android:textColor">@color/white</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="android:textColorTertiary">@color/white</item>
<item name="android:textColorHint">@color/white_50_percent</item>
</style>
</resources>
5 changes: 4 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="accent">#FFEF6456</color>

<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="dark_background">#FF121212</color>
<color name="white_50_percent">#80FFFFFF</color>
<color name="text_color">@color/black</color>

</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@
<string name="port_number_hint">Port Number</string>

<string name="tile_toggle_server">Toggle Frida</string>
<string name="main_logo">Logo</string>
<string name="frida_server_pid">Server PID: <b>%s</b></string>
<string name="not_running">None</string>
</resources>
5 changes: 1 addition & 4 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Base.Theme.FridaManager" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>

<style name="Theme.FridaManager" parent="Base.Theme.FridaManager" />
</resources>
Binary file modified docs/imgs/install_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/imgs/post_install_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.6.0"
agp = "8.7.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 10 22:25:34 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists