Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

452
Views
send control c to a linux command after specific time intervel?

Shell Scripting:

I am doing some testing on my router, I am using mdk3 and reaver utility for that.

here are the two commands:

[cmd1]  echo y|reaver -i wlan2mon -b 00:FF:EE:CC:DS:B6 -vv    -l 230
[cmd2]  sudo mdk3 wlan2mon a -a 00:FF:EE:CC:DS:B6

goal:

I am trying to create a shell script which will run [cmd1] for 2 minutes, then it will send the ctrl + c signal to [cmd1] so that it will save the reaver session.

then cmd2 will run for 2 minutes and this will also stop after that.

these two will be in loop.

below is the sample script which I written can you add timer to it..?

    #!/bin/bash

while :; do echo
echo "running mdk for 2 minutes";
timeout 120 sudo mdk3 wlan2mon a -a 00:FF:EE:CC:DS:B6;

echo "mdk finished";
echo "starting reaver for 2 minutes ";

#here timeout won't work, as ctrl+c can only save the state.

//add code here to run reaver utility for two minutes and send ctrl+c to it
echo y|reaver -i wlan2mon -b 00:FF:EE:CC:DS:B6 -vv;
 echo "reaver ran for two minutes";



done  
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I'm not familiar with the reaver program, but I think the following should work,

# Run reaver as a background process (add &)
echo y|reaver -i wlan2mon -b 00:FF:EE:CC:DS:B6 -vv &
# Save the process id.
reaverpid=$!
# Sleep 2 minutes
sleep 120
# Send SIGINT, which is what ctrl-c normally does.
kill -SIGINT $reaverpid
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!