<commit_before>#
# Yet Another UserAgent Analyzer
# Copyright (C) 2013-2016 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
config:

  - lookup:
      name: 'lookupname'
      map:
        "From1" : "To1"
        "From2" : "To2"
        "From3" : "To3"

  - matcher:
      require:
        - 'agent.(1)product.(1)comments.entry.product.(1)name="Browser"^.(1)version="Browser"'
      extract:
        - 'DeviceClass    :   50:"Mobile"'
        - 'DeviceBrand    : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.name'
        - 'DeviceName     : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.(1)version'
        - 'DeviceVersion  : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.(2)version'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Macintosh); Intel Mac OS X 10_7_5) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceBrand                        : 'Apple'
        DeviceName                         : 'Macintosh'
        DeviceCpu                          : 'Intel'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Mac OS X'
        OperatingSystemVersion             : '10.7.5'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'AppleWebKit'
        LayoutEngineVersion                : '537.11'
        AgentClass                         : 'Browser'
        AgentName                          : 'Chrome'
        AgentVersion                       : '23.0.1271.97'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Linux; U; Android 4.2.2; nl-; YC-3135D Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'
      expected:
        DeviceClass                        : 'Tablet'
        DeviceName                         : 'YC-3135D'
#        DeviceVersion                   : 'YC-3135D'
        OperatingSystemClass               : 'Mobile'
        OperatingSystemName                : 'Android'
        OperatingSystemVersion             : '4.2.2'
        OperatingSystemVersionBuild        : 'JDQ39'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'AppleWebKit'
        LayoutEngineVersion                : '534.30'
        AgentClass                         : 'Browser'
        AgentName                          : 'Safari'
        AgentVersion                       : '4.0'
        AgentSecurity                      : 'Strong security'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Linux; U; Android 4.4.2; HUAWEI P7-L10/HuaweiP7-L10C02B129 Browser/Browser/4.4.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36'
      expected:
        DeviceClass                        : 'Phone'
        DeviceBrand                        : 'HUAWEI'
        DeviceName                         : 'P7-L10'
        DeviceVersion                      : 'HuaweiP7-L10C02B129'
        OperatingSystemClass               : 'Mobile'
        OperatingSystemName                : 'Android'
        OperatingSystemVersion             : '4.4.2'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'Blink'
        LayoutEngineVersion                : '30.0'
        AgentClass                         : 'Browser'
        AgentName                          : 'Chrome'
        AgentVersion                       : '172.16.58.3'
        AgentSecurity                      : 'Strong security'

  - matcher:
      require:
        - 'agent.(1)product.(1)name%2"Mozilla"'
        - 'agent.(1)product.(1)name%1{"PB"'
      extract:
        - 'AgentClass     :3000:"Browser"'
        - 'AgentName      :3000:"PirateBrowser"'
        - 'AgentVersion   :3000:agent.(1)product.(1)name#2'

  - test:
      input:
        name: 'PrirateBrowser 0.6b'
        user_agent_string: 'PB0.6b Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceName                         : 'Desktop'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Windows NT'
        OperatingSystemVersion             : 'Windows 7'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'Gecko'
        LayoutEngineVersion                : '23.0'
        AgentClass                         : 'Browser'
        AgentName                          : 'PirateBrowser'
        AgentVersion                       : 'PB0.6b'
        LayoutEngineBuild                  : '20100101'

  - test:
      input:
        user_agent_string: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS31753; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; staticlogin:product=cboxf2010&act=login&info=ZmlsZW5hbWU9UG93ZXJXb3JkMjAxME94Zl9VbHRpbWF0ZS5leGUmbWFjPTBGRTRFMzZCMUZBNTQ1RTQ5QUZGOEE1QzZDRkNERUEwJnBhc3Nwb3J0PSZ2ZXJzaW9uPTIwMTAuNi4zLjYuMiZjcmFzaHR5cGU9MQ==&verify=cced4bb7457606add430a1b6be544f30; InfoPath.3)'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceName                         : 'Desktop'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Windows NT'<commit_msg>Silly typo<commit_after>#
# Yet Another UserAgent Analyzer
# Copyright (C) 2013-2016 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
config:

  - lookup:
      name: 'lookupname'
      map:
        "From1" : "To1"
        "From2" : "To2"
        "From3" : "To3"

  - matcher:
      require:
        - 'agent.(1)product.(1)comments.entry.product.(1)name="Browser"^.(1)version="Browser"'
      extract:
        - 'DeviceClass    :   50:"Mobile"'
        - 'DeviceBrand    : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.name'
        - 'DeviceName     : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.(1)version'
        - 'DeviceVersion  : 1000:agent.(1)product.(1)comments.entry.product.(1)name="Browser"^<.(2)version'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Macintosh); Intel Mac OS X 10_7_5) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceBrand                        : 'Apple'
        DeviceName                         : 'Macintosh'
        DeviceCpu                          : 'Intel'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Mac OS X'
        OperatingSystemVersion             : '10.7.5'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'AppleWebKit'
        LayoutEngineVersion                : '537.11'
        AgentClass                         : 'Browser'
        AgentName                          : 'Chrome'
        AgentVersion                       : '23.0.1271.97'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Linux; U; Android 4.2.2; nl-; YC-3135D Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'
      expected:
        DeviceClass                        : 'Tablet'
        DeviceName                         : 'YC-3135D'
#        DeviceVersion                   : 'YC-3135D'
        OperatingSystemClass               : 'Mobile'
        OperatingSystemName                : 'Android'
        OperatingSystemVersion             : '4.2.2'
        OperatingSystemVersionBuild        : 'JDQ39'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'AppleWebKit'
        LayoutEngineVersion                : '534.30'
        AgentClass                         : 'Browser'
        AgentName                          : 'Safari'
        AgentVersion                       : '4.0'
        AgentSecurity                      : 'Strong security'

  - test:
      input:
        user_agent_string: 'Mozilla/5.0 (Linux; U; Android 4.4.2; HUAWEI P7-L10/HuaweiP7-L10C02B129 Browser/Browser/4.4.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36'
      expected:
        DeviceClass                        : 'Phone'
        DeviceBrand                        : 'HUAWEI'
        DeviceName                         : 'P7-L10'
        DeviceVersion                      : 'HuaweiP7-L10C02B129'
        OperatingSystemClass               : 'Mobile'
        OperatingSystemName                : 'Android'
        OperatingSystemVersion             : '4.4.2'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'Blink'
        LayoutEngineVersion                : '30.0'
        AgentClass                         : 'Browser'
        AgentName                          : 'Chrome'
        AgentVersion                       : '172.16.58.3'
        AgentSecurity                      : 'Strong security'

  - matcher:
      require:
        - 'agent.(1)product.(1)name%2"Mozilla"'
        - 'agent.(1)product.(1)name%1{"PB"'
      extract:
        - 'AgentClass     :3000:"Browser"'
        - 'AgentName      :3000:"PirateBrowser"'
        - 'AgentVersion   :3000:agent.(1)product.(1)name#2'

  - test:
      input:
        name: 'PirateBrowser 0.6b'
        user_agent_string: 'PB0.6b Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceName                         : 'Desktop'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Windows NT'
        OperatingSystemVersion             : 'Windows 7'
        LayoutEngineClass                  : 'Browser'
        LayoutEngineName                   : 'Gecko'
        LayoutEngineVersion                : '23.0'
        AgentClass                         : 'Browser'
        AgentName                          : 'PirateBrowser'
        AgentVersion                       : 'PB0.6b'
        LayoutEngineBuild                  : '20100101'

  - test:
      input:
        user_agent_string: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS31753; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; staticlogin:product=cboxf2010&act=login&info=ZmlsZW5hbWU9UG93ZXJXb3JkMjAxME94Zl9VbHRpbWF0ZS5leGUmbWFjPTBGRTRFMzZCMUZBNTQ1RTQ5QUZGOEE1QzZDRkNERUEwJnBhc3Nwb3J0PSZ2ZXJzaW9uPTIwMTAuNi4zLjYuMiZjcmFzaHR5cGU9MQ==&verify=cced4bb7457606add430a1b6be544f30; InfoPath.3)'
      expected:
        DeviceClass                        : 'Desktop'
        DeviceName                         : 'Desktop'
        OperatingSystemClass               : 'Desktop'
        OperatingSystemName                : 'Windows NT'
{'fraction_non_alphanumeric': 0.09643264375305424, 'fraction_numerical': 0.055546505945593745, 'mean_word_length': 1.492691839220463, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2269493', 'n_tokens_mistral': 4046, 'n_tokens_neox': 3559, 'n_words': 726}