0

When i'm in a terminal and submit -- ls /sys/class/net

The output should read (depending on the particular inputs available): eth0, lo, wlan3, etc

I'm trying to write a script that will check to see the exact wlan interface ID and then proceed to use (for the purposes of this question; "wlan3" as listed above) as an input for aircrack. Once i've extracted the interface id (wlan3), my goal is to use this input for the following command within the same script:

airmon-ng start wlan3

and then:

airodump-ng -b a wlan3mon -w "some file"

The current code i have written so far:

#!/bin/bash
airmon-ng check kill
interface=$(ls /sys/class/net)
echo $interface

I'm unable to figure out how to extract the interface id from the output of /sys/class/net directory. The end goal is for the script to be able to run the aircrack commands without the user having to perform an "ifconfig" then modify the script with the appropriate interface id. Ideally, i'd like the script to be able to read the interface list and use as appropriate for the aircrack commands.

0xa13x
  • 5
  • 3

1 Answers1

0

It's very simple:

interface=/sys/class/net/wlan*
Ipor Sircer
  • 3,069
  • 3
  • 10
  • 15