[Q] Robust Linux command-line utils for Android? - Android Software/Hacking General [Developers Only]

Has anyone compiled a set of command line utilities for Android more robust than BusyBox? Coming from an iPhone, I love Android and its hackability, but I'm surprised that I haven't seen more about command line tools like the BSD Subsystem packages that provide common utils on the iPhone.
It would be incredibly convenient for me (and others, I would think) to have a more complete set of commands available. I know that some have compiled bash for Android, though I haven't seen an installable version of that either.
Any insights?

Android command line utilities archive
I maintain an archive of useful command line utilities at vkfox"dot"com"slash"android and a blog at androidcommandline"dot"apps-1and1"dot"com that describes installation and use for the NON-ROOT terminal emulator user. Included are a properly compiled busybox, popular command line interpreter/compilers (tcl, nodejs, d8, pforth, squirrelfish javascript, php-cli, python, perl, java, pforth, etc.), utilities (grep, strace, gdb, ctags, links, etc.) and other things in which I have an interest. I also describe in the blog how to use dalvikvm without root to compile and execute java and provide dexed versions of the eclipse java compiler and other java utilities for this purpose.
Other places where you can get properly (NDK) compiled tools are the applications CCTools, Terminal IDE, and other terminal based developer apps.
Use at your own risk, and don't point the gun at your own feet.

Related

C Code in G1? JF? Anyone?

I'm just wondering is anyone trying this yet? i mean is it even possible?
Just a thought for you big shot android devs out there JF, Haykuro, LucidREM
Google "android jni"
Well, a quick trip around google would have helped you.
Android is using java, and currently it's not possible to use anything else.
But anyway, would you rather compile all of your code for multiple architectures? J makes things easier here...
You can write cli-apps in C though... i heard something about that there was plans to make other languages available in android, but i wouldn't hold my breath
Also, why is this related to JF/Haykuro/LucidREM?
I think you can do this with JNI: http://en.wikipedia.org/wiki/Java_Native_Interface
Using an ARM native compiler (such as the ones at CodeSourcery, http://www.codesourcery.com/sgpp/lite/arm/portal/[email protected]=lite) you can compile your apps and run them fine on the G1
Code:
$ arm-none-linux-gnueabi-gcc -static foo.c -o foo
$ adb push foo /data/foo # we are pushing to /data as it is +rwx (read, write, execute) for a standard user.
$ adb shell /data/foo
a=1
b=2
foo=a+b
foo=3
^^^
OH I love when I stumble across a post like this and have something new to play with.
The problem is due to the different location of the linker and mainly the different libc you have to statically link everything.
I have been having a hell of a time getting DPKG to build statically.
I picked up a copy of the newly released book, Unlocking Android, at Barnes and Noble yesterday. There is a whole chapter devoted to writing native apps using C (and ARM assembler) with the CodeSourcery tools linked above. The author walks through the steps you need to do to dynamically link the libraries so you don't end up with enormous statically linked executables. Well worth the price.
It is surprising what you can do with C on the phone, its actually not too difficult. The method outlined below doesn't use the non native toolchains and if you use the sourcery toolchain (as mentioned above) you will end up with bigger binaries as you need to link in a standard glibc and not androids bionic libc. This may or may not be important for your project.
The other advantage of the steps below is that you will build and link against any library that is available to the android platform
The easiest way that I've found to start when porting or writing new applications is this method.
1) Check out the current git android source.
2) Build the entire tree, "make" in the top level directory.
3) Create a new directory in mydroid/external/packagename/
4) Copy one of the simple android Android.mk (Make) files from a "like" target.
(If doing a library, choose a library, if coding an executable , choose that).
5) source the mydroid/build/envsetup.sh in the users bashrc
6) cd to your directory, then instead of the usual "make" do an mm.
This should create a binary, which you can adb push to the phone and run at the console.
You can do all the usual things if linked properly, like write the framebuffer using sdl, play sounds, create network connections.
Just remember that you dont have a standard libc (glibc) to play around with you have "bionic". If you are missing your favourite glibc function , it is probably intention and not abug. You'll either need to port it or make do with the functions provided by bionic.
These instructions are for a "pure" C program. you can mix the java like dex calling by 'shelling' out to the C application when you need performance, however premature optimization is the root of all evil, you'll be surprised what performance you can pull from davlik (And I expect the VM guys to improve this even further).
I know that is a lot to digest. Will do the best I can to answer your questions. I'm by no means an expert in the area, but have learned a bit about C on android.
Well I don't know much about all this but what i know is that e.g.
ScummVM IS written in C++ , and so is g-arcade.
His FAQ says:
"How did you do this? Is it Java?
No. ScummVM is a C++ program. For this port, I turned it into a really big JNI library so Android still thinks it's running a Java program, but almost all of it is implemented in C++."
(http://sites.google.com/site/scummvmandroid/faq#TOC-How-did-you-do-this-Is-it-Java-)
So if some1 wanna port MAME, feel free to xD

GNU Standard compilers for android

Hi, I'm beginning c++ Development, Done a little stuff with OpenGL but love challenging myself with command line stuff. For this, I mostly use gcc, and either geany or nano.
I did have debian on my G1 so I could use nano and gcc. It worked well, but the only way of getting files to and from would be via ftp.
I was wondering if people who had experience compiling command line stuff for android (Hasn't Bash recently been ported?) could help or give me some tips? nano + gcc would be awesome, though gcc is a must, I'd be able to copy my app to my g1's SD card and have my terminal apps on the go, great for long journeys and stuff.
I'd even be tempted to look at writing an IDE in Java (though I've not much experience in GUI development, I have in programming theory).
Plus, are there instructions for actually compiling linux apps for android, I don't seem to have found any anywhere, and It'd be good, that we could maybe compile more apps like rtorrent and such.

[Q] Running a C++ binary

So this is probably a silly question.
I have this rather complicated app that would be a heck of a lot of work to convert to Java.
It runs in the command line and works fine in Linux.
Trying to run it fails, but x86 bytecode probably isn't very ARM friendly.
Is there a specific way I need to compile the application?
Is it even possible to run it from a console emulator?
Thanks.
Try Android NDK
I am also new to Android Dev ( 15+ years Linux, 10+ years Java, etc.)
I am not an expert but for your purposes you need the "Android NDK" in addition to the "Android SDK" that most developers utilize.
"The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications.
Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++. "
Basically the tools are needed to cross compile C++ source code for the target ARM environment.
I am prevented from posting the download URL for some bizarre reason, but it is listed under "Native Development Tools" on the left side of the web page for the standard "Android SDK" download.
Yeah that's because you are new. It's a system to prevent spammers from posting URLs.
When you have a couple of posts the restriction will disappear
Anyway; found it, seems to be what I'm looking for.
I'll check it out in the morning.
Big thanks
Dmitry Moskalchukhas written a patch for the ndk to better support c++ see crytax dot net there are posts on google groups android-ndk talking about it
Thxs for the info. I was aware that the NDK did not include all of the libs that desktop Linux/UNIX developers expect. The suggested patched version adds the STL libs back in.
Sent from my PC36100 using XDA App
There are A LOT of libraries missing
I guess I'll just keep it a hosted app.
Thanks for all the input

How to Program Own Apps in Android 4.4.4 KitKat

I am a programmer who has programmed in x86 Assembler, Visual C++ under Windows and DOS.
I need to be able to do own applications for Android KitKat 4.4.4
I need any help and information such as manuals, books, lists of commands, lists of functions, C compiler or, best, Assembler compilers for a given processor, etcetera.
I would like to code in Assembler. I guess I need an Assembler for a given processor and cell phone. In case not possible, I need a C compiler for Android 4.4.4 KitKat. I need the basic rules on how to code for this OS as well as the OS calls which I can use, as well as a description of function libraries which may come with the C compiler.
I prefer pure C than C++ or Java.
I have briefly searched the Internet with various key words and I have not been able to find anything relevant.
Please, does anyone have any information where I can get anything helpful.
I am totally new to this OS and I do not even know the shell commands. I do not have much information of the shell, although I have found a basic list on this forum and I use ls and ? and go by the name as a dumb fool.
Please, advise.
While Android is in Java, it also allows you to run C/C++ native code.
Search "Android NDK" and you will find the relevant documentation.
Arws Apps said:
While Android is in Java, it also allows you to run C/C++ native code.
Search "Android NDK" and you will find the relevant documentation.
Click to expand...
Click to collapse
Thanks. I have tried NDK. I am not sure whether I have installed this correctly but I would keep this.
Because NDK is hardware specific and I am not sure whether and how much Moto E XT1023 and others are supported, I have installed Android Studio 1.2 ad started with XML and Java. I have done similar things with HTML and Java for web sites. I would use XML as much as I can and Java only to get and set some variables, then I would use C for programming and then I would set Java variables and methods. I am not very happy with Java but there is not any other way for now. Hopefully, in the future, they would make XML a real language with all the resources available, functions and methods.
At least Java has a very C-like syntax, so in general it shouldn't be that difficult. In some sense it would even be easier (no memory management).
Arws Apps said:
At least Java has a very C-like syntax, so in general it shouldn't be that difficult. In some sense it would even be easier (no memory management).
Click to expand...
Click to collapse
Yes. You are right. I would prefer, however, a pure ANSI C. This can be done either as an interpreter to be hardware independent or as a compiler upon launch, the system would have a compiler, the user would download only the ASCI text. Upon launch, the compiler would be called first to compile and then the application can be launched. Then, the user can either keep the .exe or keep just the ASCI text, in which case, new compilation has to be done with every launch. A compilation would normally take one or a few seconds only for normal applications.

AutoSploit

This could be very good. I didn't read too much though.
AutoSploit is slightly more sophisticated but only because it leverages two popular, well-supported security tools. "As the name might suggest," its author wrote on the tool's GitHub page, "AutoSploit attempts to automate the exploitation of remote hosts." To do that, the Python script uses command line interfaces and text files to extract data from the Shodan database, which is a search engine that taps into scan data on millions of Internet-connected systems. AutoSploit then runs shell commands to execute the Metasploit penetration testing framework.
The link didn't work.
This one did:
https://arstechnica.com/information...ool-sparks-fears-of-empowered-script-kiddies/
Not useful for tablet exploitation.
Sent from my iPhone using Tapatalk

Categories

Resources