Commit a640614e authored by Edvard Rejthar's avatar Edvard Rejthar

unikátní záznamy ip X port v exportu

kompletní migrace na nový stroj
parent d80dcfce
...@@ -5,7 +5,7 @@ Scans a website for a sign of a parasite hosts or commands. ...@@ -5,7 +5,7 @@ Scans a website for a sign of a parasite hosts or commands.
## Installation ## Installation
1. ```git clone git@gitlab.labs.nic.cz:csirt/mdmaug.git /tmp/mdmaug``` 1. ```git clone git@gitlab.labs.nic.cz:csirt/mdmaug.git /tmp/mdmaug```
2. edit config.py 2. edit mdmaug/lib/config.py
3. ```/tmp/mdmaug/INSTALL``` 3. ```/tmp/mdmaug/INSTALL```
### Notes ### Notes
......
# XX shouldnt I delete this file?
su - mdmaug -c 'cd /home/mdmaug/mdmaug/ ; python3 mdmaug.py' su - mdmaug -c 'cd /home/mdmaug/mdmaug/ ; python3 mdmaug.py'
pkill python3 #pri Ctrl+C v prikazu su se uzavre jen terminal, ale ne uz python skript. Takhle to zas zabije veskery Python, ale sandboxovy-zavirovany uzivatel mdmaug stejne ma byt jen na spousteni tohohle skriptu. pkill python3 #pri Ctrl+C v prikazu su se uzavre jen terminal, ale ne uz python skript. Takhle to zas zabije veskery Python, ale sandboxovy-zavirovany uzivatel mdmaug stejne ma byt jen na spousteni tohohle skriptu.
\ No newline at end of file
...@@ -188,22 +188,21 @@ class ScanController: ...@@ -188,22 +188,21 @@ class ScanController:
def queue(self): def queue(self):
""" Ze souboru queue.cache nacte, ktery profil je volny a zabookuje ho""" """ Reads from queue.cache what profile is available and books it """
self._loadProfileQueue() self._loadProfileQueue()
self.profile = -1 self.profile = -1
for i2 in range(4): #na volny slot zkusime nekolikrat pockat for _ in range(4): #na volny slot zkusime nekolikrat pockat
for i in range(Config.profileCount): #i = 10 if i ==10: for i in range(Config.profileCount): #i = 10 if i ==10:
if self.queueFF.get(str(i)) == None: if self.queueFF.get(str(i)) == None:
self.profile = i self.profile = i
self.bookProfile() self.bookProfile()
break break
if self.profile == -1: if self.profile == -1:
logging.debug("(-1) PLNO, cekame par vterin") logging.debug("(-1) FULL, let's wait few secs")
time.sleep(randint(5, 10)) #pockame par vterin time.sleep(randint(5, 10)) #pockame par vterin
else: else:
break #volny slot jsme nasli, muzeme dal break # we found a free slot, let's proceed
#logging.debug(" profile " + str(self.profile ) + " queueFF:")
logging.debug(self.queueFF) logging.debug(self.queueFF)
#povedlo se zabookovat profil FF? #povedlo se zabookovat profil FF?
......
...@@ -8,8 +8,6 @@ from lib.model.dbp import Export ...@@ -8,8 +8,6 @@ from lib.model.dbp import Export
import logging import logging
import mimetypes import mimetypes
import os import os
import time
env = Environment() env = Environment()
env.loader = FileSystemLoader(Config.DIR + "templates/") env.loader = FileSystemLoader(Config.DIR + "templates/")
......
...@@ -107,6 +107,8 @@ class Export(DbModel): ...@@ -107,6 +107,8 @@ class Export(DbModel):
q += "NOW() - INTERVAL {} DAY ".format(int(days)) q += "NOW() - INTERVAL {} DAY ".format(int(days))
else: else:
q += "(select case when MAX(timestamp IS NULL)=0 THEN max(timestamp) ELSE 0 END from export)" q += "(select case when MAX(timestamp IS NULL)=0 THEN max(timestamp) ELSE 0 END from export)"
q += " GROUP BY concat(`ip`,`port`) " # group by concat may be a performance issue
q += " ORDER BY `timestamp` DESC"
logging.debug(q) logging.debug(q)
rq = RawQuery(Turris, q).execute() rq = RawQuery(Turris, q).execute()
print (rq) print (rq)
......
...@@ -4,5 +4,5 @@ echo "mdmaug-launch start" >> ~/log.log ...@@ -4,5 +4,5 @@ echo "mdmaug-launch start" >> ~/log.log
pkill -f mdmaug.py pkill -f mdmaug.py
pkill -f Xvfb pkill -f Xvfb
export PYTHONPATH=$PYTHONPATH:/opt/mdmaug/mdmaug/ export PYTHONPATH=$PYTHONPATH:/opt/mdmaug/mdmaug/
cd /opt/mdmaug/mdmaug && ./mdmaug.py 2>&1 | /usr/bin/logger -t yourtag cd /opt/mdmaug/mdmaug && ./mdmaug.py 2>&1 | /usr/bin/logger -t mdmaugtag
whoami >> ~/log.log whoami >> ~/log.log
\ No newline at end of file
...@@ -27,7 +27,7 @@ vdisplay = Xvfb() ...@@ -27,7 +27,7 @@ vdisplay = Xvfb()
vdisplay.start() vdisplay.start()
try: try:
print('Listening at https://0.0.0.0:{}'.format(Config.APP_PORT)) print('Listening at https://0.0.0.0:{}'.format(Config.APP_PORT))
for _ in range(2): # XX Config.profileCount for _ in range(Config.profileCount):
threading.Thread(target=httpd.serve_forever).start() threading.Thread(target=httpd.serve_forever).start()
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
vdisplay.stop() vdisplay.stop()
......
file.reference.opt-mdmaug-installer=.
java.lib.path= java.lib.path=
platform.active=Python_3.5.1 platform.active=Python_3.5.1
python.lib.path= python.lib.path=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment