Comments (68)
For the scrypt Error
Read the Errors - OpenSSL is missing
Make sure VC Compiler can find the OpenSSL Headers
Its looking in c:\OpenSSL-Win64\include
http://slproweb.com/products/Win32OpenSSL.html
Needs -> Win64 OpenSSL v1.0.2q Package
1.1.x Package have different LibNames
the last one with the white Window.
Its saying adb is missing (sometimes or with debugger).
Make sure Path to adb.ex is in PATH
from dwarf.
the nox adb is stderr
DirtyFix
utils.py line 28
def do_shell_command(cmd, stdout=subprocess.PIPE):
result = subprocess.run(cmd.split(' '), stdout=stdout, stderr=subprocess.STDOUT)
if stdout == subprocess.PIPE:
return result.stdout.decode('utf8')
elif stdout == subprocess.STDOUT:
return result.stdout.decode('utf8')
else:
return ''
from dwarf.
All my changes
(Tested on Windows with Nox Android 4 and 7beta)
diff --git a/lib/adb.py b/lib/adb.py
index f9d2321..dfc1e05 100644
--- a/lib/adb.py
+++ b/lib/adb.py
@@ -87,7 +87,12 @@ class Adb(object):
if not self.adb_available:
utils.show_message_box('adb not found')
return None
- self._do_adb_command('adb shell su -c "mount -o rw,remount /system"')
+ res = self._do_adb_command('adb shell su -c "mount -o rw,remount /system"')
+ try:
+ if (len(res) > 0) and (res.index('Permission denied') >= 0):
+ self._do_adb_command('adb shell mount -o rw,remount /system')
+ except ValueError:
+ pass
def pull(self, path, dest):
if not self.adb_available:
@@ -105,4 +110,10 @@ class Adb(object):
if not self.adb_available:
utils.show_message_box('adb not found')
return None
- return self._do_adb_command('adb shell su -c "' + cmd + '"', stdout=stdout)
+ res = self._do_adb_command('adb shell su -c "' + cmd + '"', stdout=stdout)
+ try:
+ if (len(res) > 0) and (res.index('Permission denied') >= 0):
+ res = self._do_adb_command('adb shell ' + cmd, stdout=stdout)
+ except ValueError:
+ res = ''
+ return res
diff --git a/lib/utils.py b/lib/utils.py
index c6ad9b5..7aa33fd 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -26,9 +26,11 @@ app_icon = None
def do_shell_command(cmd, stdout=subprocess.PIPE):
- result = subprocess.run(cmd.split(' '), stdout=stdout)
+ result = subprocess.run(cmd.split(' '), stdout=stdout, stderr=subprocess.STDOUT)
if stdout == subprocess.PIPE:
return result.stdout.decode('utf8')
+ elif stdout == subprocess.STDOUT:
+ return result.stdout.decode('utf8')
else:
return ''
diff --git a/ui/ui_welcome.py b/ui/ui_welcome.py
index 4b5a59b..6382743 100644
--- a/ui/ui_welcome.py
+++ b/ui/ui_welcome.py
@@ -136,6 +136,7 @@ class WelcomeUi(QSplitter):
self.update_device_ui()
self.update_commits()
self.update_frida_version()
+ self.on_device_changed()
def update_commits(self):
data = self.app.get_dwarf().get_git().get_dwarf_commits()
@@ -289,6 +290,12 @@ class WelcomeUi(QSplitter):
self.frida_update_button.setVisible(self.updated_frida_version != local_version)
+ #check if frida is running on device or start
+ if(self.updated_frida_version == local_version):
+ res = self.app.get_adb().su('ps | grep frida', stdout=subprocess.PIPE)
+ if(len(res) == 0):
+ self.app.get_adb().su('frida -D', stdout=subprocess.PIPE)
+
def update_frida(self):
def _update():
if os.path.exists('frida'):
@@ -309,16 +316,28 @@ class WelcomeUi(QSplitter):
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
- res = utils.do_shell_command('unxz frida.xz')
+ #on windows no unxz command
+ if os.name == 'nt':
+ import lzma
+ with lzma.open('frida.xz') as xz:
+ with open('frida', 'wb') as unxz:
+ unxz.write(xz.read())
+ res = ''
+ os.remove('frida.xz')
+ else:
+ res = utils.do_shell_command('unxz frida.xz')
+
if len(res) == 0:
res = self.app.get_adb().mount_system()
if res is None or len(res) == 0:
self.app.get_adb().push('frida', '/sdcard/')
- self.app.get_adb().su('killall -9 frida', stdout=subprocess.DEVNULL)
- self.app.get_adb().su('mv /sdcard/frida /system/xbin/frida', stdout=subprocess.DEVNULL)
- self.app.get_adb().su('chmod 755 /system/xbin/frida', stdout=subprocess.DEVNULL)
+ #self.app.get_adb().su('killall -9 frida', stdout=subprocess.DEVNULL)
+ #not all have killall command
+ self.app.get_adb().su('kill -9 $(ps | grep \'frida\' | awk \'{ print $2 }\')', stdout=subprocess.PIPE)
+ self.app.get_adb().su('cp /sdcard/frida /system/xbin/frida', stdout=subprocess.PIPE)
+ self.app.get_adb().su('chmod 755 /system/xbin/frida', stdout=subprocess.PIPE)
self.update_frida_version()
- self.app.get_adb().su('frida -D', stdout=subprocess.DEVNULL)
+ self.app.get_adb().su('frida -D', stdout=subprocess.PIPE)
os.remove('frida')
else:
os.remove('frida.xz')
from dwarf.
Yes, you can.
from dwarf.
Hi! Yes is multi platform! Should works fine on win too but let me know for issues!
from dwarf.
hey, here comes some issues on Windows……seem like keystone problems...
from dwarf.
-> http://www.keystone-engine.org/download/
install from here
from dwarf.
Аfter installing keystone, there is a problem with the scrypt
from dwarf.
Python 3.7
from dwarf.
Python 3.6
from dwarf.
For the scrypt Error
Read the Errors - OpenSSL is missing
Make sure VC Compiler can find the OpenSSL Headers
Its looking in c:\OpenSSL-Win64\includehttp://slproweb.com/products/Win32OpenSSL.html
Needs -> Win64 OpenSSL v1.0.2q Package1.1.x Package have different LibNames
the last one with the white Window.
Its saying adb is missing (sometimes or with debugger).
Make sure Path to adb.ex is in PATH
It worked, but the application also freeze.
from dwarf.
Think its same adb problem.
Trying to reproduce but the adb stuff is not showing in my console
With adb.exe in %PATH% it looks then this in my UI
Try
in dwarf\ui\ui_welcome.py
TempModify Line 272
to
local_version = None # self.app.get_adb().get_frida_version()
from dwarf.
Let me know if you came up with something! Unfortunately I have no windows box to test... I'll setup a VM soon
from dwarf.
You can use our slack as well! There is people running it on windows that can help with tests
from dwarf.
Ok im using cmd as shell on windows not powershell but think thats not the Problem.
Removed adb from system vars
white window appears
in cmd then
D:\git-repos\Dwarf>set PATH=%PATH%;D:\AndroidSDK\platform-tools
D:\git-repos\Dwarf>python dwarf.py
and it works fine again
from dwarf.
Ok im using cmd as shell on windows not powershell but think thats not the Problem.
Removed adb from system vars
white window appearsin cmd then
D:\git-repos\Dwarf>set PATH=%PATH%;D:\AndroidSDK\platform-tools
D:\git-repos\Dwarf>python dwarf.pyand it works fine again
Maybe there is a problem in the NoxPlayer?
from dwarf.
I think the problem is your emulator. Try Genymotion or android devices.
from dwarf.
The adb stuff should not appear in console it should be redirected to the script
utils.py do_shell_command
from dwarf.
Yes. It's x86. You'll find some if else around which checks only 'arm' or 'arm64'
from dwarf.
It is well redirected in osx/linux
from dwarf.
Ok it does not work with the adb from nox dir can reproduce it now.
Use the real Android SDK and its adb
from dwarf.
Yeah but would be better to know why? Maybe try to use:
adb shell su -c id
On the nox adb
from dwarf.
Some emulators use its own adb, you can check it in the emulator installation folder.
from dwarf.
version is empty so it thinks no adb and it is freezing on welcome
from dwarf.
Genymotion solved the problem, but unfortunately most applications do not work on it.
New problem:
https://i.imgur.com/8dUbRBh.gifv
I execute
adb push C:\Users\Andrey\Desktop\frida\frida /data/local/tmp/
But it did not give any results.
from dwarf.
Another one
on Windows there is no "unxz" command so it should simply use pythons lzma
ui_welcome.py line 312
if os.name == 'nt':
import lzma
with lzma.open('frida.xz') as xz:
with open('frida', 'wb') as unxz:
unxz.write(xz.read())
res = ''
os.remove('frida.xz')
else:
res = utils.do_shell_command('unxz frida.xz')
from dwarf.
i dont know how come i did totally forget about your message @PinkiePieStyle
Is there any way you could pr those changes!? just to keep the ownership.. during those days i've fixed (i think) the problem with the stderr as my other friend was having this and we solved it. The one for lzma is still there indeed!
from dwarf.
I've started rewriting a lot of stuff.
But my local Version is behind master
I'll upload my stuff so take what you want.
It fixes starting freezer from threading in ui_welcome (only main thread should update ui)
Fixes lot of adb stuff and allows more frida stuff (running/stopping)
stdout/stderror is fixed it uses "capture_output=True" so python handles the stdout/stderr
frida update is fixed
remove:
utils.do_shell_command('unxz frida.xz')
pythons lzma works on all os'es
ADB gives now a Message and works only when 3 requirements are true:
"adb: False
dev/emu: False
su: False
root: False
at least 3x True required"
works with all tested devices and emulators fine here
But my changes for the other UI Stuff arent ready so they are not included atm.
The UI suxx on windows...
QTableWidget in panel_memory is replaced with own HexViewer Widget and so on wich runs smoothly and fast here. but all this later when ready...
from dwarf.
Golllllddddd!!!! Really appreciated!!! Gonna take a diff to most recent code and your code and merge them <3 sadly there won't be ownership but I'll add notes to the code! Thanks!
from dwarf.
Im porting your changes @PinkiePieStyle ! So far so good, had to edit a couple of stuffs described in commits!
https://github.com/iGio90/Dwarf/tree/PinkiePieStyle
from dwarf.
In ui_welcome it need two changes
replace
update_commits.run()
with
update_commits.start()
and
dwarf_update_thread.run()
with:
dwarf_update_thread.start()
it should not call run directly
from dwarf.
if i do those 2 changes
iGio90:Dwarf igio90$ python3 dwarf.py
QThread: Destroyed while thread is still running
Abort trap: 6
iGio90:Dwarf igio90$
from dwarf.
its -> update_commits.run()
from dwarf.
its the garbage collector
ui_welcome
def update_commits(self):
if self.update_commits_thread is None:
self.update_commits_thread = DwarfCommitsThread(app=self.app)
self.update_commits_thread.on_update_available.connect(self.on_dwarf_isupdate)
self.update_commits_thread.on_add_commit.connect(self.on_dwarf_commit)
if not self.update_commits_thread.isRunning():
self.update_commits_thread.start()
def update_dwarf(self):
if self.update_dwarf_thread is None:
self.update_dwarf_thread = DwarfUpdateThread(self.app)
self.update_dwarf_thread.on_finished.connect(self.on_dwarf_updated)
self.update_dwarf_thread.on_status_text(self.on_dwarf_status)
if not self.update_dwarf_thread.isRunning():
self.update_dwarf_thread.start()
and before self.setup_threads()
self.update_commits_thread = None
self.update_dwarf_thread = None
from dwarf.
that worked
from dwarf.
adb.py line 58 needs ():
if res and ('no devices/emulators' or 'device not found') in res:
and your self.su('ps -A -o comm,pid | grep frida') isnt working with some androids (nox android 4)
thats why the self.su('ps | grep 'frida' | awk '{ print $2 " " $9 }'') is there
nox with android 4
130|root@android:/ # ps | grep 'frida' | awk '{ print $2 " " $9 }'
2013 frida
2015 /data/local/tmp/re.frida.server/frida-helper-32
root@android:/ # ps -A -o comm,pid | grep frida
1|root@android:/ #
from dwarf.
Ok so, let's add an if is_emulator there and use the awk version... I wonder why it's not working on nox?
from dwarf.
Have an real device with android 5 rom and there is also no "ps -o" support
from dwarf.
Ok... Let's just kill -o and grep each of res.split('\n').split(' ') fields
from dwarf.
Tested this part
is_frida_running
result = self.su('ps -A -o comm | grep 'frida'')
if result is not None and 'frida' in result.split('\n'):
return True
its always False
when changed to self._do_adb_command('adb shell ps | grep 'frida'')
it runs the command but ('frida' in result.split('\n')) is false
so with awk it runs on all tested devices better
from dwarf.
the subprocess.run() stuff was fixed before some comments above
stderr is redirected to stdout and stdout to pipe
def do_shell_command(cmd, timeout=60):
try:
# capture output is only supported in py 3.7
if VERSION.minor >= 7:
result = subprocess.run(cmd.split(' '), timeout=timeout, capture_output=True)
else:
result = subprocess.run(cmd.split(' '), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=timeout)
if result.stderr:
return result.stderr.decode('utf8')
return result.stdout.decode('utf8')
except subprocess.TimeoutExpired:
return None # todo: timeout doesnt mean cmd failed
from dwarf.
Hey @PinkiePieStyle just got an idea... can you check if your devices respond with a pid to command "adb shell su -c pidof frida" when frida is running? we could use this instead!
from dwarf.
awk still give trouble on my op5... pidof could be a general workaround, i can just add 3 if frida/frida-helper/frida-helper64 to both is_running and kill -9
from dwarf.
used the command with awk in it directly in shell? dont know whats wrong with awk.
ps | grep 'frida' | awk '{ print $2 " " $9 }'
run it on your device and show outputs
nox has no pidof on android 4:
root@android:/ # pidof
/system/bin/sh: pidof: not found
from dwarf.
a-side that awk doesn't come by default, i had to install busybox but that was not the issue, the command is returning me error even if i run on an adb shell :/ let's just use pidof if it's working on emulators too... we just need the pid in the end!
from dwarf.
ok I made awk work! but for you it's $2 $9 for me its $1 $4 XD
from dwarf.
OnePlus5T:/ # ps -A | grep frida | awk '{print $1 " " $4}'
26466 grep
30413 frida
30423 /data/local/tmp/re.frida.server/frida-helper-64
30691 /data/local/tmp/re.frida.server/frida-helper-32
OnePlus5T:/ # ps -A | grep frida | awk '{print $2 " " $9}'
0
0
0
0
OnePlus5T:/ #
from dwarf.
Its Android 8 or greater?
Can you show the output from 'ps' only
This should work on all too but it needs some workaround for killing frida as it needs a pid
def is_frida_running(self):
""" Checks if frida is running
"""
if not self._adb_available:
return False
found = False
result = self.su('ps | grep \'frida\'')
result = result.split()
if 'frida' in result:
for r in result:
if 'frida-helper' in r:
found = True
return found
from dwarf.
what about this -> 596c561
Edit: yeah, it's android 8.1
Edit2: i tested myself the pidof thing (my device will follow the pidof path) and it's working... can you confirm yours is working as well?
from dwarf.
Line 61 needs the ( ) or dev_emu is always false
if res and ('no devices/emulators' or 'device not found') in res:
with the android 4 the ps -A returns nothing only without -A works
Edit: Android 7 also no -A but gives atleast an error
ps -A
bad pid '-A'
seems in 8 it becomes new ps
https://stackoverflow.com/questions/44732749/how-to-make-adb-shell-ps-list-all-processes-in-android-o
some ro.build.version.release check for >8.0?
from dwarf.
@PinkiePieStyle review -> e7f1679
from dwarf.
found another one
after installing frida on the dev the button needs to enable again
ui_welcome line 657:
if not self.app.get_adb().is_frida_running():
self.frida_update_button.setText('start frida')
self.frida_update_button.setEnabled(True)
self.frida_update_button.setVisible(True)
else:
self.frida_update_button.setText('stop frida')
self.frida_update_button.setEnabled(True)
self.frida_update_button.setVisible(True)
in my repo is my adb.py wich works here with android 4, 5, 7
includes some other fixes too
from dwarf.
you mean here:
def update_status_label(self, update_text):
""" sets status text from fridaserver update
"""
if not self.app.get_adb().is_frida_running():
self.frida_update_button.setText('start frida')
self.frida_update_button.setEnabled(True)
self.frida_update_button.setVisible(True)
else:
self.frida_update_button.setText('stop frida')
self.frida_update_button.setEnabled(True)
self.frida_update_button.setVisible(True)
label_text = ('device frida version: {0}\nupdated frida version: {1}'
.format(update_text, self.updated_frida_version))
self.frida_update_label.setText(label_text)
from dwarf.
in def update_frida_version(self):
when it updates or installs frida the button gets disabled but then no one can click 'start frida'
Edit:
something looks wrong there this is my update_status_label
def update_status_label(self, update_text):
""" sets status text from fridaserver update
"""
label_text = ('device frida version: {0}\nupdated frida version: {1}'
.format(update_text, self.updated_frida_version))
self.frida_update_label.setText(label_text)
from dwarf.
ok check now! just committed
from dwarf.
when changed in update_frida_version it fine then
changed in adb in my repo
line 66 + elif res and 'device not found' in res:
and all is working on oreo too then fine
from dwarf.
cool! merged into master with ur last change!
from dwarf.
was there some changes in requirements? merged master in my build but is crying about unicorn now
then on_dwarf_updated should have some "pip3 install -r requirements.txt" stuff too
from dwarf.
mhhh yeah... i did re-run pipreqs to generate new requirements.txt yesterday i think
from dwarf.
found it
216b2b1#diff-b4ef698db8ca845e5845c4618278f29a
but this breaks the internal dwarf update
from dwarf.
updated my adb
ive closed all emus/devices here and found another bug
sdk_ver and android_ver doesnt work without dev/emu
from dwarf.
a friend of me having this:
Traceback (most recent call last):
File "C:\Users\James\Desktop\Dwarf\ui\ui_welcome.py", line 494, in update_dwarf
self.update_dwarf_thread.on_status_text(self.on_dwarf_status)
TypeError: native Qt signal is not callable
from dwarf.
edit: self.update_dwarf_thread.on_status_text.connect(self.on_dwarf_status)
from dwarf.
kudos! <3 I'm still newby in pyqt
from dwarf.
ive changed to connect in my comment
emit was wrong srry
from dwarf.
'Setup and run' in readme should have some windows related stuff
On Windows remove 'keystone_engine>=0.9.1.post3' in requirements.txt
pip3 install -r requirements.txt
and install the precompiled binaries
x86: https://github.com/keystone-engine/keystone/releases/download/0.9.1/keystone-0.9.1-python-win32.msi
or
x64: https://github.com/keystone-engine/keystone/releases/download/0.9.1/keystone-0.9.1-python-win64.msi
python3 dwarf.py
from dwarf.
keystone is optional, there is code to check and eventually show a dialog if it's not installed so it could be safely removed from reqs. Yeah anyway, let's add those notes!
from dwarf.
"Can this software be installed on my Windows 10?"
yes - can be closed here?
from dwarf.
Related Issues (20)
- Ultra laggy
- Reason: Frida Error: the connection is closed
- dead link http://sec-r.et/dwarf
- how to save java trace HOT 1
- Support Hotspot JVM .
- fail to attach a process HOT 3
- There are too many same classes. HOT 11
- TypeError: cannot read property 'apply' of undefined at api (/script1.js:3503) at apply (native) at (frida/runtime/message-dispatcher.js:13) at c (frida/runtime/message-dispatcher.js:23)
- Error message is shown when adding breakpoint for export function at first time HOT 9
- Error message is shown when adding breakpoint HOT 1
- where is dwarf 2.0.0 HOT 13
- the decompiler output is wrong HOT 8
- Step instruction doesn't work for Java in Android HOT 1
- ReferenceError: breakpoint is not defined HOT 7
- Does core.js match the latest commit in DwarfCore project? HOT 1
- Crash on launch HOT 14
- Crash on launch 2 HOT 1
- Android "ADB missing or no Device" HOT 1
- no output while javascript injecting HOT 2
- how to get Dwarf.core.ts? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwarf.