This piece of artwork was found in android audio driver (bp_utils.c)
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int exec_at(char *tty_dev, char *at)
{
char cmdline[100] ={0} ;
sprintf(cmdline, "/system/bin/busybox echo -e \"%s\r\n\" > %s", at, tty_dev);
return system(cmdline);
}
Busybox in this case – works as shell.
So to write data to file instead of fopen(), fwrite(), fclose() they are invoking shell to do echo to file.
Genius!
It’s cunning piece of code actually: echo -e will interpret blacksash.
This programmer is lazy… like most of us.