chg: Use simplejson when possible & gunicorn for production.
parent
07559a2ed8
commit
af6189bbfd
|
@ -8,6 +8,9 @@ from dateutil.relativedelta import relativedelta
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import zipfile
|
import zipfile
|
||||||
import logging
|
import logging
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .libs.helpers import safe_create_dir, set_running, unset_running
|
from .libs.helpers import safe_create_dir, set_running, unset_running
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
|
|
|
@ -31,7 +31,7 @@ class DatabaseInsert():
|
||||||
while True:
|
while True:
|
||||||
if shutdown_requested():
|
if shutdown_requested():
|
||||||
break
|
break
|
||||||
uuids = self.redis_sanitized.spop('to_insert', 1000)
|
uuids = self.redis_sanitized.spop('to_insert', 100)
|
||||||
if not uuids:
|
if not uuids:
|
||||||
break
|
break
|
||||||
p = self.redis_sanitized.pipeline(transaction=False)
|
p = self.redis_sanitized.pipeline(transaction=False)
|
||||||
|
|
|
@ -9,6 +9,9 @@ from redis import StrictRedis
|
||||||
from redis.exceptions import ConnectionError
|
from redis.exceptions import ConnectionError
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import time
|
import time
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
from pyipasnhistory import IPASNHistory
|
from pyipasnhistory import IPASNHistory
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ from datetime import datetime, timedelta
|
||||||
from ipaddress import IPv4Address, IPv6Address, IPv4Network, IPv6Network
|
from ipaddress import IPv4Address, IPv6Address, IPv4Network, IPv6Network
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
from .helpers import get_homedir, safe_create_dir
|
from .helpers import get_homedir, safe_create_dir
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import copy
|
import copy
|
||||||
|
|
|
@ -8,6 +8,9 @@ from hashlib import sha512 # Faster than sha256 on 64b machines.
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import logging
|
import logging
|
||||||
from pid import PidFile, PidFileError
|
from pid import PidFile, PidFileError
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .libs.helpers import safe_create_dir, set_running, unset_running
|
from .libs.helpers import safe_create_dir, set_running, unset_running
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from redis import StrictRedis
|
from redis import StrictRedis
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import logging
|
import logging
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from redis import StrictRedis
|
from redis import StrictRedis
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Sanitizer():
|
||||||
while True:
|
while True:
|
||||||
if shutdown_requested():
|
if shutdown_requested():
|
||||||
break
|
break
|
||||||
uuids = self.redis_intake.spop('intake', 1000)
|
uuids = self.redis_intake.spop('intake', 100)
|
||||||
if not uuids:
|
if not uuids:
|
||||||
break
|
break
|
||||||
for_cache = []
|
for_cache = []
|
||||||
|
|
|
@ -9,6 +9,9 @@ from typing import Tuple
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from .libs.helpers import safe_create_dir, set_running, unset_running
|
from .libs.helpers import safe_create_dir, set_running, unset_running
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
import asyncio
|
import asyncio
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
|
@ -5,6 +5,7 @@ git+https://github.com/jsommers/pytricia.git
|
||||||
git+https://github.com/trbs/pid.git
|
git+https://github.com/trbs/pid.git
|
||||||
aiohttp
|
aiohttp
|
||||||
requests
|
requests
|
||||||
|
simplejson
|
||||||
|
|
||||||
git+https://github.com/MISP/PyTaxonomies
|
git+https://github.com/MISP/PyTaxonomies
|
||||||
git+https://github.com/MISP/PyMISPGalaxies.git
|
git+https://github.com/MISP/PyMISPGalaxies.git
|
||||||
|
|
|
@ -4,6 +4,6 @@ Install the dependencies, run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export FLASK_APP=${BGPRANKING_HOME}/website/web/__init__.py
|
export FLASK_APP=${BGPRANKING_HOME}/website/web/__init__.py
|
||||||
flask run --port 5005
|
gunicorn --worker-class gevent -w 10 -b 127.0.0.1:5005 web:app
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# Web thing
|
# Web thing
|
||||||
flask
|
flask
|
||||||
flask-bootstrap
|
flask-bootstrap
|
||||||
|
gunicorn[gevent]
|
||||||
|
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
pycountry
|
pycountry
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
try:
|
||||||
|
import simplejson as json
|
||||||
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from flask import Flask, render_template, request, session, Response
|
from flask import Flask, render_template, request, session, Response
|
||||||
|
|
Loading…
Reference in New Issue