Skip to content

Commit 405e4c9

Browse files
author
Trevor
authored
Merge pull request #4 from azazelm3dj3d/publish-to-pypi
Now available on PyPI
2 parents 368886b + 63e9f19 commit 405e4c9

File tree

5 files changed

+132
-72
lines changed

5 files changed

+132
-72
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# Droid
22

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

55
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.
66

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

9+
## Install
10+
Droid can be installed via `pip`:
11+
```bash
12+
pip install droid
13+
```
14+
915
## Simple usage
1016
```bash
11-
./droid -ip 127.0.0.1 -c
17+
droid -ip 127.0.0.1 -c
1218
```
1319

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

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

4450
## Example(s)
4551
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`
4652
```bash
47-
./droid -ip 127.0.0.1 -c -rm -p com.android.ui -up ~/Downloads/test_apk_v1.apk
53+
droid -ip 127.0.0.1 -c -rm -p com.android.ui -up ~/Downloads/test_apk_v1.apk
4854
```
4955

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

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

6066
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):
6167
```bash
62-
./droid -ip 127.0.0.1 -bl=start
68+
droid -ip 127.0.0.1 -bl=start
6369
```
6470

6571
You can `stop` the service by running this command (starting the service uses the `start` argument):
6672
```bash
67-
./droid -ip 127.0.0.1 -w=stop
73+
droid -ip 127.0.0.1 -w=stop
6874
```
6975
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.
7076

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

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

7985
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:
8086
```bash
81-
./droid -g
87+
droid
88+
89+
# or
90+
91+
droid -g
8292
```

droid/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""
2+
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
3+
Project: Droid (https://github.com/azazelm3dj3d/droid)
4+
License: MIT
5+
"""

main.py renamed to droid/main.py

Lines changed: 67 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""
22
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
3-
Project: Droid
3+
Project: Droid (https://github.com/azazelm3dj3d/droid)
44
License: MIT
55
"""
66

77
import os, argparse, sys, time, platform
88
from subprocess import getoutput
9-
from utils.view import View
9+
from droid.view import View
10+
# from _tkinter import TclError
1011

1112
parser = argparse.ArgumentParser()
1213

@@ -34,7 +35,7 @@
3435
args = parser.parse_args()
3536

3637
author = "azazelm3dj3d"
37-
version = "1.4.20"
38+
version = "1.4.21"
3839

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

224+
def main():
225+
if len(sys.argv) > 1:
226+
D = Droid()
227+
D.banner()
223228

224-
if __name__ == '__main__':
225-
226-
if len(sys.argv) > 1:
227-
D = Droid()
228-
D.banner()
229+
if args.version:
230+
print(f"Droid Version: {version}")
231+
sys.exit(0)
229232

230-
if args.version:
231-
print(f"Droid Version: {version}")
232-
sys.exit(0)
233+
if args.content != None and args.file_system != None:
234+
D.modify_file()
233235

234-
if args.content != None and args.file_system != None:
235-
D.modify_file()
236+
if args.connect:
237+
D.connect_ip()
236238

237-
if args.connect:
238-
D.connect_ip()
239+
try:
240+
D.connect_ip()
241+
except AttributeError:
242+
print("Please enter an IP address by using -ip")
239243

240-
try:
241-
D.connect_ip()
242-
except AttributeError:
243-
print("Please enter an IP address by using -ip")
244+
if args.remove and args.package:
245+
D.remove_apk()
246+
247+
if args.file and args.location:
248+
D.upload_file()
249+
250+
if args.rmfile and args.location:
251+
D.remove_file()
244252

245-
if args.remove and args.package:
246-
D.remove_apk()
247-
248-
if args.file and args.location:
249-
D.upload_file()
250-
251-
if args.rmfile and args.location:
252-
D.remove_file()
253+
if args.upload:
254+
D.upload_apk()
255+
256+
if args.download:
257+
D.download()
253258

254-
if args.upload:
255-
D.upload_apk()
256-
257-
if args.download:
258-
D.download()
259+
if args.reboot:
260+
D.reboot()
261+
262+
if args.disconnect:
263+
D.disconnect_ip()
264+
265+
if args.bluetooth:
266+
D.bluetooth()
267+
268+
if args.wifi:
269+
D.wifi()
270+
271+
if args.screenshot:
272+
D.screenshot()
259273

260-
if args.reboot:
261-
D.reboot()
262-
263-
if args.disconnect:
264-
D.disconnect_ip()
265-
266-
if args.bluetooth:
267-
D.bluetooth()
268-
269-
if args.wifi:
270-
D.wifi()
271-
272-
if args.screenshot:
273-
D.screenshot()
274+
if args.log:
275+
D.logcat()
274276

275-
if args.log:
276-
D.logcat()
277+
if args.gui:
278+
V = View(version)
277279

278-
if args.gui:
280+
try:
281+
V.__init__()
282+
except TypeError:
283+
pass
284+
elif len(sys.argv) == 1:
279285
V = View(version)
280286

281287
try:
282288
V.__init__()
283289
except TypeError:
284290
pass
285-
elif len(sys.argv) == 1:
286-
V = View(version)
291+
else:
292+
print("Nothing happened. Try using -h")
293+
sys.exit(0)
294+
287295

288-
try:
289-
V.__init__()
290-
except TypeError:
291-
pass
292-
else:
293-
print("Nothing happened. Try using -h")
294-
sys.exit(0)
296+
if __name__ == '__main__':
297+
Droid.main()
298+
299+
# Code for the logo
300+
# try:
301+
# Droid.main()
302+
# except TclError:
303+
# print("Missing logo. Only CLI available.")

utils/view.py renamed to droid/view.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
3-
Project: Droid
3+
Project: Droid (https://github.com/azazelm3dj3d/droid)
44
License: MIT
55
"""
66

@@ -42,9 +42,10 @@ def __init__(self, version):
4242
self.grid_columnconfigure(1, weight=1)
4343
self.grid_rowconfigure(0, weight=1)
4444

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

4950
# Sidebar
5051
self.frame_left = customtkinter.CTkFrame(master=self, width=200, corner_radius=0)

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Owner: azazelm3dj3d (https://github.com/azazelm3dj3d)
3+
Project: Droid (https://github.com/azazelm3dj3d/droid)
4+
License: MIT
5+
"""
6+
7+
import setuptools
8+
9+
with open("README.md", "r", encoding = "utf-8") as fh:
10+
long_description = fh.read()
11+
12+
setuptools.setup(
13+
name = "droid",
14+
version = "1.4.21",
15+
author = "azazelm3dj3d",
16+
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.",
17+
long_description = long_description,
18+
long_description_content_type = "text/markdown",
19+
url = "https://github.com/azazelm3dj3d/droid",
20+
classifiers = [
21+
"Programming Language :: Python :: 3",
22+
"License :: OSI Approved :: MIT License",
23+
"Operating System :: OS Independent",
24+
],
25+
packages = ["droid"],
26+
install_requires=[
27+
"argparse",
28+
"customtkinter==4.6.3"
29+
],
30+
scripts=["droid/main.py"],
31+
entry_points={
32+
"console_scripts": ["droid=droid.main:Droid.main"]
33+
},
34+
python_requires = ">=3.6"
35+
)

0 commit comments

Comments
 (0)