Adversarial language analysis for code scanning
AssigneeOracle International Corporation
InventorRyan Murray
Life of this patent
Estimating the term…
Abstract
Techniques to determine a programming language of a set of code based on learned programming language patterns. One technique includes receiving a set of code, generating a pattern map of discovered string patterns from the set of code, comparing the string patterns included within the pattern map against learned programming language patterns included with a master voting map to identify one or more profiled programming languages that utilize the learned programming, language patterns that match the string patterns, generating a score card for the set of code by tallying scores for the one or more profiled programming languages based on the comparing, and determining one or more programming languages used to write the set of code based on the score card.
Claims20
A method comprising:
- receiving, by a data processing system, a set of code;
- generating, by the data processing system, a pattern map of discovered string patterns from the set of code, wherein the string patterns comprise words and linear combinations thereof in the set of code;
- comparing, by the data processing system, the string patterns included within the pattern map against learned programming language patterns included within a master voting map to identify one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, wherein the master voting map comprises for each learned programming language pattern, a first weight or a second weight associated with the one or more profiled programming languages that utilize the learned programming language pattern;
- generating, by the data processing system, a score card for the set of code, wherein the generating comprises tallying scores for the one or more profiled programming languages based on the comparing and the first weight or the second weight associated with the one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, and recording the scores with the one or more profiled programming languages in the score card;
- and
- determining, by the data processing system, one or more programming languages used to write the set of code based on the score card.
A non-transitory computer-readable memory storing a plurality of instructions executable by one or more processors, the plurality of instructions comprising instructions that when executed by the one or more processors, cause the one or more processors to perform processing comprising:
- receiving a set of code;
- generating a pattern map of discovered string patterns from the set of code, wherein the string patterns comprise words and linear combinations thereof in the set of code;
- comparing the string patterns included within the pattern map against learned programming language patterns included within a master voting map to identify one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, wherein the master voting map comprises for each learned programming language pattern, a first weight or a second weight associated with the one or more profiled programming languages that utilize the learned programming language pattern;
- generating a score card for the set of code, wherein the generating comprises tallying scores for the one or more profiled programming languages based on the comparing and the first weight or the second weight associated with the one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, and recording the scores with the one or more profiled programming languages in the score card;
- and
- determining one or more programming languages used to write the set of code based on the score card.
15 A system comprising:
- one or more processors;
- and
- a memory coupled to the one or more processors, the memory storing a plurality of instructions executable by the one or more processors, the plurality of instructions comprising instructions that when executed by the one or more processors cause the one or more processors to perform processing comprising:
- receiving a set of code;
- generating a pattern map of discovered string patterns from the set of code, wherein the string patterns comprise words and linear combinations thereof in the set of code;
- comparing the string patterns included within the pattern map against learned programming language patterns included within a master voting map to identify one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, wherein the master voting map comprises for each learned programming language pattern, a first weight or a second weight associated with the one or more profiled programming languages that utilize the learned programming language pattern;
- generating a score card for the set of code, wherein the generating comprises tallying scores for the one or more profiled programming languages based on the comparing and the first weight or the second weight associated with the one or more profiled programming languages that utilize the learned programming language patterns that match the string patterns, and recording the scores with the one or more profiled programming languages in the score card;
- and
- determining one or more programming languages used to write the set of code based on the score card.
The system of claim 15, wherein the generating the pattern map comprises:
- parsing and splitting the set of code by lines and by words;
- identifying the words and linear combinations thereof in each line;
- counting a number of times each word and each linear combination thereof is identified within the set of code to obtain count values of each word and each linear combination thereof flattening the pattern map by merging multiple instances of each word and each linear combination thereof into single instances based on the counting and associating the count values of each word and each linear combination thereof to the single instances of each word and each linear combination thereof;
- and
- sorting the single instances of each word and each linear combination thereof based on the count values.
The system of claim 15, wherein the processing, further comprises:
- determining one or more programming languages to be profiled;
- for each programming language to be profiled, selecting sets of code written in the programming language to be profiled from one or more known sources or repositories of code;
- for each programming language to be profiled, generating a pattern map of the learned programming language patterns from the sets of code written in the programming language to be profiled, wherein the learned programming language patterns comprise words and linear combinations thereof in the sets of code;
- and
- for each programming language to be profiled, comparing the pattern map generated for the programming language to be profiled against the pattern maps generated for the other profiled programming languages to be profiled, and generating the master voting map based on the comparisons between the programming languages to be profiled.
Dependencies are inferred from the claim text.