-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
243 lines (210 loc) · 9.62 KB
/
index.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MISP Hardware Sizer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="rangeslider.css">
<style>
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
color: #404040;
font-family: Helvetica, arial, sans-serif;
}
body {
padding: 50px 20px;
margin: 0 auto;
max-width: 800px;
}
output {
display: block;
font-size: 20px;
font-weight: bold;
text-align: center;
margin: 10px 0;
width: 100%;
}
result_RAM {
display: block;
font-size: 30px;
font-weight: bold;
text-align: center;
margin: 30px 0;
width: 100%;
}
.u-left {
float: left;
}
.u-cf:before,
.u-cf:after {
content: "";
display: table;
}
.u-cf:after {
clear: both;
}
.u-text-left {
text-align: left;
}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
<noscript>
<div style="border: 1px solid purple; padding: 10px">
<span style="color:red">JavaScript is not enabled! Please enable javascript and make sure you load this page through a webserver, even if local.<BR/>
Quick trick / way to serve local pages quickly:<BR/>
python2 -m SimpleHTTPServer 8000<BR/>
open http://127.0.0.1:8000/</span>
</div>
</noscript>
<a href="http://www.misp-project.org/" target="_new"><img src="http://www.misp-project.org/assets/images/misp-small.png?src=sizer" alt="" width="100"></a>
<h2>MISP Hardware Sizer (calculator)</h2>
<div id="js-example-change-attributes">
<h3>Number of users: <output></output></h3>
<input id="users_count_id" name="users_count" type="range" min="0" max="1000" step="10" value="100" data-rangeslider>
<label style="display:none"><input type="number" name="min" value="0"> <code>min</code></label>
<label><input type="number" name="max" value="1000"> <code>max</code></label>
<label style="display:none"><input type="number" name="step" value="10"> <code>step</code></label>
<button>Change</button>
</div>
<HR>
<div id="js-example-change-attributes">
<h3>Number of attributes (=field values): <output></output></h3>
<input id="attributes_count_id" name="attributes_count" type="range" min="10" max="10000000" step="10" value="1300000" data-rangeslider>
<label style="display:none"><input type="number" name="min" value="10"> <code>min</code></label>
<label><input type="number" name="max" value="10000000"> <code>max</code></label>
<label style="display:none"><input type="number" name="step" value="10"> <code>step</code></label>
<button>Change</button>
</div>
<HR>
<div id="js-example-change-attributes">
<h3>Percentage of attributes that correlate / overlap:</h3>
<P>
0% : OSINT free text attributes with no chance of two attributes in the database having the same value.<br/>
50% : a given attribute field will have the same value in 50% of events (already a huge value, rare and costly case)<br/>
If unknown, leave at 25% which is currently a good average.
</P>
<output></output>
<input id="attributes_correlation_id" name="attributes_correlation" type="range" min="0" max="100" value="25" data-rangeslider>
</div>
<HR>
Resulting RAM: <input id="result_RAM_id" name="result_RAM" type="field"> GB<br/>
Resulting DISK: <input id="result_DISK_id" name="result_DISK" type="field"> GB<br/>
Resulting CPU: <input id="result_CPU_id" name="result_CPU" type="field"> * vCPU core(s) (Intel Xeon Level)<br/>
<HR>
<a href="README.txt">README.txt</a> - <a href="https://github.com/MISP/MISP-sizer">GitHub page</a> - <a href="https://github.com/MISP/MISP">GitHub MISP</a> - <a href="http://www.misp-project.org/">Project home</a>
<script src="//localhost:8081"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="rangeslider.js"></script>
<script>
// From : https://github.com/andreruffert/rangeslider.js/blob/develop/example/index.html
$(function() {
var $document = $(document);
var selector = '[data-rangeslider]';
var $element = $(selector);
// For ie8 support
var textContent = ('textContent' in document) ? 'textContent' : 'innerText';
function result_compute() {
// var ram_result = 0;
// var cpu_count_result = 0;
// var disk_result = 0;
var c_users_count = parseInt(document.getElementById('users_count_id').value);
var c_attributes_count = parseInt(document.getElementById('attributes_count_id').value);
var c_attributes_correlation = parseInt(document.getElementById('attributes_correlation_id').value);
// console.log(c_users_count);
var ram_output = document.getElementById('result_RAM_id');
var disk_output = document.getElementById('result_DISK_id');
var cpu_output = document.getElementById('result_CPU_id');
// Please adapt heuristics here
ram_output.value = 2 + Math.floor(c_users_count / 1000) + Math.floor(c_attributes_correlation / 2) + Math.floor(c_attributes_count / 200000);
disk_output.value = 2 + Math.floor(c_users_count/10) + Math.floor(c_attributes_correlation/10) + Math.floor(c_attributes_count / 1000);
cpu_output.value = Math.floor(c_users_count / 1000.0 + c_attributes_correlation / 10.0 + c_attributes_count / 90000000.0 + 1);
}
// Example functionality to demonstrate a value feedback
function valueOutput(element) {
var value = element.value;
var output = element.parentNode.getElementsByTagName('output')[0] || element.parentNode.parentNode.getElementsByTagName('output')[0];
output[textContent] = value;
}
$document.on('input', 'input[type="range"], ' + selector, function(e) {
valueOutput(e.target);
result_compute();
});
$( document ).ready(function() {
result_compute();
});
// Example functionality to demonstrate disabled functionality
$document .on('click', '#js-example-disabled button[data-behaviour="toggle"]', function(e) {
var $inputRange = $(selector, e.target.parentNode);
if ($inputRange[0].disabled) {
$inputRange.prop("disabled", false);
}
else {
$inputRange.prop("disabled", true);
}
$inputRange.rangeslider('update');
});
// Example functionality to demonstrate programmatic value changes
$document.on('click', '#js-example-change-value button', function(e) {
var $inputRange = $(selector, e.target.parentNode);
var value = $('input[type="number"]', e.target.parentNode)[0].value;
$inputRange.val(value).change();
});
// Example functionality to demonstrate programmatic attribute changes
$document.on('click', '#js-example-change-attributes button', function(e) {
var $inputRange = $(selector, e.target.parentNode);
var attributes = {
min: $('input[name="min"]', e.target.parentNode)[0].value,
max: $('input[name="max"]', e.target.parentNode)[0].value,
step: $('input[name="step"]', e.target.parentNode)[0].value
};
$inputRange.attr(attributes);
$inputRange.rangeslider('update', true);
});
// Example functionality to demonstrate destroy functionality
$document
.on('click', '#js-example-destroy button[data-behaviour="destroy"]', function(e) {
$(selector, e.target.parentNode).rangeslider('destroy');
})
.on('click', '#js-example-destroy button[data-behaviour="initialize"]', function(e) {
$(selector, e.target.parentNode).rangeslider({ polyfill: false });
});
// Example functionality to test initialisation on hidden elements
$document
.on('click', '#js-example-hidden button[data-behaviour="toggle"]', function(e) {
var $container = $(e.target.previousElementSibling);
$container.toggle();
});
// Basic rangeslider initialization
$element.rangeslider({
// Deactivate the feature detection
polyfill: false,
// Callback function
onInit: function() {
valueOutput(this.$element[0]);
},
// Callback function
onSlide: function(position, value) {
console.log('onSlide');
console.log('position: ' + position, 'value: ' + value);
},
// Callback function
onSlideEnd: function(position, value) {
console.log('onSlideEnd');
console.log('position: ' + position, 'value: ' + value);
}
});
});
</script>
</body>
</html>