Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emadadel4 committed Jan 12, 2025
0 parents commit a726f3f
Show file tree
Hide file tree
Showing 17 changed files with 1,483 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test.sh
BatLinux
BatLinux.sh
142 changes: 142 additions & 0 deletions Core/main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
options=(
"Monitor Mode"
"Start Airgeddon"
"Change MAC"
"Network Monitoring"
"Capture Handshake"
"WPS Attack"
"Install Packages"
"Restart Network Manager"
"Settings"
"About"
"Exit"
)
descriptions=(
"Put interface in monitor mode"
"Launch Airgeddon wireless auditing tool."
"Change MAC."
"Monitor wireless networks."
"Capture WPA/WPA2 handshakes from networks."
"(bully) Bruteforce PIN attack."
"List of popular packages."
"Put interface in managed mode"
"Edit csv files & update script"
"
⠈⠙⠲⢶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣿⡀⠀⠀⠀⠀⠀⠀⠀⡄⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⣼⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣿⠟⠓⠉
⠀⠀⠀⠀⠈⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⢀⣧⣶⣦⣇⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣾⣿⣿⣿⣿⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠛⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠟⠛⠛⠛⠛⠛⠛⠃⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
BatLinux developed by Emad Adel, known as 'Dark Knight.'\nYou can find the source code for this script and more projects on his GitHub: emadadel4."
"Exit from script."
)
selected=0

# Functions
###########################################
Draw_Main_Menu() {
echo -e "\033[0;33m[i] Use ↑/↓ or W/S to navigate, Enter/Space to select\033[0m"
echo ""

# Display menu options with selection indicator
for i in ${!options[@]}; do
if [ $i -eq $selected ]; then
echo -e "\e[96m> ${options[$i]}\e[0m"
else
echo " ${options[$i]}"
fi
done

# Display description of selected option
echo "----------------------------------------"
echo -e "${descriptions[$selected]}"
}

# Handle menu selection
Handle_Main_Selection() {
case $selected in
0) # Monitor Mode
Monitor_Mode
;;
1) # Start Airgeddon
x-terminal-emulator -e airgeddon
;;
2) # Change MAC address
MAC_change
;;
3) # Network Monitoring
Network_Monitoring
;;
4) # Capture Handshake
Capture_Handshake
;;
5) # WPS
Crack_WPS
;;
6) # Install required packages
Packages
;;
7) # Restart NetworkManager
airmon-ng stop wlan0
NetworkManager restart
;;
8) # Settings
Settings_Loop
;;
9) # About
xdg-open "https://github.com/emadadel4"
return
;;
10) # Exit program
exit 0
;;
esac
}

Main_Loop() {
while true; do
clear
HEADER
Draw_Main_Menu
read -rsn1 key
case "$key" in
$'\x1B') # Handle arrow keys
read -rsn2 key
case "$key" in
"[A") # Up arrow
((selected--))
[ $selected -lt 0 ] && selected=$((${#options[@]}-1))
;;
"[B") # Down arrow
((selected++))
[ $selected -ge ${#options[@]} ] && selected=0
;;
esac
;;
[wW]) # W key - Move up
((selected--))
[ $selected -lt 0 ] && selected=$((${#options[@]}-1))
;;
[sS]) # S key - Move down
((selected++))
[ $selected -ge ${#options[@]} ] && selected=0
;;
"") # Enter key - Select option
Handle_Main_Selection
;;
[fF]) # F key - Select option
Handle_Main_Selection
;;
esac
done
}

# Start the main loop
Check_Dependencies
Main_Loop
67 changes: 67 additions & 0 deletions Functions/Capture_Handshake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
function Capture_Handshake(){

CSV_FILE="${BatLinux["Main_DIR"]}/${BatLinux["Networks_File"]}"
selected=0
IFS=$'\n' read -d '' -r -a lines < <(tail -n +2 "$CSV_FILE")
total_lines=${#lines[@]}

Draw_Network_Menu() {
clear
echo "=== Capture Handshake ==="
echo "---------------------------------------------------"
echo "ESSID • BSSID • Channel • WPS"
for i in "${!lines[@]}"; do
IFS=',' read -r ESSID BSSID Channel WPS Note <<< "${lines[$i]}"
if [ $i -eq $selected ]; then
echo -e ">\e[96m $ESSID$BSSID$Channel • WPS $WPS\e[0m"
selected_note="$Note"
else
echo -e "$ESSID$BSSID$Channel"
fi
done
echo "---------------------------------------------------"
echo "[Note] $selected_note"
}

function Capture() {
clear
IFS=',' read -r ESSID BSSID Channel Note <<< "${lines[$selected]}"
read -p $'\e[32mDeauth aireplay attack timeout in seconds or [Enter] to accept the proposal [10]:\e[0m ' deauth
deauth=${deauth:-25}
airodump-ng -c $Channel --bssid $BSSID -w "${BatLinux["Main_DIR"]}/${BatLinux["HandShakes_DIR"]}/$ESSID" --output-format pcap wlan0 &
xterm -e aireplay-ng --deauth $deauth -a $BSSID wlan0
echo -e "\e[32mStarting capture and deauth attack...\e[0m"
wait
Capture_Handshake
}

# Handle keyboard input
while true; do
Draw_Network_Menu
read -rsn1 key
case "$key" in
$'\x1B') # Handle arrow keys
read -rsn2 key
case "$key" in
"[A") # Up arrow
((selected--))
[ $selected -lt 0 ] && selected=$((total_lines-1))
;;
"[B") # Down arrow
((selected++))
[ $selected -ge $total_lines ] && selected=0
;;
esac
;;
"") # Enter key
Capture
break
;;
[qQ]) # Quit
clear
return
;;
esac
done

}
66 changes: 66 additions & 0 deletions Functions/Change_Mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function MAC_change() {
CSV_FILE="${BatLinux["Main_DIR"]}/${BatLinux["Mac_File"]}"
selected=0
IFS=$'\n' read -d '' -r -a lines < <(tail -n +2 "$CSV_FILE")
total_lines=${#lines[@]}

# Function to draw MAC selection menu
Draw_Mac_Menu() {
clear
echo "=== MAC Address ==="
echo "----------------------------------------"
for i in "${!lines[@]}"; do
IFS=',' read -r Device Mac Note <<< "${lines[$i]}"
if [ $i -eq $selected ]; then
echo -e "> \e[96m$Device$Mac\e[0m"
selected_note="$Note"
else
echo "$Device ($Mac)"
fi
done
echo "----------------------------------------"
echo "[Note] $selected_note"
}

Change_mac() {
clear
IFS=',' read -r Device Mac Note <<< "${lines[$selected]}"
ifconfig wlan0 down
macchanger -m "$Mac" wlan0
echo "Changing MAC address to: $Mac"
echo "Bringing the interface wlan0 up..."
ifconfig wlan0 up
macchanger -s wlan0
echo "MAC address changed successfully."
read -n1 -p "Press any key to continue"
}

# Handle keyboard input
while true; do
Draw_Mac_Menu
read -rsn1 key
case "$key" in
$'\x1B') # Handle arrow keys
read -rsn2 key
case "$key" in
"[A") # Up arrow
((selected--))
[ $selected -lt 0 ] && selected=$((total_lines-1))
;;
"[B") # Down arrow
((selected++))
[ $selected -ge $total_lines ] && selected=0
;;
esac
;;
"") # Enter key
Change_mac
break
;;
[qQ]) # Quit
clear
return
;;
esac
done
}
12 changes: 12 additions & 0 deletions Functions/Hader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function HEADER {
echo -e "
Welcome Dark Knight!
██████╗00█████╗0████████╗██╗00000██╗███╗000██╗██╗000██╗██╗00██╗
██╔══██╗██╔══██╗╚══██╔══╝██║00000██║████╗00██║██║000██║╚██╗██╔╝
██████╔╝███████║000██║000██║00000██║██╔██╗0██║██║000██║0╚███╔╝0
██╔══██╗██╔══██║000██║000██║00000██║██║╚██╗██║██║000██║0██╔██╗0
██████╔╝██║00██║000██║000███████╗██║██║0╚████║╚██████╔╝██╔╝0██╗
╚═════╝0╚═╝00╚═╝000╚═╝000╚══════╝╚═╝╚═╝00╚═══╝0╚═════╝0╚═╝00╚═╝
"
}
4 changes: 4 additions & 0 deletions Functions/Hint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Show_Hint()
{
echo -e "\033[0;33m[i] Use ↑/↓ or W/S to navigate, Enter/Space to select, [Q] to Back\033[0m"
}
39 changes: 39 additions & 0 deletions Functions/Monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
function Monitor_Mode() {

airmon-ng check kill

# Extract device information
local device_info=$(dmesg | grep -i "RTL8188EU" | tail -n 1)

if [ -n "$device_info" ]; then
echo "Getting USB path of the Wi-Fi adapter..."
USB_PATH=$(echo "$device_info" | grep -oE 'usb [0-9]+-[0-9]+(\.[0-9]+)*' | awk '{print $2}')
echo "Found USB device at path: $USB_PATH"
else
echo "USB Wi-Fi adapter not found. Please check the device name."
exit 1
fi

# Unbind the device
if echo "$USB_PATH" | sudo tee /sys/bus/usb/drivers/usb/unbind > /dev/null; then
echo "Disconnecting USB device at $USB_PATH..."
else
echo "Failed to disconnect USB device. Please check the USB path."
exit 1
fi

sleep 5

# Rebind the device
if echo "$USB_PATH" | sudo tee /sys/bus/usb/drivers/usb/bind > /dev/null; then
echo "Reconnecting USB device..."
else
echo "Failed to reconnect USB device. Please check the USB path."
exit 1
fi

airmon-ng start wlan0
iwconfig
echo -e "\033[32m[i] Successfully switched to Monitor Mode\033[0m"
read -n1 -p "Press any key to continue"
}
Loading

0 comments on commit a726f3f

Please sign in to comment.