Compare commits

...

8 Commits

Author SHA1 Message Date
Alexandre Dulaunoy 3c1125083a
Merge pull request #167 from Cloud-Target/main
Improvements to diagnostic.py
2023-04-26 21:28:55 +02:00
Alexandre Dulaunoy ac28784feb
Merge pull request #174 from Nicolas-Pellletier/main
Fix some bugs and minor improvements
2023-04-26 21:28:17 +02:00
nicolas pelletier a636f14ca1 Fix tag apparition in Chart log panel + Fix attribute category panel bug 2023-04-26 20:33:02 +02:00
nicolas pelletier 480e339ced start_all.sh: Run zmq tool if it's not running + remove launch start_zmq.sh under 'zmqs' user 2023-04-26 20:28:35 +02:00
nicolas pelletier b762733f95 Fix bug due to Leaflet old version 1.2.0 (replace by 1.9.3) 2023-04-26 20:17:25 +02:00
nicolas pelletier 213c3fd36f diagnostic: fix malformed print format string 2023-04-26 20:15:48 +02:00
Lucas Magalhães 06dc976160 MISP user and password are now easier to set in diagnostic.py 2022-08-24 11:07:50 -03:00
Lucas Magalhães 4c9bc87437 Using settings from config file in diagnostic.py
Also fixed a typo in a return from exception
2022-08-23 23:26:52 -03:00
6 changed files with 42 additions and 18 deletions

View File

@ -40,6 +40,8 @@ Steps:
- check log dynamic endpoint
'''
MISP_USER = 'admin@admin.test'
MISP_PASSWD = 'Password1234'
HOST = 'http://127.0.0.1'
PORT = 8001 # overriden by configuration file
configuration_file = {}
@ -121,7 +123,7 @@ def check_virtual_environment_and_packages(spinner):
@add_spinner
def check_configuration(spinner):
global configuration_file, port
global configuration_file, PORT, HOST
configfile = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config/config.cfg')
cfg = configparser.ConfigParser()
cfg.read(configfile)
@ -135,7 +137,14 @@ def check_configuration(spinner):
# Check if all fields from config.default exists in config
result, faulties = diagnostic_util.dict_compare(cfg_default, cfg)
if result:
port = configuration_file.get("Server", "port")
PORT = configuration_file.get("Server", "port")
host = configuration_file.get("Server", "host")
if not (host == "localhost" or host == "127.0.0.1"):
if configuration_file.getboolean("Server", "ssl"):
http = "https://"
else:
http = "http://"
HOST = http+host
return (True, '')
else:
return_text = '''Configuration incomplete.
@ -388,7 +397,7 @@ def check_server_listening(spinner):
try:
r = requests.get(url)
except requests.exceptions.ConnectionError:
return (False, 'Can\'t connect to {}').format(url)
return (False, 'Can\'t connect to {}'.format(url))
if '/error_page' in r.url:
o = urlparse(r.url)
@ -410,8 +419,8 @@ def check_server_listening(spinner):
@add_spinner
def check_server_dynamic_enpoint(spinner):
payload = {
'username': 'admin@admin.test',
'password': 'Password1234',
'username': MISP_USER,
'password': MISP_PASSWD,
'submit': 'Sign In'
}
sleep_max = 15

View File

@ -127,7 +127,7 @@ mv temp/startbootstrap-sb-admin-2-${SBADMIN_VERSION}/bower_components/font-aweso
mv temp/startbootstrap-sb-admin-2-${SBADMIN_VERSION}/bower_components/bootstrap/fonts/* ./static/fonts
# leaflet
LEAFLET_VERSION="1.2.0"
LEAFLET_VERSION="1.9.3"
wget http://cdn.leafletjs.com/leaflet/v${LEAFLET_VERSION}/leaflet.zip -O temp/leaflet.zip
unzip -o temp/leaflet.zip -d temp/

View File

@ -328,9 +328,13 @@ class EventMessage():
if self.name == 'Attribute':
self.feed = jsonMsg['log']
self.feed = LogItem(self.feed, filters).get_row()
if (self.feed[2]):
self.feed[2]['data'] = json.dumps(self.feed[2]['data'])
elif self.name == 'ObjectAttribute':
self.feed = jsonMsg['log']
self.feed = LogItem(self.feed, filters).get_row()
if (self.feed[2]):
self.feed[2]['data'] = json.dumps(self.feed[2]['data'])
else:
self.feed = jsonMsg['log']

View File

@ -93,5 +93,12 @@ else
echo -e $RED"\t* NOT starting flask server, made a very unrealiable check on port 8001, and something seems to be there… please double check if this is good!"$DEFAULT
fi
ps auxw |grep mispzmq.py |grep -v grep ; check_zmq_tool=$?
sleep 0.1
sudo -u zmqs /bin/bash ${DIR}/start_zmq.sh &
if [ "${check_zmq_tool}" == "1" ]; then
echo -e "MISP zmq tool is not currently running"
sudo -b su -c "/var/www/MISP/venv/bin/python /var/www/MISP/app/files/scripts/mispzmq/mispzmq.py"
fi
sleep 0.1
${DIR}/start_zmq.sh &

View File

@ -174,7 +174,7 @@ $(document).ready(function () {
livelog = new $.livelog($("#divLogTable"), {
pollingFrequency: 5000,
tableHeader: head,
tableMaxEntries: 50,
tableMaxEntries: 300,
// animate: false,
preDataURL: urlForLogs,
endpoint: urlForLogs
@ -194,9 +194,9 @@ function updateLogTable(name, log, zmqName, ignoreLed) {
ledmanager.updateKeepAlive(zmqName);
}
// only add row for attribute
if (name == "Attribute" ) {
var categName = log[toPlotLocationLog];
// add row for attribute and Object attribute
if (name == "Attribute" || name == "ObjectAttribute") {
var categName = log[3];
sources.addIfNotPresent(categName);
sources.incCountOnSource(categName);
sources.incCountOnSource('global');
@ -209,6 +209,7 @@ function updateLogTable(name, log, zmqName, ignoreLed) {
}
function slideAndMax(orig, newData) {
var slided = [];
var max = newData;
@ -335,7 +336,8 @@ function createHead(callback) {
var $toRet;
if (typeof data === 'object') {
$toRet = $('<span></span>');
data.data.forEach(function(cur, i) {
let tagList = JSON.parse(data.data);
tagList.forEach(function(cur, i) {
switch (data.name) {
case 'Tag':
var $tag = $('<a></a>');
@ -841,7 +843,7 @@ $(document).ready(function() {
$panel.removeClass('liveLogFullScreen');
$this.data('isfullscreen', false);
$panel.find('#divLogTable').css({'overflow': 'hidden'});
livelog.changeOptions({tableMaxEntries: 50});
livelog.changeOptions({tableMaxEntries: 300});
}
});

View File

@ -1,5 +1,5 @@
var updateIntervalDirect = 1000*2; // 2s
var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1h
var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1 hour
var maxNumPoint = hours_spanned+1;
var optionsLineChart = {
@ -8,7 +8,7 @@ var optionsLineChart = {
lines: {
fill: true,
fillColor: {
colors: [ { opacity: 1 }, { opacity: 0.1 } ]
colors: [ { opacity: 0.1 }, { opacity: 0.1 } ]
}
}
},
@ -17,14 +17,15 @@ var optionsLineChart = {
xaxis: { min: 0, max: maxNumPoint },
ticks: maxNumPoint+1,
points: { show: true },
lines: { show: true, fill: true },
lines: { show: true, fill: true, lineDashType: "dash"},
grid: {
tickColor: "#dddddd",
borderWidth: 0
},
legend: {
show: true,
position: "nw"
position: "nw",
dockInsidePlotArea: true
}
};
@ -51,7 +52,8 @@ function updateChartDirect() {
plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax();
plotLineChart.setupGrid();
plotLineChart.draw();
//setTimeout(updateChartDirect, updateIntervalDirect);
setTimeout(updateChartDirect, updateIntervalDirect);
}
updateChartDirect()