示例#1
0
    def post(self):

        args = parser_payload.parse_args()
        o = Payload()

        o.payload = args["payload"]
        o.ordering = 1
        o.notes = args["notes"]

        try:
            db.session.add(o)
            db.session.commit()
        except IntegrityError, exc:
            app.logger.warn(exc.message)
            return {"error": exc.message}, 500
示例#2
0
    def post(self):

        args = parser_payload.parse_args()
        o = Payload()

        o.payload = args["payload"]
        o.ordering = 1
        o.notes = args["notes"]

        try:
            db.session.add(o)
            db.session.commit()
        except IntegrityError, exc:
            app.logger.warn(exc.message)
            return {"error": exc.message}, 500
示例#3
0
    def post(self):

        args = parser_payload.parse_args()
        o = Payload()
        o.payload = args["payload"].replace("$1","//" + app.config['HOSTNAME'] + "/c.js?u=" + str(o.id))
        o.url = args["url"]
        o.method = args["method"]
        o.parameter = args["parameter"]
        o.notes = args["notes"]

        for assessment_id in args["assessments"]:
            a = Assessment.query.filter(Assessment.id == assessment_id).first()
            if a == None:
                return {"error": "Assessment not found!"}, 500
            o.assessments.append(a)

        try:
            db.session.add(o)
            db.session.commit()
        except IntegrityError, exc:
            return {"error": exc.message}, 500
示例#4
0
    def post(self):

        args = parser_payload.parse_args()
        o = Payload()
        o.payload = args["payload"].replace("$1", "//{}/x?u={}".format(app.config['HOSTNAME'], str(o.id)))
        o.url = args["url"]
        o.method = args["method"]
        o.parameter = args["parameter"]
        o.notes = args["notes"]

        for assessment_id in args["assessments"]:
            a = Assessment.query.filter(Assessment.id == assessment_id).first()
            if a is None:
                return {"error": "Assessment not found!"}, 500
            o.assessments.append(a)

        try:
            db.session.add(o)
            db.session.commit()
        except IntegrityError, exc:
            return {"error": exc.message}, 500