w4sp-book / w4sp-lab

Lab environment for the Wireshark for Security Professionals book
https://github.com/w4sp-book/w4sp-lab/wiki/Lab-Installation
70 stars 42 forks source link

Unable to locate python-netifaces #73

Open skyluke70 opened 4 years ago

skyluke70 commented 4 years ago

when i prove to install w4sp-lab with

sudo python w4sp-webap.py

I receive this error ~/Downloads/w4sp-lab-master$ sudo python w4sp_webapp.py Requirement already satisfied: netifaces in /usr/lib/python3/dist-packages (0.10.9) Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package python-netifaces Traceback (most recent call last): File "w4sp_webapp.py", line 8, in import w4sp File "/home/sharky/Downloads/w4sp-lab-master/w4sp.py", line 1, in from w4sp_app import * File "/home/sharky/Downloads/w4sp-lab-master/w4sp_app/init.py", line 1, in from container import container,ns_root,c File "/home/sharky/Downloads/w4sp-lab-master/w4sp_app/container.py", line 22, in subprocess.check_call(['apt-get', 'install', 'python-netifaces']) File "/usr/lib/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) and if i prove to install python netifaces sudo apt install python-netifaces Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package python-netifaces

i can't install lab for esemple on the book can you help me? thx

skyluke70 commented 4 years ago

without laboratory the book is nothing i'll write to amazon

paladinalessandro commented 3 years ago

I had the same error too, in fact python netifaces is not installed with the command apt-get install python-netifaces, it's installed with pip install python-netifaces. As you can see in this link ( https://howtoinstall.co/en/ubuntu/utopic/python-netifaces ) this command was supported in ubuntu 14.0.1 but now it isn't. I also saw this git hub repository was updated for the last time 4 years ago, I really don't know how a book that they are selling today can be based on a 4 year old repository wich has not been updated. I don't even imagine what a mess would be for me to update manually all these obsolete commands...

rickjd commented 3 years ago

I was able to get the docker containers running and the UI running. I noticed that the w4sp_webapp.py is using python 2.x. I installed the latest distribution of kali linux which doesn't install python 2.x. I tried to install python 2.7 on the latest kali but could not. I looked at the book and page 34 says use version 2016.2 so i installed that.

Here are the steps i used to get the lab running:

  1. During the installation of kali 2016.2 (see page 45 of book) on the Configure the package manager screen make sure to select No to Use a network mirror. If you select Yes grub fails to load. I found this link https://superuser.com/questions/1195075/install-the-grub-boot-loader-on-a-hard-disk-failed-on-my-pc to solve this: (step 1. go back to the previous window where you chose 'network mirror' -step 2- change 'yes' to 'no' - step 3- the issue should be solved, and you should be able to carry on with the installation procedure.)
  2. After kali linux is installed and creating the w4sp-lab user, you need to install docker ce - https://www.kali.org/docs/containers/installing-docker-on-kali a. w4sp-lab@w4sp:~$ sudo apt update (if you get an error asking is package apt-transport-https installed? do the following:
    1. navigate to https://packages.debian.org/jessie/libapt-pkg4.12 and select your architecture
    2. download libapt-pkg4.12_1.0.9.8.6_arch.deb
    3. install package - w4sp-lab@w4sp:~/Downloads$ sudo dpkg -i libapt-pkg4.12_1.0.9.8.6_arch.deb
    4. navigate to https://packages.debian.org/jessie/apt-transport-https and select your architecture
    5. download apt-transport-https_1.0.9.8.6_arch.deb
    6. $ cd ~/Downloads
    7. $ sudo dpkg -i apt-transport-https_1.0.9.8.6_arch.deb b. $ printf "%s\n" "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-ce-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable" \ | sudo tee /etc/apt/sources.list.d/docker-ce.list c. $ curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/docker-ce-archive-keyring.gpg d. w4sp-lab@w4sp:~/Downloads$ sudo apt update (if you get an error asking is package apt-transport-https installed? do the steps in 2a. above.
  3. w4sp-lab@w4sp:~/Downloads$ sudo apt install -y docker-ce docker-ce-cli containerd.io
  4. w4sp-lab@w4sp:~/Downloads$ cd
  5. w4sp-lab@w4sp:~$ git clone https://github.com/w4sp-book/w4sp-lab.git
  6. w4sp-lab@w4sp:~$ cd w4sp-lab
  7. make a backup of images/base/Dockerfile (there are a few mods i needed to make to create the base container)- w4sp-lab@w4sp:~$ cd images/base
  8. w4sp-lab@w4sp:~/ws4sp-lab/images/base$ cp -p Dockerfile Dockerfile.orig
  9. copy the attached Dockerfile.base - w4sp-lab@w4sp:~/ws4sp-lab/images/base$ cp Dockerfile.base.txt Dockerfile
  10. edit Dockerfile and change amd64 to your architecture - w4sp-lab@w4sp:~/ws4sp-lab/images/base$ vi Dockerfile
  11. make a backup of images/victims/Dockerfile (there are a few mods i needed to make to create the victims container)- w4sp-lab@w4sp:~$ cd ~/ws4sp-lab/images/victims
  12. w4sp-lab@w4sp:~/ws4sp-lab/images/victims$ cp -p Dockerfile Dockerfile.orig
  13. copy the attached Dockerfile.victims - w4sp-lab@w4sp:~/ws4sp-lab/images/victims$ cp Dockerfile.victims.txt Dockerfile
  14. edit Dockerfile and change amd64 to your architecture - w4sp-lab@w4sp:~/ws4sp-lab/images/victims$ vi Dockerfile
  15. w4sp-lab@w4sp:~/ws4sp-lab/images/victims$ cd ../..
  16. run the installer - w4sp-lab@w4sp:~/ws4sp-lab$ sudo python w4sp_webapp.py
  17. verifiy that the UI is displayed in a browser
  18. Click Setup button
  19. After the setup I had to press the Error button
  20. Note there are buttons at the bottom of the UI page.

I have attached a few screenshots of the UI Screenshot from 2021-06-03 15-41-53 Screenshot from 2021-06-03 15-42-14

Hopefully there are no typos. Let me know if you have any questions Happy hacking Dockerfile.base.txt Dockerfile.victims.txt

k-ekanem commented 3 years ago

@rickjd Great! This works. A slight change though: in the base and victims Dockerfiles you've attached, the debian repo links are missing a portion and that halts the setup. The correct links for the wget commands are: base/Dockerfile - http://ftp.br.debian.org/debian/pool/main/n/netifaces/python-netifaces_0.10.4-1+b1_amd64.deb victims/Dockerfile - http://ftp.br.debian.org/debian/pool/main/s/scapy/python-scapy_2.4.0-2_all.deb

Thanks.

rickjd commented 3 years ago

@k-ekanem I am unable to download the correct wget commands. Can you attach them here? Thanks.

k-ekanem commented 3 years ago

@rickjd These are the files with the links updated. Line 28 in Dockerfile.base.txt and line 5 in Dockerfile.victims.txt

Dockerfile.base.txt Dockerfile.victims.txt

CoolHandLuki commented 2 years ago

Hi I'm trying to install w4sp-lab inside a virtual machine of Kali Linux 2016.2 x64 as the book recommends in 2022. I've noticed that /etc/apt/sources.list is empty other than the virtual cd medium used for installing:

w4sp-lab@w4sp-lab:/etc/apt$ cat sources.list

# deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20160830-11:29]/ kali-rolling contrib main non-free

#deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20160830-11:29]/ kali-rolling contrib main non-free

I'll try the hints on transitioning to Kali rolling from this blog post: https://www.kali.org/blog/kali-linux-2016-1-release/ but does anybody have an idea why sources.list is empty?

Thanks!