コード例 #1
0
    def mutate(self,
               info,
               host='pastebin.com',
               port=443,
               path='/',
               scheme="http"):
        url = security.strip_dangerous_characters(
            f"{scheme}://{host}:{port}{path}")
        cmd = helpers.run_cmd(f'curl --insecure {url}')

        owner = Owner.query.filter_by(name='DVGAUser').first()
        Paste.create_paste(title='Imported Paste from URL - {}'.format(
            helpers.generate_uuid()),
                           content=cmd,
                           public=False,
                           burn=False,
                           owner_id=owner.id,
                           owner=owner,
                           ip_addr=request.remote_addr,
                           user_agent=request.headers.get('User-Agent', ''))

        Audit.create_audit_entry(
            gqloperation=helpers.get_opname(info.operation))

        return ImportPaste(result=cmd)
コード例 #2
0
  def mutate(self, info, filename, content):
    result = helpers.save_file(filename, content)
    owner = Owner.query.filter_by(name='DVGAUser').first()

    Paste.create_paste(
      title='Imported Paste from File - {}'.format(helpers.generate_uuid()),
      content=content, public=False, burn=False,
      owner_id=owner.id, owner=owner, ip_addr=request.remote_addr,
      user_agent=request.headers.get('User-Agent', '')
    )

    Audit.create_audit_entry(info)

    return UploadPaste(result=result)
コード例 #3
0
    def mutate(self, info, title, content, public, burn):
        owner = Owner.query.filter_by(name='DVGAUser').first()
        paste_obj = Paste.create_paste(title=title,
                                       content=content,
                                       public=public,
                                       burn=burn,
                                       owner_id=owner.id,
                                       owner=owner,
                                       ip_addr=request.remote_addr,
                                       user_agent=request.headers.get(
                                           'User-Agent', ''))

        return CreatePaste(paste=paste_obj)
コード例 #4
0
    def mutate(self, info, title, content, public, burn):
        owner = Owner.query.filter_by(name='DVGAUser').first()

        paste_obj = Paste.create_paste(
            title='Imported Paste from File - {}'.format(
                helpers.generate_uuid()),
            content=content,
            public=False,
            burn=False,
            owner_id=owner.id,
            owner=owner,
            ip_addr=request.remote_addr,
            user_agent=request.headers.get('User-Agent', ''))

        Audit.create_audit_entry(
            gqloperation=helpers.get_opname(info.operation))

        return CreatePaste(paste=paste_obj)