PDA

View Full Version : Configuring Network manager in Kali 2.0



pedropt
2015-11-21, 13:34
I have upgraded my kali 1.1.0 to 2.0 , and one thing that i had in debian 7 that i didnt found in debian 8 was how easy was to restart networkmanager and configure eth0 connections .

So i will show you how it was before , and how it is now :

Kali 1.1.0a = Debian 7
Kali 2.0 = Debian 8

Restarting networkmanager :
Debian 7

service networkmanager restart

Debian 8

/etc/init.d/network-manager restart

Restarting network
Debian 7

service networking restart

Debian 8

/etc/init.d/networking restart

Open network icon on your tab (in case it disappeared)
Debian 7

open nmapplet

Debian 8

open nm-applet

Setup default network as managed =true

Debian 8

nano /etc/NetworkManager/NetworkManager.conf

change : managed=false to managed=true

in nano editor press both keys "ctrl+o" o from oblivious and not zero , to save

and "ctrl+x" to exit


simplifying

If you think you may not remember sometimes the init.d path to start restart network or other system tools , then you can add /etc/init.d/ path directory variable to your system path variable , and instead writing :



/etc/init.d/network-manager restart

you will start using only :


network-manager start

but for that to work you must add /etc/init.d path to your system variables
to do that open you terminal and write :


PATH=$PATH:/etc/init.d

after this command you can forget the init.d path to start any command under that directory and call the programs directly , like :

networking restart
network-manager restart
ssh start
metasploit start
postgresql start

and any other system utils you may have inside init.d directory

simplifying more - Look the update and ignore this part

if instead using "network-manager" to restart or start or even stop the service , or even opening the applet in control bar as "nm-applet" , you can simplify these services to their original name that was in debian7 , for that all you need to do is to copy them with their old name .

Like :


cp /usr/bin/nm-applet /usr/bin/nmapplet
cp /etc/init.d/network-manager /etc/init.d/networkmanager
chmod +x /usr/bin/nmapplet
chmod +x /etc/init.d/networkmanager

After this point you can restart network manager with this command on terminal "networkmanager restart/start/stop"

in case network-manager get updated , then you must remove those shortcuts from old versions and start the copy process again .
to remove the "shortcuts" created , you just need to write :

rm /usr/bin/nmapplet
rm /etc/init.d/networkmanager


Update - simplifying more

mmusket33 in post bellow brought a good question that i was missing .
I was thinking that "airmon-ng check" would detect these new shortcut i mention before , but it don't detect , and what will happen is that airmon-ng will not show any conflicting processes , but in reality there is the shortcut "networkmanager" that will enter in conflict with the monitor mode .
So , i was here trying to write a bash script to put in /usr/bin with options start/stop/restart , but it wont work with other name .
The solution in this case was to write 2 bash scripts for networkmanager in /usr/bin , to start it would use "nmstart" and to stop is another script called "nmstop"
If you still want to go ahead then all you have to do is :
- open your terminal
- Write : "nano /usr/bin/nmstart"
and place this code :

#!/bin/bash
network-manager start


and then save the file and exit .
Then apply executing permissions to that new shortcut :

chmod +x /usr/bin/nmstart

then do the same thing to stop network-manager :

- Write : "nano /usr/bin/nmstop"
and place this code :

#!/bin/bash
network-manager stop


and then save the file and exit .
Then apply executing permissions to that new shortcut :

chmod +x /usr/bin/nmstop

this way , airmon-ng will detect the network-manager service running and it will shut it down when it needs it .

If you already created the shortcuts in "simplifying more" , then all you have to do is to remove only the "networkmanager" shortcut , you may leave "nmapplet" .

to do that write this in terminal :

rm /etc/init.d/networkmanager

mmusket33
2015-11-23, 09:48
You might note that airmon-ng when evoking airmon-ng check kill uses the following two(2) commands

service network-manager stop
service avahi-daemon stop

In kali 2.0
See lines 713,714 in /usr/sbin/airmon-ng

leafpad /usr/sbin/airmon-ng


MTeams

pedropt
2015-11-23, 11:06
yes , good tip , i was not looking at that point , that in case the user wants to start a wifi monitor mode , then airmon-ng will have issues because on "check kill" command will kill "network-manager" process but not new created "networkmanager" .
However , user instead using "airmon-ng check kill" , it may use "airmon-ng check" and then kill the processes individually .
I will write that point in the first post .

mmusket33
2015-11-23, 15:33
To pedropt

Airmon-ng provides a method of killing network-manager but does not provide any method to restore its function as service network-manager start does not work after evoking airmon-ng check kill.

As you are already working in this area MTeams suggests you explore what you find and develop a method to restore network manager function after airmon-ng check kill. You may have already found a better way to kill the process and could then avoid airmon-ng check kill altogether. Maybe even patch airmon-ng as the lines of code are known.

Anyway Nice Work

Musket Teams