This script allows you to start, stop, and check the status of a PulseAudio TCP stream on a specified IP address and port. It's designed to route audio over TCP/IP from a Linux environment (such as Kali NetHunter) that uses PulseAudio, making it accessible on devices connected over a network (local host in this project).
- Starts and stops a PulseAudio TCP stream on chroot like Kali Nethunter.
- Configurable IP address, port, sample rate, format, and channels.
- Includes status checks to confirm if the stream is active.
- Kali NetHunter: Recommended environment for this script. Learn more about Kali NetHunter here.
- PulseAudio: Ensure PulseAudio is installed and running on your Linux environment.
- pactl: Required for managing PulseAudio modules.
- Basic Knowledge of Terminal Commands
-
Install PulseAudio (if not already installed):
sudo apt-get update && sudo apt-get install -y pulseaudio
-
Clone the repository:
git clone https://github.com/IamCOD3X/Nethunter_PulseAudio.git cd Nethunter_PulseAudio
or
wget https://raw.githubusercontent.com/IamCOD3X/Nethunter_Audio/refs/heads/main/audio
-
Move the script into
/usr/bin
for easy access:mv audio /usr/bin && chmod +x /usr/bin/audio
-
(Optional) Edit the Configuration: Open the script in a text editor and adjust the configuration variables if needed:
nano /usr/bin/audio
PULSE_AUDIO_IP
: IP address for the TCP stream (default is127.0.0.1
).PULSE_AUDIO_PORT
: Port number for the TCP stream (default is8000
).PULSE_AUDIO_RATE
: Sample rate for the audio stream (default is48000
).PULSE_AUDIO_FORMAT
: Audio format (default iss16le
).PULSE_AUDIO_CHANNELS
: Number of audio channels (default is2
).
Run the script with one of the following commands:
audio {start|stop|status}
Command | Description |
---|---|
start |
Starts PulseAudio (if not already running), and loads the TCP module to begin audio streaming. |
stop |
Stops the audio stream by unloading the TCP module. If no other modules are running, PulseAudio will also be stopped. |
status |
Checks if the audio stream is active and displays its current status. |
To start the audio streaming, use the following command:
audio start
- This command will check if PulseAudio is running, start it if necessary, and load the TCP module for audio streaming.
To stop the audio streaming, run:
audio stop
- This will unload the TCP module and stop PulseAudio if no other modules are in use.
To check if the audio stream is running, use:
audio status
- This will display whether the audio stream is active along with any relevant error codes.
This script uses the pactl
command to load and unload the module-simple-protocol-tcp
module in PulseAudio. Here’s a breakdown of each function:
- start_pulseaudio: Checks if PulseAudio is running, and starts it if not.
- start_stream: Unloads any existing instances of the module to avoid conflicts, then loads the TCP module with specified parameters.
- stop_stream: Unloads the TCP module and stops PulseAudio if no other modules are loaded.
- stream_status: Checks if the TCP module is currently loaded to confirm if the stream is active.
- Failed to start PulseAudio: Ensure PulseAudio is installed and working correctly by running
pulseaudio --version
. - No audio stream found: If
status
reports that no stream is found, make sure thestart
command was successful and that PulseAudio is not being blocked by firewall rules or permissions. - Connection Issues: Common errors may include connection failures. Refer to error messages for specific guidance.
- Ensure network firewalls allow the specified port (default
8000
) for the audio stream. - Verify that PulseAudio is configured to accept TCP connections.
- Ensure network firewalls allow the specified port (default
To provide a visual reference for using the Nethunter PulseAudio script, here are some example screenshots:
This project is licensed under the MIT License. See the LICENSE file for details.