I am tring to write an ash script wich can run multiple commands at the same time
Somthing like that
#!/bin/ash
netcat -zvt -w 1 83.169.210.130 1-5
netcat -zvt -w 1 83.169.210.130 6-25
netcat -zvt -w 1 83.169.210.130 26-80
netcat -zvt -w 1 83.169.210.130 81-160
the scanning is pretty low 1 port at 1 second if not open so idea is to run them at the same time and then gather all the outputs
I suggest you to try gnuparallel
Check this
1 Like
Since openwrt uses busybox you can try xargs function to run multiple commands at once
1 Like
Try this, as a starting point:
#!/bin/ash
netcat -zvt -w 1 83.169.210.130 1-5 > netcat1.log 2>&1 &
netcat -zvt -w 1 83.169.210.130 6-25 > netcat2.log 2>&1 &
netcat -zvt -w 1 83.169.210.130 26-80 > netcat3.log 2>&1 &
netcat -zvt -w 1 83.169.210.130 81-160 > netcat4.log 2>&1 &
wait
cat netcat?.log
2 Likes
Thanks a lot ! All seams to be working
i made 16 command run at the same time and i can see in top they all got diffrent PID
9000 ports for 10 minuts wich ofcose woud take (10x16)/60 hours if it was one command
another qwestion is how to make it all i loop so i dont need to write every line for a range
1 Like
ive seen this links when i googled and tried but lack of bash knowleage it didint work for me
at the end i did this
#!/bin/ash
rm netcat*.log
end=1000
x=1
while [ $x -le 150 ]
do
strt=$(($end+1))
end=$(($strt+60))
echo "$strt - $end"
netcat -zvt -w 1 83.169.210.130 $strt-$end >> netcat.log 2>&1 &
x=$(( $x + 1 ))
done
wait
cat netcat.log
and it works !
1 Like
system
Closed
December 22, 2022, 5:22pm
8
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.