Is there any neat way of accessing screenshot of android device
programatically. I am looking for some 15-20fps.
I found one code
android\generic\frameworks\base\services\surfaceflinger\tests\screencap\scr eencap.cpp,
i built the executable and put it in /data and changed the mode 777
but when i tried to execute it using adb shell it gives the below error.
# chmod 777 test-screencap
chmod 777 test-screencap
# ./test-screencap test
./test-screencap test
screen capture failed: Function not implemented
I also know that we can access fb0 but its not a right method as suggested
by android team. Is it possible to access the screen shot at the frameworks
layer. I beleive surface flinger composes individual layers and gives it to
framebuffer.Where exactly this is done ? Can a application be able to access
such codes.
There are some java apps also which use ddms to actually capture this
framebuffer data without root access. But the fps is really poor.
I beleive there should be some or the other way of doing the above job.
Please suggest me some neat way of doing it. Suggestions are welcome.
What you are trying to do is not possible if you don't have a rooted phone, there is an app out there that does what you are trying, Screenshot ER. The latest OEM's are putting it into their /system/apps now... so you may be able to use their apps, check out this article for devices that have enabled this feature. Other than that your really stuck but there are implications with screen captures enabled as this could lead apps saving screen captures and sending that info out, enabling virus type apps...
Information for others .....Through Eclipse you can get a screen capture usig the DDMS perspective. If you take a look at the Eclipse DDMS code base its actually a stand-alone app too. You might be able to use this Java code then.
AdbHelper.getFrameBuffer(AndroidDebugBridge.getSocketAddress(), this);
Take a look at droid VNC Server
This is an open source project which you can clone the source code to your private PC. (http://github.com/oNaiPs/droid-VNC-server). I am investigating how VNC can do but It's really hard to do the same.
Read framebuffer content is an good solution also. But it just work with android <3.x only. I don't know how to fix it to work on android 4.x. If you know how (after see my suggestion) please share it here. Through my researching, I see that there are a lot of people looking for this.
Hope this helps.
nguyenminhbinh1602#gmail.com.
Android Freelancer.
Related
I have a K1 Plus android box which have a built-in dvb-t2` and dvb-s2 tuner in it. I want to create an app that gets and shows the channels from those tuners.
At first, I found about android's TV Input Framework(TIF). The sample app keeps crashing by calling a method that gets the available inputs of the device. Then, found out that it only work for real Android TVs. I looked for android libraries for that android box but didn't find anything. I looked for c libraries that can access the tuners but didn't find anything as well. I looked for code on how to access the hardware components of an android device and didn't find anything. I recently found about https://opencv.org/. I haven't read everything about it yet so I don't really know how to use it.
I found about https://git.linuxtv.org/v4l-utils.git from an answer to a SO question but it seems like it can only be used after installing it to an OS. I was able to compile it using CMake on android but it got missing header files.
I also found http://android4tv.iwedia.com. Unfortunately, it's also using TIF.
I'm trying to create something like kodi but I found out that it isn't really the one that gets the channels but kodi is getting it from a supported iptv box. I have zero knowledge about writing C but I'll try to make the code.
This is the box btw. http://www.videostrong.com/S905D+DVB(KI%20PLUS)/55.html
From my research, I found about HAL(Hardware Abstraction Layer). Do I need that for making my C code?
Update:
After months of research and not finding any quick way to implement a tv tuner library, I returned to my bookmarks from previous research. One of them is this. The first step from that SO answer is do a ls /dev/dvb/ on the device. Because I need to do it on the android box itself, I researched about android terminal apps and found Termux. Then I did the ls /dev/dvb/ command on Termux and it told that the resource was not found or it did not exist. Then I tried to just do a ls /dev/ command and luckily I got results. There's quite a lot of them and I found something related to dvb.
The dvb related results were:
dvb0.demux0
dvb0.demux1
dvb0.demux2
dvb0.dsc0
dvb0.dsc1
dvb0.dvr0
dvb0.dvr1
dvb0.dvr2
dvb0.net0
dvb0.net1
dvb0.net2
I can post the whole list but I'll post this more related (I think) results.
The results are quite different than the example of the link above because they only used dvb and not dvb0.
UPDATE:
I might use a usb tv tuner now based on a suggestion to me.
UPDATE:
Is there a list of standard and tv tuner related usb byte[] commands that I can look at? I already saw some but they are mostly for FTDI, serial or the really standard commands which I don't have really have any use.
It will probably take a lot of reverse engineering or a leaked documentation to achieve what you are trying to do.
Devices like the one you are working on usually use proprietery hardware with proprietery drivers for things like DVB, so making a third party app for a TV tuner is very hard.
First, you need to find out what kind of DVB chip / card this Android box has.
Then, you need to figure out how (on what kind of BUS) it is connected to the system.
If it is something generic, you may be able to talk to its driver, if not, you would need to write your own driver.
This is too complicated to explain in a SO post, but you could start by opening the box and looking at the components or by running commands like lsusb through ADB to try and identify the DVB component.
If the device already has a DVB app, you could try disassembling it, to find out how it works.
Good luck!
I'm looking to build an app that will restart my device at a specified time, then open up a couple 3rd party apps in sequence and run their feature/s.
For example: I would like to automatically restart my phone at 5am. Then have it open an antivirus app of my choice and run the scan. Then close that app and open up another app and run it's cleaner function.
I have experience coding, but I'm just starting to take a peak into android app development. So, I was wondering if this is something feasible to do.
Any advice would be appreciated!
I am not sure about the starting phone at the desired time, but I am sure you can start applications on boot using "init". Linux systems support that, and android does as well. But it completely depends on your kernel.
Read here about init.d.
Check if your phone's kernel supports init.d. Check here if your phone doesn't have init.d support.
Check Here for running a script at boot. It is quite useful for custom scripts.
Check Here for running scripts/application the application at boot
Create a script according to your needs and I think you would be able to achieve what you are looking for. <- Custom Rules
I would have commented but apparently I can not since I am new here.
I hope I was of some help. Will look into the android starting part and get back to you.
Cheers.
Let's assumed I have a malware application I got from a device and reversing it using smali or dedexter or dex2jar is ok, but I want to actually debug it and not just perform static analysis.
Is it even possible? I'm not sure how the dalvik VM debugging capabilities work since they should know when single stepping which line of code belongs to which dalvik opcode line, I'm not sure where that meta data resides, anyone has experience with it?
Of course i can try dex2jar and create an eclipse project, but I'm looking for a way to do it from dalvik as well, meaning being able to step through dalvik byecode lines.
Couldn't find any open source project that does that, I'm not sure even Ida Pro allows it.
Anyone got a clue?
You can certainly do that, and debug the malware app without problem. Ida allows you to do it in a very smooth and gentle way, you only need to open the classes.dex inside the apk to IDA PRO and configure the Davilk debugger. But you could also do this in the same way that you would do it if you were writing the application using eclipse for example.
Only restriction,since the application manifest doesn't allow you to debug it (let's suppose the worst scenario and a smart malware), you need to have an engineer device so that you can attach your IDA Pro or Debugger , I mean a device where
$ getprop ro.debuggable
1
$ getprop ro.secure
0
It is also extremely easy to meet those conditions, if you can unlock the bootloader of your device and edit you ramdisk setting ro.debuggable=1 and ro.secure=0 inside the initfiles.
Alternatively, if you device were rooted, you would be able to use setpropex to easily change read only properties in this way.
# ./setpropex ro.debuggable 1
# ./setpropex ro.secure 0
github to setpropex
https://github.com/poliva/rootadb/blob/master/jni/setpropex.c
I did not try the approach but it's possible. To do that you need to download old versions of apktool 1.4.1 and netbeans 6.8 It's claimed that on newer versions the approach does not work.
You can watch the video here how to do this and read also this article which describes how to perform debugging using smali codes.
I read about the approaches on a popular russian IT webpage. Here are the links to these articles: first and it's extension. If you know russian, there are step by step instructions what to do to perform debugging. If you don't Google Translate can help you to catch the idea.
If you there are some points unclear I'll try to help you with them.
Hy everyone, I'm Korean and a little short on using english so please try to understand if I say things not appropriate.
So, my status is that I have odroid-s.
What I'm trying to do for like month or more is that I want to make android to HelloWorld.
What I want to say is that, on the odroid-s, bootloader part, kernel part is the same but the framework part(which will be android), I'll remove all the android part and replace it with just HelloWorld program. The purpose of this HelloWorld program is to display HelloWorld on the screen.
What I think I discovered is that, as I 'vimdiff' bootlogs between normal bootlog and the one that I removed all the system partition part (which is android system partition part) is that android kernel's init goes on and executes console(/bin/sh), netd(bin/netd), ... and it enables adb and it completes his work.
So my conclusion is, I need to use Linux kernel that is non-modified and modify it for odroid-s, and use that kernel for my HelloWorld program!
What I want to ask is.... Am I doing it right?? T_T
My goal right now is to make HelloWorld come out from this odroid-s device...
Please somebody help me. If anybody don't understand what I wrote plz tell me, I'll fix it.
Thx for reading....
The modifications to the linux kernel are likely to be irrelevant to your goals, so you might as well leave them in place for simplicity.
Your biggest challenge is going to be output - where do you want to send it? If you had one of the devices that has (or can have with the right kernel config) a debug serial port, then it would be really easy to write something triggered by the init script (or even use 'echo' in the script) which outputs your message on that port.
But chances are you want to put something on the screen. This is going to be overwhelmingly more complicated, and perhaps device dependent. The way the android runtime does this for actual apps is going to be way more involved than you probably want to get into.
A more practical approach might be to look at how the boot animation is done. For starters you could just replace it with a static image that says "hello world". Once you can do that, the next step would probably be to find some character generator code. Finally you might want to implement scrolling and other terminal-like features.
As an alternative approach, there are builds of more traditional linuxes for some android devices - debian or ubuntu for example. These may include console implementations capable of displaying on the device screen.
As another idea, if you are flexible about how much of android you would be willing to leave on the device, you could build a version of the android terminal emulator example, modified to be a home screen replacement. You might be able to remove a lot of android components (eventually including the default home screen). Or on a secured device (ie, most consumer devices that haven't been rooted) you could just do the home screen replacement while leaving the actual system unmodified. It wouldn't be secure against users wanting to run other things, but generally the user would interact only with your code.
I am performing some experiments where I want to replay a previously captured packet trace from Android. So far I have written my own application to replay the trace and get then answer back from the server. Timing accuracy is not a big problem as long as is within reasonable bounds (e.g., some milliseconds).
However, I would prefer to use a tested tool like tcpreplay. Is there any project that have ported tcpreplay to Android? Given that libpcap is available, there should be something available, but I could not find anything.
Thanks for your help
I'm the author of tcpreplay, and I can't say I'm aware of an Android port. Never owned an Android device so can't say one is coming anytime soon.
I've got it running on my tab, you need to install GNUroot and Debian no root, they are both from the same developer... After get it, open GNUroot, check emulate new root, create rootfs and run the rootfs, after this "apt-get install tcpreplay". If you want to capture use TpacketCapture in the play store, you can also get Tpacketcapture Pro to use the capture in only one app.
If you are planning to hack games don't publish it, cause this vulnerability can be easily patched...
any question email me.