Monitor mode on internal wifi card REDME NOTE 4 MIDO - Xiaomi Redmi Note 4 Questions & Answers

Anyone successfully enabled monitor mode on redmi note 4 Mido?
Both qcmon and wlan0mon not working.
Also tried below method (https://forum.xda-developers.com/redmi-note-3/how-to/wifi-monitor-mode-t3874557/amp/)
adb push iwpriv /data/local/tmp/
adb shell su -c chmod +x /data/local/tmp/iwpriv
Code:
#!/system/bin/sh
ip link set wlan0 down
sleep 1
echo 4 > /sys/module/wlan/parameters/con_mode
sleep 2
ip link set wlan0 up
/data/local/tmp/iwpriv wlan0 monitor 1
/data/local/tmp/iwpriv wlan0 MonitorModeConf 9 40 1 111 0
I'm using stock rom and kernal.
So, please help.

Even I tried but it was not possible
Eventually it shows but as qcom:802.11n on wlan0 there is no modes I think it's not possible to turn on monitor mode in redmi note 4 sd.v

Related

Reverse Tether

I currently run Paranoid Android on my SG5, which works well enough for my tastes. One thing I've wanted to play with is reverse tethering. Since I charge my player via the computer's usb connection, I figured it'd make sense to disable wifi and save a little power to speed up the slow usb charging and just use the pc's internet connection via usb. I also have a few apps like calibre and the compantion app which don't work correctly when I'm on a wifi connection that's been firewalled to prevent devices from communicating with each other. This bypasses the wifi connection and gives me a nice secure connection between devices.
I got it working ... mostly. I don't expect many people to find this useful, but I thought it might be an entertaining hack to poke at.
The following script sits on my linux netbooks' ~/bin directory as reverse-tether.sh
Code:
#!/bin/sh
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the Player to mess with networking
echo 'Enabling adb root access...'
adb -d root
# Turn on usb networking
echo 'Enabling usb network interface on the Galaxy Player...'
adb -d shell 'sh /storage/sdcard0/reverse_tether.sh up &'
# adb disconnects, so we wait for the network on the player to settle before continuing on.
sleep 2
# Rename device interface as ArchLinux has annoying device names (becomes player)
IF=`ifconfig -a | grep "enp" | cut -d ':' -f 1`
ip link set dev $IF down
/usr/sbin/ifrename -i $IF -n player
ip link set dev player up
echo 'Setting Computer IP Address ...'
ifconfig player 192.168.200.1 netmask 255.255.255.0
ifconfig player up
echo 'Enabling NAT and IP Forwarding on Computer...'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq on Computer...'
dnsmasq --interface=player --no-dhcp-interface=player
echo
echo 'Connection is ready! Press any key to shutdown.'
echo
read
echo 'Shutting down reverse tethering'
# SSH server is always running on player, with public rsa key imported for passwordless logins
# This hackery is required as adb seems to be disabled with rndis active.
# I use dropbear server II, but any of the ssh servers would probably work.
ssh [email protected] 'sh /storage/sdcard0/reverse_tether.sh down &'
killall dnsmasq
ifconfig player down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
And the following script is simply stashed on the sdcard of the player. as /storage/sdcard0/reverse_tether.sh
Code:
#!/system/bin/sh
if [ "$1" = "up" ]; then
echo 1 > /sys/class/usb_composite/rndis/enable
ip addr add 192.168.200.2/24 dev usb0
ip link set usb0 up
ip route delete default
ip route add default via 192.168.200.1
setprop net.dns1 192.168.200.1
fi
if [ "$1" = "down" ]; then
sleep 2
ip route delete default
ip link set usb0 down
echo 0 > /sys/class/usb_composite/rndis/enable
fi
When I finish, sometimes I need to restart wifi on the player to get networking to work again.
The only real problem I've had is that some apps require or want wifi/3g active in order to fully function. For example, the play store works fine until you try and download an actual update. Google Maps works fine, although you get lots of warnings about having wifi turned off. I have no idea how to "emulate" 3g or wifi which I think would solve that problem.
This was fun getting running. Hope you enjoyed...
I know this is an old thread but I found this really really useful. Going to give it a try after work today. Great job.
Sent from my YP-G70 using xda app-developers app

[Q] Corrupted WiFi Mac Address

I have a Nexus 5 which was running 5.1 . I wanted to change my mac address and did some research and it seemed that it was very difficult on 5.1 so I downgraded to 4.4, rooted the device and ran these groups of commands (11:22:33:44:55:66 wasn't actually used, I used the actual IP address I was trying to replicate):
busybox ifconfig wlan0 hw ether 11:22:33:44:55:66
ip link set wlan0 address 11:22:33:44:55:66
ip link set wlan0 broadcast 11:22:33:44:55:66
echo -n "112233445566" > /persist/wifi/.macaddr
After all this stuff, my mac address changed, but kept changing on its own whenever I reboot the phone; 00:90:4C:XX:XX:XX the first 3 sets always the same with the last 3 sets always changing. I tried this to fix the problem and get my mac address to it's original state.
echo -ne '\x11\x22\x33\x44\x55\x66' > /persist/wifi/.macaddr
chown root:root /persist/wifi
chmod 755 /persist/wifi
chown wifi:wifi /persist/wifi/.macaddr
chmod 660 /persist/wifi/.macaddr
While that seemed to have fixed the problem, as soon as I upgraded back to 5.1, the bad mac address started appearing again. I've factory reset and flashed stock firmware several times without success.
BUMP
I have had this issue posted for two weeks now and not a single response. Is there an alternate forum that anyone can even recommend? Thanks

How to turn on and off the WiFi through ADB (no root)?

I found I can use these ADB commands to turn on and of the WiFi of a rooted phone:
Code:
adb shell su -c 'svc wifi enable'
adb shell su -c 'svc wifi disable'
However, I'm interested in doing it without having to root the phone for an automatic testing I'm doing. Do you guys know if this is possible?
I found this project which allows me to connect to a WiFi through ADB commands not being a root user. I was wondering if anyone knows how to disconnect also from ADB and not being a root user.
UPDATE:
I've been recently trying:
Code:
C:\adb>adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
adb server is out of date. killing...
* daemon started successfully *
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.wifi.WifiSettings }
Warning: Activity not started, its current task has been brought to the front
and
Code:
C:\adb>adb -s serial_number shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.wifi.WifiSettings }
Warning: Activity not started, its current task has been brought to the front
I also found doing this type of command:
Code:
adb shell input keyevent 20 & adb shell input keyevent 23
I can navigate and click. The problem seems to be that I always finish in a different state so the next time I input the command
Code:
adb -s serial_number shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
I start in a different place and start clicking elsewhere. I've tried returning home, but that doesn't fix the issue. Is there any way to start always from the same point inside the WiFi settings?
Thanks!
natiya said:
I found I can use these ADB commands to turn on and of the WiFi of a rooted phone:
Code:
adb shell su -c 'svc wifi enable'
adb shell su -c 'svc wifi disable'
However, I'm interested in doing it without having to root the phone for an automatic testing I'm doing. Do you guys know if this is possible?
Click to expand...
Click to collapse
Turn WiFi off
Code:
adb shell settings put global airplane_mode_on 1
adb shell settings put global wifi_on 0
adb shell settings put global wifi_scan_always_enabled 0
Afterwards you've to re-boot the device.
Turn WiFi on
Code:
adb shell settings put global airplane_mode 0
adb shell settings put global wifi_on 1
adb shell settings put global wifi_scan_always_enabled 1
jwoegerbauer said:
Turn WiFi off
Code:
adb shell settings put global airplane_mode_on 1
adb shell settings put global wifi_on 0
adb shell settings put global wifi_scan_always_enabled 0
Afterwards you've to re-boot the device.
Turn WiFi on
Code:
adb shell settings put global airplane_mode 0
adb shell settings put global wifi_on 1
adb shell settings put global wifi_scan_always_enabled 1
Click to expand...
Click to collapse
Thank you, but those don't produce any change on my device. Actually, if I put the first two commands without doing "adb kill-server" in between, I get this message:
error: more than one device/emulator
Click to expand...
Click to collapse
But the output when they work is:
adb server is out of date. killing...
* daemon started successfully *
Click to expand...
Click to collapse
and nothing happens.
I've been recently trying:
Code:
C:\adb>adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
adb server is out of date. killing...
* daemon started successfully *
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.wifi.WifiSettings }
Warning: Activity not started, its current task has been brought to the front
and
Code:
C:\adb>adb -s serial_number shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.wifi.WifiSettings }
Warning: Activity not started, its current task has been brought to the front
This opens the screen where you can turn on and off the WiFi but it doesn't do it...not sure if I'm missing something!
Just to be shure, make shure your using the latest version of ADB offered by google here:
https://developer.android.com/studio/releases/platform-tools
You could use adb wifi
After activating when using usb it and connecting through the same wifi:
svc wifi enable
works without root
I'm a little late to this thread, but if it still helps the OP, non-rooted Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb start-server && adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to turn the non-rooted Android Wi-Fi on or off via adb (which was the OP's original question after all).
Maybe this will work if we can figure out how to tap the buttons?
adb shell "am start -a android.settings.WIFI_SETTINGS"
Click to expand...
Click to collapse
For swiping on the phone from adb this works...
C:\> adb shell input swipe 500 1000 500 100
This will instantly swipe from center to the top of the screen.
You can add a time period, e.g., take 3 seconds to swipe that.
C:\> adb shell input swipe 500 1000 500 100 3000
Click to expand...
Click to collapse
But you want to tap the buttons, right?
If we can figure out the positions, maybe this would work?
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
That should pop up an Android "Reset Advertising ID" settings page.
C:\> adb shell input tap 500 400
If run after the command above, that will tap the button to
asking to "Opt out of Ads Personalization" in that Activity
if that button is like mine, at the X=500 & Y=400 location.
On my phone, this is the "Reset advertising ID" button location:
adb shell input tap 500 200
On my phone, this is the "OK" button on that GUI above.
adb shell input tap 700 1000
C:\> adb shell am force-stop com.google.android.gms
If run after bringing up the advertising-id reset Activity,
it will close the activity without doing anything else.
Click to expand...
Click to collapse
Here is a somewhat related post...
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
Type adb tcpip 5555 in the command line or Terminal and press Enter.
Find your phone's IP address in Settings > About Phone > Status > IP Address.
Back in the command line or Terminal, type adb connect [your Android's IP address].
Finally, press Enter again.
Regards,
J Wick

Running svc in ssh returns Aborted

I've rooted my phone using Magisk
I want to enable/disable Wifi using a shell script
Enabling or diabling works fine using command below
adb -s <serial> shell "svc wifi enable"
But when i start a SSH session svc throws an "Aborted" error
# svc wifi enable
Aborted
Info:
# adb -s <serial> shell "whoami"
shell
# adb -s <serial> shell "which svc"
/system/bin/svc
# adb -s <serial> shell "which sh"
/system/bin/sh
Also tried logging in SSH as user "shell"
Why is svc giving this error, is there a way to fix this ?
ReMiOS said:
I've rooted my phone using Magisk
I want to enable/disable Wifi using a shell script
Enabling or diabling works fine using command below
adb -s <serial> shell "svc wifi enable"
But when i start a SSH session svc throws an "Aborted" error
# svc wifi enable
Aborted
Info:
# adb -s <serial> shell "whoami"
shell
# adb -s <serial> shell "which svc"
/system/bin/svc
# adb -s <serial> shell "which sh"
/system/bin/sh
Also tried logging in SSH as user "shell"
Why is svc giving this error, is there a way to fix this ?
Click to expand...
Click to collapse
I'm facing the same issue here, did you mage to solve it?
estevaofv said:
I'm facing the same issue here, did you mage to solve it?
Click to expand...
Click to collapse
Unfortunately not ...
i have no clue
Hello friend, I just found the solution:
export ANDROID_DATA=/data
just run the above command, it was an environment variable related issue, I found the solution on the link below:
Can not run some CMDs over SSH · Issue #12 · Magisk-Modules-Repo/ssh
PixelExperience_caf_whyred-9.0 Magisk 19.2 Can not run some su CMDs over SSH shell, but over ADB everything is OK The error gives a sign of 'Aborted' Have been using SSH-Module for some time now, s...
github.com
estevaofv said:
Hello friend, I just found the solution:
export ANDROID_DATA=/data
just run the above command, it was an environment variable related issue, I found the solution on the link below:
Can not run some CMDs over SSH · Issue #12 · Magisk-Modules-Repo/ssh
PixelExperience_caf_whyred-9.0 Magisk 19.2 Can not run some su CMDs over SSH shell, but over ADB everything is OK The error gives a sign of 'Aborted' Have been using SSH-Module for some time now, s...
github.com
Click to expand...
Click to collapse
It works now
Great Solution ! Thanks !
I've put it in my ~/.profile to load it automatically at login (using SSH magisk module)
I've upgraded to Android 10 after this svc just gave an rc =1
# svc
1|
# echo $?
1
Fixed is by adding this to my ~/.profile
export PATH=$PATH:/sbin
export ANDROID_DATA=/data
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
# svc
Available commands:
help Show information about the subcommands
power Control the power manager
data Control mobile data connectivity
wifi Control the Wi-Fi manager
usb Control Usb state
nfc Control NFC functions
bluetooth Control Bluetooth service
system-server System server process related command

Wifi Monitor Mode

Hi all,
I have root on my tab s6 lite and I have nethunter installed. There isn't a custom kernel for tab s6 lite so I have to just use the generic install. When i try su -c "ip link set wlan0 down; echo 4 > /sys/module/wlan/parameters/con_mode;ip link set wlan0 up";exit I get Permission Denied, even in an android su terminal. Any idea what I'm doing wrong? When I do iw ph wlan0 I see that the chipset supports monitor mode. How can I get permission denied with root? Thanks!

Categories

Resources