Results 1 to 3 of 3

Thread: How to create a permanent WiFi hotspot on raspberry pi 4?

  1. #1
    Join Date
    2023-Mar
    Posts
    5

    How to create a permanent WiFi hotspot on raspberry pi 4?

    I am learning Kali Linux on raspberry pi4 without a monitor. I'm connecting via VNC. For pentests, I use an Alfa external WiFi adapter. For many WiFi pentests, for example autopwner, hcxdumptool and others like that, I need to disable wpa_supplicant and NetworkManager. Accordingly, I need to somehow control what is happening on the screen
    Could the respected community suggest a script that constantly checks for the presence of NetworkManager and wpa_supplicant processes and if they are disabled, then launch a WiFi access point on raspberry pi? So that I can connect via VNC and/or SSH to the raspberry pi access point to manage and monitor what is happening on the device
    Thank you all in advance!

  2. #2
    Join Date
    2021-May
    Location
    UK
    Posts
    782
    If your Pi has its own WiFi adapter built in to support WiFi, and the Alpha adapter is being used seperately in monitor mode, you could create a shell script to both put the alpha into monitor mode, and start a local hotspot on the Pi.

    However, I suspect your actually using the same adapter for the hotspot as you are for the scan, so when you put it into monitor mode, the hotspsot drops.. and what you are asking is not possible. An adapter cannot be in promiscous, 'listen to everyone' mode, and a hotspot, 'connect to known', mode at the same time.

    To do this you need 2 network adapters, one for you to connect too, and one for the monitor mode to capture traffic

  3. #3
    Join Date
    2022-Apr
    Location
    Frankfurt am Main
    Posts
    2
    Here's a sample script that you can use to achieve this:

    #!/bin/bash


    # Check if NetworkManager and wpa_supplicant are running
    while true; do
    if pgrep NetworkManager >/dev/null && pgrep wpa_supplicant >/dev/null; then
    echo "NetworkManager and wpa_supplicant are running"
    sleep 5
    else
    echo "Disabling NetworkManager and wpa_supplicant"
    systemctl stop NetworkManager.service
    systemctl stop wpa_supplicant.service


    # Launch WiFi access point
    echo "Starting WiFi access point"
    systemctl start hostapd.service
    systemctl start dnsmasq.service


    break
    fi
    done


    This script continuously checks for the presence of NetworkManager and wpa_supplicant processes. If both processes are running, it waits for 5 seconds before checking again. If either process is not running, the script disables both processes and starts the WiFi access point.


    You can save this script in a file with a .sh extension (e.g. wifi-ap.sh) and make it executable using the following command:

    chmod +x wifi-ap.sh

    Then, you can run the script using the following command:

    sudo ./wifi-ap.sh

    Note that you need to run this script with root privileges (sudo) because it stops and starts system services.


    Once the script launches the WiFi access point, you should be able to connect to it using another device and manage the Raspberry Pi remotely via VNC and/or SSH.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •