forked from denilsonsa/prettyping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mockping.sh
executable file
·55 lines (52 loc) · 2.36 KB
/
mockping.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
#!/bin/bash
#
# This is just a mock ping program that reproduces the same output all the
# time. It is used for testing/developing prettyping.
sample_output() {
cat << EOF
PING registro.br (200.160.2.3) 56(84) bytes of data.
Request timeout for icmp_seq 1
64 bytes from registro.br (200.160.2.3): icmp_seq=2 ttl=56 time=25.5 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=3 ttl=56 time=55.7 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=4 ttl=56 time=75.2 ms
ping: sendto: Network is down
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
64 bytes from registro.br (200.160.2.3): icmp_seq=8 ttl=56 time=123 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=9 ttl=56 time=149 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=10 ttl=56 time=183 ms
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
Request timeout for icmp_seq 13
64 bytes from registro.br (200.160.2.3): icmp_seq=14 ttl=56 time=123 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=15 ttl=56 time=149 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=16 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=19 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=20 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=21 ttl=56 time=183 ms
From 10.1.1.160 icmp_seq=22 Destination Host Unreachable
From 10.1.1.160 icmp_seq=23 Destination Host Unreachable
From 10.1.1.160 icmp_seq=24 Destination Host Unreachable
From 10.1.1.160 icmp_seq=25 Destination Host Unreachable
From 10.1.1.160 icmp_seq=26 Destination Host Unreachable
From 10.1.1.160 icmp_seq=27 Destination Host Unreachable
From 10.1.1.160 icmp_seq=28 Destination Host Unreachable
64 bytes from registro.br (200.160.2.3): icmp_seq=29 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=30 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=31 ttl=56 time=183 ms
64 bytes from registro.br (200.160.2.3): icmp_seq=32 ttl=56 time=183 ms
--- registro.br ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 36.750/38.535/40.048/1.360 ms
EOF
}
sample_output | while read line; do
echo -E "$line"
sleep 0.25s
done