-
Notifications
You must be signed in to change notification settings - Fork 4
/
combine1090.sh
executable file
·65 lines (57 loc) · 1.12 KB
/
combine1090.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
opts="-d"
retry=15
tcpopts="keepalive,keepidle=30,keepintvl=30,keepcnt=2,connect-timeout=30,retry=2,interval=15"
echo -n "Starting data redirection with socat for combine1090: "
date
for j in $TARGET
do
for i in $SOURCES
do
for p in $PORTS
do
sleep .2
while true
do
echo "Redirecting: SOURCE: $i:$p TARGET: $j"
socat $opts -u TCP:$i:$p,$tcpopts TCP:$j,$tcpopts
echo "Lost Connection: SOURCE: $i:$p TARGET: $j"
sleep $retry
sleep $(($RANDOM%10)).$(($RANDOM%10))
done &
done
done
for i in $CUSTOM
do
sleep .2
while true
do
echo "Redirecting: SOURCE: $i TARGET: $j"
socat $opts -u TCP:$i TCP:$j
echo "Lost connection: SOURCE: $i TARGET: $j"
sleep $retry
sleep $(($RANDOM%10)).$(($RANDOM%10))
done &
done
done
for pair in $SOTA
do
pair=(${pair//\// })
i=${pair[0]}
j=${pair[1]}
sleep .2
while true
do
echo "Redirecting: SOURCE: $i TARGET: $j"
socat $opts -u TCP:$i,$tcpopts TCP:$j,$tcpopts
echo "Lost connection: SOURCE: $i TARGET: $j"
sleep $retry
sleep $(($RANDOM%10)).$(($RANDOM%10))
done &
done
while true
do
sleep 1024
done &
wait
exit 0