LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash Shell Script Help please (https://www.linuxquestions.org/questions/linux-newbie-8/bash-shell-script-help-please-4175539980/)

budasouljah 04-17-2015 06:41 AM

Bash Shell Script Help please
 
I want to write a bash shell script to execute a command for one minute then stop that command (ctrl c) pause for 10 seconds then run another command for one minute then stop that command pause for 10 seconds then go back to the begining of the script and loop indefinetly.

First I want to run this command for one minute;

reaver -i mon0 -c 6 -b "mac address" -a -vv

stop previous command and pause for 10 seconds

Then run this command for one minute;

airodump-ng -i mon0

stop previous command and pause for 10 seconds

Then recall reaver command and continue to loop through until reaver spits out result.

I imagine I will need to create a function for each command, an if statement and an ifelse statement and I will need the break and sleep commands. but I am not sure about the syntax, PLEASE HELP THIS NOOB!

T3RM1NVT0R 04-17-2015 06:57 AM

Welcome to LQ!!!

As you are new to LQ it will be good if you have a look at LQ rules here

We are happy to assist you but you have to let us know what you have done so far. You already have requirements for your script in place let us know what you have prepared for that? Share the script which you have prepared and let us know where you are stuck.

veerain 04-17-2015 07:34 AM

You can use 'timeout' command to run a program for 10 secs. You can use bash or even sh 'while' for loop.

loadedmind 04-17-2015 08:52 AM

At a Linux terminal, type man bash

I'd also suggest looking at "sleep".

budasouljah 04-17-2015 09:34 AM

Thanks guys for your help.
The truth is I need to read up more on this. I have no Idea where to start and how the syntax would go.

allend 04-17-2015 09:39 AM

Quote:

PLEASE HELP THIS NOOB!
This NOOB is seeking advice on automating the use of cracking tools (reaver and airodump-ng). Without a legitimate use case, I would consider any further advice as being complicit in cracking and so against LQ rules.

loadedmind 04-17-2015 09:41 AM

That's a pretty hefty assumption. How do we know the OP doesn't want to test this on his LAN? Is that really the attitude we want to portray to the community? That hacking/reverse engineering is to be admonished?

T3RM1NVT0R 04-17-2015 09:47 AM

Quote:

Originally Posted by loadedmind (Post 5348886)
That's a pretty hefty assumption. How do we know the OP doesn't want to test this on his LAN? Is that really the attitude we want to portray to the community? That hacking/reverse engineering is to be admonished?

No one here is denying any assistance but allend raised a valid point. We need to know what exactly he is trying to achieve / do? And no one is admonishing hacking / reverse engineering, it is person's personal choice. It is just that at LQ we do not encourage discussions on those topics. More information on that rule LQ mods can give.

allend 04-17-2015 09:50 AM

No less hefty than the assumption that the OP does not have malicious motives.
If the OP has pure motives, then disabling WPS and WEP on the AP would seem an easier course.

T3RM1NVT0R 04-17-2015 09:53 AM

Quote:

Originally Posted by allend (Post 5348891)
No less hefty than the assumption that the OP does not have malicious motives.
If the OP has pure motives, then disabling WPS and WEP on the AP would seem an easier course.

It might be possible that he is trying to test those tools obviously my assumption is that he is doing it for learning purpose. We cannot say for sure unless OP clarifies himself.

Another thing is that he is not asking us information on those tools instead he is asking on script.

allend 04-17-2015 10:01 AM

I accept that the intent of the post was advice on scripting, and the answers addressed that. I just have a reservation about a self-confessed noob having trouble writing a script also wanting to conduct pen-testing.

loadedmind 04-17-2015 10:10 AM

QUOTE: "If the OP has pure motives, then disabling WPS and WEP on the AP would seem an easier course."

Unless he was trying to hack his own network. I just don't see how this kind of attitude can propagate anything but negative bias. Of COURSE I don't condone nefarious behavior, but one can only learn better security by learning how to defend one's self. What better way to do this than to learn what someone might do to your network?

TB0ne 04-17-2015 10:18 AM

Quote:

Originally Posted by loadedmind (Post 5348906)
QUOTE: "If the OP has pure motives, then disabling WPS and WEP on the AP would seem an easier course."

Unless he was trying to hack his own network. I just don't see how this kind of attitude can propagate anything but negative bias. Of COURSE I don't condone nefarious behavior, but one can only learn better security by learning how to defend one's self. What better way to do this than to learn what someone might do to your network?

That's very true, and I absolutely agree with you...BUT...

There is no way for us to KNOW the OP's motives; we can only address what we see, and acknowledge the position it will put LQ in, if those motives aren't correct. Knowledge should be free and open..and thankfully there is no shortage of advice on how to use either of those programs, nor is there shortage of advice on how to construct bash shell scripts to automate tasks. The OP has free, unfettered access to those resources. Putting the two together is up to them.

In this case, it's not about censorship, but about accountability to this site.

loadedmind 04-17-2015 10:23 AM

So, guilty until proven innocent? OP didn't mention his motives. Do folks have to provide that information before we can help them?

T3RM1NVT0R 04-17-2015 10:42 AM

I do agree that OP should have clarified on what exactly he is trying to do / achieve but without giving him a chance to clarify we cannot simply roll the case against him.

Quote:

In this case, it's not about censorship, but about accountability to this site.
I am not sure how it will make the site accountable? We are not teaching other person to use those tools as this site is not for hacking / cracking related stuff. However, this site is do here for assisting the members on anything related to linux and bash is definitely part of it. As per LQ rule:

Quote:

Posts containing information about cracking, piracy, warez, fraud or any topic that could be damaging to either LinuxQuestions.org or any third party will be immediately removed.
I don't see anything relate to cracking here but just the name of two tools which can be used for cracking. I don't think so mentioning just the names violates any rule. As long anyone as anyone put anything directly related to hacking / cracking I don't think LQ rules are getting violated. Here OP is asking about scripting and not anything about those tools whatsoever.

When looking at such posts I guess we should be neutral unless there is something happens which points to something fishy.


All times are GMT -5. The time now is 04:16 PM.