What do you use the Android Terminal Emulator for? - android

Why is there a terminal emulator in the Android App Market?

So you can get direct access to the commandline?
Android is based on Linux, so it's essentially the Linux commandline you'd be accessing here
If you don't know the Linux commandline:
http://linuxcommand.org/learning_the_shell.php
Please note that it'll be a somewhat limited environment - you might need to root your phone to get access to everything, also some commands won't be available, you probably want to install something like Busybox to get a more featureful environment.
Cheers,
Victor

As above - it's for shell access, once you have root.
I've mainly just used it for browsing the file structure to get a better idea of where everything sits.

We use terminal emulator on Android for executing Linux core shells or other shells and program like that. It is a very useful app for Android developers.

Related

Interact with SELinux on GenyMotion Virtual Device

I read a lot about SELinux, and I would have liked to try and get my hands on a case study for the university.
I have installed various virtual devices on GenyMotion, from Android 6 to Android 9, but nobody owns SElinux: when I do "sestatus" it answers "disabled".
I do not think it's enough to enable it, it seems that the modules must be installed in the kernel, can someone tell me how to do it? I tried but I did not find anything, I'm having a lot of difficulties, it's the first time I do these things.
Thanks to everyone in advance.
Finally I managed to make everything work: I was able to access Selinux information via a terminal in the GenyMotion virtual device. Selinux is already active on devices after version 4.3, there is no need to install it as it said #Martin Zeitler. I explain the solution to the problem (on Linux it works).
The first thing to do is to install a terminal in the virtual device: I have installed Termux. To do this, just download the apk from a site and drag it to the virtual device, the installation will start. Subsequently, it is necessary to provide the SuperUser permissions to the Termux terminal: banally, by opening the terminal, provide the SU command, and the device will ask you if you want to provide SuperUser permissions to the Termux application. When you enter the SU command, it will allow you to browse the folders on your device. With the "ls" command, providing the "-Z" option, you can see the SElinux context of the files. From the terminal, using the "getenforce" command, you can see how Selinux is running. Here you will see other useful commands: https://www.all-things-android.com/content/se-android-commands
Now, you will need to download the tool that allows us to interact with Selinux: setools. https://github.com/pasis/setools-android These tools are written in C, the native language of Android, so you need to download the NDK library to compile them: https://developer.android.com/ndk/downloads/
The first thing to do to compile, is to specify the project path:
export NDK_PROJECT_PATH=/my/project/path . The second step is to specify the makefile:
ndk-build NDK_APPLICATION_MK=/my/project/Makefile.am (for a complete guide: https://software.intel.com/en-us/articles/building-an-android-command-line-application-using-the-ndk-build-tools)
When you have finished compiling, you can send the Setools folder to the virtual device, using the adb program. ./adb push /setool/local/folder /remote/device/folder
(example: ./adb /setool /tmp) Now that you have Setool on your device, you can run the tools in the "/setool/obj/local/x86" folder. Thanks to "sepolicy-inject" you can also add rules to the policies.
Finally, thanks to this guide I realized that Selinux policies are stored in binary format, so it is not possible to interact with them without tools.
https://ge0n0sis.github.io/posts/2015/12/exploring-androids-selinux-kernel-policy/
one cannot "install SE Linux" on Android; because it's already installed and enabled by default since API level 21. you'd need to become user root, in order to access these management commands. this would only be possible on a rooted hardware device - or a rooted emulator image.
... just install CentOS or whatever else security enabled Linux distribution, for a test.

How to invoke "./configure; make; make install" on Android adb

I have a program that I would like to install on an android phone (x86). The program can be installed on a Linux PC. The procedure of installing the program on the PC is:
$./configure
$make
$make install
Now I would like to do the above through android ADB so I can install it on the phone. What are the utilities needed? (I cannot find "make" in busybox http://www.busybox.net/live_bbox/live_bbox.html)
Building your program directly on the phone probably isn't going to be practical. The number of dependencies that make will wind up invoking during the build process will be huge, and either not exist or not work well on the device itself.
It would be better to look at cross-compiling, where you use a different system to build a binary that is suitable for your device.
It wouldn't be possible to provide more specific info without more detail, but be warned: you're probably in for a big project.
Maybe start here? http://forum.xda-developers.com/showthread.php?t=2723240

Golang for Android on Windows?

I haven't read anything explicitly stating that you can't use Windows but everything that does walk you through what to do seems to involve running a .sh file. Has anybody had any luck compiling any kind of Go for Android, whether it be a library or a full native activity?
No, the all process is tied to Linux (FROM ubuntu:12.04 in the Dockerfile).
That means you would need to have on Windows a Docker-compliant environment (like a boot2docker) in order to launch the
docker run -v $GOPATH/src:/src mobile /bin/bash -c 'cd /src/your/project && ./make.bash'

Is it possible to gain root and/or install BusyBox on the Android Emulator?

It'd be nice to have the "Swiss Army knife" of BusyBox on my emulator. It would also be nice to have full root access. Does anyone have any experience doing this? I'm not familiar with qemu; is this even possible?
Update: The emulator has root by default (accessed via the adb shell command). Does anyone know where I can easily obtain a pre-built busybox binary?
The emulator is not set to secure mode, so it's adb shell should be a root shell.
There are several android builds of busybox, for example cyanogen alternative versions of Android use it to augment toolbox (which is Android's own limited re-implementation of the same concept under a non-gpl license). You should be able to get it from the cyanogen repositories and build it from source, or it's possible that just extracting the binaries from a same-android-version cyanogen update.zip would work (it may be in a compressed file system inside the update though)
There were also some writeups from pioneers who discovered the accidental root shell on the original G1 release and installed quite a bit of debian arm.

unix utilities under Android

I have a smartQ V5 device running Android ( 1.6, I think)
Q: I can not do simple unix things (find, more, ... ) on this device.
they are not there. Do I aomehow downlooad them? apt-get is not there
either; is there an alternative?
Do I aomehow downlooad them?
Generally, no. There is supposedly an ARM port of busybox around somewhere. An Android device is not a Linux PC.
apt-get is not there either; is there
an alternative?
Not for command-line Linux usage. Again, an Android device is not a Linux PC. You use tools like the Android Market to install Android applications.
You can download Cyanogenmod's busybox from here. You will need to root your phone to run it.
busybox is a single executable which contains many unix commands, including find and more.
For what you want to do, you may find it easier to simply install cyanogenmod on your phone. Be aware rooting and/or flashing your phone is not a step to take lightly, and may result in an expensive brick.
Here's an installer, logically, it requires root.
https://play.google.com/store/apps/details?id=stericson.busybox

Categories

Resources