Skip to content

Commit

Permalink
Improvements on OS/distro detection
Browse files Browse the repository at this point in the history
  • Loading branch information
v1s1t0r1sh3r3 committed Mar 3, 2023
1 parent 1377788 commit 8db1e1b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Improvements on graphics system and resolution detection
- Fixed 5Ghz Evil Twin attacks DoS problems
- Added 5Ghz country code check
- Improvements on OS/distro detection

### 11.10
- Fixed problem for latest BeEF
Expand Down
61 changes: 37 additions & 24 deletions airgeddon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ known_incompatible_distros=(

known_arm_compatible_distros=(
"Raspbian"
"Raspberry Pi OS"
"Parrot arm"
"Kali arm"
)
Expand Down Expand Up @@ -14372,15 +14373,26 @@ function detect_distro_phase1() {

debug_print

local possible_distro=""
for i in "${known_compatible_distros[@]}"; do
if uname -a | grep "${i}" -i > /dev/null; then
distro="${i^}"
break
if uname -a | grep -i "${i}" > /dev/null; then
possible_distro="${i^}"
if [ "${possible_distro}" != "Arch" ]; then
distro="${i^}"
break
else
if uname -a | grep -i "aarch64" > /dev/null; then
continue
else
distro="${i^}"
break
fi
fi
fi
done

for i in "${known_incompatible_distros[@]}"; do
if uname -a | grep "${i}" -i > /dev/null; then
if uname -a | grep -i "${i}" > /dev/null; then
distro="${i^}"
break
fi
Expand Down Expand Up @@ -14409,30 +14421,30 @@ function detect_distro_phase2() {
distro="Debian"
if [ -f "${osversionfile_dir}os-release" ]; then
extra_os_info="$(grep "PRETTY_NAME" < "${osversionfile_dir}os-release")"
if [[ "${extra_os_info}" =~ Raspbian ]]; then
if [[ "${extra_os_info}" =~ [Rr]aspbian ]]; then
distro="Raspbian"
is_arm=1
elif [[ "${extra_os_info}" =~ Parrot ]]; then
elif [[ "${extra_os_info}" =~ [Pp]arrot ]]; then
distro="Parrot arm"
is_arm=1
elif [[ "${extra_os_info}" =~ [Dd]ebian ]] && [[ "$(uname -a)" =~ [Rr]aspberry ]]; then
distro="Raspberry Pi OS"
is_arm=1
fi
fi
fi
elif [ "${distro}" = "Arch" ]; then
if [ -f "${osversionfile_dir}os-release" ]; then
extra_os_info="$(grep "PRETTY_NAME" < "${osversionfile_dir}os-release")"
if [[ "${extra_os_info}" =~ BlackArch ]]; then
extra_os_info2="$(grep -i "blackarch" < "${osversionfile_dir}issue")"
if [[ "${extra_os_info}" =~ [Bb]lack[Aa]rch ]] || [[ "${extra_os_info2}" =~ [Bb]lack[Aa]rch ]]; then
distro="BlackArch"
elif [[ "${extra_os_info}" =~ Kali ]]; then
#Kali is intentionally here too to avoid some Kali arm distro bad detection
distro="Kali"
is_arm=1
fi
fi
elif [ "${distro}" = "Ubuntu" ]; then
if [ -f "${osversionfile_dir}os-release" ]; then
extra_os_info="$(grep "PRETTY_NAME" < "${osversionfile_dir}os-release")"
if [[ "${extra_os_info}" =~ Mint ]]; then
if [[ "${extra_os_info}" =~ [Mm]int ]]; then
distro="Mint"
fi
fi
Expand All @@ -14447,21 +14459,22 @@ function detect_arm_architecture() {
debug_print

distro_already_known=0
if uname -m | grep -Ei "arm|aarch64" > /dev/null; then

if uname -m | grep -Ei "arm|aarch64" > /dev/null && [[ "${distro}" != "Unknown Linux" ]]; then

for item in "${known_arm_compatible_distros[@]}"; do
if [ "${distro}" = "${item}" ]; then
distro_already_known=1
fi
done
is_arm=1
if [ "${distro}" != "Unknown Linux" ]; then
for item in "${known_arm_compatible_distros[@]}"; do
if [ "${distro}" = "${item}" ]; then
distro_already_known=1
fi
done
fi

if [ ${distro_already_known} -eq 0 ]; then
distro="${distro} arm"
is_arm=1
if [ "${distro: -3}" != "arm" ]; then
distro="${distro} arm"
fi
fi
elif [[ "${distro}" != "Unknown Linux" ]] && [[ "${is_arm}" -eq 1 ]]; then
distro="${distro} arm"
fi
}

Expand Down Expand Up @@ -14576,7 +14589,7 @@ function special_distro_features() {
ywindow_edge_lines=1
ywindow_edge_pixels=1
;;
"Raspbian")
"Raspbian|Raspberry Pi OS")
networkmanager_cmd="service network-manager restart"
xratio=6.2
yratio=14
Expand Down

0 comments on commit 8db1e1b

Please sign in to comment.