Skip to content

Commit 52b3c56

Browse files
committed
Added scrcpy tool. This application mirrors Android devices (video and audio) connected via USB
1 parent ad8368c commit 52b3c56

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ChangeLog
22

3+
### 0.7.26
4+
- ADDED: scrcpy (This application mirrors Android devices (video and audio) connected via USB)
5+
36
### 0.7.25
47
- CHANGE: Updated command execution
58

@@ -10,7 +13,7 @@
1013
- BUGFIX: Fixed bug mobSF installation
1114

1215
### 0.7.22
13-
- Added: poetry dependency
16+
- ADDED: poetry dependency
1417

1518
### 0.7.21
1619
- CHANGE: new stable version

mpt/console.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from mpt import functions
1717

18-
__version__ = '0.7.25'
18+
__version__ = '0.7.26'
1919

2020
from mpt import settings, logger
2121
from mpt.config import Config
@@ -838,6 +838,7 @@ def cli():
838838
app.add_argument('-p', '--pidcat', metavar='package-name', nargs='?', type=str, const='',
839839
help='Show colored logcat for a specific application (<package name> optional)')
840840
app.add_argument('-st', '--screenshot', help='Take a screenshot from device screen', action='store_true')
841+
app.add_argument('-sc', '--screen-copy', help='Mirrors Android device screen connected via USB to host (scrcpy)', action='store_true')
841842
app.add_argument('-D', '--fridump', help='Dump application memory', action='store_true')
842843
app.add_argument('-b', '--backup', metavar='package-name', nargs='?', type=str, const='',
843844
help='Backup an android application \n (<package name> optional)')
@@ -900,6 +901,8 @@ def cli():
900901
run_pidcat_ex(package_name=args.pidcat)
901902
if args.screenshot:
902903
take_screenshot()
904+
if args.screen_copy:
905+
run_tool(["scrcpy"])
903906
if args.fridump:
904907
run_fridump()
905908
if args.backup or type(args.backup) is str:

mpt/functions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def install_http(package):
260260
tool_url = settings.ANDROID_TOOLS[package]['url']
261261
tool_dir = os.path.join(install_dir, settings.ANDROID_TOOLS[package]['dir'])
262262

263-
if tool_url.endswith('zip') or tool_url.endswith('tar.xz'):
263+
if tool_url.endswith('zip') or tool_url.endswith('tar.xz') or tool_url.endswith('tar.gz'):
264264
install_http_archive(package)
265265
else:
266266

@@ -322,6 +322,12 @@ def install_http_archive(package):
322322
run_command(command=f'cd {download_dir}; wget -q {tool_url} -O {temp_archive_filename}; tar -xf {temp_archive_filename};',
323323
print_output=True)
324324

325+
# handle tar.gz files
326+
if tool_url.endswith('tar.gz'):
327+
temp_archive_filename = 'download-tmp.tar.gz'
328+
run_command(command=f'cd {download_dir}; wget -q {tool_url} -O {temp_archive_filename}; tar -xzf {temp_archive_filename};',
329+
print_output=True)
330+
325331
# execute post instructions
326332
if 'post' in settings.ANDROID_TOOLS[package]:
327333
run_command(

mpt/settings.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
'bin': os.path.join(conf.load_config('install-dir'), 'dex2jar/d2j-dex2jar.sh'),
214214
'dir': 'dex2jar',
215215
'install': 'http',
216-
'post': 'mv dex-tools-v2.4 dex2jar'
216+
'post': 'mv dex-tools-v2.4 dex2jar'
217217
},
218218
'janus': {
219219
'url': 'https://github.com/ppapadatis/python-janus-vulnerability-scan',
@@ -239,6 +239,15 @@
239239
'dir': 'kitty',
240240
'install': 'local',
241241
'post': 'curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin dest={} launch=n'.format(os.path.join(conf.load_config('install-dir'),'kitty'))
242+
},
243+
'scrcpy': {
244+
# check version and replace file: https://github.com/Genymobile/scrcpy
245+
'url': 'https://github.com/Genymobile/scrcpy/releases/download/v3.1/scrcpy-linux-x86_64-v3.1.tar.gz',
246+
'info': 'Application mirrors Android devices (video and audio) connected via USB',
247+
'bin': os.path.join(conf.load_config('install-dir'), 'scrcpy/scrcpy'),
248+
'dir': 'scrcpy',
249+
'install': 'http',
250+
'post': 'mv scrcpy-linux-x86_64-v3.1 scrcpy'
242251
}
243252
}
244253

0 commit comments

Comments
 (0)