Example #1
0
 def setUp(self):
     self.db_fd, self.fname = tempfile.mkstemp()
     app.app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///"+self.fname
     app.app.config['TESTING'] = True
     app.app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.app.test_client()
     app.db.create_all()
     api = APIControl()
     api.usercontrol.create("john", "password")
     self.create_sample()
     app.db.session.commit()
#!/usr/bin/env python
import sys
from time import sleep

from app.controllers.api import APIControl
api = APIControl()

for i in sys.argv[1:]:
    api.analysiscontrol.schedule_sample_analysis(int(i))
    sleep(200)
Example #3
0
#!/usr/bin/env python

from app.controllers.api import APIControl
from app.models.sample import Sample
from app.models.analysis import IDACommentAction, IDANameAction
import datetime
import requests

api = APIControl()

api.idacontrol.add_comment(1, 0x12345, 'This is a test')

print api.idacontrol.get_comments(1)

data = {
    "timestamp": str(datetime.datetime.now()),
    "addr": 0x12345,
    "comment": "This is a comment test"
}
r = requests.post("http://localhost:5000/api/1.0/samples/" + '1' +
                  '/ida/comments',
                  json=data)

s = Sample.query.get(1)

toto = IDANameAction()
titi = IDACommentAction()
toto.address = 0xDEADBEEF
titi.address = 0x0BADCAFE

toto.data = "This is a name"
Example #4
0
#!/usr/bin/env python

from app.controllers.api import APIControl
from app.models.sample import Sample
from app.models.analysis import IDACommentAction, IDANameAction
import datetime
import requests


api = APIControl()

api.idacontrol.add_comment(1, 0x12345, 'This is a test')


print api.idacontrol.get_comments(1)

data = {"timestamp": str(datetime.datetime.now()),
        "addr": 0x12345,
        "comment": "This is a comment test"
        }
r = requests.post("http://localhost:5000/api/1.0/samples/" +
                  '1' +
                  '/ida/comments',
                  json=data)

s = Sample.query.get(1)

toto = IDANameAction()
titi = IDACommentAction()
toto.address = 0xDEADBEEF
titi.address = 0x0BADCAFE
def launch():
    api = APIControl()
    api.analysiscontrol.reschedule_all_analysis(True)
    app.logger.info("Rescheduled all analysis!")
    sleep(2000000)
    return 0
Example #6
0
from flask import Flask, render_template

from flask.ext.sqlalchemy import SQLAlchemy
from flask_bootstrap import Bootstrap
from flask_login import LoginManager
from flask_marshmallow import Marshmallow
from flask.ext.misaka import Misaka
app = Flask(__name__)

app.config.from_object('config')


# Init bootstrap extension
Bootstrap(app)


# Init SQL extension
db = SQLAlchemy(app)
ma = Marshmallow(app)
Misaka(app)
# Init login manager extension
login_manager = LoginManager()
login_manager.init_app(app)

from app.controllers.api import APIControl

api = APIControl(db)

from app.models import models
from app.views import webui, apiview