Mail processing method and device
By identifying and reconstructing attachments that handle security risk data in emails, and combining the email body data to form new target emails, the problem of security risk data propagation in emails is solved and the security of email transmission is improved.
Patent Information
- Application Number
- CN202310355134.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2024-10-15
AI Technical Summary
Security risk data (such as viruses, Trojans, etc.) carried in emails will bring security problems to the email recipients, and existing technologies cannot effectively reduce these risks.
By determining the attachments to be reconstructed in the email, perform reconstruction processing to remove security risk data, and combine the processed attachments with the email body data to form a target email that replaces the original email, thereby reducing the probability of the spread of security risk data.
It effectively reduces the probability that emails carry security risk data, reduces security threats to email recipients, and improves the security of email transmission.
Smart Images

Figure CN118784608A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a mail processing method and device. Background Art
[0002] With the rapid development of Internet technology, people are increasingly using emails to transmit information and files in their work and daily lives. Currently, emails sent by the sender are directly provided to the recipient for viewing. In this case, if the email contains security risk data such as viruses and Trojans, it will cause security problems for the recipient after the email is viewed. Summary of the invention
[0003] In view of this, the present application proposes an email processing method and device, the main purpose of which is to reduce the probability of emails carrying security risk data.
[0004] In order to achieve the above objectives, this application mainly provides the following technical solutions:
[0005] In a first aspect, the present application provides an email processing method, the email processing method comprising:
[0006] Determine the attachments to be reconstructed in the pending mails;
[0007] Performing reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used to remove the security risk data in the attachment to be reconstructed;
[0008] The first data in the mail to be processed and the target attachment obtained after reconstruction are combined to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
[0009] In some embodiments, determining the attachment to be rebuilt in the email to be processed includes: determining the file type of the attachment included in the email to be processed; if it is determined that the file type includes the target file type, determining the attachment of the target file type as the attachment to be rebuilt.
[0010] In some embodiments, determining the file type of the attachment included in the email to be processed includes: parsing the email to be processed to obtain a boundary identifier; wherein the boundary identifier is used to locate the position of the attachment in the email to be processed; determining the attachment data segments included in the email to be processed based on the boundary identifier; wherein each attachment data segment corresponds to an attachment; and determining the file type of the attachment included in the email to be processed based on the file type information included in the determined attachment data segments.
[0011] In some embodiments, the email processing method further includes: if it is determined that the file types do not include the target file type, sending the email to be processed to a target server.
[0012] In some embodiments, the attachment to be reconstructed is reconstructed, including: calling a reconstruction function that matches the file type of the attachment to be reconstructed to process the attachment to be reconstructed; wherein the reconstruction function is used to remove security risk data in the attachment of the matching file type; and determining the data processed by the reconstruction function as the target attachment.
[0013] In some embodiments, the attachment to be reconstructed is reconstructed, including: determining a data extraction item that matches the file type of the attachment to be reconstructed; wherein the data extraction item is used to determine second data corresponding to the matching file type; deleting data in the second data that meets the risk condition of the corresponding data extraction item to obtain the target attachment.
[0014] In some embodiments, the first data in the email to be processed and the target attachment obtained after reconstruction are combined and processed, including: setting the relative position relationship between the first data and the target attachment in the first email template; based on the relative position relationship, writing the first data and the target attachment into the first email template.
[0015] In some embodiments, the email processing method also includes: reading the data rows in the email to be processed line by line; if the data row currently being read belongs to the email body data included in the first data or is not selected as the attachment to be reconstructed, writing the data row currently being read into the second email template, and continuing to read the next row of data in the email to be processed; if the data row currently being read belongs to the attachment to be reconstructed and is the first data row of the attachment to be reconstructed, not writing the data row currently being read into the second email template, and writing the replacement attachment of the current attachment to be reconstructed into the second email template; after the replacement attachment of the current attachment to be reconstructed is written, continuing to read the target data row in the email to be processed; wherein the replacement attachment is the reconstructed attachment of the current attachment to be reconstructed; the target data row is the next row of data in the email to be processed that is adjacent to the last row of data of the current attachment to be reconstructed.
[0016] In some embodiments, before combining the first data in the email to be processed and the target attachment obtained after reconstruction, the method also includes: detecting whether there is abnormal data in the email body data included in the first data; wherein the abnormal data includes security risk links and / or sensitive data; if detected, performing matching data processing operations on the abnormal data based on the data type of the abnormal data.
[0017] In some embodiments, the email processing method also includes: when an email is obtained, parsing the content type field in the email header of the email; if the content type field includes a target field, determining the email as the email to be processed; wherein the target field is used to describe the presence of attachments in the email.
[0018] In a second aspect, the present application provides a mail processing device, the mail processing device comprising:
[0019] A determination module, used for determining the attachment to be reconstructed in the email to be processed;
[0020] A reconstruction module, used for performing reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used for removing the security risk data in the attachment to be reconstructed;
[0021] The combination module is used to combine the first data in the mail to be processed and the target attachment obtained after reconstruction to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
[0022] In a third aspect, the present application provides a network gate, and the network gate application is the mail processing method of the first aspect.
[0023] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the mail processing method described in the first aspect.
[0024] In a fifth aspect, the present application provides an electronic device, comprising: a memory for storing a program; and a processor, coupled to the memory, for running the program to execute the mail processing method of the first aspect.
[0025] The email processing method and device provided by the present application, after determining the email to be processed, determines the attachment to be rebuilt in the email to be processed, and reconstructs the attachment to be rebuilt. Then, the data in the email to be processed except the attachment to be rebuilt and the target attachment obtained after the reconstruction process are combined and processed to form a target email for replacing the email to be processed. It can be seen that the solution provided by the present application takes into account that most of the security risk data will exist in the attachment of the email, so the security risk data carried in the attachment is cleared by reconstructing the attachment, and the target attachment obtained after the reconstruction process is used to generate a target email for replacing the email to be processed. The probability of the target email carrying security risk data is low. After the target email replaces the email to be processed, the security issues brought to the email recipient by the security risk data can be reduced.
[0026] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1 A flowchart of a mail processing method provided by an embodiment of the present application is shown;
[0029] Figure 2 A schematic diagram of the structure of a mail processing device provided by an embodiment of the present application is shown;
[0030] Figure 3 A structural schematic diagram of a mail processing device provided in another embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0032] At present, the emails sent by the email sender are directly provided to the email receiver for the email receiver to view. In this case, once the email contains security risk data such as viruses and Trojans, the email will cause security problems to the email receiver after being viewed by the email receiver.
[0033] After research, the inventor found that before the email reaches the email recipient, the email can be processed to remove the security risk data in the email, thereby reducing the probability of the email carrying security risk data and reducing the security problems caused by the security risk data to the email recipient.
[0034] Based on the above research, the inventor has designed a technical solution for email processing, specifically: after determining the email to be processed, determine the attachment to be reconstructed in the email to be processed. Then reconstruct the attachment to be reconstructed. Finally, the first data in the email to be processed and the target attachment obtained after the reconstruction process are combined to form a target email for replacing the email to be processed, where the first data here refers to the data in the email to be processed other than the attachment to be reconstructed. Considering that most of the security risk data will exist in the attachment of the email, the email processing solution provided in the embodiment of the present application clears the security risk data carried in the attachment by reconstructing the attachment, and uses the target attachment obtained after the reconstruction process to generate a target email for replacing the email to be processed. In this way, the probability of the email carrying security risk data can be reduced, thereby reducing the security problems caused by the security risk data to the email recipient.
[0035] The application scenarios of the technical solution for email processing provided by the embodiment of the present application may include the following two scenarios: the first scenario is applied to the email recipient, so that before the email recipient browses the email, the email is first processed to remove security risk data. The second scenario is applied to the email sender, that is, before the email sender sends the email, the email to be sent is first processed to remove security risk data, so as to minimize the number of emails carrying security risk data sent by the email sender.
[0036] The application subject of the technical solution for email processing provided in the embodiment of the present application can be determined based on business requirements. For example, the application subject is a network gate.
[0037] The following is a detailed description of the technical solution for email processing provided in the embodiments of the present application.
[0038] like Figure 1 As shown, the embodiment of the present application provides an email processing method, which mainly includes the following steps 101-103:
[0039] 101. Determine the attachments to be rebuilt in the pending emails.
[0040] Considering that security risk data is usually carried in email attachments, emails with attachments are identified as pending emails in this application. The security risk data here refers to data that may cause losses to the email recipient. The security risk data may include but is not limited to data such as viruses and Trojans.
[0041] In actual applications, since not all emails carry attachments, it is necessary to filter the emails to be processed. The specific process of filtering the emails to be processed includes the following steps 101A to 101B:
[0042] 101A. When an email is obtained, the content type field in the email header of the email is parsed.
[0043] The email header of an email usually includes a content type field. The content type field is used to describe whether the email includes an attachment. Therefore, when obtaining an email, it is necessary to parse the content type field in the email header of the email in order to determine whether the email includes an attachment based on the content type field.
[0044] The method of parsing the content type field is: extract the text line including the first field in the email header as the content type field. The first field is a field that must exist in the content type field. Exemplarily, if the first field is Content-Type, the text line "Content-Type: multipart / mixed" including "Content-Type" in the email header is extracted as the content type field.
[0045] 101B. If the content type field includes a target field, the email is determined as a to-be-processed email; wherein the target field is used to describe the existence of an attachment in the email.
[0046] After parsing the content type field, it is detected whether the content type field includes a target field for indicating that there is an attachment in the email. The target field here can be determined based on the email system type. Exemplarily, the target field is "multipart / mixed".
[0047] If it is detected that the content type field does not include the target field, it means that there is no attachment in the email and the email may only include plain text email body data. Therefore, the email is not determined as a to-be-processed email.
[0048] If it is detected that the content type field includes the target field, it means that there is an attachment in the email. In order to remove the security risk data in the attachment, the email is determined as a pending email.
[0049] After the emails to be processed are determined, it is necessary to determine the attachments to be rebuilt in the emails to be processed, so as to remove the security risk data in the attachments to be rebuilt by rebuilding the attachments to be rebuilt. There are two solutions for determining the attachments to be rebuilt in the emails to be processed:
[0050] First, the specific process of determining the attachment to be reconstructed in the email to be processed includes the following steps 101C to 101D:
[0051] 101C. Determine the file type of the attachment included in the email to be processed.
[0052] Considering that some file types of attachments are unlikely to carry security risk data, in order to reduce the amount of email processing, it is necessary to determine the file types of attachments included in the emails to be processed, so as to select attachments with a higher probability of carrying security risk data as attachments to be reconstructed based on the file types.
[0053] The specific process of determining the file type of the attachment included in the email to be processed includes the following steps 101C1 to 101C3:
[0054] 101C1. Parse the mail to be processed to obtain the boundary identifier.
[0055] The boundary identifier is used to locate the position of the attachment in the email to be processed, and is used to separate the email body data and the attachment and to separate different attachments. Exemplarily, the boundary identifier is "boundary="segment identifier", where the segment identifier can be set based on business needs and is not specifically limited in this embodiment. For example, the boundary identifier is: boundary="----".
[0056] 101C2. Determine the attachment data segments included in the email to be processed according to the boundary identifier; wherein each attachment data segment corresponds to an attachment.
[0057] Since the boundary marker can separate the email body data and the attachment and is used to separate different attachments, the attachment data segment included in the email to be processed can be determined according to the boundary marker. One attachment data segment corresponds to one attachment. The attachment data includes the content data, attachment name information and file type information of the corresponding attachment.
[0058] 101C3. Determine the file type of the attachment included in the email to be processed based on the file type information included in the determined attachment data segment.
[0059] After determining the attachment data segments included in the to-be-processed email, for each attachment data segment, the following is performed: extracting file type information from the attachment data segment. The file type information is used to describe what type of file the corresponding attachment is. For example, if the file type information includes ".doc", it is determined that the file type of the corresponding attachment is a document type, specifically an office document type.
[0060] 101D. If it is determined that the determined file types include the target file type, the attachment of the target file type is determined as the attachment to be reconstructed.
[0061] The probability that the attachments of the target file type include security risk data is relatively high. Therefore, in order to reduce the probability of security risk data existing in the email, if it is determined that the determined file types include the target file type, the attachments of the target file type are determined as attachments to be reconstructed, so that the security risk data in these attachments can be removed by reconstruction.
[0062] The target file type can be determined based on business needs, and the embodiments of this application do not specifically limit it. Exemplarily, the target file type may include at least one of the following: Office document type, WPS document type, PDF document type, RTF document type, picture type, and specified type; wherein the file of the specified type is composed of at least one file, and the target file exists in the files that constitute it, and the target file here is a document type or a picture type file.
[0063] Document-type attachments are more likely to carry VBA scripts, macro viruses, embedded data, controls and other security risk data, so the above document types are determined as target file types.
[0064] The specific format of the type can be determined based on business needs. For example, the image type can be a JPG image type. The probability of attachments of these image types carrying security risk data such as viruses and Trojans is high, so the image type is determined as the target file type. The specified type can be a compressed package, and the compressed package includes files of document type and / or image type.
[0065] Further, if it is determined that the determined file types do not include the target file type, the mail to be processed is sent to the target server.
[0066] If the target file type is not included in the determined file types, it means that the probability of the attachment of the email carrying security risk data is small, so the email to be processed is directly sent to the target server. The target server here is used to operate the received email based on its own configured email operation function. The email operation function configured by the target server itself is related to the role of the target server. For example, when the target server is an email sending and receiving server, the email operation function configured by the target server is to send emails to the email recipient. When the target server is an email storage server, the email operation function configured by the target server is to store emails.
[0067] 102. Perform reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used to remove security risk data in the attachment to be reconstructed.
[0068] The attachment to be rebuilt is an attachment that is more likely to carry security risk data. In order to reduce the probability that the attachment to be rebuilt carries security risk data, it is necessary to reconstruct the attachment to be rebuilt. The reconstruction of the attachment to be rebuilt can be based on the file type of the attachment to be rebuilt. Therefore, the reconstruction schemes for the attachment to be rebuilt include the following two:
[0069] First, the specific process of reconstructing the attachment to be reconstructed includes the following steps 102A to 102B:
[0070] 102A. Call a reconstruction function that matches the file type of the attachment to be reconstructed to process the attachment to be reconstructed.
[0071] In order to facilitate the processing of the attachment to be rebuilt, multiple reconstruction functions can be pre-set, and each reconstruction function has a matching file type. The reconstruction function is used to reconstruct the attachment of the matching file type to remove the security risk data in the attachment of the matching file type. Therefore, when the attachment to be rebuilt is reconstructed, the reconstruction function called matches the file type of the attachment to be rebuilt and is used to remove the security risk data in the attachment of the matching file type.
[0072] It should be noted that when the attachment to be rebuilt is a document type or a picture type attachment, the reconstruction function called is directly used for the attachment to be rebuilt. When the attachment to be rebuilt is an attachment of a specified type, that is, the attachment to be rebuilt is composed of at least one file, and there is a target file in the files that constitute it, the reconstruction function called is mainly used to rebuild the target file in the attachment. Here, the target file is a document type or a picture type file.
[0073] 102B. Determine the data processed by the reconstruction function as the target attachment.
[0074] After the reconstruction function is called, the reconstruction function will perform a reconstruction operation on the attachment to be reconstructed. The reconstruction operation here will not affect the content data in the attachment to be reconstructed, but will only remove the security risk data in the attachment to be reconstructed.
[0075] After the reconstruction function completes the reconstruction of the attachment to be reconstructed, it will feedback the reconstructed data. After the reconstruction function feedbacks the data, the feedback data is determined as the target attachment for replacing the attachment to be reconstructed.
[0076] The second method is to reconstruct the attachment to be reconstructed, and the specific process includes the following steps 102C to 102D:
[0077] 102C. Determine a data extraction item that matches the file type of the attachment to be reconstructed; wherein the data extraction item is used to determine second data corresponding to the matching file type.
[0078] The location of security risk data may be different for attachments of different file types. Therefore, it is necessary to select the data extraction item that matches the file type of the attachment to be reconstructed.
[0079] The data extraction items matched by each file type can be set based on the data characteristics of the file type. Exemplarily, the data extraction items matched by the Office document type can include but are not limited to at least one of the following: VBA script items, macro enablement items, embedded file items, ActiveXObject object items, etc.
[0080] After the data extraction item is determined, the second data corresponding to the determined data extraction item is obtained from the attachment to be rebuilt. The specific process of obtaining the second data corresponding to the determined data extraction item from the attachment to be rebuilt is: based on the field corresponding to the data extraction item, the corresponding second data is extracted from the attachment to be rebuilt.
[0081] 102D. Delete the data in the second data that meets the risk condition of the corresponding data extraction item to obtain the target attachment.
[0082] Each data extraction item has a corresponding risk condition, and the risk condition is used to exclude security risk data included in the corresponding second data.
[0083] If there is data satisfying the corresponding risk condition in the second data, it means that if the attachment to be rebuilt is opened by the email recipient, it will cause losses to the email recipient. Therefore, the data satisfying the corresponding risk condition in the second data needs to be deleted.
[0084] If the second data does not satisfy the corresponding risk condition, it means that even if the attachment to be rebuilt is opened by the email recipient, it is highly unlikely to cause loss to the email recipient, so the second data can be maintained unchanged.
[0085] 103. Combine the first data in the mail to be processed and the target attachment obtained after the reconstruction process to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
[0086] After the attachment to be rebuilt is reconstructed, the first data in the mail to be processed and the target attachment obtained after the reconstruction process need to be combined to form a target mail to replace the mail to be processed. The target mail here is used to replace the mail to be processed and sent to the target database so that the target database can operate the received mail based on its own configured mail operation function. The first data here refers to the data in the mail to be processed except the attachment to be rebuilt, and the first data includes the mail body data in the mail to be processed and the data corresponding to the attachment in the mail to be processed that is not determined as the attachment to be rebuilt.
[0087] There are two solutions for combining the first data in the mail to be processed and the target attachment obtained after the reconstruction process to form the target mail:
[0088] The first one is to combine the first data in the mail to be processed and the target attachment obtained after reconstruction. The specific scheme is: retain the first data in the mail to be processed, and replace the attachment to be reconstructed in the mail to be processed with the corresponding target attachment.
[0089] In this solution, only the reconstructed attachments in the to-be-processed mail are replaced with the corresponding target attachments, so the efficiency of the combined processing is high and the target mail can be quickly formed.
[0090] The second one is a specific scheme for combining the first data in the email to be processed and the target attachment obtained after reconstruction processing as follows: setting the relative position relationship between the first data and the target attachment in the first email template; and writing the first data and the target attachment into the first email template based on the relative position relationship.
[0091] There may be the following two problems with the emails to be processed: first, the email template used for the emails to be processed may contain security risk data; second, the format of the email template of the emails to be processed may not meet specific business requirements.
[0092] Considering the above two problems, when processing the first data and the target attachment in combination, a first email template that meets the business requirements can be selected, and then the relative position relationship between the first data and the target attachment in the first email template is set based on the business requirements. Then, based on the relative position relationship, the first data and the target attachment are written into the first email template. In this way, not only can the security risk data that may exist in the email template used for the email to be processed be removed, but also the layout of the first data and the target attachment in the first email template is made more in line with the business requirements.
[0093] In order to further reduce the security risks that emails bring to email recipients, before the first data in the email to be processed and the target attachment obtained after reconstruction are combined and processed, the following process can also be included: detecting whether there is abnormal data in the email body data included in the first data; if detected, performing matching data processing operations on the abnormal data based on the data type of the abnormal data.
[0094] Abnormal data includes security risk links and / or sensitive data. Security risk links are links that will bring security risks to the email recipient after being triggered. Sensitive data here refers to data that will cause losses to the email recipient or email sender.
[0095] Abnormal data can be detected by blacklist or whitelist. If abnormal data is detected, a matching data processing operation is performed on the abnormal data based on the data type of the abnormal data. For example, when the abnormal data is a security risk link, the matching data processing operation is a deletion operation. For example, when the abnormal data is sensitive data, the matching data processing operation is a desensitization operation.
[0096] The mail processing method provided in the embodiment of the present application, after determining the mail to be processed, determines the attachment to be rebuilt in the mail to be processed, and reconstructs the attachment to be rebuilt. Then, the data in the mail to be processed except the attachment to be rebuilt and the target attachment obtained after the reconstruction process are combined and processed to form a target mail for replacing the mail to be processed. It can be seen that the scheme provided in the embodiment of the present application takes into account that most of the security risk data will exist in the attachment of the mail, so the security risk data carried in the attachment is cleared by reconstructing the attachment, and the target attachment obtained after the reconstruction process is used to generate a target mail for replacing the mail to be processed. The probability of the target mail carrying security risk data is low. After the target mail replaces the mail to be processed, the security issues brought to the mail recipient by the security risk data can be reduced.
[0097] In some embodiments of the present application, the mail processing method may further include steps 104-106 to form a target mail for replacing the mail to be processed.
[0098] 104. Read the data lines in the email to be processed line by line.
[0099] Reading the data lines in the pending email line by line can be performed under the following conditions: obtaining the replacement attachment corresponding to the email to be reconstructed in the pending email, and determining that the first data and the replacement attachment need to be written into the second email template. The replacement attachment here is the reconstructed attachment of the attachment to be reconstructed.
[0100] When the first data and the replacement attachment are processed in combination, the data lines in the mail to be processed need to be read line by line, so as to write the first data and the replacement attachment into the second mail template that meets the business requirements to form a target mail.
[0101] The second email template selection method includes the following two methods: First, if it is determined that the email format of the email to be processed is reused, the email template with the same email format as the email to be processed is selected as the second email template. If it is determined that the email format of the email to be processed is not reused, the email template with the email format meeting the email template usage requirements is selected as the second email template.
[0102] 105. If the currently read data row belongs to the email body data included in the first data or is not selected as the attachment to be rebuilt, write the currently read data row into the target email template, and continue to read the next data row in the email to be processed.
[0103] If the currently read data row belongs to the email body data included in the first data or is not selected as the attachment to be rebuilt, it means that the currently read data row does not need to be changed, and the currently read data row is written into the target email template.
[0104] 106. If the data row currently being read belongs to an attachment to be rebuilt and is the first data row of the attachment to be rebuilt, the data row currently being read is not written into the second email template, and a replacement attachment of the current attachment to be rebuilt is written into the email template; after the replacement attachment of the current attachment to be rebuilt is written, the target data row in the email to be processed continues to be read; wherein, the target data row is the next data row in the email to be processed that is adjacent to the last data row of the current attachment to be rebuilt.
[0105] If the currently read data row belongs to the attachment to be rebuilt and is the first data row of the attachment to be rebuilt, it means that the currently read data row has security risks, so it is no longer written into the second email template, but the replacement attachment corresponding to the attachment to be rebuilt is determined. Then the replacement attachment of the attachment to be rebuilt is written into the second email template.
[0106] After the replacement attachment of the attachment to be rebuilt is completely written into the second mail template, determine whether there is a target data row in the mail to be processed. The target data row here is the next row of data row adjacent to the last row of data row of the current attachment to be rebuilt in the mail to be processed. If there is a target data row, continue to read the target data row. If there is no target data row, it means that there is no data in the attachment to be rebuilt that needs to be continued to be written into the target mail template, so it is determined that the data row reading process is completed and the target mail is formed.
[0107] In some embodiments of the present application, the mail processing method provided in the embodiment of the present application is applied to a network gate as an example to illustrate the mail processing method provided in the embodiment of the present application. Specifically:
[0108] When the network gate receives the email, it saves the content data packet of the email in a landing file. The content data packet here includes all the data in the email, so the landing file contains all the data included in the email. The format and name of the landing file can be determined based on business needs. For example, the landing file is txt, and the landing file corresponding to the email is named "named encode.txt".
[0109] After obtaining the landing file, the content type field in the email header of the email is parsed by parsing the data in the landing file. If the target field is included in the content type field, the email is determined to be an email to be processed. Then, the data in the landing file of the email to be processed is parsed to obtain the boundary identifier, where the boundary identifier is used to locate the position of the attachment in the email to be processed. Then, the attachment data segments included in the email to be processed are determined according to the boundary identifier, wherein each attachment data segment corresponds to an attachment. Based on the file type information included in the determined attachment data segment, the file type of the attachment included in the email to be processed is determined. If it is determined that the email to be processed includes an attachment of the target file type, the attachment of the target file type is determined as an attachment to be rebuilt, and the name of the rebuilt attachment is added to a rebuilt attachment list. This list maintains the correspondence between the email to be processed and the rebuilt attachment.
[0110] If there is a reconstructed attachment in the reconstructed attachment list, the reconstruction function is called to process the attachment to be reconstructed. The reconstruction function here matches the file type of the attachment to be reconstructed and is used to remove the security risk data in the attachment of the matching file type. Then, the data processed by the reconstruction function is determined as the target attachment.
[0111] Check whether there is a reconstructed attachment corresponding to the email to be processed in the reconstructed attachment list. If so, combine the first data in the email to be processed and the target attachment obtained after the reconstruction process. The first data here refers to the data in the email to be processed except the attachment to be reconstructed.
[0112] Furthermore, an embodiment of the present application also provides a network gate that applies the above-mentioned mail processing method.
[0113] The network gate provided in the embodiment of the present application is a security isolation network gate that supports mail access and mail import functions. When the network gate performs mail access or mail import, the mail can be processed by the above-mentioned mail processing method to reduce the probability of the mail carrying security risk data.
[0114] The network gate provided by the embodiment of the present application and applied to the above-mentioned mail processing method clears the security risk data carried in the attachment by reconstructing the attachment, and uses the target attachment obtained after the reconstruction process to generate a target mail for replacing the mail to be processed. In this way, the probability of the target mail carrying the security risk data is low, and after the target mail replaces the mail to be processed, the security problems brought to the mail recipient by the security risk data can be reduced.
[0115] Furthermore, an embodiment of the present application also provides a mail processing device, such as Figure 2 As shown, the mail processing device includes:
[0116] A determination module 21, used to determine the attachment to be reconstructed in the email to be processed;
[0117] A reconstruction module 22, used for performing reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used for removing the security risk data in the attachment to be reconstructed;
[0118] The combining module 23 is used to combine the first data in the mail to be processed and the target attachment obtained after reconstruction to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
[0119] The mail processing device provided in the embodiment of the present application, after determining the mail to be processed, determines the attachment to be reconstructed in the mail to be processed, and reconstructs the attachment to be reconstructed. Then, the data in the mail to be processed except the attachment to be reconstructed and the target attachment obtained after the reconstruction process are combined and processed to form a target mail for replacing the mail to be processed. It can be seen that the scheme provided in the embodiment of the present application takes into account that most of the security risk data will exist in the attachment of the mail, so the security risk data carried in the attachment is cleared by reconstructing the attachment, and the target attachment obtained after the reconstruction process is used to generate a target mail for replacing the mail to be processed. The probability of the target mail carrying security risk data is low. After the target mail replaces the mail to be processed, the security issues brought to the mail recipient by the security risk data can be reduced.
[0120] In some embodiments of the present application, Figure 3 As shown, the determination module 21 includes:
[0121] A first determining unit 211 is used to determine the file type of the attachment included in the email to be processed;
[0122] The second determining unit 212 is configured to determine an attachment of the target file type as the attachment to be reconstructed if it is determined that the file types include a target file type.
[0123] In some embodiments of the present application, Figure 3 As shown, the first determination unit 211 is specifically used to parse the email to be processed to obtain a boundary identifier; wherein the boundary identifier is used to locate the position of the attachment in the email to be processed; the attachment data segments included in the email to be processed are determined according to the boundary identifier; wherein each attachment data segment corresponds to an attachment; based on the file type information included in the determined attachment data segment, the file type of the attachment included in the email to be processed is determined.
[0124] In some embodiments of the present application, Figure 3 As shown, the determination module 21 also includes:
[0125] The sending unit 213 is configured to send the to-be-processed email to a target server if it is determined that the file types do not include the target file type.
[0126] In some embodiments of the present application, Figure 3 As shown, the reconstruction module 22 includes:
[0127] The calling unit 221 is used to call a reconstruction function matching the file type of the attachment to be reconstructed to process the attachment to be reconstructed; wherein the reconstruction function is used to remove the security risk data in the attachment of the matching file type;
[0128] The reconstruction unit 222 is used to determine the data processed by the reconstruction function as the target attachment.
[0129] In some embodiments of the present application, Figure 3 As shown, the reconstruction module 22 includes:
[0130] A third determining unit 223 is used to determine a data extraction item that matches the file type of the attachment to be reconstructed; wherein the data extraction item is used to determine the second data corresponding to the matching file type;
[0131] The deleting unit 224 is used to delete the data in the second data that meets the risk condition of the corresponding data extraction item to obtain the target attachment.
[0132] In some embodiments of the present application, Figure 3 As shown, the combined module 23 includes:
[0133] A setting module 231, used for setting the relative position relationship between the first data and the target attachment in the first email template;
[0134] The writing module 232 is used to write the first data and the target attachment into the first email template based on the relative position relationship.
[0135] In some embodiments of the present application, Figure 3As shown, the combination module 23 is also used to read the data rows in the to-be-processed email line by line; if the data row currently being read belongs to the email body data included in the first data or is not selected as the attachment to be rebuilt, the data row currently being read is written into the second email template, and the next data row in the to-be-processed email is continued to be read; if the data row currently being read belongs to the attachment to be rebuilt and is the first data row of the attachment to be rebuilt, the data row currently being read is not written into the second email template, and the replacement attachment of the current attachment to be rebuilt is written into the second email template; after the replacement attachment of the current attachment to be rebuilt is written, the target data row in the to-be-processed email is continued to be read; wherein the replacement attachment is the reconstructed attachment of the current attachment to be rebuilt; the target data row is the next data row in the to-be-processed email adjacent to the last data row of the current attachment to be rebuilt.
[0136] In some embodiments of the present application, Figure 3 As shown, the mail processing device also includes:
[0137] The selection module 24 is used to parse the content type field in the email header of the email when the email is obtained; if the content type field includes a target field, the email is determined as the email to be processed; wherein the target field is used to describe the existence of attachments in the email.
[0138] In some embodiments of the present application, Figure 3 As shown, the mail processing device also includes:
[0139] The processing module 25 is used to detect whether there is abnormal data in the email body data included in the first data before the combination module 23 combines the first data in the email to be processed and the target attachment obtained after the reconstruction processing; wherein the abnormal data includes security risk links and / or sensitive data; if detected, the abnormal data is matched with the data processing operation based on the data type of the abnormal data.
[0140] In the mail processing device provided in the embodiment of the present application, the detailed description of the method adopted during the operation of each functional module can be referred to the detailed description of the corresponding method in the above method embodiment, which will not be repeated here.
[0141] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, wherein the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above-mentioned mail processing method.
[0142] Furthermore, an embodiment of the present application also provides an electronic device, which includes: a memory for storing a program; and a processor, coupled to the memory, for running the program to execute the above-mentioned mail processing method.
[0143] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0144] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second" and the like in the above embodiments are used to distinguish the embodiments, but do not represent the advantages and disadvantages of the embodiments.
[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0146] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the application described herein, and the description of the above specific language is to disclose the preferred embodiment of the application.
[0147] In addition, the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0148] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0149] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data cutover device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data cutover device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data switching device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data transfer device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0152] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0153] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0154] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0155] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0156] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0157] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A mail processing method, It is characterized in that The method comprises: Determine the attachments to be reconstructed in the pending mails; Performing reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used to remove the security risk data in the attachment to be reconstructed; The first data in the mail to be processed and the target attachment obtained after reconstruction are combined to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
2. The method according to claim 1, It is characterized in that Identify the attachments to be reconstructed in the pending emails, including: Determine the file type of the attachment included in the email to be processed; If it is determined that the file types include the target file type, the attachment of the target file type is determined as the attachment to be reconstructed.
3. The method according to claim 2, It is characterized in that Determining the file type of the attachment included in the email to be processed includes: Parsing the email to be processed to obtain a boundary identifier; wherein the boundary identifier is used to locate the position of the attachment in the email to be processed; Determining the attachment data segments included in the to-be-processed email according to the boundary identifier; wherein each attachment data segment corresponds to an attachment; The file type of the attachment included in the to-be-processed email is determined based on the file type information included in the determined attachment data segment.
4. The method according to claim 2, It is characterized in that The method further comprises: If it is determined that the file types do not include the target file type, the mail to be processed is sent to the target server.
5. The method according to claim 1, It is characterized in that Reconstructing the attachment to be reconstructed includes: Calling a reconstruction function that matches the file type of the attachment to be reconstructed to process the attachment to be reconstructed; wherein the reconstruction function is used to remove security risk data in the attachment of the matching file type; The data processed by the reconstruction function is determined as the target attachment.
6. The method according to claim 1, It is characterized in that Reconstructing the attachment to be reconstructed includes: Determine a data extraction item that matches the file type of the attachment to be reconstructed; wherein the data extraction item is used to determine second data corresponding to the matching file type; The data satisfying the risk condition of the corresponding data extraction item in the second data is deleted to obtain the target attachment.
7. The method according to claim 1, It is characterized in that Combining the first data in the to-be-processed email and the target attachment obtained after the reconstruction process, comprises: Setting the relative position relationship between the first data and the target attachment in the first email template; Based on the relative position relationship, the first data and the target attachment are written into the first email template.
8. The method according to claim 1, It is characterized in that The method further comprises: Reading data lines in the email to be processed line by line; If the currently read data row belongs to the email body data included in the first data or is not selected as the attachment to be rebuilt, write the currently read data row into the second email template, and continue to read the next data row in the email to be processed; If the data row currently being read belongs to the attachment to be rebuilt and is the first data row of the attachment to be rebuilt, the data row currently being read is not written into the second email template, and a replacement attachment of the current attachment to be rebuilt is written into the second email template; after the replacement attachment of the current attachment to be rebuilt is written, the target data row in the email to be processed continues to be read; wherein the replacement attachment is the reconstructed attachment of the current attachment to be rebuilt; the target data row is the next row of data in the email to be processed that is adjacent to the last row of data of the current attachment to be rebuilt.
9. The method according to any one of claims 1 to 8, It is characterized in that Before combining the first data in the to-be-processed email and the target attachment obtained after the reconstruction process, the method further includes: Detecting whether there is abnormal data in the email body data included in the first data; wherein the abnormal data includes security risk links and / or sensitive data; If detected, a matching data processing operation is performed on the abnormal data based on the data type of the abnormal data.
10. The method according to any one of claims 1 to 8, It is characterized in that The method further comprises: When an email is obtained, parsing the content type field in the email header of the email; If the content type field includes a target field, the email is determined as the email to be processed; wherein the target field is used to describe the existence of an attachment in the email.
11. A mail processing device, It is characterized in that The device comprises: A determination module, used for determining the attachment to be reconstructed in the email to be processed; A reconstruction module, used for performing reconstruction processing on the attachment to be reconstructed; wherein the reconstruction processing is used for removing the security risk data in the attachment to be reconstructed; The combination module is used to combine the first data in the mail to be processed and the target attachment obtained after reconstruction to form a target mail for replacing the mail to be processed; wherein the first data is the data in the mail to be processed except the attachment to be reconstructed.
12. A network gatekeeper, It is characterized in that The network gate applies the mail processing method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, It is characterized in that The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the mail processing method according to any one of claims 1 to 10.
14. An electronic device, It is characterized in that The electronic device comprises: Memory, used to store programs; A processor, coupled to the memory, is used to run the program to execute the mail processing method according to any one of claims 1 to 10.
