CN114153796A - File abnormity detection method, device and system - Google Patents

File abnormity detection method, device and system Download PDF

Info

Publication number
CN114153796A
CN114153796A CN202111461919.7A CN202111461919A CN114153796A CN 114153796 A CN114153796 A CN 114153796A CN 202111461919 A CN202111461919 A CN 202111461919A CN 114153796 A CN114153796 A CN 114153796A
Authority
CN
China
Prior art keywords
file
compared
standard
data
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111461919.7A
Other languages
Chinese (zh)
Inventor
李丹丹
姜艳
王志海
李江朋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yinqing Technology Co ltd
Original Assignee
Yinqing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yinqing Technology Co ltd filed Critical Yinqing Technology Co ltd
Priority to CN202111461919.7A priority Critical patent/CN114153796A/en
Publication of CN114153796A publication Critical patent/CN114153796A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files

Abstract

The invention provides a method, a device and a system for detecting file abnormity, wherein the method comprises the following steps: acquiring a file to be compared and a standard file; respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared; the invention can automatically compare the files to be compared with the standard files without manual participation and has low comparison error rate, thereby reducing the labor cost, improving the comparison efficiency and having simple operation.

Description

File abnormity detection method, device and system
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to the technical field of text recognition, and particularly relates to a method, a device and a system for detecting file abnormity.
Background
The existing file abnormity detection mode mainly comprises manual checking and comparison by adopting an application tool. Wherein, the difference points among the files are easily missed during manual checking, and the labor cost is high. In the application of tool comparison, a tester can check files and folders by means of the existing mature file comparison tool, and visually find out the difference between the two files through a tool interface, so that the probability of missing difference points between the files is greatly reduced, and the working efficiency is improved. However, the comparison of the current application tool is generally performed by comparing the comparison file with the standard file line by line, and if the positions do not correspond to each other, the comparison is difficult, which may cause the problems of failed comparison or inaccurate comparison result, and requires the user to adjust the file format to perform the comparison, thereby resulting in a complex operation process.
Disclosure of Invention
One object of the present invention is to provide a file anomaly detection method, which automatically compares a file to be compared with a standard file, does not require human intervention, has a low comparison error rate, reduces labor cost, improves comparison efficiency, and is simple to operate. Another object of the present invention is to provide a document abnormality detection apparatus. It is a further object of this invention to provide a file anomaly detection system. It is a further object of the present invention to provide a computer apparatus. It is a further object of this invention to provide such a readable medium.
In order to achieve the above object, the present invention discloses a file anomaly detection method, including:
acquiring a file to be compared and a standard file;
respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared;
and comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an abnormal detection result.
Preferably, the acquiring the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is an off-line comparison mode, determining storage position information of the file to be compared and the standard file according to the detection instruction;
and acquiring the file to be compared and the standard file according to the storage position information.
Preferably, the acquiring the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is a single online comparison mode, determining partition information of the files to be compared and storage position information of the standard files according to the detection instruction;
and acquiring the file to be compared according to the partition information, and acquiring the standard file according to the storage position information.
Preferably, the acquiring the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is a double-online comparison mode, determining partition information of the file to be compared and the standard file according to the detection instruction;
and acquiring the file to be compared and the standard file according to the partition information.
Preferably, the partition information includes an IP address and an access password.
Preferably, the extracting the to-be-compared file and the standard file according to a preset analysis rule to obtain the to-be-compared layered file and the standard layered file specifically includes:
determining all keywords, starting marks and ending marks according to a preset analysis rule;
identifying keywords in the file to be compared and the standard file according to all the keywords, and acquiring data to be compared corresponding to the keywords according to a starting mark and an ending mark corresponding to the keywords, wherein each keyword and corresponding data to be compared form layer data;
and forming multilayer data of the file to be compared and the standard file according to the layer data of all the keywords of the file to be compared and the standard file.
Preferably, the keyword is a function name of a function, the start mark is a start symbol of the function, and the end mark is an end symbol of the function;
the obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
identifying the function name in the file to be compared and the standard file and the initial character and the end character after the function name;
and acquiring all data between the starting character and the ending character to obtain the data to be compared corresponding to the function name.
Preferably, the keyword is a line number, the start mark is a first character after the line number, and the end mark is a separator;
the obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
identifying the row number of the keywords in the file to be compared and the standard file and a first character and a separator after the row number;
and acquiring all data between the first character and the separator after the line number to obtain the data to be compared corresponding to the line number.
Preferably, the comparing the layered file to be compared with the data to be compared in the layer corresponding to the keyword in the standard layered file to obtain the anomaly detection result specifically includes:
and comparing the layered file to be compared with the data to be compared of the corresponding layer of the keywords in the standard layered file by a text comparison method to obtain an abnormal detection result.
Preferably, the method further comprises the step of pre-forming the preset analysis rule:
determining keywords, a starting mark and an ending mark of abnormal detection according to a detection instruction of a user;
and forming the preset analysis rule according to the keywords, the starting mark and the ending mark.
The invention also discloses a file abnormity detection device, which comprises:
the file acquisition module is used for acquiring a file to be compared and a standard file;
the file comparison module is used for respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared;
and the anomaly detection module is used for comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an anomaly detection result.
The invention also discloses a file abnormity detection system, which comprises a user terminal and a file abnormity detection device;
the user terminal is used for forming a detection instruction based on the operation of a user;
the anomaly detection device is used for acquiring a file to be compared and a standard file based on the detection instruction; the file comparison module is used for respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared; and the anomaly detection module is used for comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an anomaly detection result.
The invention also discloses a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method as described above.
The invention also discloses a computer-readable medium, having stored thereon a computer program,
which when executed by a processor implements the method as described above.
The file abnormity detection method comprises the steps of obtaining a file to be compared and a standard file, respectively extracting the file to be compared and the standard file according to a preset analysis rule to obtain a layered file to be compared and the standard layered file, wherein the layered file to be compared and the standard layered file comprise multiple layers of data, each layer of data comprises keywords and data to be compared, and comparing the layered file to be compared and the data to be compared of the layer corresponding to the keywords in the standard layered file to obtain an abnormity detection result. Therefore, according to the invention, the files to be compared and the standard files are firstly subjected to data extraction through the preset analysis rule to obtain the layered files to be compared and the standard layered files, the files to be compared and the standard files are analyzed into a multi-layer data form, and then layer data corresponding to the files to be compared and the standard files are analyzed and compared to obtain the abnormal detection result. Therefore, the method and the device automatically compare the file to be compared with the standard file, do not need manual participation, have low comparison error rate, reduce labor cost, improve comparison efficiency and have simple operation.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a file anomaly detection system according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a particular embodiment of a file anomaly detection method of the present invention;
FIG. 3 is a flowchart of a file anomaly detection method S100 according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating another exemplary embodiment of a file anomaly detection method according to the present invention;
FIG. 5 is a flow chart illustrating a method for file anomaly detection in accordance with yet another embodiment of the present invention;
FIG. 6 is a flowchart of a specific embodiment S200 of the file anomaly detection method according to the present invention;
FIG. 7 is a block diagram illustrating an exemplary embodiment of a document abnormality detection apparatus according to the present invention;
FIG. 8 shows a schematic block diagram of a computer device suitable for use in implementing embodiments of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The common configuration file formats at present are: the method comprises the following steps of performing properties, ini, hoc, json, xml, yaml, profile and the like, wherein files json, yaml and xml in standard formats are common in mature open source software, checking of the files is frequently involved in daily work, and whether the files are abnormal or not is checked, such as static checking, environment checking and the like, and file comparison is required.
The existing file abnormity detection mode mainly comprises manual checking and comparison by adopting an application tool. The manual check is suitable for the condition that the content of the file is less or the format is more standard, and a tester can easily and intuitively find the difference between the two files and quickly position the difference point. When the content of the document is more, the difficulty of finding the difference points of the document is increased, and the difference points between the documents are easy to miss when the comparison is carried out due to the fact that a person easily makes mistakes, time pressure and the influence of the external environment are added. If the tedious work with high repeatability is completed by people, the testers cannot release more energy to input other more important testing work, the labor cost is high, and the resource utilization is low and the efficiency is low. In the application of tool comparison, a tester can check files and folders by means of the existing mature file comparison tool, and visually find out the difference between the two files through a tool interface, so that the probability of missing difference points between the files is greatly reduced, and the working efficiency is improved. At present, common file comparison tools such as WinMerge, Meld and the like have visual characteristics, so that file comparison is simple and easy, but the software generally compares file contents line by line, and is often ineffective when a certain section of content in a line needs to be compared, and the stability of the software is poor, so that the problems of code disorder, coding and the like are easy to occur.
In addition, document comparison often involved in daily work, such as the need for operation and maintenance personnel to periodically calibrate the existing system environment during daily work, the need for test personnel to perform static inspection on the environment configuration during integration test, and the like. The traditional file comparison method mainly comprises the steps of manually checking or checking file differences with the help of a comparison tool, and manually recording difference points into a document (such as excel) for supporting subsequent statistical work. Taking environmental calibration as an example, when the environment requiring calibration is more or the frequency of calibration work is higher, file differences are checked only by manual checking or by means of a tool, so that the efficiency is low, errors are prone to occur, and the method is not suitable for the situation. In summary, the comparison of the current application tool is generally performed by comparing the comparison file with the standard file line by line, and if the positions do not correspond to each other, the comparison is difficult, which may cause the problems of failed comparison or inaccurate comparison result, and the user needs to adjust the file format to perform the comparison again, which results in a complex operation process.
Based on the problems in the prior art, in order to solve at least one of the problems in the prior art, the invention firstly extracts data of the file to be compared and the standard file through a preset analysis rule to obtain a layered file to be compared and a standard layered file, analyzes the file to be compared and the standard file into a multi-layer data form, and then analyzes layer data corresponding to the file to be compared and the standard file to obtain an abnormal detection result. Therefore, the method and the device automatically compare the file to be compared with the standard file, do not need manual participation, have low comparison error rate, reduce labor cost, improve comparison efficiency and have simple operation.
In order to facilitate understanding of the technical solutions provided in the present application, the following first describes relevant contents of the technical solutions in the present application. According to the file anomaly detection method provided by the embodiment of the invention, the file to be compared and the standard file are respectively extracted according to a preset analysis rule to obtain a layered file to be compared and a standard layered file, wherein the layered file to be compared and the standard layered file comprise multiple layers of data, the layer data of each layer comprises keywords and the data to be compared, and the data to be compared of the layers corresponding to the keywords in the layered file to be compared and the standard layered file are compared to obtain an anomaly detection result.
Fig. 1 is a schematic structural diagram of a file abnormality detection system according to an embodiment of the present invention, and as shown in fig. 1, the file abnormality detection system according to the embodiment of the present invention includes a user terminal 1 and a file abnormality detection device 2.
Wherein, the user terminal 1 can form a detection instruction based on the operation of the user and transmit the detection instruction to the file abnormality detection device 2.
The file abnormity detection device 2 can obtain a file to be compared and a standard file according to the detection instruction; respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared; and comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an abnormal detection result.
It should be noted that, in this embodiment, the file abnormality detection device 2 may obtain the file to be compared and the standard file according to the detection instruction, and compare the file to be compared and the standard file to obtain the abnormality detection result, and may also start at regular time or directly start to obtain the file to be compared and the standard file to obtain the abnormality detection result, which is not limited in the present invention.
The following describes an implementation process of the file anomaly detection method provided by the embodiment of the present invention, taking a file anomaly detection apparatus as an execution subject. It can be understood that the executing subject of the file abnormality detection method provided by the embodiment of the invention includes, but is not limited to, the file abnormality detection device.
According to one aspect of the invention, the embodiment discloses a file abnormality detection method. As shown in fig. 2, in this embodiment, the method includes:
s100: acquiring a file to be compared and a standard file;
s200: respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared;
s300: and comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an abnormal detection result.
The file abnormity detection method comprises the steps of obtaining a file to be compared and a standard file, respectively extracting the file to be compared and the standard file according to a preset analysis rule to obtain a layered file to be compared and the standard layered file, wherein the layered file to be compared and the standard layered file comprise multiple layers of data, each layer of data comprises keywords and data to be compared, and comparing the layered file to be compared and the data to be compared of the layer corresponding to the keywords in the standard layered file to obtain an abnormity detection result. Therefore, according to the invention, the files to be compared and the standard files are firstly subjected to data extraction through the preset analysis rule to obtain the layered files to be compared and the standard layered files, the files to be compared and the standard files are analyzed into a multi-layer data form, and then layer data corresponding to the files to be compared and the standard files are analyzed and compared to obtain the abnormal detection result. Therefore, the method and the device automatically compare the file to be compared with the standard file, do not need manual participation, have low comparison error rate, reduce labor cost, improve comparison efficiency and have simple operation.
In an optional embodiment, as shown in fig. 3, the step S100 of acquiring the to-be-compared file and the standard file specifically includes:
s111: the detection mode is determined based on a detection instruction of a user.
S112: and if the detection mode is an off-line comparison mode, determining the storage position information of the file to be compared and the standard file according to the detection instruction.
S113: and acquiring the file to be compared and the standard file according to the storage position information.
It is understood that, in this alternative embodiment, the file anomaly detection method supports an offline comparison mode, and can perform direct comparison on a local file or folder. Specifically, the user terminal 1 may form a detection instruction based on an operation of selecting offline comparison by the user, and send the detection instruction to the file abnormality detection device 2. The file abnormity detection device 2 receives the detection instruction and analyzes the detection instruction to obtain an offline comparison mode designated by a user, so that the storage position information of the file to be compared and the standard file is further analyzed from the detection instruction. And obtaining the file to be compared and the standard file according to the storage position information of the file to be compared and the standard file obtained by analysis, and carrying out anomaly detection to obtain an anomaly detection result.
Optionally, the storage location information may be addresses of folders for storing the files to be compared and the standard files, folder addresses corresponding to the files to be compared and the standard files are accessed, and the files to be compared and the standard files are obtained according to file information such as names of the files to be compared and the standard files.
In another optional embodiment, as shown in fig. 4, the step S100 of acquiring the to-be-compared file and the standard file specifically includes:
s121: the detection mode is determined based on a detection instruction of a user.
S122: and if the detection mode is a single online comparison mode, determining partition information of the files to be compared and storage position information of the standard files according to the detection instruction.
S123: and acquiring the file to be compared according to the partition information, and acquiring the standard file according to the storage position information.
It can be understood that, in this optional embodiment, the file anomaly detection method supports a single online comparison mode in which only the files to be compared are acquired online, and the files to be compared can be acquired from the network address and compared with the locally stored standard file to obtain an anomaly detection result. The scene mainly applied to the single online comparison mode can be a scene that operation and maintenance personnel need to regularly calibrate the existing environment in daily work, and test personnel carry out static inspection on environment configuration in integrated test. Specifically, the user terminal 1 may form a detection instruction based on an operation of selecting the single online comparison mode by the user, and send the detection instruction to the file abnormality detection apparatus 2. The file abnormity detection device 2 receives the detection instruction and analyzes the detection instruction to obtain a single online comparison mode designated by a user, so that the partition information of the file to be compared is further analyzed from the detection instruction, and the storage position information of the standard file is analyzed from the detection instruction. And acquiring the file to be compared on line according to the partition information of the file to be compared obtained through analysis, acquiring the standard file according to the storage position information of the standard file, and performing anomaly detection on the file to be compared and the standard file to obtain an anomaly detection result.
Optionally, the storage location information may be an address of a folder for storing the standard file, an address of a folder corresponding to the access standard file, and the standard file is obtained according to file information such as a name of the standard file. The partition information can comprise an IP address and an access password, the storage network position of the file to be compared is accessed according to the IP address, and the corresponding file to be compared is extracted according to the access password.
In yet another optional embodiment, as shown in fig. 5, the step S100 of acquiring the to-be-compared file and the standard file specifically includes:
s131: the detection mode is determined based on a detection instruction of a user.
S132: and if the detection mode is a double-online comparison mode, determining partition information of the file to be compared and the standard file according to the detection instruction.
S133: and acquiring the file to be compared and the standard file according to the partition information.
It can be understood that, in this optional embodiment, the file anomaly detection method supports a dual online comparison mode in which the to-be-compared file and the standard file are obtained online, and the to-be-compared file and the standard file can be obtained from the network address and compared to obtain an anomaly detection result. Specifically, the user terminal 1 may form a detection instruction based on an operation in which the user selects the dual online comparison mode, and send the detection instruction to the file abnormality detection apparatus 2. The file abnormity detection device 2 receives the detection instruction and analyzes the detection instruction to obtain a dual-online comparison mode designated by a user, so that partition information of the file to be compared and the standard file is further analyzed from the detection instruction. And acquiring the file to be compared and the standard file on line according to the partition information of the file to be compared and the standard file obtained by analysis, and performing anomaly detection on the file to be compared and the standard file to obtain an anomaly detection result.
Optionally, the partition information may include an IP address and an access password, the storage network location of the file to be compared is accessed according to the IP address in the partition information of the file to be compared, and the corresponding file to be compared is extracted according to the access password. And similarly, accessing the storage network position of the file to be compared according to the IP address in the partition information of the standard file, and extracting the corresponding file to be compared according to the access password.
In a preferred embodiment, as shown in fig. 6, the step S200 of respectively extracting the to-be-compared file and the standard file according to a preset analysis rule to obtain a to-be-compared layered file and a standard layered file specifically includes:
s210: and determining all keywords, the starting marks and the ending marks according to a preset analysis rule.
S220: and identifying keywords in the file to be compared and the standard file according to all the keywords, and acquiring data to be compared corresponding to the keywords according to a starting mark and an ending mark corresponding to the keywords, wherein each keyword and corresponding data to be compared form layer data.
S230: and forming multilayer data of the file to be compared and the standard file according to the layer data of all the keywords of the file to be compared and the standard file.
It will be appreciated that in a typical system file, where data blocks in a class have the same attributes, such data may include one or more lines of data, such that a key, start tag, and end tag identifying the data may be determined based on the attributes of the data itself, for identifying a segment of the data. Thus, the preset analysis rule includes a keyword, a start flag, and an end flag. The key words can uniquely mark a segment of data, and the range of the segment of data can be determined according to the starting mark and the ending mark corresponding to the key words. And intercepting the keywords, and then obtaining the data to be compared, wherein the data between the initial mark and the end mark is all data corresponding to the keywords. And respectively extracting data of the file to be compared and the standard file according to the keywords and the corresponding starting marks and ending marks to obtain data to be compared corresponding to the keywords, and dividing the keywords and the data to be compared into the same layer of data. Therefore, the files to be compared and the standard files can form the layered files to be compared and the standard layered files after being processed by the preset analysis rules, wherein the layered files to be compared and the standard layered files comprise multilayer data, each layer of data comprises keywords and the data to be compared, and the layer of data can be marked through the keywords. Compared with the traditional abnormity detection method of comparing by line and comparing by byte, the method has the advantages that the files to be compared and the standard files are layered and then are respectively compared by the keywords, the initial mark and the end mark of the preset analysis rule, corresponding data can be compared more finely, a user can conveniently check difference points among the files, and the problem of comparison failure possibly caused by wrong line comparison is prevented.
In an alternative embodiment, the key is a function name of a function, the start flag is a start symbol of the function, and the end flag is an end symbol of the function.
The obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
s201: and identifying the function name in the file to be compared and the standard file and the start character and the end character after the function name.
S202: and acquiring all data between the starting character and the ending character to obtain the data to be compared corresponding to the function name.
It will be appreciated that for a program script file, a plurality of functions are provided in the script, each function being provided with a function name, such that the function name can be used as a key, and the start symbol of the first symbol and the end symbol of the last symbol of the function can be used as a start symbol and an end symbol, respectively, to mark the data range of the function. Therefore, the function name in the file to be compared and the standard file and the start character and the end character after the function name can be identified, and all data between the start character and the end character are obtained to obtain the data to be compared corresponding to the function name.
In another alternative embodiment, the keyword is a line number, the start flag is the first character after the line number, and the end flag is a separator.
The obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
s203: and identifying the line number of the key words in the file to be compared and the standard file, and the first character and the separator after the line number.
S204: and acquiring all data between the first character and the separator after the line number to obtain the data to be compared corresponding to the line number.
It will be appreciated that for a normal profile, there may not be a data block formed of multiple rows of data, and separate alignment of each row is required. Each row of data is usually provided with a row number, so that the row number can be used as a key word, and a first character symbol and a separator after the row number can be respectively used as a starting symbol and an ending symbol to mark a data range of one row of data. The separator may be a symbol such as a semicolon or a carriage return symbol. Therefore, the row number of the key words in the file to be compared and the standard file can be identified, the first character and the separator after the row number can be identified, and all data between the first character and the separator after the row number can be obtained to obtain the data to be compared corresponding to the row number.
In an optional embodiment, in the process of comparing the to-be-compared data of the layers corresponding to the keywords in the to-be-compared hierarchical file and the standard hierarchical file to obtain the anomaly detection result, the to-be-compared data of the layers corresponding to the keywords in the to-be-compared hierarchical file and the standard hierarchical file may be compared by a text comparison method to obtain the anomaly detection result. In other embodiments, the data comparison may be implemented in other manners, which is not limited in the present invention.
In a preferred embodiment, the method further comprises the step of pre-forming the preset analysis rule:
s010: and determining keywords, a starting mark and an ending mark of abnormal detection according to the detection instruction of the user.
S020: and forming the preset analysis rule according to the keywords, the starting mark and the ending mark.
It can be understood that the existing comparison application tool can only perform file comparison according to a given program, and has poor flexibility, and the comparison result is often not satisfactory for users. In the preferred embodiment, the keyword, the start flag, and the end flag of the anomaly detection may be determined according to a detection instruction of a user, and then a preset analysis rule may be formed. Therefore, in the preferred embodiment, the user is supported to form the corresponding preset analysis rule in a mode of detecting the instruction, so that the user can customize the preset analysis rule, the personalized comparison requirement of the user on the file comparison is met, and the flexibility is high.
In a preferred embodiment, the method further comprises feeding back the anomaly detection result to a user. Specifically, according to the abnormal detection result of the file, data such as a consistent item, a difference item, a consistent rate and the like between the file to be compared and the standard file can be obtained, so that an abnormal detection report is formed, and the purpose of feeding back the abnormal detection result to the user can be achieved by sending the abnormal detection report to the user. For the problems that the quantity of the files to be compared is large, and the difference points among the files are difficult to count manually, the file comparison condition can be better, faster and more intuitively known through the report.
In conclusion, the method can be used for comparing two files or folders in daily work, manual comparison is not needed, the labor cost is reduced, operation and maintenance personnel can perform daily maintenance on the test environment, the difference of the test environment in the formal environment can be mastered in time, the consistency of the test environment and the formal environment is ensured, and the normal operation of the system is ensured; the system can also be used for static inspection of the current integrated environment by testers during the integrated test, so that the missing report of the difference caused by human factors is reduced, and the failure probability caused by the integration error when the system is formally on line is reduced; meanwhile, the invention also supports personalized customization of the preset analysis rule through the detection instruction according to the actual comparison requirement, and supports comparison of various types of files.
Based on the same principle, the embodiment also discloses a file abnormity detection device. As shown in fig. 7, in this embodiment, the apparatus includes a file obtaining module 11, a file comparing module 12, and an anomaly detecting module 13.
The file obtaining module 11 is configured to obtain a file to be compared and a standard file.
The file comparison module 12 is configured to extract the to-be-compared file and the standard file according to a preset analysis rule to obtain a to-be-compared layered file and a standard layered file, where the to-be-compared layered file and the standard layered file include multiple layers of data, and each layer of data includes a keyword and data to be compared.
The anomaly detection module 13 is configured to compare the layered file to be compared with the data to be compared in the layer corresponding to the keyword in the standard layered file to obtain an anomaly detection result.
In an optional embodiment, the file obtaining module 11 is specifically configured to determine a detection mode based on a detection instruction of a user; if the detection mode is an off-line comparison mode, determining storage position information of the file to be compared and the standard file according to the detection instruction; and acquiring the file to be compared and the standard file according to the storage position information.
In another optional embodiment, the file obtaining module 11 is specifically configured to determine a detection mode based on a detection instruction of a user; if the detection mode is a single online comparison mode, determining partition information of the files to be compared and storage position information of the standard files according to the detection instruction; and acquiring the file to be compared according to the partition information, and acquiring the standard file according to the storage position information.
In yet another optional embodiment, the file obtaining module 11 is specifically configured to determine a detection mode based on a detection instruction of a user; if the detection mode is a double-online comparison mode, determining partition information of the file to be compared and the standard file according to the detection instruction; and acquiring the file to be compared and the standard file according to the partition information.
In a preferred embodiment, the partition information includes an IP address and an access password.
In a preferred embodiment, the file comparison module 12 is specifically configured to determine all keywords, start marks, and end marks according to a preset analysis rule; identifying keywords in the file to be compared and the standard file according to all the keywords, and acquiring data to be compared corresponding to the keywords according to a starting mark and an ending mark corresponding to the keywords, wherein each keyword and corresponding data to be compared form layer data; and forming multilayer data of the file to be compared and the standard file according to the layer data of all the keywords of the file to be compared and the standard file.
In a preferred embodiment, the keyword is a function name of a function, the start flag is a start symbol of the function, and the end flag is an end symbol of the function; the file comparison module 12 is specifically configured to identify a function name and a start and end symbol after the function name in the file to be compared and the standard file; and acquiring all data between the starting character and the ending character to obtain the data to be compared corresponding to the function name.
In a preferred embodiment, the keyword is a line number, the start mark is the first character after the line number, and the end mark is a separator; the file comparison module 12 is specifically configured to identify the row number of the keyword in the file to be compared and the standard file, and a first character and a separator after the row number; and acquiring all data between the first character and the separator after the line number to obtain the data to be compared corresponding to the line number.
In a preferred embodiment, the anomaly detection module 13 is specifically configured to compare the layered file to be compared with the data to be compared in the layer corresponding to the keyword in the standard layered file by using a text comparison method to obtain an anomaly detection result.
In a preferred embodiment, the anomaly detection module 13 is further configured to pre-form the preset analysis rule, and determine a keyword, a start flag, and an end flag of anomaly detection according to a detection instruction of a user; and forming the preset analysis rule according to the keywords, the starting mark and the ending mark.
Since the principle of solving the problem by the server is similar to the above method, the implementation of the server may refer to the implementation of the method, and is not described herein again.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
In a typical example, the computer device specifically comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method performed by the client as described above when executing the program, or the processor implementing the method performed by the server as described above when executing the program.
Referring now to FIG. 8, shown is a schematic diagram of a computer device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 8, the computer apparatus 600 includes a Central Processing Unit (CPU)601 which can perform various appropriate works and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM)) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output section 607 including a Cathode Ray Tube (CRT), a liquid crystal feedback (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 606 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (14)

1. A file abnormality detection method is characterized by comprising the following steps:
acquiring a file to be compared and a standard file;
respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared;
and comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an abnormal detection result.
2. The method for detecting file anomalies according to claim 1, wherein the obtaining of the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is an off-line comparison mode, determining storage position information of the file to be compared and the standard file according to the detection instruction;
and acquiring the file to be compared and the standard file according to the storage position information.
3. The method for detecting file anomalies according to claim 1, wherein the obtaining of the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is a single online comparison mode, determining partition information of the files to be compared and storage position information of the standard files according to the detection instruction;
and acquiring the file to be compared according to the partition information, and acquiring the standard file according to the storage position information.
4. The method for detecting file anomalies according to claim 1, wherein the obtaining of the file to be compared and the standard file specifically includes:
determining a detection mode based on a detection instruction of a user;
if the detection mode is a double-online comparison mode, determining partition information of the file to be compared and the standard file according to the detection instruction;
and acquiring the file to be compared and the standard file according to the partition information.
5. The file abnormality detection method according to claim 3 or 4, characterized in that said partition information includes an IP address and an access password.
6. The method for detecting file anomalies according to claim 1, wherein the extracting the to-be-compared file and the standard file respectively according to a preset analysis rule to obtain a to-be-compared layered file and a standard layered file specifically includes:
determining all keywords, starting marks and ending marks according to a preset analysis rule;
identifying keywords in the file to be compared and the standard file according to all the keywords, and acquiring data to be compared corresponding to the keywords according to a starting mark and an ending mark corresponding to the keywords, wherein each keyword and corresponding data to be compared form layer data;
and forming multilayer data of the file to be compared and the standard file according to the layer data of all the keywords of the file to be compared and the standard file.
7. The file abnormality detection method according to claim 6, characterized in that said keyword is a function name of a function, said start flag is a start symbol of said function, and said end flag is an end symbol of said function;
the obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
identifying the function name in the file to be compared and the standard file and the initial character and the end character after the function name;
and acquiring all data between the starting character and the ending character to obtain the data to be compared corresponding to the function name.
8. The file abnormality detection method according to claim 6, characterized in that said keyword is a line number, said start flag is the first character after said line number, and said end flag is a separator;
the obtaining of the data to be compared corresponding to the keyword according to the start mark and the end mark corresponding to the keyword specifically includes:
identifying the row number of the keywords in the file to be compared and the standard file and a first character and a separator after the row number;
and acquiring all data between the first character and the separator after the line number to obtain the data to be compared corresponding to the line number.
9. The method for detecting file anomalies according to claim 1, wherein comparing the hierarchical file to be compared with the hierarchical file to be compared in the standard hierarchical file to obtain anomaly detection results specifically includes:
and comparing the layered file to be compared with the data to be compared of the corresponding layer of the keywords in the standard layered file by a text comparison method to obtain an abnormal detection result.
10. The file abnormality detection method according to claim 1, further comprising a step of previously forming the preset analysis rule:
determining keywords, a starting mark and an ending mark of abnormal detection according to a detection instruction of a user;
and forming the preset analysis rule according to the keywords, the starting mark and the ending mark.
11. A document abnormality detection apparatus, characterized by comprising:
the file acquisition module is used for acquiring a file to be compared and a standard file;
the file comparison module is used for respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared;
and the anomaly detection module is used for comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an anomaly detection result.
12. A file abnormity detection system is characterized by comprising a user terminal and a file abnormity detection device;
the user terminal is used for forming a detection instruction based on the operation of a user;
the anomaly detection device is used for acquiring a file to be compared and a standard file based on the detection instruction; the file comparison module is used for respectively extracting the files to be compared and the standard files according to preset analysis rules to obtain layered files to be compared and standard layered files, wherein the layered files to be compared and the standard layered files comprise multilayer data, and the layer data of each layer comprises keywords and the data to be compared; and the anomaly detection module is used for comparing the layered file to be compared with the data to be compared of the key word corresponding layer in the standard layered file to obtain an anomaly detection result.
13. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method of any of claims 1-10.
14. A computer-readable medium, having stored thereon a computer program,
the program when executed by a processor implementing the method according to any one of claims 1-10.
CN202111461919.7A 2021-12-02 2021-12-02 File abnormity detection method, device and system Pending CN114153796A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111461919.7A CN114153796A (en) 2021-12-02 2021-12-02 File abnormity detection method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111461919.7A CN114153796A (en) 2021-12-02 2021-12-02 File abnormity detection method, device and system

Publications (1)

Publication Number Publication Date
CN114153796A true CN114153796A (en) 2022-03-08

Family

ID=80455971

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111461919.7A Pending CN114153796A (en) 2021-12-02 2021-12-02 File abnormity detection method, device and system

Country Status (1)

Country Link
CN (1) CN114153796A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114889352A (en) * 2022-05-09 2022-08-12 西安热工研究院有限公司 Construction file management method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114889352A (en) * 2022-05-09 2022-08-12 西安热工研究院有限公司 Construction file management method, device, equipment and medium

Similar Documents

Publication Publication Date Title
US10885000B2 (en) Repairing corrupted references
US10878121B2 (en) Method and device for converting data containing user identity
US20130174126A1 (en) Automated testing of programming code for a web service
CN108958959B (en) Method and device for detecting hive data table
CN110851308A (en) Test method, test device, electronic equipment and storage medium
CN110389941B (en) Database checking method, device, equipment and storage medium
CN110990276A (en) Automatic testing method and device for interface field and storage medium
CN114153796A (en) File abnormity detection method, device and system
CN116089258A (en) Data migration test method, device, equipment, storage medium and program product
CN111447299A (en) DNS analysis method and system based on test environment standing book
CN108809896A (en) A kind of information calibration method, device and electronic equipment
CN113221036B (en) Method and device for processing electronic bill mail
CN112612706A (en) Automated testing method, computer device and storage medium
CN112287027B (en) Database synchronization method, device, equipment and storage medium
US11212170B1 (en) Service provider network application testing with standards references
CN114676054A (en) Test data generation method, device, equipment, medium and product
US9830215B1 (en) Computing system error analysis based on system dump data
CN113238940A (en) Interface test result comparison method, device, equipment and storage medium
WO2020215542A1 (en) Information notification method and device, computer apparatus, and storage medium
US8538995B2 (en) Device and method for automatically detecting an unclear description
CN107196789B (en) Method and device for checking base station parameters
CN111858299B (en) Automatic difference analysis and verification method
CN108509328B (en) Database checking method and device
CN113986899A (en) Data quality inspection method, storage medium, and system
CN114461724A (en) Data synchronization comparison method, device and system based on random sampling

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination