Results 1 to 4 of 4

Thread: Quickly Repeating Repetitive Terminal Commands When Booting into Kali Live Linux

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    2015-Dec
    Posts
    5

    Quickly Repeating Repetitive Terminal Commands When Booting into Kali Live Linux

    For those of you who boot into Kali Live USB or CD, you'll probably get tired of doing the same thing over and over like placing your WiFi adapter into monitor mode each time you boot.

    So, I thought that "script" and "scriptreplay" do repetitive terminal tasks but they don't - it literally records what you do in the terminal and then when you replay the script, it doesn't execute the commands, it just replays the script like a video! I don't understand the point of "script" and "scriptreplay" unless of course you enjoy eating popcorn while watching the text you recorded in the terminal playback to you? Anyway, don't do what I did above... here's a simple trick in Linux:

    After each command you want to execute in your terminal, place an "&&" (without the quotation marks) like this:

    airmon-ng check kill && rfkill unblock all && ifconfig wlan0 down && macchanger -r wlan0 && iwconfig wlan0 mode monitor && ifconfig wlan0 up

    Basically, instead of typing each command separately (line after line) over and over again each time you do a Live boot, just copy the commands (which you should save as a text file somewhere on another USB), paste it into the terminal and hit "Enter". That's it! The above will execute all the commands together at the same time on 1 single line in the terminal.

    I use the above to do this upon booting into Kali:

    airmon-ng check kill = This kills all processes that "could cause trouble".

    rfkill unblock all = This allows my WiFi adapter get into monitor mode - I can't start without it as I get an error.

    ifconfig wlan0 down = This is useful for 2 reasons:
    1) It allows me to change my MAC address and
    2) Set the adapter into monitor mode

    macchanger -r wlan0 = Changes adapters real MAC address to a random MAC - I always do this.

    iwconfig wlan0 mode monitor = Sets the adapter into monitor mode. This is equivalent to "airmon-ng start wlan0" but then you'll get "wlan0mon" which is longer to write and if you want to change your MAC address, you'll still need to do "ifconfig wlan0mon down" to change MAC address.

    ifconfig wlan0 up = Finally, this puts everything into place and you're ready to execute other commands.

    You can make it longer or shorter by adding more (or less) commands and separating them with an "&&". For instance, if you often go directly into airodump-ng after placing adapter into monitor mode, simply add: "&& airodump-ng wlan0" after the "ifconfig wlan0 up".

    You can also write a script to do what I explained above, but, I found copying and pasting is adequate. Also, the "&&" can be replaced by a semi-colon ";" after each command. The difference:

    && = Executes only if the previous command executed properly (so make sure to place the commands in order!)

    ; = Executes regardless whether the previous command executed (command order matters but command may be skipped)

    Hope this helps other beginners like myself

    Enjoy
    Last edited by kalikali; 2015-12-16 at 00:37.

Similar Threads

  1. New Colored Terminal Commands
    By Xabrynth in forum General Archive
    Replies: 1
    Last Post: 2022-06-29, 09:36
  2. Replies: 1
    Last Post: 2021-01-14, 00:46
  3. Missing commands in terminal - Kali 2020.1
    By M@C3R in forum TroubleShooting Archive
    Replies: 6
    Last Post: 2020-03-20, 16:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •