parameters: (request)
return_statement: return render(request, 'file_upload_response.html',
                    {'response': json.dumps(json_reply)})
docstring: Provides upload capability for Outlook .msg files (OLE2.0 format using
      Compound File Streams). This function will import the email into CRITs and
      upload any attachments as samples
  
      :param request: Django request object (Required)
      :type request: :class:`django.http.HttpRequest`
      :returns: :class:`django.http.HttpResponse`
docstring_summary: Provides upload capability for Outlook .msg files (OLE2.0 format using
      Compound File Streams). This function will import the email into CRITs and
      upload any attachments as samples
docstring_tokens: Provides upload capability for Outlook . msg files ( OLE2 . 0 format using Compound File Streams ) . This function will import the email into CRITs and upload any attachments as samples
function: def email_outlook_add(request):
      """
      Provides upload capability for Outlook .msg files (OLE2.0 format using
      Compound File Streams). This function will import the email into CRITs and
      upload any attachments as samples
  
      :param request: Django request object (Required)
      :type request: :class:`django.http.HttpRequest`
      :returns: :class:`django.http.HttpResponse`
      """
  
      outlook_form = EmailOutlookForm(request.user, request.POST, request.FILES)
      user = request.user
      json_reply = {
          'form': outlook_form.as_table(),
          'success': False
          }
  
      if request.method != "POST":
          message = "Must submit via POST."
      else:
          if not outlook_form.is_valid():
              message = "Form is invalid."
          elif not user.has_access_to(EmailACL.WRITE):
              message = "User does not have permission to add email."
          else:
              form_data = outlook_form.cleaned_data
              method = "Outlook MSG Upload"
              if form_data['source_method']:
                  method = method + " - " + form_data['source_method']
  
              result = handle_msg(request.FILES['msg_file'],
                                  form_data['source_name'],
                                  form_data['source_reference'],
                                  form_data['source_method'],
                                  form_data['source_tlp'],
                                  user,
                                  form_data['password'],
                                  form_data['campaign'],
                                  form_data['campaign_confidence'],
                                  form_data['bucket_list'],
                                  form_data['ticket'],
                                  form_data['related_id'],
                                  form_data['related_type'],
                                  form_data['relationship_type'])
  
              if result['status']:
                  redirect = reverse('crits-emails-views-email_detail',
                                     args=[result['obj_id']])
                  json_reply['success'] = True
                  message = 'Email uploaded successfully'
                  if result.get('reason'):
                      message += ', but %s' % result['reason']
                  message += ('. <a href="%s">View email.</a>' % redirect)
                  if 'message' in result:
                      message += "<br />Attachments:<br />%s" % result['message']
              else:
                  message = result['reason']
  
      json_reply['message'] = message
      return render(request, 'file_upload_response.html',
                    {'response': json.dumps(json_reply)})
function_tokens: def email_outlook_add ( request ) : outlook_form = EmailOutlookForm ( request . user , request . POST , request . FILES ) user = request . user json_reply = { 'form' : outlook_form . as_table ( ) , 'success' : False } if request . method != "POST" : message = "Must submit via POST." else : if not outlook_form . is_valid ( ) : message = "Form is invalid." elif not user . has_access_to ( EmailACL . WRITE ) : message = "User does not have permission to add email." else : form_data = outlook_form . cleaned_data method = "Outlook MSG Upload" if form_data [ 'source_method' ] : method = method + " - " + form_data [ 'source_method' ] result = handle_msg ( request . FILES [ 'msg_file' ] , form_data [ 'source_name' ] , form_data [ 'source_reference' ] , form_data [ 'source_method' ] , form_data [ 'source_tlp' ] , user , form_data [ 'password' ] , form_data [ 'campaign' ] , form_data [ 'campaign_confidence' ] , form_data [ 'bucket_list' ] , form_data [ 'ticket' ] , form_data [ 'related_id' ] , form_data [ 'related_type' ] , form_data [ 'relationship_type' ] ) if result [ 'status' ] : redirect = reverse ( 'crits-emails-views-email_detail' , args = [ result [ 'obj_id' ] ] ) json_reply [ 'success' ] = True message = 'Email uploaded successfully' if result . get ( 'reason' ) : message += ', but %s' % result [ 'reason' ] message += ( '. <a href="%s">View email.</a>' % redirect ) if 'message' in result : message += "<br />Attachments:<br />%s" % result [ 'message' ] else : message = result [ 'reason' ] json_reply [ 'message' ] = message return render ( request , 'file_upload_response.html' , { 'response' : json . dumps ( json_reply ) } )