@hyperwatch/hyperwatch 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,12 @@ const api = require('../app/api');
4
4
  const { Aggregator } = require('../lib/aggregator');
5
5
  const { Formatter } = require('../lib/formatter');
6
6
  const pipeline = require('../lib/pipeline');
7
- const { aggregateSpeed, md5 } = require('../lib/util');
7
+ const {
8
+ aggregateCount,
9
+ aggregateSum,
10
+ formatDuration,
11
+ md5,
12
+ } = require('../lib/util');
8
13
 
9
14
  const { agentFormat } = require('./agent');
10
15
 
@@ -91,12 +96,18 @@ function start() {
91
96
  },
92
97
  ],
93
98
 
94
- ['15m', (entry) => aggregateSpeed(entry, 'per_minute')],
95
- ['24h', (entry) => aggregateSpeed(entry, 'per_hour')],
99
+ ['count15m', (entry) => aggregateCount(entry, 'per_minute')],
100
+ ['count24h', (entry) => aggregateCount(entry, 'per_hour')],
101
+
102
+ [
103
+ 'execTime15m',
104
+ (entry) => formatDuration(aggregateSum(entry, 'per_minute')),
105
+ ],
106
+ ['execTime24h', (entry) => formatDuration(aggregateSum(entry, 'per_hour'))],
96
107
  ]);
97
108
 
98
109
  signatureFormatter.insertFormat('agent', agentFormat, {
99
- before: '15m',
110
+ before: 'count15m',
100
111
  color: 'grey',
101
112
  });
102
113
 
@@ -3,20 +3,20 @@ const monitoring = require('../lib/monitoring');
3
3
  const { formatTable } = require('../lib/util');
4
4
  const stylesheet = require('../stylesheet');
5
5
 
6
- const aggregateSpeed = (entry, path) =>
6
+ const aggregateCount = (entry, path) =>
7
7
  entry.hasIn(path) ? entry.getIn(path).reduce((p, c) => p + c, 0) : null;
8
8
 
9
9
  function mapper(entry, format) {
10
10
  return {
11
11
  name: entry.get('name'),
12
12
  type: entry.get('type'),
13
- '15m':
14
- aggregateSpeed(entry, ['speeds', 'processed', 'per_minute']) ||
15
- aggregateSpeed(entry, ['speeds', 'accepted', 'per_minute']) ||
13
+ count15m:
14
+ aggregateCount(entry, ['speeds', 'processed', 'per_minute']) ||
15
+ aggregateCount(entry, ['speeds', 'accepted', 'per_minute']) ||
16
16
  (format !== 'json' ? '' : null),
17
- '24h':
18
- aggregateSpeed(entry, ['speeds', 'processed', 'per_hour']) ||
19
- aggregateSpeed(entry, ['speeds', 'accepted', 'per_hour']) ||
17
+ count24h:
18
+ aggregateCount(entry, ['speeds', 'processed', 'per_hour']) ||
19
+ aggregateCount(entry, ['speeds', 'accepted', 'per_hour']) ||
20
20
  (format !== 'json' ? '' : null),
21
21
  status: entry.get('status'),
22
22
  };
@@ -1,218 +1,24 @@
1
1
  const { Map } = require('immutable');
2
2
  const proxyaddr = require('proxy-addr');
3
3
 
4
+ // Run `node scripts/fetch-cloudflare-ips.js` to update
5
+ const cloudflareIps = require('../data/cloudflare-ips.json');
6
+ // Run `node scripts/fetch-cloudfront-ips.js` to update
7
+ const cloudfrontIps = require('../data/cloudfront-ips.json');
8
+
4
9
  const ipRanges = {
5
- cloudflare: [
6
- // Source: https://www.cloudflare.com/ips/
7
- '173.245.48.0/20',
8
- '103.21.244.0/22',
9
- '103.22.200.0/22',
10
- '103.31.4.0/22',
11
- '141.101.64.0/18',
12
- '108.162.192.0/18',
13
- '190.93.240.0/20',
14
- '188.114.96.0/20',
15
- '197.234.240.0/22',
16
- '198.41.128.0/17',
17
- '162.158.0.0/15',
18
- '104.16.0.0/13',
19
- '104.24.0.0/14',
20
- '172.64.0.0/13',
21
- '131.0.72.0/22',
22
- '2400:cb00::/32',
23
- '2606:4700::/32',
24
- '2803:f800::/32',
25
- '2405:b500::/32',
26
- '2405:8100::/32',
27
- '2a06:98c0::/29',
28
- '2c0f:f248::/32',
29
- ],
30
- cloudfront: [
31
- // Source: scripts/cloudfront-ips.js
32
- '3.10.17.128/25',
33
- '3.11.53.0/24',
34
- '3.35.130.128/25',
35
- '3.101.158.0/23',
36
- '3.128.93.0/24',
37
- '3.134.215.0/24',
38
- '3.160.0.0/14',
39
- '3.231.2.0/25',
40
- '3.234.232.224/27',
41
- '3.236.48.0/23',
42
- '3.236.169.192/26',
43
- '13.32.0.0/15',
44
- '13.35.0.0/16',
45
- '13.48.32.0/24',
46
- '13.54.63.128/26',
47
- '13.59.250.0/26',
48
- '13.113.196.64/26',
49
- '13.113.203.0/24',
50
- '13.124.199.0/24',
51
- '13.210.67.128/26',
52
- '13.224.0.0/14',
53
- '13.228.69.0/24',
54
- '13.233.177.192/26',
55
- '13.249.0.0/16',
56
- '15.158.0.0/16',
57
- '15.188.184.0/24',
58
- '15.207.13.128/25',
59
- '15.207.213.128/25',
60
- '18.64.0.0/14',
61
- '18.68.0.0/16',
62
- '18.154.0.0/15',
63
- '18.160.0.0/15',
64
- '18.164.0.0/15',
65
- '18.172.0.0/15',
66
- '18.192.142.0/23',
67
- '18.200.212.0/23',
68
- '18.216.170.128/25',
69
- '18.229.220.192/26',
70
- '18.238.0.0/15',
71
- '18.244.0.0/15',
72
- '34.195.252.0/24',
73
- '34.216.51.0/25',
74
- '34.223.12.224/27',
75
- '34.223.80.192/26',
76
- '34.226.14.0/24',
77
- '35.158.136.0/24',
78
- '35.162.63.192/26',
79
- '35.167.191.128/26',
80
- '36.103.232.0/25',
81
- '36.103.232.128/26',
82
- '44.227.178.0/24',
83
- '44.234.90.252/30',
84
- '44.234.108.128/25',
85
- '52.15.127.128/26',
86
- '52.46.0.0/18',
87
- '52.47.139.0/24',
88
- '52.52.191.128/26',
89
- '52.56.127.0/25',
90
- '52.57.254.0/24',
91
- '52.66.194.128/26',
92
- '52.78.247.128/26',
93
- '52.82.128.0/19',
94
- '52.84.0.0/15',
95
- '52.124.128.0/17',
96
- '52.199.127.192/26',
97
- '52.212.248.0/26',
98
- '52.220.191.0/26',
99
- '52.222.128.0/17',
100
- '54.182.0.0/16',
101
- '54.192.0.0/16',
102
- '54.230.0.0/17',
103
- '54.230.128.0/18',
104
- '54.230.200.0/21',
105
- '54.230.208.0/20',
106
- '54.230.224.0/19',
107
- '54.233.255.128/26',
108
- '54.239.128.0/18',
109
- '54.239.192.0/19',
110
- '54.240.128.0/18',
111
- '58.254.138.128/26',
112
- '58.254.138.0/25',
113
- '64.252.64.0/18',
114
- '64.252.128.0/18',
115
- '65.8.0.0/16',
116
- '65.9.0.0/17',
117
- '65.9.128.0/18',
118
- '70.132.0.0/18',
119
- '71.152.0.0/17',
120
- '99.79.169.0/24',
121
- '99.84.0.0/16',
122
- '99.86.0.0/16',
123
- '108.138.0.0/15',
124
- '108.156.0.0/14',
125
- '111.13.171.192/26',
126
- '111.13.171.128/26',
127
- '111.13.185.64/27',
128
- '111.13.185.32/27',
129
- '116.129.226.0/25',
130
- '116.129.226.128/26',
131
- '118.193.97.128/25',
132
- '118.193.97.64/26',
133
- '119.147.182.128/26',
134
- '119.147.182.0/25',
135
- '120.52.12.64/26',
136
- '120.52.22.96/27',
137
- '120.52.39.128/27',
138
- '120.52.153.192/26',
139
- '120.232.236.128/26',
140
- '120.232.236.0/25',
141
- '120.253.240.192/26',
142
- '120.253.241.160/27',
143
- '120.253.245.192/27',
144
- '120.253.245.128/26',
145
- '130.176.0.0/17',
146
- '130.176.128.0/18',
147
- '130.176.192.0/19',
148
- '130.176.224.0/20',
149
- '143.204.0.0/16',
150
- '144.220.0.0/16',
151
- '180.163.57.0/25',
152
- '180.163.57.128/26',
153
- '204.246.164.0/22',
154
- '204.246.168.0/22',
155
- '204.246.172.0/24',
156
- '204.246.173.0/24',
157
- '204.246.174.0/23',
158
- '204.246.176.0/20',
159
- '205.251.200.0/21',
160
- '205.251.208.0/20',
161
- '205.251.249.0/24',
162
- '205.251.250.0/23',
163
- '205.251.252.0/23',
164
- '205.251.254.0/24',
165
- '216.137.32.0/19',
166
- '223.71.11.0/27',
167
- '223.71.71.96/27',
168
- '223.71.71.128/25',
169
- '204.246.164.0/22',
170
- '204.246.168.0/22',
171
- '204.246.174.0/23',
172
- '204.246.176.0/20',
173
- '205.251.192.0/19',
174
- '205.251.249.0/24',
175
- '205.251.250.0/23',
176
- '205.251.252.0/23',
177
- '205.251.254.0/24',
178
- '216.137.32.0/19',
179
- '2400:7fc0:500::/40',
180
- '2404:c2c0:500::/40',
181
- '2409:8c00:2421:400::/56',
182
- '2409:8c00:2421:300::/56',
183
- '2600:9000:eee::/48',
184
- '2600:9000:f580::/41',
185
- '2600:9000:5310::/44',
186
- '2600:9000:f520::/44',
187
- '2600:9000:f534::/46',
188
- '2600:9000:5308::/45',
189
- '2600:9000:fff::/48',
190
- '2600:9000:1000::/36',
191
- '2600:9000:2000::/36',
192
- '2600:9000:4000::/36',
193
- '2600:9000:5320::/43',
194
- '2600:9000:5340::/42',
195
- '2600:9000:5380::/41',
196
- '2600:9000:f538::/45',
197
- '2600:9000:f400::/40',
198
- '2600:9000:f800::/37',
199
- '2600:9000:ddd::/48',
200
- '2600:9000:f500::/43',
201
- '2600:9000:f000::/38',
202
- '2600:9000:f540::/42',
203
- '2600:9000:f600::/39',
204
- '2600:9000:3000::/36',
205
- ],
10
+ cloudflare: cloudflareIps,
11
+ cloudfront: cloudfrontIps,
12
+ // To update: https://docs.sucuri.net/website-firewall/sucuri-firewall-troubleshooting-guide/
206
13
  sucuri: [
207
- // Source: https://docs.sucuri.net/website-firewall/sucuri-firewall-troubleshooting-guide/
208
14
  '192.88.134.0/23',
209
15
  '185.93.228.0/22',
210
16
  '66.248.200.0/22',
211
17
  '2a02:fe80::/29',
212
18
  '208.109.0.0/22',
213
19
  ],
20
+ // To update: https://docs-cybersec.thalesgroup.com/bundle/z-kb-articles-knowledgebase-support/page/290228110.html
214
21
  imperva: [
215
- // Source: https://docs.imperva.com/howto/c85245b7
216
22
  '199.83.128.0/21',
217
23
  '198.143.32.0/19',
218
24
  '149.126.72.0/21',
@@ -223,6 +29,7 @@ const ipRanges = {
223
29
  '107.154.0.0/16',
224
30
  '45.60.0.0/16',
225
31
  '45.223.0.0/16',
32
+ '131.125.128.0/17',
226
33
  '2a02:e980::/29',
227
34
  ],
228
35
  };
package/src/script.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-env browser */
2
1
  /* eslint-disable-next-line no-unused-vars */
3
2
  function sparkline(
4
3
  canvasId,
@@ -1,56 +0,0 @@
1
- /* eslint-disable-next-line node/no-unpublished-require */
2
- const fetch = require('node-fetch');
3
-
4
- async function main() {
5
- const response = await fetch(
6
- 'https://ip-ranges.amazonaws.com/ip-ranges.json'
7
- );
8
-
9
- const ipRanges = await response.json();
10
-
11
- console.log(
12
- ipRanges.prefixes
13
- .filter((p) => p.service === 'CLOUDFRONT')
14
- .map((el) => el.ip_prefix)
15
- .sort((a, b) => {
16
- const aArray = a.split('.').map(Number);
17
- const bArray = b.split('.').map(Number);
18
- if (aArray[0] === bArray[0]) {
19
- if (aArray[1] === bArray[1]) {
20
- if (aArray[2] === bArray[2]) {
21
- return aArray[3] > bArray[3] ? 1 : -1;
22
- }
23
- return aArray[2] > bArray[2] ? 1 : -1;
24
- }
25
- return aArray[1] > bArray[1] ? 1 : -1;
26
- }
27
- return aArray[0] > bArray[0] ? 1 : -1;
28
- })
29
- .map((el) => `"${el}"`)
30
- .join(',\n')
31
- );
32
-
33
- console.log(
34
- ipRanges.ipv6_prefixes
35
- .filter((p) => p.service === 'CLOUDFRONT')
36
- .map((el) => el.ipv6_prefix)
37
- .sort((a, b) => {
38
- const aArray = a.split(':').map(Number);
39
- const bArray = b.split(':').map(Number);
40
- if (aArray[0] === bArray[0]) {
41
- if (aArray[1] === bArray[1]) {
42
- if (aArray[2] === bArray[2]) {
43
- return aArray[3] > bArray[3] ? 1 : -1;
44
- }
45
- return aArray[2] > bArray[2] ? 1 : -1;
46
- }
47
- return aArray[1] > bArray[1] ? 1 : -1;
48
- }
49
- return aArray[0] > bArray[0] ? 1 : -1;
50
- })
51
- .map((el) => `"${el}"`)
52
- .join(',\n')
53
- );
54
- }
55
-
56
- main();