I wanted to test Unified Remote (WiFi Remote for your PC) and I wasn't able
to connect to my PC in any way (although I could ping from PC to my Android). In the instructions it said I should try a ping from my Android to the PC, so I used the Android Terminal Emulator to try a ping and it just printed this:
ping: icmp open socket: Operation not permitted
My Android is rooted so I typed su and tried again and it worked. So I figured that Unified Remote needs su-rights to open a socket and connect to the server on my PC! The only problem is, that Unified Remote doesn't ask for su-rights... (Like the terminal. It didn't want root rights until i used su and I guess the same thing happens internally with Unified Remote)
Can I somehow start an App (in this case Unified Remote) with su-rights WITHOUT having it asking???
EDIT:
So now I tried 2 other remote control apps and none of them were able to find a server (neither detect it automaticly nor manually... And yes, I have installed and opened the server!) Again -> Ping works fine.... What surprises me is that only remote control apps have that problem... For example FTP with ES File Explorer works fine... Also I have an online game wich works fine too... I don't get it :(
Android device
ping: icmp open socket: Operation not permitted
Solution:
After Root my android mobile - PING socket error occured and I solved the issue by setting "ping" file permission as given below:
Read Write Execute
Owner Y - Y - Y
Group Y - N - Y
Others Y - N - Y
------------------
Set UID: Y
Set GID:
Sticky:
------------------
Octal Value: 4755 rwsr-xr-x
-------------------------------
You can edit permission by Root Explorer android software - Found - Play Store.
If the application it self not asking you for su rights than there is NO need to do it manualy.
I checked Google Play and in description of Unified Remote I dind't find any hint that it requires su rights.
Related
I am using Linux Fedora. I have Xampp/Lampp installed.
I have run Xampp/Lampp from terminal
sudo su
/opt/lampp/lampp start
Output :
Starting XAMPP for Linux 8.0.2-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
I am able to open localhost following ways on laptop.
http://127.0.0.1/dashboard/
http://localhost/
http://192.168.0.106/dashboard/
My ip is 192.168.0.106
But, when I was trying to open it in Android Device it's not working..
What to do now? How can I access localhost from my Android Device?
I was reading the answer also. It's not helpful also..
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"
<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Should I edit anything?
#Tenso
>NAME=Fedora
>
>VERSION="33 (Workstation Edition)"
>
>ID=fedora
>
>VERSION_ID=33
Don't different devices have different ips
And yea I've also sometimes tried localhost from Android but it never seems to work, kind of just guessing that it can only be access from the device that it's hosted on.
I am trying to add an http server to my custom ROM, which is based on 5.1. I managed to place lighttpd binary in system/xbin via PRODUCT_COPY_FILES in device.mk, and able to run it successfully in device in eng build. Server in listening to port 80.
But in user build, server is not able to bind to 80. When checked, file owner/group is root/shell. Is this the reason port 80 is not allowed ? How to change to root/root while placing the binary ? Is there any alternative method to bind to 80 ?
EDIT-1
Another option I tried is to use iptables.. but again , permission denied.
Is there any way to add an iptable rule in android source and build ?
Also read about 'updating linux configuration' to mark port 80 as a non-privileged port.. but could not figure out how to so this.
Thanks in advance.
You should not leave it running as root on port 80. this may end up in a security breach.
Either run on a higher than 1024 port, or read this answer , especially the part that explains how to use su
There are command line flags (or "switches") that Chromium (and Chrome) accept in order to enable particular features or modify otherwise default functionality.
Chromium Command Line Switches
Run Chromium with flags
Tried Chrome 41.0.xx and Chromium 43.0.xxx shell with:
# echo "chrome <flags>" > /data/local/tmp/android-webview-command-line
# echo "chrome <flags>" > /data/local/tmp/content-shell-command-line
Any idea how to run chrome with flags on Android or directly add these into default profile.
Want to add --sync-url flag to use my sync server instead of google sync servers. chrome://flags only enable/disable flags but wont let you add new flag.
New method added in Chrome 661 that works for a production build on unrooted devices.
Using adb, write the flags to /data/local/tmp/chrome-command-line.
For example:
~$ adb shell 'echo --unsafely-treat-insecure-origin-as-secure=http://a.test > /data/local/tmp/chrome-command-line'
In chrome://flags, turn on enable-command-line-on-non-rooted-devices.
Force stop Chrome (the relaunch now button will not trigger the reading of the flags file, even though the danger snackbar will disagree).
Verify in chrome://version that this worked.
https://www.chromium.org/developers/how-tos/run-chromium-with-flags#TOC-Android
What you're doing is correct, but seems like you're writing the switches to the wrong file for Chrome (and note that the file that you write the switches to may vary based on the OS version [or maybe phone?] ).
I tried this on two different phones, and had to write to two different files! Hopefully one of them will work for you:
Phone 1: Nexus 6 with Android 6.0.1
Simply do the following in adb shell:
echo "chrome --sync-url" > /data/local/tmp/chrome-command-line'
Phone 2: MotoG with Android 4.4.4
This is a bit trickier. It turned out that Chrome actually reads the switches from /data/local/chrome-command-line (not in the tmp subdirectory!). Now the issue is that on an unrooted phone you won't have permission to write to this file! So I had to root my phone* and use su to write to the file:
adb shell
su
echo "chrome --sync-url" > /data/local/chrome-command-line
*Rooting an Android phone is actually very easy and takes only a few minutes. There are a number of one click apps for rooting your phone (e.g. KingoRoot). For the case of MotoG, I had to do a few more steps to root, following this)
I needed insecure origin flag for testing of service workers on mobile device. However, for some reason these flags did not work on mobile chrome. Behaviour similar to insecure origin flag can be achieved by port forwarding.
You can find further info in my original answer here: https://stackoverflow.com/a/56146180/5048121
This does not apply exclusively on service workers, if you need https behavior on mobile device, you can combine it for example with allow-insecure-localhost flag or use self-signed certificate for localhost on server and get rid of cert errors on mobile chrome.
You need chromium debug build in order to use these switches.
Is there any way to add IMEI to AndroVM (now Genymotion) or any other Android Emulator. And also I want MAC address for wlan0 port. We already have emulators which contain MAC at lan0 port but not for wlan.
How can we do so?
if someone in your acquaintances has done so please ask them to contribute.
Details:
I am trying to build a cloud based Android App testing center as my pre final year college project for partial fulfillment towards my Bachelor of Technology (Computer Science) degree.
I am wondering how we can get more configurations for Genymotion.
Or if you can provide me with more device configurations and if it is possible to build configurations for genymotion for different devices very quickly.
Secondly, How to add MAC addresses and IMEI number to the builds?
We are trying to emulate a mobile device (non Google nexus) to make a cloud based testing centre.
For this we are trying to use androVM (Genymotion) and we are facing a few problems
What have we done so far
Building the androVm source code in "VBOX86tp-userdebug" mode from the scratch after following the steps given on official Android website.
After building the source code on a virtual ec2 server, typing the emulator command runs but its blank.
And if possible can AndroVm be run in "Fastboot" mode so that we can install it on the device.
We have been working on "building the androVm" from source code and trying to accomplish few tasks like
Running it with the img's available after the building process is complete.
Making it portable ie creating an iso/ova out of all the stuff found in the out directory.
What we have tried till now
Downloading of the AndroVm source code
initializing the repo using repo init
Downloading the source code using repo sync
choosing the lunch menu using lunch
choosing vbox86tp-userdebug
Other menus full-eng didn't work so discontinued
Few errors that came our way
Make errors: they were pretty straightforward so resolved
system.img was not being generated: resolved by making it again
bin/bash jar command error: happened to be the path error resolved by the exporting the path to jar command.
Few Questions
What an OVA file consits of and how can it be created? From what I have seen it contains few VMDK's and few configurations files attached to it,
How to convert the platform specific image files(system.img ramdisk.img userdata.img) into an OVA or ISO file.
If at all we are missing few files to give to the emulator, can you just name them.
Also how to add IMEI number
We already have MAC for eth0/1 port but we want it on wlan port
Now to make things interesting
This is the reply I got from Genymotion Team:
I want my project to cover various configurations but for starters if i can get something like Samsung Galaxy phones and tab or as a
start if I can get Samsung galaxy tab 2.
You can change the screen size and DPI for each virtual device. You
can toggle navigation bar and virtual keyboard. However, we cannot
provide virtual devices that contains proprietary applications like
Samsung.
Now here what we get is the MAC address of eth0/1 port. What if I need wlan MAC.
Unless one of the two network interface have been disabled, there
should be 2 interfaces, 2 IP, and 2 MAC addresses: adb shell ip a. 2:
eth0: mtu 1500 qdisc pfifo_fast
state UP qlen 1000
link/ether 08:00:27:d4:fe:e0 brd ff:ff:ff:ff:ff:ff
inet 192.168.56.101/24 brd 192.168.56.255 scope global eth0
inet6 fe80::a00:27ff:fed4:fee0/64 scope link
valid_lft forever preferred_lft forever 3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:c8:37:e7 brd ff:ff:ff:ff:ff:ff
inet 10.0.3.15/24 brd 10.0.3.255 scope global eth1
inet6 fe80::a00:27ff:fec8:37e7/64 scope link .
Sorry, but we do not provide support for specific ROM. However, I
strongly recommend you to visit the community at:
https://groups.google.com/forum/#!forum/genymotion-users
1. What an OVA file consits of and how can it be created ?From what i have seen it contains few VMDK's and few configurations files
attached to it,
"The entire directory can be distributed as an OVA package, which is a
tar archive file with the OVF directory inside."
(http://en.wikipedia.org/wiki/Open_Virtualization_Format)
2. How to convert the platform specific image files(system.img ramdisk.img userdata.img) into an OVA or ISO file.
If at all we are missing few files to give to the emulator, can you just name them.
Please read the community tutorials
3. Also how to add IMEI number
There is currently no way to add IMEI number. This feature will come
in the near future
4. We already have MAC for eth0 port but we want it on wlan port
There is 2 interfaces: eth0 and eth1. Eth0 is used for Genymotion
application widgets. If this network connection is broken, Genymotion
would not be able to start anymore. Eth1 is used for network current
access (fake WiFi connection). You can change this network
configuration as you want.
It is a common practice for mobile applications to identify the user by IMSI number (associated with the SIM card) or IMEI number (unique ID of the device). Of course, it is also possible on Android:
TelehponyManager manager = (TelehponyManager)getSystemService(TELEPHONY_SERVICE);
String imei = manager.getDeviceId();
String imsi = manager.getSubscriberId();
This code works perfectly fine on a real device, however under emulator IMEI is always all-zero and it’s not configurable. It quickly becomes awkward when debugging a network-enabled application which uses IMEI as a user ID.
Trying to resolve the problem I first looked at the TelephonyManager service, just to find the following snippet:
private IPhoneSubInfo getSubscriberInfo() {
// get it each time because that process crashes a lot
return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
}
Fair comment, isn’t it? It really made my day :)
Anyway, code analysis shows that IMEI/IMSI request goes down through all the telephony layers (see the diagram), eventually getting to the baseband device. In case of emulated system, rild daemon is used together with libreference-ril.so – reference Vendor RIL library which talks to the baseband modem device using plain, old AT commands.
The modem device itself is emulated outside the Android system, as part of qemu (which is the heart of the emulator). Details of the communication between the emulator and the Android system running inside the emulator are interesting on its own (all the communication goes through a virtual serial port, Android system’s qemud daemon is used to (de)multiplex the data). I’ll try to post a brief introduction to the topic soon.
Virtual modem implementation can be found in external/qemu/telephony/android_modem.c. The most important part of the file is this function:
const char* amodem_send( AModem modem, const char* cmd );
This function is called for each received AT command. For each command sDefaultResponses array is searched for a given command and either predefined response is sent, or a command handler is executed. The array itself looks like:
static const struct {
const char* cmd; /* command coming from libreference-ril.so, if first
character is '!', then the rest is a prefix only */
const char* answer; /* default answer, NULL if needs specific handling or
if OK is good enough */
ResponseHandler handler; /* specific handler, ignored if 'answer' is not NULL,
NULL if OK is good enough */
} sDefaultResponses[] =
{
/* ... */
{ "+CIMI", OPERATOR_HOME_MCCMNC "000000000", NULL }, /* request internation subscriber identification number */
{ "+CGSN", "000000000000000", NULL }, /* request model version */
/* ... */
};
Two array rows cited above are responsible for IMSI and IMEI retrieval. As you can see, both values are hardcoded and there is no chance to modify them without recompiling the emulator.
However, an old-school hack comes in handy. The emulator binary is not encrypted nor compressed, so the string literals should be visible inside the emulator binary. In fact they are, and IMEI number can be modified in a few simple steps:
** backup the emulator binary
** open the binary with your favourite hex editor
** search for +CGSN string followed by a null byte, it should be followed by 15 digits of the IMEI number
** edit the number, be careful not to change the number of digits
** save the file, that’s all!
Sure, it’s not a perfectly comfortable solution, yet better than nothing. In the next part I’ll explain how to make IMEI number a configurable option. Enjoy!
I have a problem that has been nagging me to an extreme extend in the past few days. I would like to write an Android sh script that does the following (to help me sync music, pics etc.):
1) Turn on wifi (wifi is off by default to save power)
2) Check if my wifi connection is in range (lets call it myWifi)
3) If myWifi is not in range, disable wifi, if it is in range, connect and start some synch software
Now, to enable / disable wifi, I use the following command, which requires root:
svc wifi enable / disable
To scan for avaible wifi connections, I use the following command:
iwlist eth0 scan
The strage thing is, that iwlist eth0 scan will only work if I am NOT logged in as root (I am very curious to why this is the case, if anyone knows anything?), running it while root will return:
eth0: Interface doesn't support scanning : Invalid argument
but running it while not logged in as root, will give me the info I need. I have tried different approaches to get around this problem. The most obvious one is logging in as the standard user in the Android system right before invoking the iwlist command:
su -c app_1
However, any command that involves su will return permission denied even when invoking it as root, and since sudo does not exist in Android, I feel pretty lost here. I did also try a workaround involving splitting the script into two parts, and trying to run the first as root and the second as non root (the default user in Android i app_1), but this will only delay the problem...
If anyone has an answer to how to either get around this user problem, or how to use iwlist eth0 scan (or another command that does the same) while logged in as root, I would be very gratefull.
Thank you.
According to man iwlist normal users can only see some left-over scanning results. To initiate a new scan as root you first need to start up your interface (after starting wifi):
ifconfig wlan0 up