RandomCoderOrg / ubuntu-on-android

Run Ubuntu with pre-installed Desktop Environments in android/termux with ease! Everything is preinstalled so just download install and doneπŸš€πŸš€
https://udroid-rc.gitbook.io
MIT License
1.17k stars 86 forks source link

Nmap not working #19

Closed TOXIC-KID closed 3 years ago

TOXIC-KID commented 3 years ago

Nmap is not working inside the chroot when I run namp IP it shows an error Starting Nmap 7.80 ( https://nmap.org ) at 2021-06-21 10:48 IST nmap: netutil.cc:3265: int route_dst_netlink(const sockaddr_storage, route_nfo, const char, const sockaddr_storage): Assertion `p != NULL' failed. Aborted Any fix for this issue

SaicharanKandukuri commented 3 years ago

@SOUL-HAKER sorry to say that we are not supporting root users now cause this project is currently on non-root termux users only from GitHub issue platform

But here are suggestions for chroot

1 Missing GID's

On Android, you will need to add at least one group 3003 aid_inet for those processes which require access to creating sockets (other security guarded systems particular to Android may need addressing for other applications, search for 3003 aid_inet on the web for more detail).

So try doing -> groupadd -g 3003 aid_inet


if you don't want to do everything on your own (like setting these things up) You can opt Top 1 -> nethunter project 2nd Linux Deploy in playstore


Be careful you may brick your phone and we do not take responsibility for that

TOXIC-KID commented 3 years ago

@SOUL-HAKER sorry to say that we are not supporting root users now cause this project is currently on non-root termux users only from GitHub issue platform

But here are suggestions for chroot

1 Missing GID's

On Android, you will need to add at least one group 3003 aid_inet for those processes which require access to creating sockets (other security guarded systems particular to Android may need addressing for other applications, search for 3003 aid_inet on the web for more detail).

So try doing -> groupadd -g 3003 aid_inet

if you don't want to do everything on your own (like setting these things up) You can opt Top 1 -> nethunter project 2nd Linux Deploy in playstore

Be careful you may brick your phone and we do not take responsibility for that

But my phone isn't rooted

SaicharanKandukuri commented 3 years ago

You mentioned chroot Nmap is not working inside the chroot when I run namp IP it shows an error

TOXIC-KID commented 3 years ago

You mentioned chroot Nmap is not working inside the chroot when I run namp IP it shows an error

Sorry it's my mistake the problem is that nmap is not working inside the chroot environment

SaicharanKandukuri commented 3 years ago

ya you did it again

nmap is not working inside the chroot environment

It's called prooted environment if you are not using root

say us more like what Linux distro you are using send the output of cat /etc/group or groups

TOXIC-KID commented 3 years ago

#

ya you did it again

nmap is not working inside the chroot environment

It's called prooted environment if you are not using root

say us more like what Linux distro you are using send the output of cat /etc/group or groups

root@localhost:~# cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:pulse
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-timesync:x:101:
systemd-journal:x:102:
systemd-network:x:103:
systemd-resolve:x:104:
messagebus:x:105:
input:x:106:
kvm:x:107:
render:x:108:
bluetooth:x:109:
netdev:x:110:
lpadmin:x:111:
rtkit:x:112:
avahi:x:113:
geoclue:x:114:
pulse:x:115:
pulse-access:x:116:
scanner:x:117:saned
saned:x:118:
colord:x:119:
gdm:x:120:
aid_u0_a143:x:10143:root,aid_u0_a143
aid_inet:x:3003:root,aid_u0_a143
aid_everybody:x:9997:root,aid_u0_a143
aid_u0_a143_cache:x:20143:root,aid_u0_a143
aid_all_a143:x:50143:root,aid_u0_a143
aid_u999_everybody:x:99909997:root,aid_u0_a143

root@localhost:~# Am using your repo the hippo And yes am sorry for my mistake calling it chroot And the output is

SaicharanKandukuri commented 3 years ago

can you share what options you used! cause even if the current user appears to be root. Proot provides a fake root with no privileges, raw sockets are not working with it so the option which requires root may not work

SaicharanKandukuri commented 3 years ago

I suggest you make a non-root user to make things work


Let's think you want to create a non-root user with name hippo

-> adduser hippo after complete filling up details. next, give sudo permission to the user

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL hippo ALL=(ALL:ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on "@include" directives:


You can login with
- if you already logged into root `su - hippo`
- you can login as non-root by default `proot-distro login hippo --user hippo`
Things work better in non-root user
TOXIC-KID commented 3 years ago

Screenshot_2021-06-21-13-30-49-92_84d3000e3f4017145260f7618db1d683.png

TOXIC-KID commented 3 years ago

I suggest you make a non-root user to make things work


Let's think you want to create a non-root user with name hippo

-> adduser hippo after complete filling up details. next, give sudo permission to the user

  • visudo and add line hippo ALL=(ALL:ALL) ALL like this
    
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # Please consider adding local content in /etc/sudoers.d/ instead of
    # directly modifying this file.
    #
    # See the man page for details on how to write a sudoers file.
    #
    Defaults        env_reset
    Defaults        mail_badpass
    Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL hippo ALL=(ALL:ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on "@include" directives:


You can login with
- if you already logged into root `su - hippo`
- you can login as non-root by default `proot-distro login hippo --user hippo`
Things work better in non-root user

Nmap now works as non-root πŸ™‚

SaicharanKandukuri commented 3 years ago

Nmap now works as non-root slightly_smiling_face

Good to hear thatπŸ‘

SaicharanKandukuri commented 3 years ago

You can closed the issue if your got it working

TOXIC-KID commented 3 years ago

You can closed the issue if your got it working

Ok and thanks 😊 for your kind assistance

Ajaythepower1606 commented 1 year ago

I am useing a rooted device and then when i need to scan anything which need root permission i tried sudo nmap -A -sS -6 xxxxxxxxxxxxxxxxx

It gives this result

Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-03 17:07 IST route_dst_netlink: can't find interface "lo"

And when ever i use sudo or as root to use nmap . It gives error like route_dst_netlink: can't find interface "lo"

nmap: netutil.cc:3197: int route_dst_netlink(const sockaddr_storage, route_nfo, const char, const sockaddr_storage): Assertion `p != NULL' failed. zsh: abort

Can any one help. I did some research and found why nmap need sudo or root privileged to perform some tasks like read raw data socket packets and more... But to use it requires some extra packages like libpcap ...

I thought libpcap might stop the error but no , libpcap is already installed in termux and many more utilities but the error comes. Again and again.