Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airmon-ng: line 263, in a for loop, replace ls with a glob #2558

Open
1 task done
wileyhy opened this issue Jul 30, 2023 · 1 comment
Open
1 task done

airmon-ng: line 263, in a for loop, replace ls with a glob #2558

wileyhy opened this issue Jul 30, 2023 · 1 comment

Comments

@wileyhy
Copy link
Contributor

wileyhy commented Jul 30, 2023

Defect Report

Issue type

  • Defect - Unexpected behavior (obvious or confirmed in the GitHub Discussions)

System information

$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="38 (Xfce)"
ID=fedora
VERSION_ID=38
VERSION_CODENAME=""
PLATFORM_ID="platform:f38"
PRETTY_NAME="Fedora Linux 38 (Xfce)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:38"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f38/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=38
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=38
SUPPORT_END=2024-05-14
VARIANT="Xfce"
VARIANT_ID=xfce
 $ uname -a
Linux localhost-live 6.3.7-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun  9 15:21:11 UTC 2023 x86_64 GNU/Linux
 $ lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    CPU family:          6
    Model:               142
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           1
    Stepping:            10
    CPU(s) scaling MHz:  84%
    CPU max MHz:         3400.0000
    CPU min MHz:         400.0000
    BogoMIPS:            3600.00
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pd
                         pe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 moni
                         tor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdr
                         and lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fs
                         gsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida 
                         arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Virtualization features: 
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   128 KiB (4 instances)
  L1i:                   128 KiB (4 instances)
  L2:                    1 MiB (4 instances)
  L3:                    6 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-7
Vulnerabilities:         
  Itlb multihit:         KVM: Mitigation: VMX disabled
  L1tf:                  Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
  Mds:                   Mitigation; Clear CPU buffers; SMT vulnerable
  Meltdown:              Mitigation; PTI
  Mmio stale data:       Mitigation; Clear CPU buffers; SMT vulnerable
  Retbleed:              Mitigation; IBRS
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
  Srbds:                 Mitigation; Microcode
  Tsx async abort:       Not affected
 # airmon-ng
PHY	Interface	Driver		Chipset
phy0	wlo1		iwlwifi		Intel Corporation Dual Band Wireless-AC 3168NGW [Stone Peak] (rev 10)
  • OS Name: Fedora
  • OS Version: 38
  • Kernel version: 6.3.7-200
  • CPU: x86_64
  • Wireless card and chipset (if relevant): NA

Aircrack-ng version

 # rpm -qi aircrack-ng
Name        : aircrack-ng
Version     : 1.7
Release     : 4.fc38

Defect

This bug report and its associated PR are intended to resolve an error from Shellcheck.

 # shellcheck -S error ./airmon-ng.linux_orig 
In ./airmon-ng.linux_orig line 264:
						for j in $(ls "/sys/class/ieee80211/${PHYDEV}/device/net/"); do
                                                         ^-- SC2045 (error): Iterating over ls output is fragile. Use globs.

Details

Here's the original script for the area where Shellcheck shows an error:

 260           if [ -d "/sys/class/ieee80211/${PHYDEV}/device/net" ]; then
 261             #this should be fixed, but it's not going to be right now
 262             # shellcheck disable=2045
 263             for j in $(ls "/sys/class/ieee80211/${PHYDEV}/device/net/"); do
 264               if [ "$(cat "/sys/class/ieee80211/${PHYDEV}/device/net/${j}/type")" = "${target_type}" ]; then
 265                 #here is where we catch udev renaming our interface
 266                 k="${j#wlan}"
 267                 i="${k%mon}"
 268               fi

How to reproduce the issue

 # git clone https://github.com/aircrack-ng/aircrack-ng
 # rsync -cva ./aircrack-ng/scripts/airmon-ng.linux ~/airmon-ng.linux_orig
 # cd ~
 # sed -i 's,shellcheck,hellcheck,g' ./airmon-ng.linux_orig
 # shellcheck -S error ./airmon-ng.linux_orig  | head -n5
@wileyhy
Copy link
Contributor Author

wileyhy commented Jul 30, 2023

Associated with PR #2559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant