Esempio n. 1
0
    def __init__(self, module=None, cdmtra=None):
        self.cdmtra = "('%s')" % "','".join(
            cdmtra.split(",")) if cdmtra else None
        self.srv = services(module)
        self.scratch = _SCRATCH

        self.CDMTRA = modules[module]["CD_MTRA"]
        self.FieldArchivoImg = "ARCHIVO"
        self.estado = "REVISION"

        self.msg = Messages()
        self.jsonresponse = None
        self.identifiers = None
        self.responseId = None
Esempio n. 2
0
def sampleCounting(modulo):
    '''
    Funcion para devolver el JSON del feature principal del modulo (Listado de codigos de muestra)
    :param modulo: Nombre del modulo
    :return: JSON del feature principal del modulo (Listado de codigos de muestra)
    '''
    url = services(modulo).query_url
    response = requests.post(url,
                             data={
                                 'where': '1=1',
                                 'outFields': '*',
                                 'f': 'pjson',
                                 'token': token
                             })
    res = json.loads(response.text)
    return res.get('features')
Esempio n. 3
0
def validate_mail():
    if "mail" in session:
        return redirect(url_for('dashboard'))
    else:
        try:
            #print("validate_mail")
            if request.method == 'POST':
                data_dict = request.form.to_dict()
                email = str(request.form['mail'])
                service_obj = services()
                temp = service_obj.check(email)
                #print temp
                #print data_dict
                return '%s' % temp
            else:
                render_template("dashboard.html")

        except:
            render_template("dashboard.html")
Esempio n. 4
0
def signin_data():
    if "mail" in session:
        return redirect(url_for('dashboard'))
        #print"login"
    elif request.method == 'POST':
        data_dict = request.form.to_dict()
        print data_dict
        user_name = str(request.form['mail'])
        password = str(request.form['password'])
        #print user_name,password
        #email_check=login_handler().email()
        service_obj = services()
        sign_done = service_obj.insert(user_name, password)
        #print email_check
        session['mail'] = request.form['mail']
        session['gmail'] = str('NO')
        #Sprint session['mail']
        return '%s' % sign_done
    return render_template("unbxd_suggestion.html")
Esempio n. 5
0
def login_data():
    print session
    if "mail" in session:
        #print"login"
        return redirect(url_for("dashboard"))
    elif request.method == 'POST':
        data_dict = request.form.to_dict()
        print data_dict
        user_name = str(request.form['mail'])
        password = str(request.form['password'])
        #print user_name,password
        #email_check=login_handler().email()
        service_obj = services()
        temp = service_obj.validate_user(user_name, password)
        print temp
        if (str(temp) == 'valid'):
            session['mail'] = request.form['mail']
            print session['mail']
            print "session mein stor ho gaya"
        return '%s' % temp
        #return render_template("dashboard.html")
    else:
        return redirect(url_for("login"))
Esempio n. 6
0
def read_only_data():
    if "mail" in session:
        try:
            if request.method == 'POST':
                # print ("2")
                data_dict = request.form.to_dict()
                print "get popular input data"
                print data_dict
                a = services()
                print "1"
                data = a.read_data("alok")
                print "2"
                return '%s' % data
                '''
                message=str(request.form['command'])

                field=str(request.form['fields'])
                #print message,field
                if message!="":
                    handler=data_handler()
                    handler_data=str(handler.delete_in_field(message,field))
                    #print handler_data
                    api=unbxd.api.PostmanApi(host="feed.unbxdapi.com")
                    products=api.infield.delete(data=handler_data)
                    #print products
                    return '%s' % products
                
                else:
                    return render_template("dashboard.html")
                '''
            else:
                return render_template("dashboard.html")

        except Exception as e:
            return '%s' % e
    else:
        return redirect(url_for('login'))

## this function unwraps a multi level JSON object into a python dictionary with key value pairs


def unwrap(keyval, temp):

    for key1, value1 in keyval:
        if type(value1) == str:

            temp[key1] = value1

        else:

            unwrap(value1.items(), temp)

    return (temp)


datacollect = packetcap(1, 'packet capture data')
datacollect.start()

dataprocess = packetanalyze(2, 'packet analyzing thread')
dataprocess.start()

dataservices = services(3, 'service analyzing thread')
dataservices.start()

timecounts = times(4, 'time the packets')
timecounts.start()
Esempio n. 8
0
__author__ = 'shams'
from websocket import create_connection
from jFlip import *
from services import *
import sys

ws = create_connection("ws://54.200.254.179/coinflip/socket.yaws")
connect = jFlip.connectToCloud("2Qsdfd34234",["Assal","Nawar","Mohsen","Shams"],"Shams_Laptop")
ws.send(connect)
rec = jFlip.receive(ws.recv())
myservices = services("services.ini")
services = myservices.getServices()

if(rec["returnCode"] == "Failed"):
    print "Failed reason: " + rec["failReason"]
    sys.exit()

while (True):
    rec = ws.recv()
    dec = jFlip.receive(rec)
    print dec
    if dec["action"] == action.getServices:
        s = []
        for service in services:  #should be in the database!
            x = jFlip.makeService(service["serviceName"],service["parameterCount"],service["parameters"],service["returnType"])
            s.append(x)
        y = jFlip.getServicesSuccess(s,dec["userID"])
        print y
        ws.send(y)
    elif dec["action"] == action.execService:
        arg = []