diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f3458d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +extracted/* diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..bd7eae6 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,60 @@ +# Copyright (c) 2016 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. + +if (is_android) { + import("//build/buildflag_header.gni") + import("//build/config/android/config.gni") + import("//build/config/android/rules.gni") + + _target_arch = target_cpu + _build_type = "Release" + if (is_debug) { + _build_type = "Debug" + } + + copy("copy_libswewebrefiner") { + sources = [ "$_target_arch/$_build_type/libswewebrefiner.so" ] + outputs = [ "$root_shlib_dir/libswewebrefiner.so" ] + data = [ "$root_shlib_dir/libswewebrefiner.so" ] + } + + group("libswewebrefiner") { + public_deps = [ + ":copy_libswewebrefiner", + "//swe/swe_core:swe_core_native", + ] + } + + _wr_res_zip_path = "//components/web_refiner/java/libswewebrefiner_java.zip" + _wr_unpacked_res_path = "//components/web_refiner/extracted/res/" + + _rebased_res_dir = rebase_path(_wr_unpacked_res_path, root_build_dir) + _wr_res_dir_exists = exec_script("//build/dir_exists.py", [ _rebased_res_dir ], "string") == "True" + if (!_wr_res_dir_exists) { + exec_script("//build/makedirs.py", [ _rebased_res_dir ], "string") + } + + _wr_extract_res_depfile = "//components/web_refiner/extracted/wr_extract_res.d" + _wr_extract_res_stamp = "//components/web_refiner/extracted/wr_extract_res.stamp" + + extract_zip_args = [ + "--zip", rebase_path(_wr_res_zip_path, root_build_dir), + "--exdir", rebase_path(_wr_unpacked_res_path, root_build_dir), + "--depfile", rebase_path(_wr_extract_res_depfile, root_build_dir), + "--stamp", rebase_path(_wr_extract_res_stamp, root_build_dir), + ] + exec_script("//components/web_refiner/extract_zip.py", extract_zip_args) + + android_resources("libswewebrefiner_java_resources") { + custom_package = "com.qualcomm.qti.webrefiner" + resource_dirs = [ _wr_unpacked_res_path ] + } + + android_java_prebuilt("libswewebrefiner_java") { + jar_path = "//components/web_refiner/java/libswewebrefiner_java.jar" + deps = [ + ":libswewebrefiner_java_resources", + ] + } +} diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..db179da --- /dev/null +++ b/VERSION @@ -0,0 +1,3 @@ +WebRefiner-2.6.5 +Built on Chromium-57.0 @ 146c2fd97c8e227646f9b43ba3536a918318804d +Source @ 56f05ebcc4abe75dac4c036979d6711412f6f167 diff --git a/WEBDEFENDER.md b/WEBDEFENDER.md new file mode 100644 index 0000000..7fcdd47 --- /dev/null +++ b/WEBDEFENDER.md @@ -0,0 +1,47 @@ +### WebDefender +WebDefender enhances the anti-tracking technology originally developed by the Electronic Frontier Foundation for the browser extension Privacy Badger. Implemented natively within “Smart Protect - Web”, WebDefender uses machine learning to detect third-party websites who are exhibiting tracking behavior and blocks them. + +#### UI Enablement (in SWE Browser): + * Default: toggle the option in Menu > Settings > Site settings > "Web Defender" + * Per-site (Overrides the default option on a per-website basis): toggle the option in Top-left Favicon Button > "Web Defender" + +#### Configuration: + - Web Defender is enabled by default. + - Web Defender can use Disconnect.me's services.json list to improve the user experiencing by white-listing CDN domains that serve website contents which would otherwise be blocked by Web Defender and cause breakages in some websites. + + - To configure URL to your Disconnect.me services list +``` + { + "version": "1.0", + "update": {}, + "subscriptions": [ + { + "name" : "DisconnectMe Services List", + "category" : "DISCONNECT_ME_SERVICES_LIST", + "format" : "WebDefender 1.0", + "url" : "", + "expiration" : "4 days" + } + ] + } +``` + - Create a file called **web_defender_conf** with the above configuration + - Add a valid URL in place of **** + - Copy the **web_defender_conf** into **/res/raw/web_defender_conf** and build your browser. + +#### WebDefender libraries: + - The libraries listed in this repository are built on top of SWE based on Chromium version specified in the VERSION file. Attempting to use these libraries in any other version of chromium will result in instability. + - `libswewebrefiner.so` is built with dependency on `libswe.so`. If you are changing the chromium library name to something else in your project, then `libswewebrefiner.so` library loading will simply fail at runtime. + - Libraries support ARM (32-bit) architecture only. + +#### Browser command line arguments: +``` +--disable-web-defender disables WebDefender completely +--enable-web-refiner-logcat-stats enables logcat output of WebDefender and WebRefiner actions +``` + +#### Debugging: Logcat messages: +``` +logcat -s WebDefender generic WebDefender failure messages +logcat -s WebDefenderStat filter stats when '--enable-web-refiner-logcat-stats' is used +``` diff --git a/WEBREFINER.md b/WEBREFINER.md new file mode 100644 index 0000000..5aa2377 --- /dev/null +++ b/WEBREFINER.md @@ -0,0 +1,34 @@ +### WebRefiner +WebRefiner is a content filtering component for SWE Browser. It provides a core filtering engine for filtering URLs and a DOM manipulator for applying cosmetic filters on web pages to block advertisements, privacy info trackers and malware domains. + +`TL;DR: you should change the subscription.url(s) in web_refiner_conf, and you're good to go.` + +#### UI Enablement (in SWE Browser): + * Default: toggle the option in Menu > Settings > Site settings > "Web Refiner" + * Per-site (Overrides the default option on a per-website basis): toggle the option in Top-left Favicon Button > "Web Refiner" + +#### Filter configuration: + - The configuration file is in: **chrome/android/java/res/raw/web_refiner_conf** + - By default **web_refiner_conf** contains no valid subscription URLs. + - WebRefiner looks for the configuration only in the above path and failure to provide a valid configuration will result in a failed initialization of WebRefiner (and WebRefiner won't be shown in the UI) + - WebRefiner is fully compatible with the *leading ad-blocking filter list formats*. A wide variety of public filters can be configured in `subscriptions.url` or you can create your own compatible filter list. + - Subscriptions configured in **web_refiner_conf** will always be downloaded from a http/https server at the very first browser startup and they will be updated periodically according their expiration. + - All the downloaded filter files (and internal WebRefiner data) are stored in device `/data/data//web_refiner/`. Deleting the folder, or clearing the APP DATA will bring WebRefiner back to its default state. + - Filters are applied in the same order as in the configuration file. + +#### WebRefiner libraries: + - The libraries listed in this repository are built on top of SWE based on Chromium version specified in the VERSION file. Attempting to use these libraries in any other version of chromium will result in instability. + - `libswewebrefiner.so` is built with dependency on `libswe.so`. If you are changing the chromium library name to something else in your project, then `libswewebrefiner.so` library loading will simply fail at runtime. + - Libraries support ARM (32-bit) architecture only. + +#### Browser command line arguments: +``` +--disable-web-refiner disables WebRefiner completely +--enable-web-refiner-logcat-stats enables logcat output of applied filters +``` + +#### Debugging: Logcat messages: +``` +logcat -s WebRefiner generic WebRefiner failure messages +logcat -s WebRefinerStat filter stats when '--enable-web-refiner-logcat-stats' is used +``` diff --git a/arm/Debug/libswewebrefiner.so b/arm/Debug/libswewebrefiner.so new file mode 100755 index 0000000..0032b99 Binary files /dev/null and b/arm/Debug/libswewebrefiner.so differ diff --git a/arm/Release/libswewebrefiner.so b/arm/Release/libswewebrefiner.so new file mode 100755 index 0000000..2e1b688 Binary files /dev/null and b/arm/Release/libswewebrefiner.so differ diff --git a/extract_zip.py b/extract_zip.py new file mode 100755 index 0000000..f2309e4 --- /dev/null +++ b/extract_zip.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Copyright (c) 2016 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# + +import fnmatch +import optparse +import os +import sys + +REPOSITORY_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) + +sys.path.append(os.path.join(REPOSITORY_ROOT, 'build/android/gyp/util')) +import build_utils + +def ExtractZip(options): + + zip_path = options.zip + extract_path = options.exdir + build_utils.DeleteDirectory(extract_path) + build_utils.MakeDirectory(extract_path) + unzip_cmd = ['unzip', '-qq', zip_path, '-d', extract_path] + build_utils.CheckOutput(unzip_cmd) + +def main(): + parser = optparse.OptionParser() + build_utils.AddDepfileOption(parser) + parser.add_option('--zip', help='Zip file path.') + parser.add_option('--exdir', help='Extract files into exdir') + parser.add_option('--stamp', help='Path to touch on success.') + + options, _ = parser.parse_args() + + ExtractZip(options) + + if options.depfile: + build_utils.WriteDepfile(options.depfile, options.zip) + + if options.stamp: + build_utils.Touch(options.stamp) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/generate_secure_connect_rulesets.py b/generate_secure_connect_rulesets.py new file mode 100755 index 0000000..0b776de --- /dev/null +++ b/generate_secure_connect_rulesets.py @@ -0,0 +1,80 @@ +#! /usr/bin/python + +# +# Copyright (c) 2016 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# + +import xml.etree.ElementTree as ET +import sys +import os, glob, re +import argparse + +parser = argparse.ArgumentParser( + description="This script generates a ruleset file that contains mapping of HTTP URLs \ + to corresponding HTTPS URLs. The input is a directory containing XML files with ruleset \ + definitions. The output file is generated using Protocol Buffer compiler.") + +parser.add_argument('rules_dir', metavar='', nargs=1, + help='The input directory that contains ruleset definition XML files') + +parser.add_argument('output_file', metavar='', nargs=1, + help='The output file that the script will generate') +parser.add_argument('-v', '--verbose', type=int, default=[0], + nargs=1, help='Level of verbosity (default 0)') +parser.add_argument('-i', '--include', default=['.'], + nargs=1, help='Location of secure_connect_ruleset_pb2 package (default = current folder)') + +args = parser.parse_args() + +rules_dir = args.rules_dir[0]; +output_file = args.output_file[0]; +verbosity = args.verbose[0] +include_dir = args.include[0] + +sys.path.append(include_dir) + +import secure_connect_ruleset_pb2 + +files = glob.glob(rules_dir + '/*.xml') +ruleset_list = secure_connect_ruleset_pb2.RuleSetList() + +for file in files: + if verbosity > 0: + print "Parsing " + file + tree = ET.parse(file) + root = tree.getroot() + + if root.tag == 'ruleset': + if verbosity > 1: + print root.tag, root.attrib + ruleset = ruleset_list.ruleset.add() + ruleset.name = root.attrib['name'] + if 'default_off' in root.attrib.keys(): + ruleset.default_off = root.attrib['default_off'] + + for child in root: + if verbosity > 2: + print child.tag, child.attrib + if child.tag == 'target': + target = ruleset.targets.add() + target.host = child.attrib['host'] + + if child.tag == 'rule': + rule = ruleset.rules.add() + rule.regex = child.attrib['from'] + rule.to = child.attrib['to'] + + if child.tag == 'exclusion': + exclusion = ruleset.exclusions.add() + exclusion.pattern = child.attrib['pattern'] + + if child.tag == 'securecookie': + securecookie = ruleset.securecookies.add() + securecookie.host = child.attrib['host'] + securecookie.name = child.attrib['name'] + +output = open(output_file, "wb") +output.write(ruleset_list.SerializeToString()) +output.close() diff --git a/java/libswewebrefiner_java.jar b/java/libswewebrefiner_java.jar new file mode 100644 index 0000000..cc8dbb5 Binary files /dev/null and b/java/libswewebrefiner_java.jar differ diff --git a/java/libswewebrefiner_java.zip b/java/libswewebrefiner_java.zip new file mode 100644 index 0000000..48ba29b Binary files /dev/null and b/java/libswewebrefiner_java.zip differ diff --git a/secure_connect_ruleset_pb2.py b/secure_connect_ruleset_pb2.py new file mode 100644 index 0000000..35d997b --- /dev/null +++ b/secure_connect_ruleset_pb2.py @@ -0,0 +1,320 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: secure_connect_ruleset.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='secure_connect_ruleset.proto', + package='secure_connect', + syntax='proto2', + serialized_pb=_b('\n\x1csecure_connect_ruleset.proto\x12\x0esecure_connect\"\x16\n\x06Target\x12\x0c\n\x04host\x18\x01 \x02(\t\"!\n\x04Rule\x12\r\n\x05regex\x18\x01 \x02(\t\x12\n\n\x02to\x18\x02 \x02(\t\"\x1c\n\tExclusion\x12\x0f\n\x07pattern\x18\x01 \x02(\t\"*\n\x0cSecureCookie\x12\x0c\n\x04host\x18\x01 \x02(\t\x12\x0c\n\x04name\x18\x02 \x02(\t\"\xde\x01\n\x07RuleSet\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\'\n\x07targets\x18\x02 \x03(\x0b\x32\x16.secure_connect.Target\x12#\n\x05rules\x18\x03 \x03(\x0b\x32\x14.secure_connect.Rule\x12-\n\nexclusions\x18\x04 \x03(\x0b\x32\x19.secure_connect.Exclusion\x12\x33\n\rsecurecookies\x18\x05 \x03(\x0b\x32\x1c.secure_connect.SecureCookie\x12\x13\n\x0b\x64\x65\x66\x61ult_off\x18\x06 \x01(\t\"7\n\x0bRuleSetList\x12(\n\x07ruleset\x18\x01 \x03(\x0b\x32\x17.secure_connect.RuleSetB\x02H\x03') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_TARGET = _descriptor.Descriptor( + name='Target', + full_name='secure_connect.Target', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='host', full_name='secure_connect.Target.host', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=48, + serialized_end=70, +) + + +_RULE = _descriptor.Descriptor( + name='Rule', + full_name='secure_connect.Rule', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='regex', full_name='secure_connect.Rule.regex', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='to', full_name='secure_connect.Rule.to', index=1, + number=2, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=72, + serialized_end=105, +) + + +_EXCLUSION = _descriptor.Descriptor( + name='Exclusion', + full_name='secure_connect.Exclusion', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='pattern', full_name='secure_connect.Exclusion.pattern', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=107, + serialized_end=135, +) + + +_SECURECOOKIE = _descriptor.Descriptor( + name='SecureCookie', + full_name='secure_connect.SecureCookie', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='host', full_name='secure_connect.SecureCookie.host', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='secure_connect.SecureCookie.name', index=1, + number=2, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=137, + serialized_end=179, +) + + +_RULESET = _descriptor.Descriptor( + name='RuleSet', + full_name='secure_connect.RuleSet', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='secure_connect.RuleSet.name', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='targets', full_name='secure_connect.RuleSet.targets', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rules', full_name='secure_connect.RuleSet.rules', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='exclusions', full_name='secure_connect.RuleSet.exclusions', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='securecookies', full_name='secure_connect.RuleSet.securecookies', index=4, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='default_off', full_name='secure_connect.RuleSet.default_off', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=182, + serialized_end=404, +) + + +_RULESETLIST = _descriptor.Descriptor( + name='RuleSetList', + full_name='secure_connect.RuleSetList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ruleset', full_name='secure_connect.RuleSetList.ruleset', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=406, + serialized_end=461, +) + +_RULESET.fields_by_name['targets'].message_type = _TARGET +_RULESET.fields_by_name['rules'].message_type = _RULE +_RULESET.fields_by_name['exclusions'].message_type = _EXCLUSION +_RULESET.fields_by_name['securecookies'].message_type = _SECURECOOKIE +_RULESETLIST.fields_by_name['ruleset'].message_type = _RULESET +DESCRIPTOR.message_types_by_name['Target'] = _TARGET +DESCRIPTOR.message_types_by_name['Rule'] = _RULE +DESCRIPTOR.message_types_by_name['Exclusion'] = _EXCLUSION +DESCRIPTOR.message_types_by_name['SecureCookie'] = _SECURECOOKIE +DESCRIPTOR.message_types_by_name['RuleSet'] = _RULESET +DESCRIPTOR.message_types_by_name['RuleSetList'] = _RULESETLIST + +Target = _reflection.GeneratedProtocolMessageType('Target', (_message.Message,), dict( + DESCRIPTOR = _TARGET, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.Target) + )) +_sym_db.RegisterMessage(Target) + +Rule = _reflection.GeneratedProtocolMessageType('Rule', (_message.Message,), dict( + DESCRIPTOR = _RULE, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.Rule) + )) +_sym_db.RegisterMessage(Rule) + +Exclusion = _reflection.GeneratedProtocolMessageType('Exclusion', (_message.Message,), dict( + DESCRIPTOR = _EXCLUSION, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.Exclusion) + )) +_sym_db.RegisterMessage(Exclusion) + +SecureCookie = _reflection.GeneratedProtocolMessageType('SecureCookie', (_message.Message,), dict( + DESCRIPTOR = _SECURECOOKIE, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.SecureCookie) + )) +_sym_db.RegisterMessage(SecureCookie) + +RuleSet = _reflection.GeneratedProtocolMessageType('RuleSet', (_message.Message,), dict( + DESCRIPTOR = _RULESET, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.RuleSet) + )) +_sym_db.RegisterMessage(RuleSet) + +RuleSetList = _reflection.GeneratedProtocolMessageType('RuleSetList', (_message.Message,), dict( + DESCRIPTOR = _RULESETLIST, + __module__ = 'secure_connect_ruleset_pb2' + # @@protoc_insertion_point(class_scope:secure_connect.RuleSetList) + )) +_sym_db.RegisterMessage(RuleSetList) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('H\003')) +# @@protoc_insertion_point(module_scope) diff --git a/validate_secure_connect_rulesets.py b/validate_secure_connect_rulesets.py new file mode 100755 index 0000000..6af6e38 --- /dev/null +++ b/validate_secure_connect_rulesets.py @@ -0,0 +1,83 @@ +#! /usr/bin/python + +# +# Copyright (c) 2016 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# + +import sys +import os, glob, re +import argparse + +parser = argparse.ArgumentParser( + description="This script parses the ruleset file that contains mapping of HTTP URLs to corresponding \ + HTTPS URLs. The input is a file that was generated using Protocol Buffer compiler.") + +parser.add_argument('input_file', metavar='', nargs=1, + help='The input protobuf file that contains rulesets') +parser.add_argument('-v', '--verbose', type=int, default=[0], + nargs=1, help='Level of verbosity (default 0)') +parser.add_argument('-i', '--include', default=['.'], + nargs=1, help='Location of secure_connect_ruleset_pb2 package (default = current folder)') + +args = parser.parse_args() + +input_file = args.input_file[0]; +verbosity = args.verbose[0] +include_dir = args.include[0] + +sys.path.append(include_dir) + +import secure_connect_ruleset_pb2 + +ruleset_list = secure_connect_ruleset_pb2.RuleSetList() +try: + f = open(input_file, "rb") + ruleset_list.ParseFromString(f.read()) + f.close() +except IOError: + print input_file + ": Could not open file.." + exit() + +ruleset_count = 0 +ruleset_off = 0 +target_count = 0; +rule_count = 0; +exclusion_count = 0; +securecookie_count = 0; + +for ruleset in ruleset_list.ruleset: + if verbosity > 0: + print "Ruleset: ", ruleset.name.encode('ascii', 'ignore') + ruleset_count += 1 + if ruleset.HasField('default_off'): + ruleset_off += 1 + if verbosity > 1: + print "Off: ", ruleset.default_off + + for exclusion in ruleset.exclusions: + exclusion_count += 1 + + for securecookie in ruleset.securecookies: + securecookie_count += 1 + + for target in ruleset.targets: + target_count += 1 + if verbosity > 1: + print "Target: ", target.host.encode('ascii', 'ignore') + + for rule in ruleset.rules: + rule_count += 1 + if verbosity > 2: + print "Rule: regex ", rule.regex.encode('ascii', 'ignore') + print "Rule: to ", rule.to.encode('ascii', 'ignore') + +print "----------------------------------------------------" +print "Count: ", ruleset_count +print "Off: ", ruleset_off +print "Targets: ", target_count +print "Rules: ", rule_count +print "Exclusions: ", exclusion_count +print "SecureCookies: ", securecookie_count +print "----------------------------------------------------" diff --git a/web_refiner_vars.gni b/web_refiner_vars.gni index 877eb1a..e6b06b9 100644 --- a/web_refiner_vars.gni +++ b/web_refiner_vars.gni @@ -3,7 +3,7 @@ # Confidential and Proprietary - Qualcomm Technologies, Inc. declare_args() { - web_refiner_native_libs = [] - web_refiner_resource_dirs = [] - web_refiner_dependencies = [] + web_refiner_resource_dirs = [ "//components/web_refiner/extracted/res" ] + web_refiner_native_deps = [ "//components/web_refiner:libswewebrefiner" ] + web_refiner_java_deps = [ "//components/web_refiner:libswewebrefiner_java" ] }