Skip to content

Commit

Permalink
size and pull bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
den4uk committed Nov 11, 2020
1 parent a02c81d commit 0a8d1d1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
install:
- pip install pip -U
- pip install -r requirements-dev.txt
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
===

### 3.5.3 (2020-11-11)

- Bugfix related to file size retrieval from the remote device.
- File pull bug using adb (with root), affecting Windows.


### 3.5.2 (2020-10-28)

- Switched timeouts to `wrapt_timeout_decorator` to fix bug with Python 3.8
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2012-2019 Denis Sazonov
Copyright (c) 2012-2020 Denis Sazonov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions andriller/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__version__ = '3.5.2'
__version__ = '3.5.3'
__app_name__ = 'Andriller CE'
__package_name__ = 'andriller'
__website__ = "https://github.com/den4uk/andriller" # "https://www.andriller.com"
__website__ = "https://github.com/den4uk/andriller"
__license__ = 'MIT'

import os
Expand Down
22 changes: 12 additions & 10 deletions andriller/adb_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def pull_file(self, file_path, dst_path, **kwargs):
"""
file_path_strict = re.sub(' ', r'\ ', file_path)
dst_path_strict = re.sub(' ', r'\ ', dst_path)
self.adb(f"pull {file_path_strict} {dst_path_strict}")
self.adb(f"pull {file_path_strict} '{dst_path_strict}'", **kwargs)

def get_size(self, file_path, **kwargs) -> int:
"""
Expand All @@ -168,15 +168,17 @@ def get_size(self, file_path, **kwargs) -> int:
file_path (str|Path): Remote file path.
"""
file_path_strict = self.strict_name(file_path)
size = self.adb(f'shell stat -c %s {file_path_strict}', **kwargs)
if not size.isdigit():
size = self.adb(f'shell ls -nl {file_path_strict}', **kwargs).split()[3]
if not size.isdigit():
size = self.adb(f'shell wc -c < {file_path_strict}', **kwargs)
if not size.isdigit():
self.logger.debug(f'Size Error: {size}')
return -1
return int(size)
size_functions = [
lambda: self.adb(f'shell stat -c %s {file_path_strict}', **kwargs),
lambda: self.adb(f'shell ls -nl {file_path_strict}', **kwargs).split()[3],
lambda: self.adb(f'shell wc -c < {file_path_strict}', **kwargs),
]
for size_function in size_functions:
size = size_function()
if size and size.isdigit():
return int(size)
self.logger.debug(f'Size Error for: {file_path}')
return -1

@timeout(30, use_signals=False)
def cmd_shell(self, cmd, code=False, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
commit = True
current_version = 3.5.2
current_version = 3.5.3
files = andriller/__init__.py
tag = True
tag_name = {new_version}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
version=__version__,
description='Andriller CE | Android Forensic Tools',
author='Denis Sazonov',
author_email='info@andriller.com',
author_email='den (at) saz (dot) lt',
url=__website__,
packages=[__package_name__],
license='MIT License',
Expand Down

1 comment on commit 0a8d1d1

@ashokkumar9001
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

andriller lice

Please sign in to comment.