open 4 konsole

Discussion in 'Command Line' started by johan oosterwaal, Jun 17, 2014.

  1. johan oosterwaal

    johan oosterwaal New Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    i'm new at linux and i working on the following issue.
    i want to monitor a wireless network with the following commands:
    ifconfig wlan0 up
    ifconfig wlan1 up
    ifconfig wlan2 up
    ifconfig wlan3 up
    airmon-ng start wlan0
    airmon-ng start wlan1
    airmon-ng start wlan2
    airmon-ng start wlan3
    airodump-ng mon0 --channel 1
    airodump-ng mon1 --channel 6
    airodump-ng mon2 --channel 11
    airodump-ng mon3 --channel 14

    the only problem is i need to run every command separate in 4 different konsole like:
    konsole 1
    ifconfig wlan0 up
    airmon-ng start wlan0
    airodump-ng mon0 --channel 1

    konsole 2
    ifconfig wlan1 up
    airmon-ng start wlan1
    airodump-ng mon1 --channel 6

    and so on... how can i create a script that thus this for me...?

    thanks!.

  2. JasKinasis

    JasKinasis New Member

    Messages:
    25
    Likes Received:
    13
    Trophy Points:
    3
    Best Answer
    After a bit of a play with Konsole and its command line options, I have come up with this:

    Code:
    #!/bin/bash
    # write the commands we want to use to four temporary files:
    echo "ifconfig wlan0 up; airmon-ng start wlan0; airodump-ng mon0 --channel 1" > /tmp/kon1RC
    echo "ifconfig wlan1 up; airmon-ng start wlan1; airodump-ng mon1 --channel 6" > /tmp/kon2RC
    echo "ifconfig wlan2 up; airmon-ng start wlan2; airodump-ng mon2 --channel 11" > /tmp/kon3RC
    echo "ifconfig wlan3 up; airmon-ng start wlan3; airodump-ng mon3 --channel 14" > /tmp/kon4RC
    
    # Fire up 4 instances of Konsole and run the commands:
    konsole --separate -e /bin/bash --rcfile /tmp/kon1RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon2RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon3RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon4RC
    
    NOTE:
    I haven't tested the script with the commands you are using, I don't have airmon or airodump installed. So I used a different chain of commands.

    The reason for the temporary files is because I had problems chaining the commands together after the -e flag. I tried numerous different things. After everything I tried failed, writing the commands to temporary files was the only other thing I could think of. The temporary files are then used as parameters to bash. And this worked for me. So I am happy with that!

    I don't know if anybody will have any better suggestions, but I hope this will be of some use! :)
    Last edited: Jun 17, 2014
  3. johan oosterwaal

    johan oosterwaal New Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thanks!! that worked...

    i only needed to change the following
    konsole --separate -e /bin/bash --rcfile /tmp/kon1RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon2RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon3RC
    konsole --separate -e /bin/bash --rcfile /tmp/kon4RC

    to

    gnomde-terminal -x /bin/bash --rcfile /tmp/kon1RC
    gnomde-terminal -x /bin/bash --rcfile /tmp/kon2RC
    gnomde-terminal -x /bin/bash --rcfile /tmp/kon3RC
    gnomde-terminal -x /bin/bash --rcfile /tmp/kon4RC
  4. JasKinasis

    JasKinasis New Member

    Messages:
    25
    Likes Received:
    13
    Trophy Points:
    3
    Ah! When you said konsole, I assumed you were using the KDE terminal with the same name! :)

    Although I'm currently a Kubuntu user, I prefer Terminator to Konsole. So I'm not that au fait with Konsole, heh heh! In fact, I rarely use the KDE/Plasma desktop anymore. I spend most of my time with dwm nowadays!
    Last edited: Jun 18, 2014

Share This Page