Skip to content

Commit

Permalink
Merge pull request #4 from azazelm3dj3d/publish-to-pypi
Browse files Browse the repository at this point in the history
Now available on PyPI
  • Loading branch information
Trevor committed Mar 6, 2023
2 parents 368886b + 63e9f19 commit 405e4c9
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 72 deletions.
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Droid

<img src=".github/assets/droid_logo.png" />
<img src="https://raw.githubusercontent.com/azazelm3dj3d/droid/main/.github/assets/droid_logo.png" />

Droid is a remote communication application created to communicate with Android devices on the local network over the Android debug bridge (adb). Droid allows you to completely control the Android device using multiple options, including a CLI and a GUI.

IMPORTANT NOTE: Script does require Android debug bridge (adb) to be installed on the system.

## Install
Droid can be installed via `pip`:
```bash
pip install droid
```

## Simple usage
```bash
./droid -ip 127.0.0.1 -c
droid -ip 127.0.0.1 -c
```

## Options
Expand Down Expand Up @@ -38,45 +44,49 @@ IMPORTANT NOTE: Script does require Android debug bridge (adb) to be installed o

I would recommend running this command before doing anything else to confirm you can successfully connect to the Android device on your network
```bash
./droid -ip 127.0.0.1 -c
droid -ip 127.0.0.1 -c
```

## Example(s)
This example connects to the Android device (127.0.0.1), removes the specified APK package (`com.android.ui`), and then uploads a new APK called `test_apk_v1.apk`
```bash
./droid -ip 127.0.0.1 -c -rm -p com.android.ui -up ~/Downloads/test_apk_v1.apk
droid -ip 127.0.0.1 -c -rm -p com.android.ui -up ~/Downloads/test_apk_v1.apk
```

This example downloads a test images from the Android device onto your local machine (automatically saves it in the ~/Downloads folder on most platforms)
```bash
./droid -ip 127.0.0.1 --download /sdcard/cool_pic.png
droid -ip 127.0.0.1 --download /sdcard/cool_pic.png
```

Once you're finished working within the environment, you can run this command to disconnect from the Android device:
```bash
./droid -ip 127.0.0.1 -d
droid -ip 127.0.0.1 -d
```

We now have the option to control the bluetooth service on Android devices. You can `start` the service by running this command (stopping the service uses the `stop` argument):
```bash
./droid -ip 127.0.0.1 -bl=start
droid -ip 127.0.0.1 -bl=start
```

You can `stop` the service by running this command (starting the service uses the `start` argument):
```bash
./droid -ip 127.0.0.1 -w=stop
droid -ip 127.0.0.1 -w=stop
```
NOTE: When turning the wifi off, if you are communicating with the Android device remotely, this will result in the device being disconnected and unusable until the network is re-established.

This command will take a screenshot of the current Android screen while monitoring Logcat in real-time:
```bash
./droid -ip 127.0.0.1 -sl -o screenshot
droid -ip 127.0.0.1 -sl -o screenshot
```

## GUI
You can now double-click the Droid icon to run it on most platforms

If you would like to run the GUI, you can run this command to boot it up. Almost all CLI options are available in the GUI:
```bash
./droid -g
droid

# or

droid -g
```
5 changes: 5 additions & 0 deletions droid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
Project: Droid (https://github.com/azazelm3dj3d/droid)
License: MIT
"""
125 changes: 67 additions & 58 deletions main.py → droid/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
Project: Droid
Project: Droid (https://github.com/azazelm3dj3d/droid)
License: MIT
"""

import os, argparse, sys, time, platform
from subprocess import getoutput
from utils.view import View
from droid.view import View
# from _tkinter import TclError

parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -34,7 +35,7 @@
args = parser.parse_args()

author = "azazelm3dj3d"
version = "1.4.20"
version = "1.4.21"

# Default Android Debug Bridge (adb) location on specific platforms
if platform.system() == 'Darwin':
Expand Down Expand Up @@ -220,75 +221,83 @@ def modify_file(self):
except:
print("Device is unresponsive. Please check connection")

def main():
if len(sys.argv) > 1:
D = Droid()
D.banner()

if __name__ == '__main__':

if len(sys.argv) > 1:
D = Droid()
D.banner()
if args.version:
print(f"Droid Version: {version}")
sys.exit(0)

if args.version:
print(f"Droid Version: {version}")
sys.exit(0)
if args.content != None and args.file_system != None:
D.modify_file()

if args.content != None and args.file_system != None:
D.modify_file()
if args.connect:
D.connect_ip()

if args.connect:
D.connect_ip()
try:
D.connect_ip()
except AttributeError:
print("Please enter an IP address by using -ip")

try:
D.connect_ip()
except AttributeError:
print("Please enter an IP address by using -ip")
if args.remove and args.package:
D.remove_apk()

if args.file and args.location:
D.upload_file()

if args.rmfile and args.location:
D.remove_file()

if args.remove and args.package:
D.remove_apk()

if args.file and args.location:
D.upload_file()

if args.rmfile and args.location:
D.remove_file()
if args.upload:
D.upload_apk()

if args.download:
D.download()

if args.upload:
D.upload_apk()

if args.download:
D.download()
if args.reboot:
D.reboot()

if args.disconnect:
D.disconnect_ip()

if args.bluetooth:
D.bluetooth()

if args.wifi:
D.wifi()

if args.screenshot:
D.screenshot()

if args.reboot:
D.reboot()

if args.disconnect:
D.disconnect_ip()

if args.bluetooth:
D.bluetooth()

if args.wifi:
D.wifi()

if args.screenshot:
D.screenshot()
if args.log:
D.logcat()

if args.log:
D.logcat()
if args.gui:
V = View(version)

if args.gui:
try:
V.__init__()
except TypeError:
pass
elif len(sys.argv) == 1:
V = View(version)

try:
V.__init__()
except TypeError:
pass
elif len(sys.argv) == 1:
V = View(version)
else:
print("Nothing happened. Try using -h")
sys.exit(0)


try:
V.__init__()
except TypeError:
pass
else:
print("Nothing happened. Try using -h")
sys.exit(0)
if __name__ == '__main__':
Droid.main()

# Code for the logo
# try:
# Droid.main()
# except TclError:
# print("Missing logo. Only CLI available.")
9 changes: 5 additions & 4 deletions utils/view.py → droid/view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
Project: Droid
Project: Droid (https://github.com/azazelm3dj3d/droid)
License: MIT
"""

Expand Down Expand Up @@ -42,9 +42,10 @@ def __init__(self, version):
self.grid_columnconfigure(1, weight=1)
self.grid_rowconfigure(0, weight=1)

if platform.system() == 'Darwin':
img = PhotoImage(file=f"{import_resources('assets/droid.png')}")
self.iconphoto(True, img)
# Logo isn't working with PyPI, removing for now
# if platform.system() == 'Darwin':
# img = PhotoImage(file=f"{import_resources('assets/droid.png')}")
# self.iconphoto(True, img)

# Sidebar
self.frame_left = customtkinter.CTkFrame(master=self, width=200, corner_radius=0)
Expand Down
35 changes: 35 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
Project: Droid (https://github.com/azazelm3dj3d/droid)
License: MIT
"""

import setuptools

with open("README.md", "r", encoding = "utf-8") as fh:
long_description = fh.read()

setuptools.setup(
name = "droid",
version = "1.4.21",
author = "azazelm3dj3d",
description = "Droid is a remote communication application created to communicate with Android devices on the local network over the Android debug bridge (adb). Available as a CLI or GUI.",
long_description = long_description,
long_description_content_type = "text/markdown",
url = "https://github.com/azazelm3dj3d/droid",
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages = ["droid"],
install_requires=[
"argparse",
"customtkinter==4.6.3"
],
scripts=["droid/main.py"],
entry_points={
"console_scripts": ["droid=droid.main:Droid.main"]
},
python_requires = ">=3.6"
)

0 comments on commit 405e4c9

Please sign in to comment.