CN109145675A - A kind of nested type two dimensional code attack double check method and system - Google Patents

A kind of nested type two dimensional code attack double check method and system Download PDF

Info

Publication number
CN109145675A
CN109145675A CN201810690963.7A CN201810690963A CN109145675A CN 109145675 A CN109145675 A CN 109145675A CN 201810690963 A CN201810690963 A CN 201810690963A CN 109145675 A CN109145675 A CN 109145675A
Authority
CN
China
Prior art keywords
code
dimensional code
image
maximum number
detection
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.)
Granted
Application number
CN201810690963.7A
Other languages
Chinese (zh)
Other versions
CN109145675B (en
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.)
China University of Geosciences
Original Assignee
China University of Geosciences
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 China University of Geosciences filed Critical China University of Geosciences
Priority to CN201810690963.7A priority Critical patent/CN109145675B/en
Publication of CN109145675A publication Critical patent/CN109145675A/en
Application granted granted Critical
Publication of CN109145675B publication Critical patent/CN109145675B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • G06K19/06075Constructional details the marking containing means for error correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps
    • G06K7/1473Methods for optical code recognition the method including quality enhancement steps error correction

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The present invention provides a kind of nested type two dimensional code attack double check method and system, and method specifically includes three steps, is scanned first to image in 2 D code to be detected;System carries out conventional detection to the image in 2 D code of scanning, obtain two dimensional code finger URL number in the image, the finger URL number that system will acquire is compared with normal value, if it is greater than normal value, then determine two dimensional code exception, other two dimensional codes are embedded in warning user's image in 2 D code, otherwise, into depth detection;Depth detection module carries out depth scan to image, obtains finger URL quantative attribute again, and be compared with normal value by the recognition parameter of modification finger URL probe function.By the above-mentioned means, the present invention can warn whether the two-dimension code area of user's Current Scan is embedded in other two dimensional codes, effectively enhance the safety of two-dimensional code scanning link, provides a kind of new detection method for the design of two dimensional code identification software.

Description

A kind of nested type two dimensional code attack double check method and system
Technical field
The present invention relates to attack detecting field, it is specifically related to a kind of nested type two dimensional code attack double check method and is System.
Background technique
Planar bar code technology is as a kind of novel information storage technology, with information density is high, robustness is good, fault-tolerance By force, the features such as manufacturing cost is low.In recent years, using two dimensional code as the Information Mobile Service of medium, people's daily life is incorporated extensively Multiple fields, while bringing convenient to Working Life, also potential many safety problems and hidden danger.
In CCS international conference in 2016, Adrain etc. proposes a kind of novel attack means for two dimensional code " Barcode-in-Barcode Attacks ", can literal translate are as follows: " code is attacked in code ", the basic principle of this attack means is: An other two dimensional code is embedded in original image in 2 D code region, forms nested type two dimensional code, causes different user scanning same It opens image in 2 D code and is likely to be obtained different recognition results.
Under present condition, relatively extensively, technical characterstic is also being constantly updated for two dimensional code application, and improve and perfect decodes plan Slightly there is still a need for longer-term processes;Secondly, the solution for reducing serious forgiveness usually influences whether the decoding performance of two dimensional code.Cause This, improves decoding performance using tradition or improves the technical method of error correcting capability, it is difficult to successfully manage two dimensional code nested type and attack Problem is hit, there is no effective technical solution and control measures so far in statistical literature.
In conclusion the present invention carries out nested type two dimensional code (QRinQR) attack detecting research, with important theory with Practical significance.The present invention, can be during user's two-dimensional code scanning, to embedding by improving the decoding process based on the library ZXing Shell type two dimensional code (QRinQR) attack carries out double check, and whether the warning original two-dimension code area of user is embedded into other two dimensions Code has and is applicable in a variety of decoding policies, is not required to the characteristics of reducing serious forgiveness.
Summary of the invention
The technical problem to be solved in the present invention is that being provided for the deficiency of above-mentioned existing two dimensional code detection technique at present A kind of nested type two dimensional code attack double check method and system, can be during scanning input two dimensional code, to nested type two It ties up code attack and carries out double check, whether the warning original two-dimension code area of user is embedded into other two dimensional codes.
A kind of nested type two dimensional code attacks double check method, which is characterized in that specifically include the following three steps:
Step 1: user enters nested type two dimensional code attack detecting main interface, is scanned to image in 2 D code to be detected;
Step 2: conventional detection being carried out to the image in 2 D code of scanning, obtains two dimensional code finger URL in the image in 2 D code Number, the finger URL number of acquisition is compared with predetermined normal level, if the finger URL number obtained is greater than predetermined normal level, Determine that the two dimensional code is improper two dimensional code, warns in user's image in 2 D code and be embedded in other two dimensional codes, otherwise, into step Rapid 3 carry out depth detection;
Step 3: the recognition parameter of modification finger URL probe function carries out depth detection to image in 2 D code, obtains again Finger URL number, and be compared with normal value, if obtaining finger URL number again is greater than predetermined normal level, determine the two dimension Code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensional codes, otherwise, it is determined that when this two dimensional code just Normal two dimensional code.
Further, the conventional detection is completed using open source bar code ZXing packet.
Further, two dimensional code decoding process in open source bar code ZXing packet is improved, using the two dimensional code after improvement Decoding process completes the depth scan, and the detailed process of the two dimensional code decoding process after improvement is as follows:
(1) modification parsing figure finds the class of characteristic point, detects the maximum number variable of figure in such middle point of addition, The position sensing figure number detected, i.e. finger URL number are recorded, chooses the maximum for obtaining position sensing figure inside it In the function of number, the anchor point number that will test out assigns the maximum number variable of position sensing figure, to detected Finger URL is screened, and obtains three that are best suitable for coding rule requirement, the maximum number letter of addition return position detection figure The maximum number variable of position sensing figure for counting and returning;
(2) class of modification processing detection result, point of addition detect maximum number variable, the constructed fuction of figure, and Point of addition detects the get accessor of the maximum number variable of figure;
(3) in detection class, point of addition detects the maximum number variable of figure, is parsed from internal detection function Then the maximum number variable of position sensing figure in figure class object modifies the return statement of image information acquisition function, Return to the maximum number for obtaining position sensing figure;
(4) in the coding/decoding method in barcode scanning class, the maximum number of the position sensing figure in parsing result object is obtained Variable, and it is used for construction result object;
(5) it is returned from the decoding operate function call in capture activity class to the maximum number variable of position sensing figure This module activities is adjusted back, and is compared with normal value, nested two dimensional code is judged whether it is.
A kind of nested type two dimensional code attack double check system, which is characterized in that including following three modules:
Response Code scan module: enter nested type two dimensional code attack detecting main interface for user, to two dimensional code to be detected Image is scanned;
Conventional detection module: it for carrying out conventional detection to the image in 2 D code of scanning, obtains two in the image in 2 D code Code finger URL number is tieed up, the finger URL number of acquisition is compared with predetermined normal level, if the finger URL number obtained is greater than Predetermined normal level then determines that the two dimensional code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensions Code, otherwise, into depth detection;
Depth detection module: for modifying the recognition parameter of finger URL probe function, depth inspection is carried out to image in 2 D code It surveys, obtains finger URL number again, and be compared with normal value, if obtaining finger URL number again is greater than predetermined normal level, Then determine that the two dimensional code is improper two dimensional code, warns in user's image in 2 D code and be embedded in other two dimensional codes, otherwise, it is determined that Normal two dimensional code when this two dimensional code.
Further, the conventional detection is completed using open source bar code ZXing packet.
Further, two dimensional code decoding process in open source bar code ZXing packet is improved, using the two dimensional code after improvement Decoding process completes the depth scan, and the detailed process of the two dimensional code decoding process after improvement is as follows:
(1) modification parsing figure finds the class of characteristic point, detects the maximum number variable of figure in such middle point of addition, The position sensing figure number detected, i.e. finger URL number are recorded, chooses the maximum for obtaining position sensing figure inside it In the function of number, the anchor point number that will test out assigns the maximum number variable of position sensing figure, to detected Finger URL is screened, and obtains three that are best suitable for coding rule requirement, the maximum number letter of addition return position detection figure The maximum number variable of position sensing figure for counting and returning;
(2) class of modification processing detection result, point of addition detect maximum number variable, the constructed fuction of figure, and Point of addition detects the get accessor of the maximum number variable of figure;
(3) in detection class, point of addition detects the maximum number variable of figure, is parsed from internal detection function Then the maximum number variable of position sensing figure in figure class object modifies the return statement of image information acquisition function, Return to the maximum number for obtaining position sensing figure;
(4) in the coding/decoding method in barcode scanning class, the maximum number of the position sensing figure in parsing result object is obtained Variable, and it is used for construction result object;
(5) it is returned from the decoding operate function call in capture activity class to the maximum number variable of position sensing figure This module activities is adjusted back, and is compared with normal value, nested two dimensional code is judged whether it is.
Advantage of the invention is that can warn whether the two-dimension code area of user's Current Scan is embedded in other two dimensional codes, The effectively safety of enhancing two-dimensional code scanning link, has and is applicable in a variety of decoding policies, is not required to the characteristics of reducing serious forgiveness, is two Dimension code identification software design provides a kind of new detection scheme.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples, in attached drawing:
Fig. 1 is system detection schematic diagram of the invention;
Fig. 2 is multi-standard decoding ambiguity schematic diagram of the invention;
Fig. 3 is that sliding mobile phone is directed at two dimensional code scene schematic diagram when scanning in the present invention;
Fig. 4 is two-dimension code structure and position sensing pictorial diagram in the present invention;
Fig. 5 is the QRinQR image tested in document mentioned by the present invention;
Fig. 6 is nested type two dimensional code detection schematic diagram of the invention.
Specific embodiment
For a clearer understanding of the technical characteristics, objects and effects of the present invention, now control attached drawing is described in detail A specific embodiment of the invention.
It includes conventional detection and depth detection that nested type two dimensional code (QRinQR), which attacks double check, and basic procedure is as follows Shown in Fig. 1, a kind of nested type two dimensional code attack double check method, which is realized, specifically wraps nested type two dimensional code attack double check Include the following three steps:
Step 1: user enters nested type two dimensional code attack detecting main interface, is scanned to image in 2 D code to be detected;
Step 2: conventional detection being carried out to the image in 2 D code of scanning, obtains two dimensional code finger URL in the image in 2 D code Number, the finger URL number of acquisition is compared with predetermined normal level, if the finger URL number obtained is greater than predetermined normal level, Determine that the two dimensional code is improper two dimensional code, warns in user's image in 2 D code and be embedded in other two dimensional codes, otherwise, into step Rapid 3 carry out depth detection;
Step 3: the recognition parameter of modification finger URL probe function carries out depth detection to image in 2 D code, obtains again Finger URL number, and be compared with normal value, if obtaining finger URL number again is greater than predetermined normal level, determine the two dimension Code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensional codes, otherwise, it is determined that when this two dimensional code just Normal two dimensional code.
The present invention warns the two dimensional code of user's Current Scan by detecting to nested type two dimensional code (QRinQR) attack Whether region is embedded in other two dimensional codes, effectively enhances the safety of two-dimensional code scanning link, designs for two dimensional code identification software Provide a kind of new detection scheme.It will be unfolded to introduce in terms of following four:
1) nested type two dimensional code attack formula realization principle and its groundwork process are introduced;
2) analysis introduction QRinQR testing principle introduces its identification and testing principle and method;
3) Google open source ZXing code realization principle, i.e., the technical foundation of the invention realized are introduced;
4) implementation process of the present invention and detection basic procedure is discussed in detail.
1, nested type two dimensional code (QRinQR) realization principle
(1) multi-standard ambiguity (Multiple Standards Ambiguity)
Most of barcode readers have been generally integrated multiple notations, it is ensured that equipment can identify a variety of different types of Two-dimensional bar.If including multiple bar codes in image to be scanned, recognition result there is biggish uncertainty.One warp The nested type two dimensional code for crossing well-designed production usually can meet multiple decoding standards, without the common use of professional knowledge background Family is generally difficult to discover or do not pay attention to the variation of image in 2 D code feature, two is not gone through during scanning the two-dimensional code Whether dimension code image belongs to normal type.Current most of two dimensional code decoding softwares focus on drop to improve recognition aspect efficiency The low calculating time.In detection process, once meet a certain decoding standard, then stop detecting immediately and is transferred to decoding process, and The relatively external two dimensional code of internal two dimensional code is more readily detected.As shown in Fig. 2, decoder is examined according to coding type C, B, A sequence It surveys, after detecting that image meets the decoding rule of type B, it is decoded and is presented to the user result.
(2) camera frame (Camera Frame)
It is well known that user is generally difficult to for mobile phone being pointing directly at just when using mobile telephone bar code reader scans two dimensional code True bar code, it is often necessary to which sliding mobile phone makes camera frame aim at bar code (such as Fig. 3).And during the scanning process, bar code The reader moment is obtaining each frame image information and is attempting to decode, and user is without pressing any button.In this case, interior The two dimensional code of portion's insertion may enter into frame prior to external two dimensional code, and appearance does not scan complete image but is completed decoded Typical case.This first decoding is internally embedded two dimensional code situation, can be usually two-dimentional with scanning input with the appearance of certain Probability Forms The movement of code and habit are related.This is also that different user scans same nested type two dimensional code, causes to be likely to be obtained different recognitions As a result reason for it.
(3) QR code technical characteristic
The design of nested type two dimensional code, needs original two dimensional code to meet following two condition: first is that needing to provide relatively large Continuum, wherein another two dimensional code can be embedded in;Second is that needing reliable data correction mechanism.QR code and Data Matrix can usually meet first condition;For second condition, QR code error correcting capability with higher, error correction effect Fruit is better than Data Matrix.In QR code, decoder has the ability for ignoring unknown coding section, this makes common icons are embedding It still can complete to decode after entering to image in 2 D code.Therefore, QR code is the optimum carrier that the embedded two dimensional code of insertion is realized.
2, QRinQR testing principle
The decoding system of QR code mainly includes two parts: first part first pre-processes the QR code image of acquisition, right Image is corrected, and improves recognition accuracy whereby;Second part is decoded to pretreated image, and QR code institute is obtained The text information of expression.
It during decoding, first has to obtain position sensing figure, and needs to obtain three positions for meeting decoding request Set detection figure.As shown in figure 4, two dimensional code tool there are three identical position sensing figure, be located at the lower left corner, the upper left corner, The upper right corner.The concentric squares that each position sensing figure can be regarded as being overlapped by 3 form, respectively 7x7 dark mould Block, 5x5 light module, 3x3 dark module, the width ratio of position sensing figure module is 1:1:3:1:1.Usually in image A possibility that middle other positions encounter similar pattern very little, therefore can quickly identify 3 position sensing figures in image.
Compared with normal image in 2 D code, there are more position sensing figures in nested image in 2 D code.Such as Fig. 5 exhibition The four QRinQR images tested in document are shown.Can be seen that position sensing figure from this four images increased significantly.Bar code When these images of reader scans, obtained position sensing figure will be screened, obtain three that are best suitable for decoding request Position sensing figure.
In conclusion nested two dimensional code has differences on picture position detection figure with normal two dimensional code, this module knot Conventional detection and depth detection are closed, by the number of position sensing figure in detection image, and best orientation is filtered out at it and accords with Before saved.By being compared with position sensing figure number in normal image in 2 D code, if more than in normal two dimensional code Number, then can warn in user's image in 2 D code and be embedded in other two dimensional codes.Fig. 6 is principle schematic diagram of the present invention.
3, Google open source ZXing code
Google open source ZXing code is the basis for realizing nested type two dimensional code (QRinQR) detection, this works nested type Two dimensional code detection is realized by the decoding process improved in ZXing, and by identifying, position is visited in scanned image in 2 D code The number of mapping shape further judges other two dimensional codes whether are embedded in the image in 2 D code.
(1) open source ZXing packet brief introduction
ZXing is a Google open source java class library, for the bar code of a variety of code systems and the coding of two-dimensional bar code And parsing, development interface is provided towards kinds of platform and programming language, and provide help document and code sample.ZXing It not only supports numerous barcode standards, but also provides the realization version of various language, the language that it is supported includes: Java, C+ +, C#, Objective-C, ActionScript and Ruby etc..
Compared with other bar code Open Source Codes, ZXing has the advantages that following three:
1) it is mounted in mobile phone that recognition speed is fast, recognition time is short, can identify a variety of bar codes;
2) there is good compatibility and multilingual support;
3) documents and materials are extensive, provide documents and materials to the realization of this works and support.
(2) main decoding process analysis in ZXing
In ZXing Open Source Code, the code about QR code realizes mainly include four package, in which:
1) qrcode: encoding and decoding interface, external code pass through two classes of QRcodeReader and QRCodeW-riter in wrapping Carry out the encoding and decoding of QR code;
2) detector: QR code is detected from image, and is extracted.This package is decoded key portion Point, it is able to carry out optimization and improvement;
3) decoder: according to QR code coding criterion, carrying out decoded operation for the QR code sign extracted in detector, will Image analysis is actual information;
4) encdoer: according to the coding criterion of QR code, text information is encoded and generates QR code sign.
QR code decoding process mainly extracts symbolic code by image procossing, original image in ZXing, symbolic code decodes three parts Composition.Wherein, symbolic code part, mainly searching finger URL and correction symbol are proposed in original image, and are successively carried out perspective and turned It changes and generates final matrix, the present invention realizes the detection to nested type two dimensional code by improve and perfect decoding process.
Extracting symbolic code is decoded key component, and main target is extracted from the original image that pixel is unit Symbolic code part is simultaneously converted to symbolic code matrix.Then the matrix after image procossing is given to dector, wherein the side detect Method is exactly interface method, and this method is called to obtain symbolic code matrix.Detect method working principle is described below:
Wherein, finger URL is found to be realized by FinderPatternFinder class.One is just carried out every iSkip in the picture Row sampling, and the number of pixels of consecutive identical color is included in array, and array length is 5, that is, find it is black it is white it is black it is white Black image.Such as start to detect that black is included in array [0], the value of array [0] is all added 1 until detecting white;Inspection After measuring white, start to count in array [1], and so on.Detected after filling up 5 in this 5 number of pixels whether ratio For 1:1:3:1:1, it is understood that there may be 50% error.Explanation has found the approximate location of finger URL if meeting condition.By its HandlePossibleCenter method is transferred to, further determines that the central point of finger URL.It is first detected whether from vertical direction full Sufficient finger URL condition makes the center point coordinate value of Y-axis if meeting, then detection level direction is again using the coordinate value It is no to meet finger URL condition, the center point coordinate value of X-axis is made if meeting.So far, we just have found a finger URL Centre coordinate.
The centre coordinate of all three finger URLs is found out according to previous step, next positions three finger URLs in symbol Position, i.e. three lower-left (A point), upper left (B point), upper right (C point) positions.Distance between any two is first passed through, which is determined A point is upper left that point, and usual upper left point is then fixed by calculating the multiplication cross of BA, BC vector to the closely located of other two o'clocks A and C two o'clock out.
As described above, calculating the possible position of * correction symbol by 3 points of ABC of coordinate, Alignment- is then transferred to PatternFinder looks for the correction in last cell and accords with, this process and the method for finding finger URL are essentially identical.
It (if correction symbol is not found, can be calculated with one after finding the coordinate of three anchor points and a correction symbol Value replaces), the position of glyph image is assured that.It needs to carry out anamorphose at this time, it is established that the symbol as unit of module Relationship number between matrix and original image, this works use PerspectiveTransform method.After transformational relation is established, need By each pair of point in new matrix (sign matrix as unit of module) should to the point in original image, check the point be it is black or It is white, by 0,1 filling into matrix, and generate final symbolic code.
4, implementation process and detection basic procedure
The core link of nested type two dimensional code (QRinQR) attack detecting is the acquisition finger URL number in dector. ZXing realizes code section, traverses by row to picture element matrix, and obtain finger URL all in image, further matches Three finger URLs of two dimensional code coding rule are best suitable for, subsequent decoded operation is then carried out.Realization target of the invention be into Before the symbol screening of row best orientation, maximum finger URL number is obtained, and be compared with normal two dimensional code finger URL number, judged Whether current two-dimension image is abnormal;Success rate is detected to improve, testing process is modified, resets and distinguish parameter in Key Functions, Depth scan is carried out to present image, it is as follows to obtain more accurate finger URL number specific implementation flow:
(1) modification parsing figure finds the class of characteristic point, detects the maximum number variable of figure in such middle point of addition, Record the position sensing figure number detected, i.e. finger URL number.The maximum for obtaining position sensing figure is chosen inside it In the function of number, the anchor point number that will test out assigns the maximum number variable of position sensing figure.Hereafter, detection is obtained The finger URL obtained is screened, and obtains three that are best suitable for coding rule requirement.Finally, addition return position detection figure is most Big number function and the maximum number variable for returning to obtained position sensing figure.
(2) class of modification processing detection result, point of addition detect maximum number variable, the constructed fuction of figure, and Point of addition detects the get accessor of the maximum number variable of figure.
(3) in detection class, point of addition detects the maximum number variable of figure, is parsed from internal detection function The maximum number variable of position sensing figure in figure class object.Then the return statement of image information acquisition function is modified, Return to the maximum number for obtaining position sensing figure.
(4) in the coding/decoding method in barcode scanning class, the maximum number of the position sensing figure in parsing result object is obtained Variable, and it is used for construction result object.
(5) it is returned from the decoding operate function call in capture activity class to the maximum number variable of position sensing figure Adjust back this module activities.It is compared with normal value, judges whether it is nested two dimensional code.
In view of user's barcode scanning acts the influence to barcode scanning result, the setting of this module decoding operate is in scanning input to entirely Two-dimension code area.I.e. only by setting delay barcode scanning, avoid user under the conditions of at frame misalignment image in 2 D code, bar code is read It reads software and decoded situation is completed.Concrete implementation method is as follows:
1) FinderPatternFinder class is modified, in such middle addition maxResultPoints variable, record detection The position sensing figure number arrived, i.e. finger URL number.Inside it in function selectBest-Patterns (), it will test Anchor point number out assigns maxResultPoints.Hereafter, detected finger URL is screened, is best suitable for Three of coding rule requirement.Finally, addition getMax-ResultPoints () function and returning obtains maxResultPoints。
2) DetectorResult class and Result class are modified, maxResultPoints variable, constructed fuction are added, with And the get accessor of addition maxResultPoints variable.
3) in Detector class, maxResultPoints variable is added, is obtained from internal detect () function MaxResultPoints in FinderPatternFinder object.Then processFinder-PatternInfo is modified The return sentence of () function returns to maxResultPoints value.
4) it in decode () method in QRCodeReader class, obtains in DetectorResult object MaxResultpoints, and it is used for construction Result object.
5) obtain maxResultPoints from handleDecode () function in CaptureActivity class, by its with Normal value is compared, and judges whether it is nested two dimensional code.
6) finder () function in FinderPatternFinder class is modified, sampling interval iSkip value is reseted, it is right line by line Image is detected;
7) haveMultiplyConfirmedCenters () function is modified, it is ensured that be scanned, keep away to by whole image Exempt from because detecting three similarly positioned symbol backed off after random testing processes;
Wherein, in addition to maxResultPoints and getMax-ResultPoints (), others be all in the library Zxing from The class and method of band.
MaxResultPoints variable: the maximum number of position sensing figure.
GetMax-ResultPoints () function: the maximum number that return position detects figure (returns MaxResultPoints variable).
SelectBest-Patterns () function: the maximum number for obtaining position sensing figure (detects anchor point number simultaneously It is assigned to maxResultPoints variable).
FinderPatternFinder class: for parsing the class of figure in the library Zxing, characteristic point is found.
DetectorResult class Result class: handle the class of detection result.
Detector class: for parsing the class of figure, processing detection result in the library Zxing.
Detect () function: the function in detector class, detection feature point.
ProcessFinder-PatternInfo () function: the function of graphical information is obtained.
QRCodeReader class: the class of scanning QR code, wherein including decode function.
Decode (): decoding functions.
CaptureActivity class: the Activity that can be called that ZXing is provided.It can be to dynamic after barcode scanning success It deals with.
HandleDecode () function: the result after processing barcode scanning success.
As described above, the present invention stresses to solve the problems, such as embedded two dimensional code attack threat, user is in two-dimensional code scanning process In by nested type two dimensional code carry out depth detection, warning user whether scan embedded image in 2 D code, avoid user By nested type two dimensional code malicious attack.
The present invention is attacked for the novel nested type two dimensional code (QRinQR) proposed in CCS2016 international conference such as Adrain Problem is hit, a kind of scheme based on position sensing test pattern mechanism has been designed and Implemented, by improving Google open source ZXing Decoding process in code realizes the detection attacked QRinQR, reduces decoding ambiguity bring security risk.Due to current city Big institute's number mobile terminal two-dimensional code scanning software can not effectively resist these attacks on field, also there is no effective skill so far in document Art scheme and control measures, the present invention provide a kind of new resolving ideas and technological means for the design of two dimensional code identification software.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much Form, all of these belong to the protection of the present invention.

Claims (6)

1. a kind of nested type two dimensional code attacks double check method, which is characterized in that specifically include the following three steps:
Step 1: user enters nested type two dimensional code attack detecting main interface, is scanned to image in 2 D code to be detected;
Step 2: conventional detection is carried out to the image in 2 D code of scanning, obtains two dimensional code finger URL number in the image in 2 D code, The finger URL number of acquisition is compared with predetermined normal level, if the finger URL number obtained is greater than predetermined normal level, is sentenced The fixed two dimensional code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensional codes, otherwise, enters step 3 carry out depth detection;
Step 3: the recognition parameter of modification finger URL probe function carries out depth detection to image in 2 D code, obtains positioning again Number is accorded with, and is compared with normal value, if obtaining finger URL number again is greater than predetermined normal level, determines that the two dimensional code is Improper two dimensional code warns in user's image in 2 D code and is embedded in other two dimensional codes, otherwise, it is determined that normal two when this two dimensional code Tie up code.
2. a kind of nested type two dimensional code according to claim 1 attacks double check method, which is characterized in that using open source Bar code ZXing packet completes the conventional detection.
3. a kind of nested type two dimensional code according to claim 1 attacks double check method, which is characterized in that open source item Two dimensional code decoding process is improved in code ZXing packet, completes the depth scan using the two dimensional code decoding process after improvement, The detailed process of two dimensional code decoding process after improvement is as follows:
(1) modification parsing figure finds the class of characteristic point, in the maximum number variable of such middle point of addition detection figure, record The position sensing figure number detected, i.e. finger URL number choose the maximum number for obtaining position sensing figure inside it Function in, the anchor point number that will test out assigns the maximum number variable of position sensing figure, to detected positioning Symbol is screened, and obtains three that are best suitable for coding rule requirement, the maximum number function of addition return position detection figure is simultaneously Return to the maximum number variable of obtained position sensing figure;
(2) class of modification processing detection result, point of addition detect maximum number variable, the constructed fuction of figure, and addition The get accessor of the maximum number variable of position sensing figure;
(3) in detection class, point of addition detects the maximum number variable of figure, and parsing figure is obtained from internal detection function Then the maximum number variable of position sensing figure in class object modifies the return statement of image information acquisition function, return Obtain the maximum number of position sensing figure;
(4) in the coding/decoding method in barcode scanning class, the maximum number variable of the position sensing figure in parsing result object is obtained, And it is used for construction result object;
(5) tune is returned it into the maximum number variable of position sensing figure from the decoding operate function call in capture activity class It with this module activities, and is compared with normal value, judges whether it is nested two dimensional code.
4. a kind of nested type two dimensional code attacks double check system, which is characterized in that including following three modules:
Response Code scan module: enter nested type two dimensional code attack detecting main interface for user, to image in 2 D code to be detected It is scanned;
Conventional detection module: for carrying out conventional detection to the image in 2 D code of scanning, two dimensional code in the image in 2 D code is obtained The finger URL number of acquisition is compared with predetermined normal level for finger URL number, presets if the finger URL number obtained is greater than Normal value then determines that the two dimensional code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensional codes, no Then, into depth detection;
Depth detection module: for modifying the recognition parameter of finger URL probe function, carrying out depth detection to image in 2 D code, then Secondary acquisition finger URL number, and be compared with normal value, if obtaining finger URL number again is greater than predetermined normal level, determine The two dimensional code is improper two dimensional code, warns in user's image in 2 D code and is embedded in other two dimensional codes, otherwise, it is determined that this is two-dimentional Normal two dimensional code when code.
5. a kind of nested type two dimensional code according to claim 4 attacks double check system, which is characterized in that using open source Bar code ZXing packet completes the conventional detection.
6. a kind of nested type two dimensional code according to claim 4 attacks double check system, which is characterized in that open source item Two dimensional code decoding process is improved in code ZXing packet, completes the depth scan using the two dimensional code decoding process after improvement, The detailed process of two dimensional code decoding process after improvement is as follows:
(1) modification parsing figure finds the class of characteristic point, in the maximum number variable of such middle point of addition detection figure, record The position sensing figure number detected, i.e. finger URL number choose the maximum number for obtaining position sensing figure inside it Function in, the anchor point number that will test out assigns the maximum number variable of position sensing figure, to detected positioning Symbol is screened, and obtains three that are best suitable for coding rule requirement, the maximum number function of addition return position detection figure is simultaneously Return to the maximum number variable of obtained position sensing figure;
(2) class of modification processing detection result, point of addition detect maximum number variable, the constructed fuction of figure, and addition The get accessor of the maximum number variable of position sensing figure;
(3) in detection class, point of addition detects the maximum number variable of figure, and parsing figure is obtained from internal detection function Then the maximum number variable of position sensing figure in class object modifies the return statement of image information acquisition function, return Obtain the maximum number of position sensing figure;
(4) in the coding/decoding method in barcode scanning class, the maximum number variable of the position sensing figure in parsing result object is obtained, And it is used for construction result object;
(5) tune is returned it into the maximum number variable of position sensing figure from the decoding operate function call in capture activity class It with this module activities, and is compared with normal value, judges whether it is nested two dimensional code.
CN201810690963.7A 2018-06-28 2018-06-28 Nested two-dimensional code attack double detection method and system Active CN109145675B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810690963.7A CN109145675B (en) 2018-06-28 2018-06-28 Nested two-dimensional code attack double detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810690963.7A CN109145675B (en) 2018-06-28 2018-06-28 Nested two-dimensional code attack double detection method and system

Publications (2)

Publication Number Publication Date
CN109145675A true CN109145675A (en) 2019-01-04
CN109145675B CN109145675B (en) 2020-08-25

Family

ID=64802641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810690963.7A Active CN109145675B (en) 2018-06-28 2018-06-28 Nested two-dimensional code attack double detection method and system

Country Status (1)

Country Link
CN (1) CN109145675B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113361674A (en) * 2021-06-04 2021-09-07 重庆邮电大学 Encoding and decoding method of nested guide two-dimensional code

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013238943A (en) * 2012-05-14 2013-11-28 Denso Corp Two-dimensional code reader
CN105894072A (en) * 2016-03-31 2016-08-24 郝迎喜 Two-dimensional code mixed generation system
CN107451641A (en) * 2017-07-27 2017-12-08 千里码数据服务有限公司 A kind of Quick Response Code and its generation method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013238943A (en) * 2012-05-14 2013-11-28 Denso Corp Two-dimensional code reader
CN105894072A (en) * 2016-03-31 2016-08-24 郝迎喜 Two-dimensional code mixed generation system
CN107451641A (en) * 2017-07-27 2017-12-08 千里码数据服务有限公司 A kind of Quick Response Code and its generation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113361674A (en) * 2021-06-04 2021-09-07 重庆邮电大学 Encoding and decoding method of nested guide two-dimensional code

Also Published As

Publication number Publication date
CN109145675B (en) 2020-08-25

Similar Documents

Publication Publication Date Title
US8774453B2 (en) Method and arrangement for retrieving information comprised in a barcode
Liu et al. Recognition of QR Code with mobile phones
CN102136058B (en) Bar code image identification method
US7813553B2 (en) Image region detection method, recording medium, and device therefor
KR101606469B1 (en) Method for image analysis, especially for mobile stations
US20120092329A1 (en) Text-based 3d augmented reality
US9330291B2 (en) Method and device for parsing images
US20060113390A1 (en) Barcode recognition apparatus
KR20150082464A (en) Two-dimensional code
WO2014194825A1 (en) Method and apparatus for processing visible graphic code by mobile terminal
US20190377918A1 (en) Barcode Detection Method and Barcode Detection System for Increasing Detection Efficiency by Using Gray Level Flip Counts
CN103793676A (en) Method and device for identifying anti-counterfeiting mark composed of two-dimensional code and raster graphic
US20200302135A1 (en) Method and apparatus for localization of one-dimensional barcodes
CN109284613A (en) Label detection and counterfeit site detecting method, device, equipment and storage medium
CN113989858A (en) Work clothes identification method and system
CN109145675A (en) A kind of nested type two dimensional code attack double check method and system
KR100404306B1 (en) Coded pattern and method for the extraction of code from the same
CN112163655B (en) Dynamic implicit two-dimensional code and generation and detection method and device thereof
CN108108646B (en) Bar code information identification method, terminal and computer readable storage medium
US20170091572A1 (en) System And Method For Text Detection In An Image
CN110689337A (en) Intelligent prompting method and system based on QR Code two-dimensional Code
CN110795769B (en) Anti-counterfeiting method for check-in data of face recognition check-in system
CN106055693A (en) Information processing method and terminal
KR100784200B1 (en) Method and Device for decoding the code having code information according to image
CN115422958B (en) Picture operation method, electronic device and storage medium

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
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Song Jun

Inventor after: Yang Fan

Inventor after: Gao Kun

Inventor after: Liu Rui

Inventor after: Xu Heng

Inventor before: Song Jun

Inventor before: Wang Lizhe

Inventor before: Yang Fan

Inventor before: Gao Kun

Inventor before: Liu Rui

Inventor before: Xu Heng

GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20190104

Assignee: WUHAN TIMES GEOSMART TECHNOLOGY Co.,Ltd.

Assignor: CHINA University OF GEOSCIENCES (WUHAN CITY)

Contract record no.: X2022420000021

Denomination of invention: A double detection method and system of nested QR code attack

Granted publication date: 20200825

License type: Common License

Record date: 20220302