コード例 #1
0
ファイル: views.py プロジェクト: Lscheinman/potentium
def add_event():

    iObj = request.form.to_dict(flat=False)

    if check_user() == True:

        today = datetime.now().strftime("%F")
        user = User(session["username"])
        iObj = {}
        iObj['iType'] = 'Event'
        iObj['eTYPE'] = request.form["eTYPE"]
        iObj['eCATEGORY'] = request.form["eCATEGORY"]
        iObj['eDESC'] = request.form["eDESC"]
        iObj['eCLASS1'] = request.form["eCLASS1"]
        iObj['eDATE'] = request.form["eDATE"]
        iObj['eTIME'] = request.form["eTIME"]
        iObj['Locations'] = request.form['eLOC']
        iObj['ORIGIN'] = request.form['PIRREF']
        iObj['ORIGINREF'] = (
            'COIN%s%s%s' % (user.GUID, iObj['ORIGIN'], iObj['eDESC'])).replace(
                " ", "")
        iObj['LOGSOURCE'] = 'COIN'
        iObj['Description'] = iObj['eDESC']

        TS = datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
        print("[%s_APP-View-add_event]: Received: %s %s" %
              (TS, type(iObj), iObj))
        newIntel = user.add_intel(iObj)

        return jsonify(newIntel)
    else:
        flash("Log in to access adding intel functionality.")
        return redirect(url_for("login"))
コード例 #2
0
ファイル: views.py プロジェクト: Lscheinman/potentium
def add_person():

    iObj = request.form.to_dict(flat=False)

    if check_user() == True:

        today = datetime.now().strftime("%F")
        user = User(session["username"])
        iObj['iType'] = 'Person'
        iObj['FName'] = request.form["pFNAME"]
        iObj['LName'] = request.form["pLNAME"]
        iObj['GEN'] = request.form["pGEN"]
        iObj['POB'] = request.form["pPOB"]
        iObj['DOB'] = request.form["pDOB"]
        iObj['Description'] = request.form["pDESC"]
        iObj['ORIGIN'] = request.form['PIRREF']
        iObj['ORIGINREF'] = (
            'COIN%s%s%s%s' %
            (iObj['FName'], iObj['LName'], iObj['GEN'], iObj['DOB'])).replace(
                " ", "")
        iObj['LOGSOURCE'] = 'OSINT'
        newIntel = user.add_intel(iObj)

        TS = datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
        print("[%s_APP-View-add_person]: Received: %s %s" %
              (TS, type(iObj), iObj))

        return jsonify(newIntel)
    else:
        flash("Log in to access adding intel functionality.")
        return redirect(url_for("login"))
コード例 #3
0
ファイル: views.py プロジェクト: Lscheinman/potentium
def add_relation():

    iObj = request.form.to_dict(flat=False)

    if check_user() == True:

        today = datetime.now().strftime("%F")
        user = User(session["username"])
        iObj = {}
        iObj['iType'] = 'Relation'
        iObj['pAGUID'] = request.form["pAGUID"]
        iObj['pBGUID'] = request.form["pBGUID"]
        iObj['oAGUID'] = request.form["oAGUID"]
        iObj['oBGUID'] = request.form["oBGUID"]
        iObj['AGUIDfree'] = request.form["AGUIDfree"]
        iObj['BGUIDfree'] = request.form["BGUIDfree"]
        iObj['Description'] = request.form["rDESC"]
        iObj['RELTYP'] = request.form["RELTYP"]
        iObj['ORIGIN'] = today
        iObj['ORIGINREF'] = 'COIN-%s' % user.GUID
        iObj['LOGSOURCE'] = 'COIN'

        TS = datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
        print("[%s_APP-View-add_relation]: Received: %s %s" %
              (TS, type(iObj), iObj))
        user.add_intel(iObj)

        AUTH, TILESTATS, recentPIR, USERS, TASKS = indexFill()
        MENUS = user.menus()
        return render_template("index.html",
                               MENUS=MENUS,
                               AUTH=AUTH,
                               recentPIR=recentPIR,
                               TILESTATS=TILESTATS,
                               TASKS=TASKS,
                               USERS=USERS)

    else:
        flash("Log in to access adding intel functionality.")
        return redirect(url_for("login"))