author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
263,093
17.08.2017 15:57:56
-7,200
960f6fbf96c6e4d3681cc0de9b10e806ef20bd2f
Add metadata instead of HTTP code and exception
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -21,8 +21,6 @@ import requests\nfrom requests.exceptions import ConnectionError\nfrom .definitions import HTTP_STATUS_CODE_CREATED\n-from .definitions import HTTP_STATUS_CODE_CONFLICT\n-from .errors import TimelineExist\nclass TimesketchApi(object):\n@@ -156,8 +154,8 @@ class TimesketchApi(object):\nsketches.append(sketch_obj)\nreturn sketches\n- def get_timeline(self, searchindex_id):\n- \"\"\"Get a timeline (searchindex).\n+ def get_searchindex(self, searchindex_id):\n+ \"\"\"Get a searchindex.\nArgs:\nsearchindex_id: Primary key ID of the searchindex.\n@@ -167,8 +165,8 @@ class TimesketchApi(object):\n\"\"\"\nreturn SearchIndex(searchindex_id, api=self)\n- def list_timelines(self):\n- \"\"\"Get list of all timelines that the user has access to.\n+ def list_searchindices(self):\n+ \"\"\"Get list of all searchindices that the user has access to.\nReturns:\nList of SearchIndex object instances.\n@@ -183,36 +181,35 @@ class TimesketchApi(object):\nindices.append(index_obj)\nreturn indices\n- def create_timeline(self, timeline_name, index_name=None, public=False):\n- \"\"\"Create a new timeline (searchindex).\n+ def create_searchindex(\n+ self, searchindex_name, es_index_name=None, public=False):\n+ \"\"\"Create a new searchindex.\nArgs:\n- timeline_name: Name of the searchindex in Timesketch.\n- index_name: Name of the index in Elasticsearch.\n+ searchindex_name: Name of the searchindex in Timesketch.\n+ es_index_name: Name of the index in Elasticsearch.\npublic: Boolean indicating if the searchindex should be public.\nReturns:\nInstance of a SearchIndex object.\n\"\"\"\n- if not index_name:\n- index_name = uuid.uuid4().hex\n+ if not es_index_name:\n+ es_index_name = uuid.uuid4().hex\n- resource_url = u'{0:s}/timelines/'.format(self.api_root)\n+ resource_url = u'{0:s}/searchindices/'.format(self.api_root)\nform_data = {\n- u'timeline_name': timeline_name,\n- u'index_name': index_name,\n+ u'searchindex_name': searchindex_name,\n+ u'es_index_name': es_index_name,\nu'public': public\n}\nresponse = self.session.post(resource_url, json=form_data)\nif response.status_code != HTTP_STATUS_CODE_CREATED:\n- if response.status_code == HTTP_STATUS_CODE_CONFLICT:\n- raise TimelineExist()\n- raise RuntimeError(u'Error creating timeline')\n+ raise RuntimeError(u'Error creating searchindex')\nresponse_dict = response.json()\nsearchindex_id = response_dict[u'objects'][0][u'id']\n- return self.get_timeline(searchindex_id)\n+ return self.get_searchindex(searchindex_id)\nclass BaseResource(object):\n" }, { "change_type": "DELETE", "old_path": "api_client/python/timesketch_api_client/errors.py", "new_path": null, "diff": "-# Copyright 2017 Google Inc. All rights reserved.\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Timesketch API client errors.\"\"\"\n-\n-\n-class TimelineExist(Exception):\n- \"\"\"Raise exception if timeline already exists\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "timesketch/__init__.py", "new_path": "timesketch/__init__.py", "diff": "@@ -149,9 +149,9 @@ def create_app(config=None):\nTimelineResource,\nu'/sketches/<int:sketch_id>/timelines/<int:timeline_id>/')\napi_v1.add_resource(\n- SearchIndexListResource, u'/timelines/')\n+ SearchIndexListResource, u'/searchindices/')\napi_v1.add_resource(\n- SearchIndexResource, u'/timelines/<int:searchindex_id>/')\n+ SearchIndexResource, u'/searchindices/<int:searchindex_id>/')\napi_v1.add_resource(\nGraphResource,\nu'/sketches/<int:sketch_id>/explore/graph/')\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -52,7 +52,6 @@ from timesketch.lib.definitions import HTTP_STATUS_CODE_CREATED\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_BAD_REQUEST\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_FORBIDDEN\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_NOT_FOUND\n-from timesketch.lib.definitions import HTTP_STATUS_CODE_CONFLICT\nfrom timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.datastores.neo4j import Neo4jDataStore\nfrom timesketch.lib.errors import ApiHTTPError\n@@ -1270,20 +1269,21 @@ class SearchIndexListResource(ResourceMixin, Resource):\nA search index in JSON (instance of flask.wrappers.Response)\n\"\"\"\nform = SearchIndexForm.build(request)\n- timeline_name = form.timeline_name.data\n- index_name = form.index_name.data\n+ searchindex_name = form.searchindex_name.data\n+ es_index_name = form.es_index_name.data\npublic = form.public.data\nif form.validate_on_submit():\nsearchindex = SearchIndex.query.filter_by(\n- index_name=index_name).first()\n+ index_name=es_index_name).first()\n+ metadata = {u'created': True}\nif searchindex:\n- status_code = HTTP_STATUS_CODE_CONFLICT\n+ metadata[u'created'] = False\nelse:\nsearchindex = SearchIndex.get_or_create(\n- name=timeline_name, description=timeline_name,\n- user=current_user, index_name=index_name)\n+ name=searchindex_name, description=searchindex_name,\n+ user=current_user, index_name=es_index_name)\nsearchindex.grant_permission(\npermission=u'read', user=current_user)\n@@ -1292,15 +1292,14 @@ class SearchIndexListResource(ResourceMixin, Resource):\n# Create the index in Elasticsearch\nself.datastore.create_index(\n- index_name=index_name, doc_type=u'generic_event')\n+ index_name=es_index_name, doc_type=u'generic_event')\ndb_session.add(searchindex)\ndb_session.commit()\n- status_code = HTTP_STATUS_CODE_CREATED\n-\nreturn self.to_json(\n- searchindex, status_code=status_code)\n+ searchindex, meta=metadata,\n+ status_code=HTTP_STATUS_CODE_CREATED)\nreturn abort(HTTP_STATUS_CODE_BAD_REQUEST)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/definitions.py", "new_path": "timesketch/lib/definitions.py", "diff": "@@ -21,4 +21,3 @@ HTTP_STATUS_CODE_BAD_REQUEST = 400\nHTTP_STATUS_CODE_UNAUTHORIZED = 401\nHTTP_STATUS_CODE_FORBIDDEN = 403\nHTTP_STATUS_CODE_NOT_FOUND = 404\n-HTTP_STATUS_CODE_CONFLICT = 409\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/forms.py", "new_path": "timesketch/lib/forms.py", "diff": "@@ -213,8 +213,8 @@ class StoryForm(BaseForm):\nclass SearchIndexForm(BaseForm):\n\"\"\"Form to create a searchindex.\"\"\"\n- timeline_name = StringField(u'name', validators=[DataRequired()])\n- index_name = StringField(u'Index', validators=[DataRequired()])\n+ searchindex_name = StringField(u'name', validators=[DataRequired()])\n+ es_index_name = StringField(u'Index', validators=[DataRequired()])\npublic = BooleanField(\nu'Public', false_values={False, u'false', u''},\ndefault=False)\n" } ]
Python
Apache License 2.0
google/timesketch
Add metadata instead of HTTP code and exception
263,122
17.08.2017 17:22:14
-7,200
6de215d2ca8615d334c6d54ddccf78df35feb7f9
Make vagrant bootstrap script more idempotent.
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "#!/usr/bin/env bash\n+set -e\n+set -u\n# Generate random passwords for DB and session key\n-PSQL_PW=\"$(openssl rand -hex 32)\"\n-SECRET_KEY=\"$(openssl rand -hex 32)\"\n+if [ ! -f psql_pw ]; then\n+ openssl rand -hex 32 > psql_pw\n+fi\n+if [ ! -f secret_key ]; then\n+ openssl rand -hex 32 > secret_key\n+fi\n+\n+PSQL_PW=\"$(cat psql_pw)\"\n+SECRET_KEY=\"$(cat secret_key)\"\n# Setup GIFT PPA apt repository\nadd-apt-repository -y ppa:gift/stable\n@@ -12,9 +21,9 @@ apt-get update\napt-get install -y postgresql\napt-get install -y python-psycopg2\n-# Create DB user and database\n-echo \"create user timesketch with password '${PSQL_PW}';\" | sudo -u postgres psql\n-echo \"create database timesketch owner timesketch;\" | sudo -u postgres psql\n+# Create DB user and database if they don't yet exist\n+echo \"create user timesketch with password '${PSQL_PW}';\" | sudo -u postgres psql || true\n+echo \"create database timesketch owner timesketch;\" | sudo -u postgres psql || true\n# Configure PostgreSQL\nsudo -u postgres sh -c 'echo \"local all timesketch md5\" >> /etc/postgresql/9.5/main/pg_hba.conf'\n" } ]
Python
Apache License 2.0
google/timesketch
Make vagrant bootstrap script more idempotent.
263,122
17.08.2017 17:36:44
-7,200
bc2e2105bfa77b34984e95b04c270d6f7a2973fd
Increase memory and disk size in vagrant.
[ { "change_type": "MODIFY", "old_path": "vagrant/Vagrantfile", "new_path": "vagrant/Vagrantfile", "diff": "# Set VirtualBox as default provider\nENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'\n+unless Vagrant.has_plugin?(\"vagrant-disksize\")\n+ raise 'vagrant-disksize is not installed (\"vagrant plugin install vagrant-disksize\")'\n+end\n+\nVagrant.configure(2) do |config|\nconfig.vm.box = \"ubuntu/xenial64\"\n+ config.disksize.size = \"50GB\"\nconfig.vm.box_check_update = true\n# Access to Timesketch from the host\n@@ -21,7 +26,7 @@ Vagrant.configure(2) do |config|\n# VirtualBox configuration\nconfig.vm.provider \"virtualbox\" do |vb|\nvb.cpus = 2\n- vb.memory = 4096\n+ vb.memory = 8192\nend\n# Setup the system with a shell script\n" } ]
Python
Apache License 2.0
google/timesketch
Increase memory and disk size in vagrant.
263,122
18.08.2017 10:58:17
-7,200
d2897736f0b1804e9bb147d26ddf25361438a3ef
Move docs to repo.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "-## Timesketch\n-\n+# Timesketch\n[![Build Status](https://travis-ci.org/google/timesketch.svg?branch=master)](https://travis-ci.org/google/timesketch)\n+[![Version](https://img.shields.io/pypi/v/timesketch.svg)](https://pypi.python.org/pypi/timesketch)\nTimesketch is an open source tool for collaborative forensic timeline analysis. Using sketches you and your collaborators can easily organize your timelines and analyze them all at the same time. Add meaning to your raw data with rich annotations, comments, tags and stars.\n+## Getting started\n+\n+#### Installation\n+* [Install Timesketch manually](docs/Installation.md)\n+* [Use Vagrant](vagrant)\n+* [Use Docker](docker)\n+* [Upgrade from existing installation](docs/Upgrading.md)\n+\n+#### Adding timelines\n+* [Create timeline from JSON/CSV file](docs/CreateTimelineFromJSONorCSV.md)\n+* [Create timeline from Plaso file](docs/CreateTimelineFromPlaso.md)\n+* [Enable Plaso upload via HTTP](docs/EnablePlasoUpload.md)\n+\n+## Community\n+\n+* [Community guide](docs/Community-Guide.md)\n+\n+## Contributing\n+\n+* [Prerequisites](CONTRIBUTING.md)\n+* [Developers guide](docs/Developers-Guide.md)\n+\n+## Example\n![alt text](https://01dd8b4c-a-62cb3a1a-s-sites.googlegroups.com/site/timesketchforensics/about/Screen%20Shot%202016-07-22%20at%2010.33.27.png \"Timesketch\")\n---\n+---\n##### Obligatory Fine Print\nThis is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/Community-Guide.md", "diff": "+### Mailing lists\n+* User list: https://groups.google.com/forum/#!forum/timesketch-users\n+* Developer list: https://groups.google.com/forum/#!forum/timesketch-dev\n+\n+### IRC channel\n+We have a Timesketch channel (#timesketch) on the Freenode network.\n+Use your favorite IRC client or try the [Freenode web based IRC client](http://webchat.freenode.net/).\n+\n+### Slack community\n+Join the [Timesketch Slack community](https://timesketch.slack.com/) by sending an email to get-slack-invite@timesketch.org.\n+You will get an invite in your inbox as soon as soon as possible.\n+\n+**Why do I need to email you to get access to the Slack community?**\n+A: Because Slack doesn't have a \"Request access to this community\" feature and I need an email address to send the invite to. If you have a better idea than sending me (Johan) an email to get an invite please feel free to reach out via IRC (j4711 on freenode) or send a [Twitter DM](https://twitter.com/jberggren).\n+\n+\n+\n+\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/CreateTimelineFromJSONorCSV.md", "diff": "+# Create timeline from JSON/CSV file\n+\n+You can ingest timeline data from a JSON or CSV file. You can have any number of attributes/columns as you wish but there are some mandatory fields that Timeksketch needs in order to render the events in the UI.\n+\n+**Mandatory fields:**\n+* message\n+ - String with an informative message of the event\n+* timestamp\n+ - Timestamp as microseconds since Unix epoch\n+ - Ex: 1331698658276340\n+* datetime\n+ - ISO8601 format\n+ - Ex: 2015-07-24T19:01:01+00:00\n+* timestamp_desc\n+ - String explaining what type of timestamp it is. E.g file created\n+ - Ex: \"Time created\"\n+\n+## Example CSV file\n+You need to provide the CSV header with the column names as the first line in the file.\n+\n+ message,timestamp,datetime,timestamp_desc,extra_field_1,extra_field_2\n+ A message,1331698658276340,2015-07-24T19:01:01+00:00,Write time,foo,bar\n+ ...\n+\n+\n+## Example JSON file\n+NOTE: In order to import a file in JSON format we must read in the whole file in memory. This is not optimal if the file to be imported is big. In that case you should convert it to a CSV file and import that.\n+\n+ [\n+ {\n+ \"message\": \"A message\",\n+ \"timestamp\": 123456789,\n+ \"datetime\": \"2015-07-24T19:01:01+00:00\",\n+ \"timestamp_desc\": \"Write time\",\n+ \"extra_field_1\": \"foo\",\n+ \"extra_field_2\": \"bar\",\n+ },\n+ ...\n+ ]\n+\n+Then you can create a new Timesketch timeline from the file:\n+\n+ $ tsctl csv2ts --name my_timeline --file timeline.csv\n+ $ tsctl json2ts --name my_timeline --file timeline.json\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/CreateTimelineFromPlaso.md", "diff": "+# Create timeline from Plaso file\n+\n+You need to run version >= 1.5.0 Plaso on your Timesketch server. See the [official Plaso documentation](https://github.com/log2timeline/plaso/wiki/Ubuntu-Packaged-Release) for installing Plaso and it's dependencies. If you haven't installed Timesketch yet, take a look at the [installation instructions](Installation.md).\n+\n+When you have working installations of Timesketch and Plaso you can, from the command line, do:\n+\n+ $ psort.py -o timesketch -h\n+ Optional arguments for output modules:\n+ --name NAME The name of the timeline in Timesketch. Default:\n+ hostname if present in the storage file. If no\n+ hostname is found then manual input is used.\n+ --index INDEX The name of the Elasticsearch index. Default: Generate\n+ a random UUID\n+ --flush_interval FLUSH_INTERVAL\n+ The number of events to queue up before sent in bulk\n+ to Elasticsearch. Default: 1000\n+\n+All of the above arguments are optional. If you don't provide a name for your timeline the module will try to extract the hostname from the Plaso storage file and if this fails it will prompt you to enter a name.\n+\n+So all that is needed is:\n+\n+ $ psort.py -o timesketch dump.plaso\n+ [INFO] Timeline name: machine1\n+ [INFO] Index: 206a36873cc140c1958a7d20fcd14dba\n+ [INFO] Starting new HTTP connection (1): 192.168.34.19\n+ [INFO] Adding events to Timesketch..\n+ ...\n+ [INFO] Output processing is done.\n+ [INFO]\n+ *********************************** Counter ************************************\n+ [INFO] Stored Events : 9022\n+ [INFO] Events Included : 9022\n+ [INFO] Duplicate Removals : 1\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/EnablePlasoUpload.md", "diff": "+# Enable Plaso upload via HTTP\n+\n+To enable uploading and processing of Plaso storage files, there are a couple of things to do.\n+\n+**Install Plaso**\n+\n+NOTE: Due to changes in the format of the Plaso storage file you need to run the latest version of Plaso (>=1.5.0).\n+\n+Following the official Plaso documentation:\n+https://github.com/log2timeline/plaso/wiki/Ubuntu-Packaged-Release\n+\n+ $ sudo add-apt-repository universe\n+ $ sudo add-apt-repository ppa:gift/dev\n+ $ sudo apt-get update\n+ $ sudo apt-get install python-plaso\n+\n+**Install Redis**\n+\n+ $ sudo apt-get install redis-server\n+\n+**Configure Timesketch** (/etc/timesketch.conf)\n+\n+ UPLOAD_ENABLED = True\n+ UPLOAD_FOLDER = u'/path/to/where/timesketch/can/write/files'\n+ CELERY_BROKER_URL='redis://127.0.0.1:6379',\n+ CELERY_RESULT_BACKEND='redis://127.0.0.1:6379'\n+\n+**Run a Celery worker process**\n+\n+ $ celery -A timesketch.lib.tasks worker --loglevel=info\n+\n+Read on how to run the Celery worker in the background over at the [official Celery documentation](http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html#daemonizing).\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/Installation.md", "diff": "+### Note: If you are upgrading from a previous Timesketch release, please see the [upgrading guide](Upgrading.md) instead.\n+\n+# Install Timesketch from scratch\n+\n+#### Install Ubuntu\n+This installation guide is based on Ubuntu 16.04LTS Server edition. Follow the installation guide for Ubuntu and install the base system.\n+After the installation is done, login and update the system.\n+\n+ $ sudo apt-get update\n+ $ sudo apt-get dist-upgrade\n+\n+#### Install Elasticsearch\n+\n+Install Java\n+\n+ $ sudo apt-get install openjdk-8-jre-headless\n+ $ sudo apt-get install apt-transport-https\n+\n+Install the latest Elasticsearch 2.x release (5.x is not yet supported):\n+\n+ $ wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.3/elasticsearch-2.4.3.deb\n+ $ sudo dpkg -i elasticsearch-2.4.3.deb\n+\n+**Configure Elasticsearch**\n+\n+This is up to your specific environment, but if you run elasticsearch on the same host as Timesketch you should lock it down to only listen to localhost.\n+The configuration for Elasticsearch is located in /etc/elasticsearch/elasticsearch.yml\n+\n+You need to deploy two Groovy scripts. Copy the following two files to /etc/elasticsearch/scripts/:\n+\n+ https://raw.githubusercontent.com/google/timesketch/master/contrib/add_label.groovy\n+ https://raw.githubusercontent.com/google/timesketch/master/contrib/toggle_label.groovy\n+\n+Make sure that Elasticsearch is started on boot:\n+\n+ /bin/systemctl daemon-reload\n+ /bin/systemctl enable elasticsearch.service\n+ /bin/systemctl start elasticsearch.service\n+\n+#### Install PostgreSQL\n+\n+ $ sudo apt-get install postgresql\n+ $ sudo apt-get install python-psycopg2\n+\n+**Configure PostgreSQL**\n+\n+ $ sudo vim /etc/postgresql/9.5/main/pg_hba.conf\n+\n+Configure PostgreSQL to allow the timesketch user to authenticate and use the database:\n+\n+ local all timesketch md5\n+\n+Then you need to restart PostgreSQL:\n+\n+ $ sudo /etc/init.d/postgresql restart\n+\n+#### Install Timesketch\n+\n+Now it is time to install Timesketch. First we need to install some dependencies:\n+\n+ $ sudo apt-get install python-pip python-dev libffi-dev\n+\n+Then install Timesketch itself:\n+\n+ $ sudo pip install timesketch\n+\n+**Configure Timesketch**\n+\n+Copy the configuration file to /etc and configure it. The file is well commented and it should be pretty straight forward.\n+\n+ $ sudo cp /usr/local/share/timesketch/timesketch.conf /etc/\n+ $ sudo chmod 600 /etc/timesketch.conf\n+\n+Generate a secret key and configure SECRET_KEY in /etc/timesketch.conf\n+\n+ $ openssl rand -base64 32\n+\n+Create SQL database user and database:\n+\n+ $ sudo -u postgres createuser -d -P -R -S timesketch\n+ $ sudo -u postgres createdb -O timesketch timesketch\n+\n+In the timesketch.conf file, edit the follwing using the username and password you used in the previous step:\n+\n+ SQLALCHEMY_DATABASE_URI = u'postgresql://<USERNAME>:<PASSWORD>@localhost/timesketch'\n+\n+Add the first user\n+\n+ $ tsctl add_user -u <username>\n+\n+Start the HTTP server (**NOTE: This is unencrypted. Use SSL for production deployments**):\n+\n+ $ tsctl runserver -h 0.0.0.0 -p 5000\n+\n+Go to http://<SERVER IP>:5000/\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docs/Upgrading.md", "diff": "+# Upgrade an existing Timesketch installation\n+\n+When upgrading Timesketch you might need to migrate the database to use the latest database schema. This is how you do that.\n+\n+## Backup you database (!)\n+First you should backup your current database in case something goes wrong in the upgrade process. For PostgreSQL you do the following (Ref: https://www.postgresql.org/docs/9.1/static/backup.html):\n+\n+ $ sudo -u postgres pg_dump timesketch > ~/timesketch-db.sql\n+ $ sudo -u postgres pg_dumpall > ~/timesketch-db-all.sql\n+\n+## Upgrade timesketch\n+\n+ $ pip install timesketch --upgrade\n+\n+Or, if you are installing from the master branch:\n+\n+ $ git clone https://github.com/google/timesketch.git\n+ $ cd timesketch\n+ $ pip install . --upgrade\n+\n+## Upgrade the database schema\n+Have you backed up your database..? good. Let's upgrade the schema:\n+\n+ $ git clone https://github.com/google/timesketch.git\n+ $ cd timesketch/timesketch\n+ $ tsctl db upgrade\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "vagrant/README.md", "diff": "+# Vagrant\n+\n+Timesketch has support for Vagrant. This is a convenient way of getting up and running with Timesketch development, or just to test Timesketch.\n+\n+1. Install VirtualBox for your operating system\n+2. Install Vagrant for your operating system\n+3. Clone the Timesketch repository\n+4. Create your Timesketch box\n+\n+### Install VirtualBox\n+Follow the official instructions [here](https://www.virtualbox.org/wiki/Downloads)\n+\n+### Install Vagrant\n+Follow the official instructions [here](https://www.vagrantup.com/docs/installation/)\n+\n+### Clone Timesketch\n+ $ git clone https://github.com/google/timesketch.git\n+\n+### Create Timesketch Vagrant box\n+ $ cd timesketch/vagrant\n+ $ vagrant up\n+ .. wait until the installation process is complete\n+ $ vagrant ssh\n+ $ tsctl runserver -h 0.0.0.0\n+\n+### Access Timesketch\n+* Got to: http://127.0.0.1:5000/\n+* Login: spock/spock\n+\n+### How to test your installation\n+1. You can now create your first sketch by pressing the green button on the middle of the page\n+2. Add the test timeline under the [Timeline](http://127.0.0.1:5000/sketch/1/timelines/) tab in your new sketch\n+3. Go to http://127.0.0.1:5000/explore/ and have fun exploring!\n+\n+## Development\n+The Timesketch source is installed in development mode (using pip install -e ..) so you can use your favourite text editor to edit the source code and it will be automatically reflected in your Vagrant box.\n" } ]
Python
Apache License 2.0
google/timesketch
Move docs to repo.
263,093
21.08.2017 14:33:17
-7,200
690bfdbced3de27b5a7f7e9804fb23ee39540689
Create timeline API endpoint and refactoring
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -21,6 +21,7 @@ import requests\nfrom requests.exceptions import ConnectionError\nfrom .definitions import HTTP_STATUS_CODE_CREATED\n+from .definitions import HTTP_STATUS_CODE_20X\nclass TimesketchApi(object):\n@@ -165,22 +166,6 @@ class TimesketchApi(object):\n\"\"\"\nreturn SearchIndex(searchindex_id, api=self)\n- def list_searchindices(self):\n- \"\"\"Get list of all searchindices that the user has access to.\n-\n- Returns:\n- List of SearchIndex object instances.\n- \"\"\"\n- indices = []\n- response = self.fetch_resource_data(u'timelines/')\n- for index in response[u'objects'][0]:\n- index_id = index[u'id']\n- index_name = index[u'name']\n- index_obj = SearchIndex(\n- searchindex_id=index_id, api=self, searchindex_name=index_name)\n- indices.append(index_obj)\n- return indices\n-\ndef create_searchindex(\nself, searchindex_name, es_index_name=None, public=False):\n\"\"\"Create a new searchindex.\n@@ -211,6 +196,22 @@ class TimesketchApi(object):\nsearchindex_id = response_dict[u'objects'][0][u'id']\nreturn self.get_searchindex(searchindex_id)\n+ def list_searchindices(self):\n+ \"\"\"Get list of all searchindices that the user has access to.\n+\n+ Returns:\n+ List of SearchIndex object instances.\n+ \"\"\"\n+ indices = []\n+ response = self.fetch_resource_data(u'searchindices/')\n+ for index in response[u'objects'][0]:\n+ index_id = index[u'id']\n+ index_name = index[u'name']\n+ index_obj = SearchIndex(\n+ searchindex_id=index_id, api=self, searchindex_name=index_name)\n+ indices.append(index_obj)\n+ return indices\n+\nclass BaseResource(object):\n\"\"\"Base resource object.\"\"\"\n@@ -364,6 +365,34 @@ class Sketch(BaseResource):\n)\nreturn timeline_obj\n+ def add_timeline(self, searchindex):\n+ \"\"\"Add timeline to sketch.\n+\n+ Args:\n+ searchindex: SearchIndex object instance.\n+\n+ Returns:\n+ Timeline object instance.\n+ \"\"\"\n+ resource_url = u'{0:s}/sketches/{1:d}/timelines/'.format(\n+ self.api.api_root, self.id)\n+ form_data = {u'timeline': searchindex.id}\n+ response = self.api.session.post(resource_url, json=form_data)\n+\n+ if response.status_code not in HTTP_STATUS_CODE_20X:\n+ raise RuntimeError(u'Failed adding timeline')\n+\n+ response_dict = response.json()\n+ timeline = response_dict[u'objects'][0]\n+ timeline_obj = Timeline(\n+ timeline_id=timeline[u'id'],\n+ sketch_id=self.id,\n+ api=self.api,\n+ name=timeline[u'name'],\n+ searchindex=timeline[u'searchindex'][u'index_name']\n+ )\n+ return timeline_obj\n+\ndef explore(self, query_string=None, query_dsl=None, query_filter=None,\nview=None):\n\"\"\"Explore the sketch.\n@@ -424,7 +453,7 @@ class SearchIndex(BaseResource):\n\"\"\"\nself.id = searchindex_id\nself._searchindex_name = searchindex_name\n- self._resource_uri = u'timelines/{0:d}'.format(self.id)\n+ self._resource_uri = u'searchindices/{0:d}'.format(self.id)\nsuper(SearchIndex, self).__init__(\napi=api, resource_uri=self._resource_uri)\n" }, { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/definitions.py", "new_path": "api_client/python/timesketch_api_client/definitions.py", "diff": "@@ -23,3 +23,6 @@ HTTP_STATUS_CODE_UNAUTHORIZED = 401\nHTTP_STATUS_CODE_FORBIDDEN = 403\nHTTP_STATUS_CODE_NOT_FOUND = 404\nHTTP_STATUS_CODE_CONFLICT = 409\n+\n+# Convenient buckets of return code families\n+HTTP_STATUS_CODE_20X = [HTTP_STATUS_CODE_OK, HTTP_STATUS_CODE_CREATED]\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -55,7 +55,7 @@ from timesketch.lib.definitions import HTTP_STATUS_CODE_NOT_FOUND\nfrom timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.datastores.neo4j import Neo4jDataStore\nfrom timesketch.lib.errors import ApiHTTPError\n-from timesketch.lib.forms import AddTimelineForm\n+from timesketch.lib.forms import AddTimelineSimpleForm\nfrom timesketch.lib.forms import AggregationForm\nfrom timesketch.lib.forms import SaveViewForm\nfrom timesketch.lib.forms import NameDescriptionForm\n@@ -323,48 +323,6 @@ class SketchResource(ResourceMixin, Resource):\n])\nreturn self.to_json(sketch, meta=meta)\n- @login_required\n- def post(self, sketch_id):\n- \"\"\"Handles POST request to the resource.\n-\n- Returns:\n- A sketch in JSON (instance of flask.wrappers.Response)\n-\n- Raises:\n- ApiHTTPError\n- \"\"\"\n- sketch = Sketch.query.get_with_acl(sketch_id)\n- searchindices_in_sketch = [t.searchindex.id for t in sketch.timelines]\n- indices = SearchIndex.all_with_acl(\n- current_user).order_by(\n- desc(SearchIndex.created_at)).filter(\n- not_(SearchIndex.id.in_(searchindices_in_sketch)))\n-\n- add_timeline_form = AddTimelineForm.build(request)\n- add_timeline_form.timelines.choices = set(\n- (i.id, i.name) for i in indices.all())\n-\n- if add_timeline_form.validate_on_submit():\n- if not sketch.has_permission(current_user, u'write'):\n- abort(HTTP_STATUS_CODE_FORBIDDEN)\n- for searchindex_id in add_timeline_form.timelines.data:\n- searchindex = SearchIndex.query.get_with_acl(searchindex_id)\n- if searchindex not in [t.searchindex for t in sketch.timelines]:\n- _timeline = Timeline(\n- name=searchindex.name,\n- description=searchindex.description,\n- sketch=sketch,\n- user=current_user,\n- searchindex=searchindex)\n- db_session.add(_timeline)\n- sketch.timelines.append(_timeline)\n- db_session.commit()\n- return self.to_json(sketch, status_code=HTTP_STATUS_CODE_CREATED)\n- else:\n- raise ApiHTTPError(\n- message=add_timeline_form.errors,\n- status_code=HTTP_STATUS_CODE_BAD_REQUEST)\n-\nclass ViewListResource(ResourceMixin, Resource):\n\"\"\"Resource to create a View.\"\"\"\n@@ -1171,6 +1129,48 @@ class TimelineListResource(ResourceMixin, Resource):\nsketch = Sketch.query.get_with_acl(sketch_id)\nreturn self.to_json(sketch.timelines)\n+ @login_required\n+ def post(self, sketch_id):\n+ \"\"\"Handles POST request to the resource.\n+\n+ Returns:\n+ A sketch in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+ form = AddTimelineSimpleForm.build(request)\n+ metadata = {u'created': True}\n+\n+ searchindex_id = form.timeline.data\n+ searchindex = SearchIndex.query.get_with_acl(searchindex_id)\n+ timeline_id = [\n+ t.searchindex.id for t in sketch.timelines\n+ if t.searchindex.id == searchindex_id\n+ ]\n+\n+ if form.validate_on_submit():\n+ if not sketch.has_permission(current_user, u'write'):\n+ abort(HTTP_STATUS_CODE_FORBIDDEN)\n+\n+ if not timeline_id:\n+ return_code = HTTP_STATUS_CODE_CREATED\n+ timeline = Timeline(\n+ name=searchindex.name,\n+ description=searchindex.description,\n+ sketch=sketch,\n+ user=current_user,\n+ searchindex=searchindex)\n+ sketch.timelines.append(timeline)\n+ db_session.add(timeline)\n+ db_session.commit()\n+ else:\n+ metadata[u'created'] = False\n+ return_code = HTTP_STATUS_CODE_OK\n+ timeline = Timeline.query.get(timeline_id)\n+\n+ return self.to_json(\n+ timeline, meta=metadata, status_code=return_code)\n+ return abort(HTTP_STATUS_CODE_BAD_REQUEST)\n+\nclass TimelineResource(ResourceMixin, Resource):\n\"\"\"Resource to get timeline.\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources_test.py", "new_path": "timesketch/api/v1/resources_test.py", "diff": "@@ -18,6 +18,7 @@ import json\nimport mock\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_CREATED\n+from timesketch.lib.definitions import HTTP_STATUS_CODE_OK\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_BAD_REQUEST\nfrom timesketch.lib.testlib import BaseTest\nfrom timesketch.lib.testlib import MockDataStore\n@@ -68,15 +69,6 @@ class SketchResourceTest(BaseTest):\nresponse = self.client.get(u'/api/v1/sketches/2/')\nself.assert403(response)\n- def test_add_timeline_resource(self):\n- \"\"\"Authenticated request to add a timeline to a sketch.\"\"\"\n- self.login()\n- data = dict(timelines=[1])\n- response = self.client.post(\n- u'/api/v1/sketches/3/', data=json.dumps(data, ensure_ascii=False),\n- content_type=u'application/json')\n- self.assertEquals(response.status_code, HTTP_STATUS_CODE_CREATED)\n-\nclass ViewListResourceTest(BaseTest):\n\"\"\"Test ViewListResource.\"\"\"\n@@ -299,16 +291,40 @@ class EventAnnotationResourceTest(BaseTest):\nclass SearchIndexResourceTest(BaseTest):\n\"\"\"Test SearchIndexResource.\"\"\"\n- resource_url = u'/api/v1/timelines/'\n+ resource_url = u'/api/v1/searchindices/'\n@mock.patch(\nu'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_post_create_searchindex(self):\n\"\"\"Authenticated request to create a searchindex.\"\"\"\nself.login()\n- data = dict(timeline_name=u'test2', index_name=u'test2', public=False)\n+ data = dict(\n+ searchindex_name=u'test2', es_index_name=u'test2', public=False)\nresponse = self.client.post(\nself.resource_url, data=json.dumps(data),\ncontent_type=u'application/json')\nself.assertIsInstance(response.json, dict)\nself.assertEquals(response.status_code, HTTP_STATUS_CODE_CREATED)\n+\n+\n+class TimelineListResourceTest(BaseTest):\n+ \"\"\"Test TimelineList resource.\"\"\"\n+ resource_url = u'/api/v1/sketches/1/timelines/'\n+\n+ def test_add_existing_timeline_resource(self):\n+ \"\"\"Authenticated request to add a timeline to a sketch.\"\"\"\n+ self.login()\n+ data = dict(timeline=1)\n+ response = self.client.post(\n+ self.resource_url, data=json.dumps(data, ensure_ascii=False),\n+ content_type=u'application/json')\n+ self.assertEquals(response.status_code, HTTP_STATUS_CODE_OK)\n+\n+ def test_add_new_timeline_resource(self):\n+ \"\"\"Authenticated request to add a timeline to a sketch.\"\"\"\n+ self.login()\n+ data = dict(timeline=2)\n+ response = self.client.post(\n+ self.resource_url, data=json.dumps(data, ensure_ascii=False),\n+ content_type=u'application/json')\n+ self.assertEquals(response.status_code, HTTP_STATUS_CODE_CREATED)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/forms.py", "new_path": "timesketch/lib/forms.py", "diff": "@@ -91,6 +91,11 @@ class AddTimelineForm(BaseForm):\ntimelines = MultiCheckboxField(u'Timelines', coerce=int)\n+class AddTimelineSimpleForm(BaseForm):\n+ \"\"\"Form to add timelines to a sketch.\"\"\"\n+ timeline = IntegerField(u'Timeline', validators=[DataRequired()])\n+\n+\nclass UsernamePasswordForm(BaseForm):\n\"\"\"Form with username and password fields. Use in the login form.\"\"\"\nusername = StringField(u'Email', validators=[DataRequired()])\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/testlib.py", "new_path": "timesketch/lib/testlib.py", "diff": "@@ -414,6 +414,8 @@ class BaseTest(TestCase):\nself.searchindex = self._create_searchindex(\nname=u'test', user=self.user1, acl=True)\n+ self.searchindex2 = self._create_searchindex(\n+ name=u'test2', user=self.user1, acl=True)\nself.timeline = self._create_timeline(\nname=u'Timeline 1', sketch=self.sketch1,\n" } ]
Python
Apache License 2.0
google/timesketch
Create timeline API endpoint and refactoring
263,093
21.08.2017 15:11:28
-7,200
222b13da47227cde5640743fd648ed179cd35cd2
Custom error message for HTTP 400 requests
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -76,6 +76,20 @@ from timesketch.models.sketch import SearchTemplate\nfrom timesketch.models.story import Story\n+def bad_request(message):\n+ \"\"\"Function to set custom error message for HTTP 400 requests.\n+\n+ Args:\n+ message: Message as string to return to the client.\n+\n+ Returns: Response object (instance of flask.wrappers.Response)\n+\n+ \"\"\"\n+ response = jsonify({u'message': message})\n+ response.status_code = HTTP_STATUS_CODE_BAD_REQUEST\n+ return response\n+\n+\nclass ResourceMixin(object):\n\"\"\"Mixin for API resources.\"\"\"\n# Schemas for database model resources\n@@ -447,7 +461,6 @@ class ViewListResource(ResourceMixin, Resource):\nreturn view\n-\n@login_required\ndef get(self, sketch_id):\n\"\"\"Handles GET request to the resource.\n" } ]
Python
Apache License 2.0
google/timesketch
Custom error message for HTTP 400 requests
263,093
23.08.2017 00:46:23
-7,200
b801d0c7cc0cb81fa5941352483fe6f6fb47b926
Fix linter errors with pylint 1.7.x and update Dev dependencies in Vagrant
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "\"\"\"Timesketch API client.\"\"\"\nimport json\n+from uuid import uuid4\nimport BeautifulSoup\nimport requests\nfrom requests.exceptions import ConnectionError\n-from uuid import uuid4\nclass TimesketchApi(object):\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -396,8 +396,6 @@ class ViewListResource(ResourceMixin, Resource):\nquery_filter = json.dumps(form.filter.data, ensure_ascii=False),\nquery_dsl = json.dumps(form.dsl.data, ensure_ascii=False)\n- # WTF forms turns the filter into a tuple for some reason.\n- # pylint: disable=redefined-variable-type\nif isinstance(query_filter, tuple):\nquery_filter = query_filter[0]\n@@ -428,7 +426,6 @@ class ViewListResource(ResourceMixin, Resource):\nif query_filter_dict.get(u'indices', None):\nquery_filter_dict[u'indices'] = u'_all'\n- # pylint: disable=redefined-variable-type\nquery_filter = json.dumps(query_filter_dict, ensure_ascii=False)\nsearchtemplate = SearchTemplate(\n@@ -992,6 +989,7 @@ class UploadFileResource(ResourceMixin, Resource):\ntask_id=index_name)\n# Return Timeline if it was created.\n+ # pylint: disable=no-else-return\nif timeline:\nreturn self.to_json(\ntimeline, status_code=HTTP_STATUS_CODE_CREATED)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastore.py", "new_path": "timesketch/lib/datastore.py", "diff": "@@ -22,7 +22,7 @@ class DataStore(object):\n__metaclass__ = abc.ABCMeta\n@abc.abstractmethod\n- def search(self, sketch_id, query, query_filter, query_dsl, indices,\n+ def search(self, sketch_id, query_string, query_filter, query_dsl, indices,\naggregations, return_results, return_fields, enable_scroll):\n\"\"\"Return search results.\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/elastic.py", "new_path": "timesketch/lib/datastores/elastic.py", "diff": "@@ -332,7 +332,6 @@ class ElasticsearchDataStore(datastore.DataStore):\ntry:\ndoc[u'_source'][u'timesketch_label']\nexcept KeyError:\n- # pylint: disable=redefined-variable-type\ndoc = {u'doc': {u'timesketch_label': []}}\nself.client.update(\nindex=searchindex_id,\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -71,7 +71,6 @@ class Neo4jDataStore(object):\nDictionary with formatted query result\n\"\"\"\ndata_content = DATA_GRAPH\n- # pylint: disable=redefined-variable-type\nif return_rows:\ndata_content = True\nquery_result = self.client.query(query, data_contents=data_content)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/testlib.py", "new_path": "timesketch/lib/testlib.py", "diff": "@@ -118,16 +118,8 @@ class MockDataStore(datastore.DataStore):\nself.host = host\nself.port = port\n- def search(self,\n- unused_sketch_id,\n- unused_query,\n- unused_query_filter,\n- unused_query_dsl,\n- unused_indices,\n- aggregations,\n- return_results,\n- return_fields=None,\n- enable_scroll=False):\n+ # pylint: disable=arguments-differ,unused-argument\n+ def search(self, *args, **kwargs):\n\"\"\"Mock a search query.\nReturns:\n@@ -135,7 +127,8 @@ class MockDataStore(datastore.DataStore):\n\"\"\"\nreturn self.search_result_dict\n- def get_event(self, unused_searchindex_id, unused_event_id):\n+ # pylint: disable=arguments-differ,unused-argument\n+ def get_event(self, *args, **kwargs):\n\"\"\"Mock returning a single event from the datastore.\nReturns:\n" }, { "change_type": "MODIFY", "old_path": "timesketch/models/acl.py", "new_path": "timesketch/models/acl.py", "diff": "@@ -160,10 +160,10 @@ class AccessControlMixin(object):\n# If user doesn't have a direct ACE, check group permission.\nif (user and check_group) and not ace:\ngroup_intersection = set(user.groups) & set(self.groups)\n- for group in group_intersection:\n+ for _group in group_intersection:\n# Get group ACE with the requested permission.\nace = self.AccessControlEntry.query.filter_by(\n- group=group, permission=permission, parent=self).all()\n+ group=_group, permission=permission, parent=self).all()\nif ace:\nreturn ace\nreturn ace\n" }, { "change_type": "MODIFY", "old_path": "utils/pylintrc", "new_path": "utils/pylintrc", "diff": "@@ -72,7 +72,7 @@ load-plugins=\n# W1201: Specify string format arguments as logging function parameters\n# W0201: Variables defined initially outside the scope of __init__ (reconsider this, added by Kristinn).\n#disable=C0103,C0111,C0302,F0401,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0924,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0703,W1201,W0201\n-disable=C0103,C0302,F0401,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0924,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0703,W1201,W0201,R0401,no-member\n+disable=C0103,C0302,F0401,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0924,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0703,W1201,W0201,R0401,no-member,useless-super-delegation\n[REPORTS]\n" }, { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -35,7 +35,7 @@ pip install -e /usr/local/src/timesketch/\npip install gunicorn\n# Timesketch development dependencies\n-pip install pylint nose flask-testing coverage\n+pip install pylint nose flask-testing coverage mock BeautifulSoup\n# Initialize Timesketch\nmkdir -p /var/lib/timesketch/\n" } ]
Python
Apache License 2.0
google/timesketch
Fix linter errors with pylint 1.7.x and update Dev dependencies in Vagrant
263,093
23.08.2017 15:55:10
-7,200
374104195bfc7e92267db4732e0c306b8103ac34
Fix resource url
[ { "change_type": "MODIFY", "old_path": "timesketch/__init__.py", "new_path": "timesketch/__init__.py", "diff": "@@ -148,9 +148,9 @@ def create_app(config=None):\napi_v1.add_resource(\nTimelineResource,\nu'/sketches/<int:sketch_id>/timelines/<int:timeline_id>/')\n- api_v1.add_resource(SearchIndexListResource, u'/timelines/')\n+ api_v1.add_resource(SearchIndexListResource, u'/searchindices/')\napi_v1.add_resource(SearchIndexResource,\n- u'/timelines/<int:searchindex_id>/')\n+ u'/searchindices/<int:searchindex_id>/')\napi_v1.add_resource(GraphResource,\nu'/sketches/<int:sketch_id>/explore/graph/')\n" } ]
Python
Apache License 2.0
google/timesketch
Fix resource url
263,122
23.08.2017 18:32:25
-7,200
373e239b4cd979255d3830366cef4604db868cf2
Collapse apt-get and pip invocations in bootstrap.sh
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "set -e\nset -u\n+# Setup GIFT PPA apt repository\n+add-apt-repository -y ppa:gift/stable\n+\n+# Add Elasticsearch 5.x repo\n+apt-get install -y apt-transport-https\n+wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -\n+echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | tee -a /etc/apt/sources.list.d/elastic-5.x.list\n+\n+# Add Neo4j repo\n+wget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -\n+echo \"deb https://debian.neo4j.org/repo stable/\" | tee /etc/apt/sources.list.d/neo4j.list\n+\n+# Install apt dependencies\n+apt-get update\n+apt-get install -y neo4j openjdk-8-jre-headless elasticsearch postgresql \\\n+ python-psycopg2 python-pip python-dev libffi-dev redis-server python-plaso\n+\n+# Install Timesketch + python dependencies\n+pip install --upgrade pip\n+pip install -e /usr/local/src/timesketch/\n+pip install gunicorn pylint nose flask-testing coverage mock BeautifulSoup\n+\n# Generate random passwords for DB and session key\nif [ ! -f psql_pw ]; then\nopenssl rand -hex 32 > psql_pw\n@@ -13,14 +35,6 @@ fi\nPSQL_PW=\"$(cat psql_pw)\"\nSECRET_KEY=\"$(cat secret_key)\"\n-# Setup GIFT PPA apt repository\n-add-apt-repository -y ppa:gift/stable\n-apt-get update\n-\n-# Install PostgreSQL\n-apt-get install -y postgresql\n-apt-get install -y python-psycopg2\n-\n# Create DB user and database if they don't yet exist\necho \"create user timesketch with password '${PSQL_PW}';\" | sudo -u postgres psql || true\necho \"create database timesketch owner timesketch;\" | sudo -u postgres psql || true\n@@ -28,15 +42,6 @@ echo \"create database timesketch owner timesketch;\" | sudo -u postgres psql || t\n# Configure PostgreSQL\nsudo -u postgres sh -c 'echo \"local all timesketch md5\" >> /etc/postgresql/9.5/main/pg_hba.conf'\n-# Install Timesketch\n-apt-get install -y python-pip python-dev libffi-dev redis-server\n-pip install --upgrade pip\n-pip install -e /usr/local/src/timesketch/\n-pip install gunicorn\n-\n-# Timesketch development dependencies\n-pip install pylint nose flask-testing coverage mock BeautifulSoup\n-\n# Initialize Timesketch\nmkdir -p /var/lib/timesketch/\nchown ubuntu /var/lib/timesketch\n@@ -50,16 +55,6 @@ mv /etc/timesketch.conf.new /etc/timesketch.conf\nsed s/\"timesketch:foobar@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\nmv /etc/timesketch.conf.new /etc/timesketch.conf\n-# Java is needed for Elasticsearch\n-apt-get install -y openjdk-8-jre-headless\n-\n-# Install Elasticsearch 5.x\n-apt-get install -y apt-transport-https\n-wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -\n-echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | tee -a /etc/apt/sources.list.d/elastic-5.x.list\n-apt-get update\n-apt-get install -y elasticsearch\n-\n# Copy groovy scripts\ncp /usr/local/src/timesketch/contrib/*.groovy /etc/elasticsearch/scripts/\n@@ -68,9 +63,6 @@ cp /usr/local/src/timesketch/contrib/*.groovy /etc/elasticsearch/scripts/\n/bin/systemctl enable elasticsearch.service\n/bin/systemctl start elasticsearch.service\n-# Install Plaso\n-apt-get install -y python-plaso\n-\n# Enable Celery task manager (for uploads)\nmkdir -p /var/{lib,log,run}/celery\nchown ubuntu /var/{lib,log,run}/celery\n@@ -80,12 +72,6 @@ cp /vagrant/celery.conf /etc/\n/bin/systemctl enable celery.service\n/bin/systemctl start celery.service\n-# Install Neo4j graph database\n-wget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -\n-echo \"deb https://debian.neo4j.org/repo stable/\" | tee /etc/apt/sources.list.d/neo4j.list\n-apt-get update\n-apt-get install -y neo4j\n-\n# Enable cypher-shell\necho \"dbms.shell.enabled=true\" >> /etc/neo4j/neo4j.conf\n" } ]
Python
Apache License 2.0
google/timesketch
Collapse apt-get and pip invocations in bootstrap.sh
263,122
22.08.2017 19:06:52
-7,200
5e67741b329798c2d71d214a54f73af6db670cb8
Make the code compile with Typescript + Webpack
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "+# Ignore javascript build related files\n+node_modules\n+bundle.js\n+\n+# Ignore data files\n+*.plaso\n+\n# Ignore back-up files.\n*~\n/dependencies/\n/dist/\n/build/\n+*.egg-info\n# And don't care about the 'egg'.\n/Timesketch.egg-info\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"repository\": \"git@github.com:google/timesketch.git\",\n\"author\": \"Johan Berggren <jbn@google.com>\",\n\"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"webpack\",\n+ \"watch\": \"webpack --watch\"\n+ },\n\"dependencies\": {\n- \"ace-builds\": \"1.2.5\",\n\"angular\": \"1.3.5\",\n+ \"brace\": \"^0.10.0\",\n\"chart.js\": \"2.2.2\",\n\"d3\": \"4.2.2\",\n\"jquery\": \"2.1.0\",\n\"medium-editor\": \"5.16.1\",\n\"moment\": \"2.10.3\",\n\"numeral\": \"2.0.6\",\n+ \"ts-loader\": \"^2.3.3\",\n\"typescript\": \"^2.4.2\",\n\"webpack\": \"^3.5.5\"\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/static/components/explore/explore-event-directive.ts", "new_path": "timesketch/ui/static/components/explore/explore-event-directive.ts", "diff": "@@ -60,8 +60,8 @@ import angular from 'angular'\n};\nvar getSelectedEventsFilter = function() {\n- var event_list = [];\n- var indices_list = [];\n+ var event_list: any[] = [];\n+ var indices_list: any[] = [];\nangular.forEach($scope.events, function(event) {\nif (event.selected) {\nindices_list.push(event['_index']);\n@@ -132,7 +132,7 @@ import angular from 'angular'\n};\n$scope.addStar = function() {\n- var event_list = [];\n+ var event_list: any[] = [];\nangular.forEach($scope.events, function(event) {\nif (event.selected && !event.star) {\nevent.star = true;\n@@ -143,7 +143,7 @@ import angular from 'angular'\n};\n$scope.removeStar = function() {\n- var event_list = [];\n+ var event_list: any[] = [];\nangular.forEach($scope.events, function(event) {\nif (event.selected && event.star) {\nevent.star = false;\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/static/components/explore/explore-heatmap-directive.ts", "new_path": "timesketch/ui/static/components/explore/explore-heatmap-directive.ts", "diff": "@@ -97,7 +97,7 @@ import * as d3 from \"d3\"\n.domain([0, max_value / 2, max_value])\n.range([\"white\", \"#3498db\", \"red\"]);\n- var colors = [];\n+ var colors: any[] = [];\nfor (var i = 0; i < max_value; i++) {\ncolors.push(genColor(i));\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/static/components/explore/explore-histogram-directive.ts", "new_path": "timesketch/ui/static/components/explore/explore-histogram-directive.ts", "diff": "@@ -70,12 +70,12 @@ import Chart from 'chart.js'\n}\n// Arrays to hold out chart data.\n- var chart_labels = [];\n- var chart_values = [];\n+ var chart_labels: any[] = [];\n+ var chart_values: any[] = [];\naggregation.forEach(function (d) {\n- chart_labels.push(d.key_as_string);\n- chart_values.push(d.doc_count);\n+ chart_labels.push(d.key_as_string!);\n+ chart_values.push(d.doc_count!);\n});\n// Get our canvas and initiate the chart.\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/static/components/explore/explore-json-editor-directive.ts", "new_path": "timesketch/ui/static/components/explore/explore-json-editor-directive.ts", "diff": "limitations under the License.\n*/\nimport angular from 'angular'\n-import * as ace from 'ace-builds/src/ace'\n+import * as ace from 'brace'\n+import 'brace/mode/json'\n+import 'brace/theme/dawn'\n(function() {\nvar module = angular.module('timesketch.explore.json.editor.directive', []);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/static/index.ts", "diff": "+import 'app'\n+import 'components/api/api'\n+import 'components/api/api-service'\n+import 'components/explore/explore'\n+import 'components/explore/explore-event-directive'\n+import 'components/explore/explore-filter-directive'\n+import 'components/explore/explore-search-directive'\n+import 'components/explore/explore-heatmap-directive'\n+import 'components/explore/explore-histogram-directive'\n+import 'components/explore/explore-json-editor-directive'\n+import 'components/core/core'\n+import 'components/core/core-butterbar-directive'\n+import 'components/core/core-upload-directive'\n+import 'components/core/core-edit-sketch-directive'\n+import 'components/sketch/sketch'\n+import 'components/sketch/sketch-views-directive'\n+import 'components/sketch/sketch-timelines-directive'\n+import 'components/sketch/sketch-count-events-directive'\n+import 'components/story/story'\n+import 'components/story/story-directive'\n" }, { "change_type": "ADD", "old_path": null, "new_path": "tsconfig.json", "diff": "+{\n+ \"compilerOptions\": {\n+ \"sourceMap\": true,\n+ \"noImplicitAny\": false,\n+ \"strictNullChecks\": true,\n+ \"module\": \"commonjs\",\n+ \"target\": \"es5\"\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "webpack.config.js", "diff": "+var path = require('path')\n+\n+module.exports = {\n+ entry: './timesketch/ui/static/index.ts',\n+ module: {\n+ rules: [\n+ {\n+ test: /\\.tsx?$/,\n+ use: 'ts-loader',\n+ exclude: /node_modules/,\n+ },\n+ ],\n+ },\n+ resolve: {\n+ extensions: ['.tsx', '.ts', '.js'],\n+ modules: [path.resolve(__dirname, 'timesketch/ui/static/'), 'node_modules'],\n+ },\n+ output: {\n+ filename: 'bundle.js',\n+ path: path.resolve(__dirname, 'timesketch/ui/static/'),\n+ },\n+}\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -6,10 +6,6 @@ abbrev@1:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f\"\n-ace-builds@1.2.5:\n- version \"1.2.5\"\n- resolved \"https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.2.5.tgz#41c5360cdee6c43e73735d3e3558121f9fea37a9\"\n-\nacorn-dynamic-import@^2.0.0:\nversion \"2.0.2\"\nresolved \"https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz#c752bd210bef679501b6c6cb7fc84f8f47158cc4\"\n@@ -64,6 +60,12 @@ ansi-regex@^3.0.0:\nversion \"3.0.0\"\nresolved \"https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998\"\n+ansi-styles@^3.1.0:\n+ version \"3.2.0\"\n+ resolved \"https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88\"\n+ dependencies:\n+ color-convert \"^1.9.0\"\n+\nanymatch@^1.3.0:\nversion \"1.3.2\"\nresolved \"https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a\"\n@@ -189,6 +191,12 @@ brace-expansion@^1.1.7:\nbalanced-match \"^1.0.0\"\nconcat-map \"0.0.1\"\n+brace@^0.10.0:\n+ version \"0.10.0\"\n+ resolved \"https://registry.yarnpkg.com/brace/-/brace-0.10.0.tgz#edef4eb9b0928ba1ee5f717ffc157749a6dd5d76\"\n+ dependencies:\n+ w3c-blob \"0.0.1\"\n+\nbraces@^1.8.2:\nversion \"1.8.5\"\nresolved \"https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7\"\n@@ -291,6 +299,14 @@ center-align@^0.1.1:\nalign-text \"^0.1.3\"\nlazy-cache \"^1.0.3\"\n+chalk@^2.0.1:\n+ version \"2.1.0\"\n+ resolved \"https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e\"\n+ dependencies:\n+ ansi-styles \"^3.1.0\"\n+ escape-string-regexp \"^1.0.5\"\n+ supports-color \"^4.0.0\"\n+\nchart.js@2.2.2:\nversion \"2.2.2\"\nresolved \"https://registry.yarnpkg.com/chart.js/-/chart.js-2.2.2.tgz#1f27b10a40a4ce941c03d3619ab2419dec4cae4f\"\n@@ -361,7 +377,13 @@ color-convert@^0.5.3:\nversion \"0.5.3\"\nresolved \"https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd\"\n-color-name@^1.0.0:\n+color-convert@^1.9.0:\n+ version \"1.9.0\"\n+ resolved \"https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a\"\n+ dependencies:\n+ color-name \"^1.1.1\"\n+\n+color-name@^1.0.0, color-name@^1.1.1:\nversion \"1.1.3\"\nresolved \"https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25\"\n@@ -822,7 +844,7 @@ emojis-list@^2.0.0:\nversion \"2.1.0\"\nresolved \"https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389\"\n-enhanced-resolve@^3.4.0:\n+enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0:\nversion \"3.4.1\"\nresolved \"https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e\"\ndependencies:\n@@ -895,6 +917,10 @@ es6-weak-map@^2.0.1:\nes6-iterator \"^2.0.1\"\nes6-symbol \"^3.1.1\"\n+escape-string-regexp@^1.0.5:\n+ version \"1.0.5\"\n+ resolved \"https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4\"\n+\nescope@^3.6.0:\nversion \"3.6.0\"\nresolved \"https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3\"\n@@ -1389,7 +1415,7 @@ loader-runner@^2.3.0:\nversion \"2.3.0\"\nresolved \"https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2\"\n-loader-utils@^1.1.0:\n+loader-utils@^1.0.2, loader-utils@^1.1.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd\"\ndependencies:\n@@ -1926,7 +1952,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.1.0, safe-buffer@~5.1.1:\nversion \"5.1.1\"\nresolved \"https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853\"\n-\"semver@2 || 3 || 4 || 5\", semver@^5.3.0:\n+\"semver@2 || 3 || 4 || 5\", semver@^5.0.1, semver@^5.3.0:\nversion \"5.4.1\"\nresolved \"https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e\"\n@@ -2074,7 +2100,7 @@ strip-json-comments@~2.0.1:\nversion \"2.0.1\"\nresolved \"https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a\"\n-supports-color@^4.2.1:\n+supports-color@^4.0.0, supports-color@^4.2.1:\nversion \"4.2.1\"\nresolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836\"\ndependencies:\n@@ -2121,6 +2147,15 @@ tough-cookie@~2.3.0:\ndependencies:\npunycode \"^1.4.1\"\n+ts-loader@^2.3.3:\n+ version \"2.3.3\"\n+ resolved \"https://registry.yarnpkg.com/ts-loader/-/ts-loader-2.3.3.tgz#bdf1e4f7e3acd3545e110a1d635f14753a63f6c3\"\n+ dependencies:\n+ chalk \"^2.0.1\"\n+ enhanced-resolve \"^3.0.0\"\n+ loader-utils \"^1.0.2\"\n+ semver \"^5.0.1\"\n+\ntty-browserify@0.0.0:\nversion \"0.0.0\"\nresolved \"https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6\"\n@@ -2206,6 +2241,10 @@ vm-browserify@0.0.4:\ndependencies:\nindexof \"0.0.1\"\n+w3c-blob@0.0.1:\n+ version \"0.0.1\"\n+ resolved \"https://registry.yarnpkg.com/w3c-blob/-/w3c-blob-0.0.1.tgz#b0cd352a1a50f515563420ffd5861f950f1d85b8\"\n+\nwatchpack@^1.4.0:\nversion \"1.4.0\"\nresolved \"https://registry.yarnpkg.com/watchpack/-/watchpack-1.4.0.tgz#4a1472bcbb952bd0a9bb4036801f954dfb39faac\"\n" } ]
Python
Apache License 2.0
google/timesketch
Make the code compile with Typescript + Webpack
263,122
23.08.2017 20:03:03
-7,200
b4c4c61d7026908685927b4807693798dcdf31cf
Add frontend build step to vagrant bootstrap.sh
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -14,16 +14,30 @@ echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | tee -a /e\nwget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -\necho \"deb https://debian.neo4j.org/repo stable/\" | tee /etc/apt/sources.list.d/neo4j.list\n+# Add Node.js 8.x repo\n+curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\n+\n+# Add Yarn repo\n+curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n+echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n+\n# Install apt dependencies\napt-get update\napt-get install -y neo4j openjdk-8-jre-headless elasticsearch postgresql \\\npython-psycopg2 python-pip python-dev libffi-dev redis-server python-plaso\n+sudo apt-get install -y nodejs\n+sudo apt-get update && sudo apt-get install yarn\n-# Install Timesketch + python dependencies\n+# Install python dependencies\npip install --upgrade pip\n-pip install -e /usr/local/src/timesketch/\npip install gunicorn pylint nose flask-testing coverage mock BeautifulSoup\n+# Install nodejs dependencies\n+HOME=/home/ubuntu sudo -u ubuntu bash -c 'cd /usr/local/src/timesketch && yarn install'\n+\n+# Install Timesketch\n+pip install -e /usr/local/src/timesketch/\n+\n# Generate random passwords for DB and session key\nif [ ! -f psql_pw ]; then\nopenssl rand -hex 32 > psql_pw\n@@ -83,6 +97,9 @@ echo \"dbms.connectors.default_listen_address=0.0.0.0\" >> /etc/neo4j/neo4j.conf\n/bin/systemctl enable neo4j\n/bin/systemctl start neo4j\n+# Build Timesketch frontend\n+HOME=/home/ubuntu sudo -u ubuntu bash -c 'cd /usr/local/src/timesketch && yarn run build'\n+\n# Create test user\nsudo -u ubuntu tsctl add_user --username spock --password spock\n" } ]
Python
Apache License 2.0
google/timesketch
Add frontend build step to vagrant bootstrap.sh
263,093
24.08.2017 09:20:07
-7,200
dd0184183ffcedcf5158994b99d43a197769eb49
Return HTTP 200 if searchindex already exists
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -1322,6 +1322,7 @@ class SearchIndexListResource(ResourceMixin, Resource):\nif searchindex:\nmetadata[u'created'] = False\n+ status_code = HTTP_STATUS_CODE_OK\nelse:\nsearchindex = SearchIndex.get_or_create(\nname=searchindex_name,\n@@ -1340,11 +1341,10 @@ class SearchIndexListResource(ResourceMixin, Resource):\ndb_session.add(searchindex)\ndb_session.commit()\n+ status_code = HTTP_STATUS_CODE_CREATED\nreturn self.to_json(\n- searchindex,\n- meta=metadata,\n- status_code=HTTP_STATUS_CODE_CREATED)\n+ searchindex, meta=metadata, status_code=status_code)\nreturn abort(HTTP_STATUS_CODE_BAD_REQUEST)\n" } ]
Python
Apache License 2.0
google/timesketch
Return HTTP 200 if searchindex already exists
263,093
24.08.2017 09:37:58
-7,200
673e4f8623de9f5d8725035927687897ec4bd1a4
Indicate if index was created or not
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -20,7 +20,6 @@ import requests\nfrom requests.exceptions import ConnectionError\n-from .definitions import HTTP_STATUS_CODE_CREATED\nfrom .definitions import HTTP_STATUS_CODE_20X\n@@ -169,8 +168,10 @@ class TimesketchApi(object):\n\"\"\"\nreturn SearchIndex(searchindex_id, api=self)\n- def create_searchindex(\n- self, searchindex_name, es_index_name=None, public=False):\n+ def get_or_create_searchindex(self,\n+ searchindex_name,\n+ es_index_name=None,\n+ public=False):\n\"\"\"Create a new searchindex.\nArgs:\n@@ -179,7 +180,8 @@ class TimesketchApi(object):\npublic: Boolean indicating if the searchindex should be public.\nReturns:\n- Instance of a SearchIndex object.\n+ Instance of a SearchIndex object and a boolean indicating if the\n+ object was created.\n\"\"\"\nif not es_index_name:\nes_index_name = uuid.uuid4().hex\n@@ -192,12 +194,14 @@ class TimesketchApi(object):\n}\nresponse = self.session.post(resource_url, json=form_data)\n- if response.status_code != HTTP_STATUS_CODE_CREATED:\n+ if response.status_code != HTTP_STATUS_CODE_20X:\nraise RuntimeError(u'Error creating searchindex')\nresponse_dict = response.json()\n+ metadata_dict = response_dict[u'meta']\n+ created = metadata_dict.get(u'created', False)\nsearchindex_id = response_dict[u'objects'][0][u'id']\n- return self.get_searchindex(searchindex_id)\n+ return self.get_searchindex(searchindex_id), created\ndef list_searchindices(self):\n\"\"\"Get list of all searchindices that the user has access to.\n@@ -393,8 +397,7 @@ class Sketch(BaseResource):\nsketch_id=self.id,\napi=self.api,\nname=timeline[u'name'],\n- searchindex=timeline[u'searchindex'][u'index_name']\n- )\n+ searchindex=timeline[u'searchindex'][u'index_name'])\nreturn timeline_obj\ndef explore(self,\n" } ]
Python
Apache License 2.0
google/timesketch
Indicate if index was created or not
263,122
23.08.2017 20:28:51
-7,200
392192f5c0001f0e1ac8470826426af94b957dd1
Add frontend installation instructions.
[ { "change_type": "MODIFY", "old_path": "docker/README.md", "new_path": "docker/README.md", "diff": "@@ -12,6 +12,9 @@ git clone https://github.com/google/timesketch.git\ncd timesketch\n```\n+### Build Timesketch frontend\n+Follow steps \"Install Node.js and Yarn\" and \"Build Timesketch frontend\" from [installation instructions](../docs/Installation.md).\n+\n### Build and Start Containers\n```shell\n" }, { "change_type": "MODIFY", "old_path": "docs/Installation.md", "new_path": "docs/Installation.md", "diff": "@@ -54,6 +54,17 @@ Then you need to restart PostgreSQL:\n$ sudo /etc/init.d/postgresql restart\n+#### Install Node.js and Yarn\n+\n+Add Node.js 8.x repo\n+\n+ $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\n+\n+Add Yarn repo\n+\n+ $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n+ $ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n+\n#### Install Timesketch\nNow it is time to install Timesketch. First we need to install some dependencies:\n@@ -64,6 +75,20 @@ Then install Timesketch itself:\n$ sudo pip install timesketch\n+**Build Timesketch frontend**\n+\n+Cd to timesketch installation directory:\n+\n+ $ cd `python -c 'import os, inspect, timesketch; print os.path.dirname(os.path.dirname(inspect.getfile(timesketch)))'`\n+\n+Install nodejs packages\n+\n+ $ yarn install\n+\n+Build frontend files\n+\n+ $ yarn run build\n+\n**Configure Timesketch**\nCopy the configuration file to /etc and configure it. The file is well commented and it should be pretty straight forward.\n" }, { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -23,10 +23,9 @@ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/source\n# Install apt dependencies\napt-get update\n-apt-get install -y neo4j openjdk-8-jre-headless elasticsearch postgresql \\\n- python-psycopg2 python-pip python-dev libffi-dev redis-server python-plaso\n-sudo apt-get install -y nodejs\n-sudo apt-get update && sudo apt-get install yarn\n+apt-get install -y \\\n+ neo4j openjdk-8-jre-headless elasticsearch postgresql python-psycopg2 \\\n+ python-pip python-dev libffi-dev redis-server python-plaso nodejs yarn\n# Install python dependencies\npip install --upgrade pip\n" } ]
Python
Apache License 2.0
google/timesketch
Add frontend installation instructions.
263,122
24.08.2017 10:54:33
-7,200
e865abcd10b35900c6fee82695cdb218921f4ee2
Add frontend build check to setup.py + update docs.
[ { "change_type": "MODIFY", "old_path": "docker/README.md", "new_path": "docker/README.md", "diff": "@@ -13,7 +13,7 @@ cd timesketch\n```\n### Build Timesketch frontend\n-Follow steps \"Install Node.js and Yarn\" and \"Build Timesketch frontend\" from [installation instructions](../docs/Installation.md).\n+Follow steps \"Installing Node.js and Yarn\" and \"Building Timesketch frontend\" from [developers guide](../docs/Developers-Guide.md).\n### Build and Start Containers\n" }, { "change_type": "MODIFY", "old_path": "docs/Developers-Guide.md", "new_path": "docs/Developers-Guide.md", "diff": "@@ -40,6 +40,34 @@ Use positional or parameter format specifiers with typing e.g. '{0:s}' or '{text\n* When catching exceptions use \"as exception:\" not some alternative form like \"as error:\" or \"as details:\"\n* Use textual pylint overrides e.g. \"# pylint: disable=no-self-argument\" instead of \"# pylint: disable=E0213\". For a list of overrides see: http://docs.pylint.org/features.html\n+#### Installing Node.js and Yarn\n+Add Node.js 8.x repo\n+\n+ $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\n+\n+Add Yarn repo\n+\n+ $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n+ $ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n+\n+Install\n+\n+ $ apt-get update && apt-get install nodejs yarn\n+\n+#### Building Timesketch frontend\n+First, cd to timesketch repository root (folder that contains package.json).\n+\n+Install nodejs packages\n+\n+ $ yarn install\n+\n+Build frontend files\n+\n+ $ yarn run build\n+\n+#### Packaging\n+Before pushing package to PyPI, make sure you build the frontend before.\n+\n##### The small print\nContributions made by corporations are covered by a different agreement than\nthe one above, the Software Grant and Corporate Contributor License Agreement.\n" }, { "change_type": "MODIFY", "old_path": "docs/Installation.md", "new_path": "docs/Installation.md", "diff": "@@ -54,17 +54,6 @@ Then you need to restart PostgreSQL:\n$ sudo /etc/init.d/postgresql restart\n-#### Install Node.js and Yarn\n-\n-Add Node.js 8.x repo\n-\n- $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\n-\n-Add Yarn repo\n-\n- $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n- $ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n-\n#### Install Timesketch\nNow it is time to install Timesketch. First we need to install some dependencies:\n@@ -75,20 +64,6 @@ Then install Timesketch itself:\n$ sudo pip install timesketch\n-**Build Timesketch frontend**\n-\n-Cd to timesketch installation directory:\n-\n- $ cd `python -c 'import os, inspect, timesketch; print os.path.dirname(os.path.dirname(inspect.getfile(timesketch)))'`\n-\n-Install nodejs packages\n-\n- $ yarn install\n-\n-Build frontend files\n-\n- $ yarn run build\n-\n**Configure Timesketch**\nCopy the configuration file to /etc and configure it. The file is well commented and it should be pretty straight forward.\n" }, { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "sudo python setup.py install\n\"\"\"\n+import os.path\n+import sys\n+import time\n+\nfrom setuptools import find_packages\nfrom setuptools import setup\n@@ -29,6 +33,28 @@ timesketch_description = (\nu'timelines and analyze them all at the same time. Add meaning to '\nu'your raw data with rich annotations, comments, tags and stars.')\n+def check_before_upload():\n+ this_dir = os.path.dirname(__file__)\n+ frontend_dist_dir = os.path.join(\n+ this_dir, 'timesketch', 'ui', 'static', 'dist',\n+ )\n+ js = os.path.join(frontend_dist_dir, 'bundle.js')\n+ css = os.path.join(frontend_dist_dir, 'bundle.css')\n+ if not (os.path.isfile(js) and os.path.isfile(css)):\n+ raise AssertionError(\n+ \"Build the frontend before uploading to PyPI!\"\n+ + \" (see docs/Developers-Guide.md)\"\n+ )\n+ mtime = min(os.path.getmtime(js), os.path.getmtime(css))\n+ if time.time() - mtime > 180:\n+ raise AssertionError(\n+ \"Frontend build is older than 3 minutes, please rebuild!\"\n+ + \" (see docs/Developers-Guide.md)\"\n+ )\n+\n+if 'upload' in sys.argv:\n+ check_before_upload()\n+\nsetup(\nname=u'timesketch',\nversion=timesketch_version,\n" } ]
Python
Apache License 2.0
google/timesketch
Add frontend build check to setup.py + update docs.
263,122
25.08.2017 10:07:12
-7,200
82fbe05bec6f201050715cfcfe097652ced1e03c
Add docstring for check_before_upload() in setup.py.
[ { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "@@ -34,6 +34,9 @@ timesketch_description = (\nu'your raw data with rich annotations, comments, tags and stars.')\ndef check_before_upload():\n+ \"\"\"Raise UserWarning if frontend build is not present or is not recent,\n+ so that .js and .css bundles included in the PyPI package are up to date.\n+ \"\"\"\nthis_dir = os.path.dirname(__file__)\nfrontend_dist_dir = os.path.join(\nthis_dir, 'timesketch', 'ui', 'static', 'dist',\n@@ -41,13 +44,13 @@ def check_before_upload():\njs = os.path.join(frontend_dist_dir, 'bundle.js')\ncss = os.path.join(frontend_dist_dir, 'bundle.css')\nif not (os.path.isfile(js) and os.path.isfile(css)):\n- raise AssertionError(\n+ raise UserWarning(\n\"Build the frontend before uploading to PyPI!\"\n+ \" (see docs/Developers-Guide.md)\"\n)\nmtime = min(os.path.getmtime(js), os.path.getmtime(css))\nif time.time() - mtime > 180:\n- raise AssertionError(\n+ raise UserWarning(\n\"Frontend build is older than 3 minutes, please rebuild!\"\n+ \" (see docs/Developers-Guide.md)\"\n)\n" } ]
Python
Apache License 2.0
google/timesketch
Add docstring for check_before_upload() in setup.py.
263,122
25.08.2017 10:46:18
-7,200
6d407bc4ad8ce35bd916e6c8c22a1ccd0a6c6da0
Don't run linter on stuff under node_modules/
[ { "change_type": "MODIFY", "old_path": "utils/run_linter.sh", "new_path": "utils/run_linter.sh", "diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n-find . -name \"*.py\" | xargs pylint --rcfile utils/pylintrc;\n+find . -name \"*.py\" | grep -v node_modules | xargs pylint --rcfile utils/pylintrc;\nif test $? -ne 0; then\necho \"[ERROR] Fix the issues reported by the linter\";\n" } ]
Python
Apache License 2.0
google/timesketch
Don't run linter on stuff under node_modules/
263,122
25.08.2017 10:46:53
-7,200
d1477d45a469e637e09bbb6aa0945cd37ba595ff
Remove "if model:" from ResourceMixin.to_json - this caused exceptions in javascript.
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -239,7 +239,6 @@ class ResourceMixin(object):\nschema = {u'meta': meta, u'objects': []}\n- if model: # why is that?\nif not model_fields:\ntry:\nmodel_fields = self.fields_registry[model.__tablename__]\n" } ]
Python
Apache License 2.0
google/timesketch
Remove "if model:" from ResourceMixin.to_json - this caused exceptions in javascript.
263,122
25.08.2017 12:51:00
-7,200
4f815760a37f732dc536dbe877f04886c63fc839
Format check_before_upload() docstring.
[ { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "@@ -34,8 +34,12 @@ timesketch_description = (\nu'your raw data with rich annotations, comments, tags and stars.')\ndef check_before_upload():\n- \"\"\"Raise UserWarning if frontend build is not present or is not recent,\n- so that .js and .css bundles included in the PyPI package are up to date.\n+ \"\"\"Warn user if frontend build is not present or is not recent.\n+\n+ Make sure that .js and .css bundles included in the PyPI package are up to date.\n+\n+ Raises:\n+ UserWarning\n\"\"\"\nthis_dir = os.path.dirname(__file__)\nfrontend_dist_dir = os.path.join(\n" } ]
Python
Apache License 2.0
google/timesketch
Format check_before_upload() docstring.
263,121
27.08.2017 19:18:27
14,400
84b8ae299049976dc4abbed01eb89b3e1ba52c37
add support for HTTP basic authentication to the API client.
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -31,7 +31,12 @@ class TimesketchApi(object):\nsession: Authenticated HTTP session.\n\"\"\"\n- def __init__(self, host_uri, username, password, verify=True):\n+ def __init__(self,\n+ host_uri,\n+ username,\n+ password,\n+ verify=True,\n+ auth_mode=u'timesketch'):\n\"\"\"Initializes the TimesketchApi object.\nArgs:\n@@ -39,12 +44,15 @@ class TimesketchApi(object):\nusername: User username.\npassword: User password.\nverify: Verify server SSL certificate.\n+ auth_mode: The authentication mode to use. Defaults to 'timesketch'\n+ Supported values are 'timesketch' (Timesketch login form) and\n+ 'http-basic' (HTTP Basic authentication).\n\"\"\"\nself._host_uri = host_uri\nself.api_root = u'{0:s}/api/v1'.format(host_uri)\ntry:\nself.session = self._create_session(\n- username, password, verify=verify)\n+ username, password, verify=verify, auth_mode=auth_mode)\nexcept ConnectionError:\nraise ConnectionError(u'Timesketch server unreachable')\n@@ -76,22 +84,29 @@ class TimesketchApi(object):\nu'referer': self._host_uri\n})\n- def _create_session(self, username, password, verify):\n+ def _create_session(self, username, password, verify, auth_mode):\n\"\"\"Create authenticated HTTP session for server communication.\nArgs:\nusername: User to authenticate as.\npassword: User password.\nverify: Verify server SSL certificate.\n+ auth_mode: The authentication mode to use. Supported values are\n+ 'timesketch' (Timesketch login form) and 'http-basic'\n+ (HTTP Basic authentication).\nReturns:\nInstance of requests.Session.\n\"\"\"\nsession = requests.Session()\nsession.verify = verify # Depending if SSL cert is verifiable\n+ # If using HTTP Basic auth, add the user/pass to the session\n+ if auth_mode == u'http-basic':\n+ session.auth = (username, password)\n- # Get and set CSRF token and authenticate the session.\n+ # Get and set CSRF token and authenticate the session if appropriate.\nself._set_csrf_token(session)\n+ if auth_mode == u'timesketch':\nself._authenticate_session(session, username, password)\nreturn session\n" } ]
Python
Apache License 2.0
google/timesketch
add support for HTTP basic authentication to the API client.
263,122
28.08.2017 11:13:01
-7,200
cc0975a34c8e9b1fdf1200c7491ec69bcaef7910
Fix IndexError in ResourceMixin.to_json
[ { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "@@ -36,7 +36,8 @@ timesketch_description = (\ndef check_before_upload():\n\"\"\"Warn user if frontend build is not present or is not recent.\n- Make sure that .js and .css bundles included in the PyPI package are up to date.\n+ Make sure that .js and .css bundles included in the PyPI package are up to\n+ date.\nRaises:\nUserWarning\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -239,6 +239,7 @@ class ResourceMixin(object):\nschema = {u'meta': meta, u'objects': []}\n+ if model:\nif not model_fields:\ntry:\nmodel_fields = self.fields_registry[model.__tablename__]\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources_test.py", "new_path": "timesketch/api/v1/resources_test.py", "diff": "@@ -22,6 +22,19 @@ from timesketch.lib.definitions import HTTP_STATUS_CODE_BAD_REQUEST\nfrom timesketch.lib.testlib import BaseTest\nfrom timesketch.lib.testlib import MockDataStore\n+from timesketch.api.v1.resources import ResourceMixin\n+\n+\n+class ResourceMixinTest(BaseTest):\n+ \"\"\"Test ResourceMixin.\"\"\"\n+ def test_to_json_empty_list(self):\n+ \"\"\"Behavior of to_json when given an empty list.\"\"\"\n+ response = ResourceMixin().to_json([])\n+ self.assertEqual(response.json, {\n+ 'meta': {},\n+ 'objects': [],\n+ })\n+\nclass SketchListResourceTest(BaseTest):\n\"\"\"Test SketchListResource.\"\"\"\n" } ]
Python
Apache License 2.0
google/timesketch
Fix IndexError in ResourceMixin.to_json
263,122
28.08.2017 16:45:22
-7,200
895c5680afe5bca803372a679183b07752adc429
Pin python dependencies - start using pip-tools
[ { "change_type": "MODIFY", "old_path": ".travis.yml", "new_path": ".travis.yml", "diff": "@@ -4,6 +4,5 @@ python:\n# command to install dependencies\ninstall:\n- \"pip install .\"\n- - \"pip install Flask-Testing nose mock pylint coverage requests BeautifulSoup\"\n# command to run tests\nscript: nosetests\n" }, { "change_type": "MODIFY", "old_path": "MANIFEST.in", "new_path": "MANIFEST.in", "diff": "recursive-include timesketch/ui/static *\nrecursive-include timesketch/ui/templates *\ninclude timesketch.conf\n+include requirements.txt\n+include requirements.in\n" }, { "change_type": "ADD", "old_path": null, "new_path": "requirements.in", "diff": "+# requirements:\n+Flask\n+Flask-Login\n+Flask-script\n+Flask-SQLAlchemy\n+Flask-Bcrypt\n+Flask-RESTful\n+Flask-WTF\n+Flask-Migrate\n+SQLAlchemy\n+celery\n+redis\n+blinker\n+elasticsearch\n+neo4jrestclient\n+python-dateutil\n+\n+# dev-requirements:\n+Flask-Testing\n+nose\n+mock\n+pylint\n+coverage\n+requests\n+BeautifulSoup\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "-alembic==0.9.1\n-amqp==2.1.4\n-aniso8601==1.2.0\n-appdirs==1.4.3\n-bcrypt==3.1.3\n-billiard==3.5.0.2\n+#\n+# This file is autogenerated by pip-compile\n+# To update, run:\n+#\n+# pip-compile --output-file requirements.txt requirements.in\n+#\n+alembic==0.9.5 # via flask-migrate\n+amqp==2.2.1 # via kombu\n+aniso8601==1.2.1 # via flask-restful\n+astroid==1.5.3 # via pylint\n+backports.functools-lru-cache==1.4 # via astroid, pylint\n+bcrypt==3.1.3 # via flask-bcrypt\n+beautifulsoup==3.2.1\n+billiard==3.5.0.3 # via celery\nblinker==1.4\n-celery==4.0.2\n-cffi==1.10.0\n-click==6.7\n-elasticsearch==5.3.0\n-Flask==0.12.1\n-Flask-Bcrypt==0.7.1\n-Flask-Login==0.4.0\n-Flask-Migrate==2.0.3\n-Flask-RESTful==0.3.5\n-Flask-Script==2.0.5\n-Flask-SQLAlchemy==2.2\n-Flask-WTF==0.14.2\n-itsdangerous==0.24\n-Jinja2==2.9.6\n-kombu==4.0.2\n-Mako==1.0.6\n-MarkupSafe==1.0\n+celery==4.1.0\n+certifi==2017.7.27.1 # via requests\n+cffi==1.10.0 # via bcrypt\n+chardet==3.0.4 # via requests\n+click==6.7 # via flask\n+configparser==3.5.0 # via pylint\n+coverage==4.4.1\n+elasticsearch==5.4.0\n+enum34==1.1.6 # via astroid\n+flask-bcrypt==0.7.1\n+flask-login==0.4.0\n+flask-migrate==2.1.0\n+flask-restful==0.3.6\n+flask-script==2.0.5\n+flask-sqlalchemy==2.2\n+flask-testing==0.6.2\n+flask-wtf==0.14.2\n+flask==0.12.2\n+funcsigs==1.0.2 # via mock\n+idna==2.6 # via requests\n+isort==4.2.15 # via pylint\n+itsdangerous==0.24 # via flask\n+jinja2==2.9.6 # via flask\n+kombu==4.1.0 # via celery\n+lazy-object-proxy==1.3.1 # via astroid\n+mako==1.0.7 # via alembic\n+markupsafe==1.0 # via jinja2, mako\n+mccabe==0.6.1 # via pylint\n+mock==2.0.0\nneo4jrestclient==2.1.1\n-packaging==16.8\n-pycparser==2.17\n-pyparsing==2.2.0\n-python-dateutil==2.6.0\n-python-editor==1.0.3\n-pytz==2017.2\n-redis==2.10.5\n-requests==2.13.0\n-six==1.10.0\n-SQLAlchemy==1.1.9\n-timesketch==2016.11\n-urllib3==1.20\n-vine==1.1.3\n-Werkzeug==0.12.1\n-WTForms==2.1\n+nose==1.3.7\n+pbr==3.1.1 # via mock\n+pycparser==2.18 # via cffi\n+pylint==1.7.2\n+python-dateutil==2.6.1\n+python-editor==1.0.3 # via alembic\n+pytz==2017.2 # via celery, flask-restful\n+redis==2.10.6\n+requests==2.18.4\n+singledispatch==3.4.0.3 # via astroid, pylint\n+six==1.10.0 # via astroid, bcrypt, flask-restful, mock, pylint, python-dateutil, singledispatch\n+sqlalchemy==1.1.13\n+urllib3==1.22 # via elasticsearch, requests\n+vine==1.1.4 # via amqp\n+werkzeug==0.12.2 # via flask\n+wrapt==1.10.11 # via astroid\n+wtforms==2.1 # via flask-wtf\n" }, { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "@@ -24,6 +24,8 @@ import time\nfrom setuptools import find_packages\nfrom setuptools import setup\n+from pip.req import parse_requirements\n+from pip.download import PipSession\ntimesketch_version = u'20170721'\n@@ -83,9 +85,7 @@ setup(\ninclude_package_data=True,\nzip_safe=False,\nscripts=[u'tsctl'],\n- install_requires=frozenset([\n- u'Flask', u'Flask-Login', u'Flask-script', u'Flask-SQLAlchemy',\n- u'Flask-Bcrypt', u'Flask-RESTful', u'Flask-WTF', u'Flask-Migrate',\n- u'SQLAlchemy', u'celery', u'redis', u'blinker', u'elasticsearch',\n- u'neo4jrestclient', u'python-dateutil'\n- ]))\n+ install_requires=[str(req.req) for req in parse_requirements(\n+ \"requirements.txt\", session=PipSession(),\n+ )],\n+)\n" } ]
Python
Apache License 2.0
google/timesketch
Pin python dependencies - start using pip-tools
263,122
29.08.2017 15:05:42
-7,200
8997d5be8d6826ed10b20e640a117aacde32b259
Workaround a bug that sometimes causes pip-sync to delete pkg_resources.
[ { "change_type": "MODIFY", "old_path": "requirements.in", "new_path": "requirements.in", "diff": "@@ -14,6 +14,7 @@ blinker\nelasticsearch\nneo4jrestclient\npython-dateutil\n+gunicorn\n# dev-requirements:\nFlask-Testing\n@@ -23,3 +24,15 @@ pylint\ncoverage\nrequests\nBeautifulSoup\n+\n+# Remove the following when pip-sync finally stops deleting pkg_resources.\n+# This is a hack that forces reinstall of setuptools and thus brings\n+# pkg_resources back after being deleted by pip-sync.\n+# For more information, see:\n+# - https://github.com/jazzband/pip-tools/issues/422\n+# - https://github.com/jazzband/pip-tools/issues/389\n+# - https://github.com/jazzband/pip-tools/pull/368\n+# - https://github.com/jazzband/pip-tools/issues/531\n+# Root cause of this bug:\n+# - https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463\n+setuptools==36.2.7\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "@@ -24,14 +24,15 @@ elasticsearch==5.4.0\nenum34==1.1.6 # via astroid\nflask-bcrypt==0.7.1\nflask-login==0.4.0\n-flask-migrate==2.1.0\n+flask-migrate==2.1.1\nflask-restful==0.3.6\nflask-script==2.0.5\n-flask-sqlalchemy==2.2\n+flask-sqlalchemy==2.2 # via flask-migrate\nflask-testing==0.6.2\nflask-wtf==0.14.2\n-flask==0.12.2\n+flask==0.12.2 # via flask-bcrypt, flask-login, flask-migrate, flask-restful, flask-script, flask-sqlalchemy, flask-testing, flask-wtf\nfuncsigs==1.0.2 # via mock\n+gunicorn==19.7.1\nidna==2.6 # via requests\nisort==4.2.15 # via pylint\nitsdangerous==0.24 # via flask\n@@ -54,9 +55,12 @@ redis==2.10.6\nrequests==2.18.4\nsingledispatch==3.4.0.3 # via astroid, pylint\nsix==1.10.0 # via astroid, bcrypt, flask-restful, mock, pylint, python-dateutil, singledispatch\n-sqlalchemy==1.1.13\n+sqlalchemy==1.1.13 # via alembic, flask-sqlalchemy\nurllib3==1.22 # via elasticsearch, requests\nvine==1.1.4 # via amqp\nwerkzeug==0.12.2 # via flask\nwrapt==1.10.11 # via astroid\nwtforms==2.1 # via flask-wtf\n+\n+# The following packages are considered to be unsafe in a requirements file:\n+setuptools==36.2.7\n" } ]
Python
Apache License 2.0
google/timesketch
Workaround a bug that sometimes causes pip-sync to delete pkg_resources.
263,122
04.09.2017 14:51:27
-7,200
ef25a6f171e846d9f19f063a201fe1c19efa5f38
Add simple navigation component in Angular 2 * Register Angular 2 component as AngularJS directive * Use "independent mode" of ngUpgrade which intends to avoid performance issues with propagating digest cycle to Angular 2 change detection: downgradeModule({..., propagateDigest: false}) * Use for AOT compilation of Angular 2 templates
[ { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/explore.html", "new_path": "timesketch/templates/sketch/explore.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"explore\"></ts-navigation>\n{% endblock %}\n{% block main %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/overview.html", "new_path": "timesketch/templates/sketch/overview.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"overview\"></ts-navigation>\n{% endblock %}\n{% block right_nav %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/stories.html", "new_path": "timesketch/templates/sketch/stories.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"stories\"></ts-navigation>\n{% endblock %}\n{% block right_nav %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timeline.html", "new_path": "timesketch/templates/sketch/timeline.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"timelines\"></ts-navigation>\n{% endblock %}\n{% block main %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timelines.html", "new_path": "timesketch/templates/sketch/timelines.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"timelines\"></ts-navigation>\n{% endblock %}\n{% block right_nav %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/views.html", "new_path": "timesketch/templates/sketch/views.html", "diff": "{% extends \"base.html\" %}\n{% block navigation %}\n- <ul class=\"nav nav-tabs\">\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\"><i class=\"fa fa-cube\"></i> Overview</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.explore', sketch_id=sketch.id) }}\"><i class=\"fa fa-search\"></i> Explore</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('story_views.story', sketch_id=sketch.id) }}\"><i class=\"fa fa-book\"></i> Stories</a></li>\n- <li role=\"presentation\" class=\"active\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\"><i class=\"fa fa-eye\"></i> Views</a></li>\n- <li role=\"presentation\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-clock-o\"></i> Timelines</a></li>\n- </ul>\n+ <ts-navigation sketch-id=\"{{ sketch.id }}\" active=\"views\"></ts-navigation>\n{% endblock %}\n{% block main %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/app.module.ts", "new_path": "timesketch/ui/app.module.ts", "diff": "@@ -14,10 +14,12 @@ See the License for the specific language governing permissions and\nlimitations under the License.\n*/\nimport angular from 'angularjs-for-webpack'\n+import {NgModule} from '@angular/core'\n+import {BrowserModule} from '@angular/platform-browser'\nimport {tsApiModule} from './api/api.module'\nimport {tsCoreModule} from './core/core.module'\nimport {tsExploreModule} from './explore/explore.module'\n-import {tsSketchModule} from './sketch/sketch.module'\n+import {tsSketchModule, SketchModule} from './sketch/sketch.module'\nimport {tsStoryModule} from './story/story.module'\nexport const tsAppModule = angular.module('timesketch', [\n@@ -60,3 +62,10 @@ export const tsAppModule = angular.module('timesketch', [\nconst csrftoken = document.getElementsByTagName('meta')[0]['content'];\n$httpProvider.defaults.headers.common['X-CSRFToken'] = csrftoken;\n})\n+\n+@NgModule({\n+ imports: [SketchModule, BrowserModule],\n+})\n+export class AppModule {\n+ ngDoBootstrap() {}\n+}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/main.ts", "new_path": "timesketch/ui/main.ts", "diff": "@@ -6,11 +6,23 @@ import 'twitter-bootstrap-3.0.0/dist/js/bootstrap.js'\nimport 'medium-editor/dist/css/medium-editor.css'\nimport 'medium-editor/dist/css/themes/default.css'\n+import 'zone.js'\n+\nimport angular from 'angularjs-for-webpack'\n+import {downgradeModule} from '@angular/upgrade/static'\nimport 'css/ts.css'\n-import {tsAppModule} from 'app.module'\n+import {tsAppModule, AppModule} from 'app.module'\nangular.element(function() {\n- angular.bootstrap(document.body, [tsAppModule.name])\n+ // @ngtools/webpack should automatically convert AppModule to\n+ // AppModuleNgFactory. We are casting it through any to make TypeScript happy\n+ // https://github.com/angular/angular-cli/blob/4586abd226090521f2470fa47a27553241415426/packages/%40ngtools/webpack/src/loader.ts#L267\n+ // this code rewriting by @ngtools/webpack is one big hack :(\n+ // for example, changing from \"downgradeModule as any\" to \"AppModule as any\"\n+ // will break everything because of the way the code transformation looks for\n+ // the bootstrapping code\n+ angular.bootstrap(document.body, [\n+ tsAppModule.name, (downgradeModule as any)(AppModule),\n+ ])\n})\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/sketch/navigation.component.ts", "diff": "+import {Component, Input} from '@angular/core'\n+\n+@Component({\n+ selector: 'ts-navigation',\n+ templateUrl: './navigation.ng.html',\n+})\n+export class NavigationComponent {\n+ @Input() sketchId: number\n+ @Input() active: string\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/sketch/navigation.ng.html", "diff": "+<ul class=\"nav nav-tabs\">\n+ <li role=\"presentation\" [class.active]=\"active==='overview'\">\n+ <a href=\"/sketch/{{sketchId}}/\">\n+ <i class=\"fa fa-cube\"></i> Overview\n+ </a>\n+ </li>\n+ <li role=\"presentation\" [class.active]=\"active==='explore'\">\n+ <a href=\"/sketch/{{sketchId}}/explore/\">\n+ <i class=\"fa fa-search\"></i> Explore\n+ </a>\n+ </li>\n+ <li role=\"presentation\" [class.active]=\"active==='stories'\">\n+ <a href=\"/sketch/{{sketchId}}/stories/\">\n+ <i class=\"fa fa-book\"></i> Stories\n+ </a>\n+ </li>\n+ <li role=\"presentation\" [class.active]=\"active==='views'\">\n+ <a href=\"/sketch/{{sketchId}}/views/\">\n+ <i class=\"fa fa-eye\"></i> Views\n+ </a>\n+ </li>\n+ <li role=\"presentation\" [class.active]=\"active==='timelines'\">\n+ <a href=\"/sketch/{{sketchId}}/timelines/\">\n+ <i class=\"fa fa-clock-o\"></i> Timelines\n+ </a>\n+ </li>\n+</ul>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/sketch/sketch.module.ts", "new_path": "timesketch/ui/sketch/sketch.module.ts", "diff": "@@ -14,12 +14,26 @@ See the License for the specific language governing permissions and\nlimitations under the License.\n*/\nimport angular from 'angularjs-for-webpack'\n+import {NgModule} from '@angular/core'\n+import {CommonModule} from '@angular/common'\n+import {downgradeComponent} from '@angular/upgrade/static'\nimport {tsCountEvents} from './count-events.directive'\nimport {tsTimelinesList} from './timelines.directive'\nimport {tsSavedViewList, tsSearchTemplateList} from './views.directive'\n+import {NavigationComponent} from './navigation.component'\nexport const tsSketchModule = angular.module('timesketch.sketch', [])\n.directive('tsCountEvents', tsCountEvents)\n.directive('tsTimelinesList', tsTimelinesList)\n.directive('tsSavedViewList', tsSavedViewList)\n.directive('tsSearchTemplateList', tsSearchTemplateList)\n+ .directive('tsNavigation', downgradeComponent({\n+ component: NavigationComponent, propagateDigest: false,\n+ }))\n+\n+@NgModule({\n+ imports: [CommonModule],\n+ declarations: [NavigationComponent],\n+ entryComponents: [NavigationComponent],\n+})\n+export class SketchModule {}\n" }, { "change_type": "MODIFY", "old_path": "tsconfig.json", "new_path": "tsconfig.json", "diff": "\"baseUrl\": \"./timesketch/ui/\",\n\"sourceMap\": true,\n\"noImplicitAny\": false,\n- \"strictNullChecks\": true,\n+ \"strictNullChecks\": false,\n\"module\": \"commonjs\",\n- \"target\": \"es5\"\n+ \"target\": \"es5\",\n+ \"experimentalDecorators\": true,\n+ \"lib\": [ \"es6\", \"dom\" ]\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "-var path = require('path')\n-var ExtractTextPlugin = require(\"extract-text-webpack-plugin\")\n+const path = require('path')\n+const ExtractTextPlugin = require('extract-text-webpack-plugin')\n+const AotPlugin = require('@ngtools/webpack').AotPlugin\nconst extractSass = new ExtractTextPlugin({\n- filename: \"bundle.css\",\n+ filename: 'bundle.css',\ndisable: false,\n})\n+const aotPlugin = new AotPlugin({\n+ tsConfigPath: 'tsconfig.json',\n+ // entryModule path must be absolute, otherwise it generates really obscure\n+ // error message: https://github.com/angular/angular-cli/issues/4913\n+ entryModule: path.resolve(__dirname, 'timesketch/ui/app.module#AppModule'),\n+})\n+\nmodule.exports = {\nentry: './timesketch/ui/main.ts',\nmodule: {\nrules: [\n{\ntest: /\\.tsx?$/,\n- use: 'ts-loader',\n+ use: '@ngtools/webpack',\nexclude: /node_modules/,\n},\n{\n@@ -47,7 +55,5 @@ module.exports = {\nfilename: 'bundle.js',\npath: path.resolve(__dirname, 'timesketch/static/dist/'),\n},\n- plugins: [\n- extractSass\n- ],\n+ plugins: [extractSass, aotPlugin],\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Add simple navigation component in Angular 2 (#416) * Register Angular 2 component as AngularJS directive * Use "independent mode" of ngUpgrade which intends to avoid performance issues with propagating digest cycle to Angular 2 change detection: downgradeModule({..., propagateDigest: false}) * Use @ngtools/webpack for AOT compilation of Angular 2 templates
263,122
12.09.2017 17:02:17
-7,200
4d65a7579d92871f48c4095420e8d2417fefe097
Fix non-determinism in SketchListResourceTest.
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources_test.py", "new_path": "timesketch/api/v1/resources_test.py", "diff": "@@ -44,8 +44,9 @@ class SketchListResourceTest(BaseTest):\n\"\"\"Authenticated request to get list of sketches.\"\"\"\nself.login()\nresponse = self.client.get(self.resource_url)\n- self.assertEqual(len(response.json[u'objects']), 1)\n- self.assertEqual(response.json[u'objects'][0][0][u'name'], u'Test 1')\n+ self.assertEqual(len(response.json[u'objects'][0]), 2)\n+ result = sorted(i['name'] for i in response.json[u'objects'][0])\n+ self.assertEqual(result, [u'Test 1', u'Test 3'])\nself.assert200(response)\ndef test_sketch_post_resource(self):\n" } ]
Python
Apache License 2.0
google/timesketch
Fix non-determinism in SketchListResourceTest. (#424)
263,122
13.09.2017 08:22:27
-7,200
f43924f42645a1e5e0efcfbad7b142989f14c5e5
Add angular-specific linter.
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"chart.js\": \"2.2.2\",\n\"chokidar\": \"^1.7.0\",\n\"chokidar-cli\": \"^1.2.0\",\n+ \"codelyzer\": \"^3.2.0\",\n\"css-loader\": \"^0.28.5\",\n\"d3\": \"4.2.2\",\n\"extract-text-webpack-plugin\": \"^3.0.0\",\n" }, { "change_type": "MODIFY", "old_path": "tslint.json", "new_path": "tslint.json", "diff": "{\n- \"extends\": \"tslint:recommended\",\n+ \"extends\": [\"tslint:recommended\", \"codelyzer\"],\n+ \"rulesDirectory\": [\n+ \"node_modules/codelyzer\"\n+ ],\n\"rules\": {\n\"max-line-length\": {\n\"options\": [150]\n\"whitespace\": true,\n\"no-empty\": false,\n\"no-shadowed-variable\": false,\n- \"member-access\": false\n+ \"member-access\": false,\n+\n+ \"angular-whitespace\": [true, \"check-interpolation\", \"check-pipe\", \"check-semicolon\"],\n+ \"banana-in-box\": true,\n+ \"templates-no-negated-async\": true,\n+ \"directive-selector\": [\n+ true, \"attribute\", [\"ts\"], \"camelCase\"\n+ ],\n+ \"component-selector\": [\n+ \"element\", [\n+ \"ts-core\", \"ts-explore\", \"ts-sketch\", \"ts-story\"\n+ ], \"kebab-case\"\n+ ],\n+ \"use-input-property-decorator\": true,\n+ \"use-output-property-decorator\": true,\n+ \"use-host-property-decorator\": true,\n+ \"use-view-encapsulation\": true,\n+ \"no-attribute-parameter-decorator\": true,\n+ \"no-input-rename\": true,\n+ \"no-output-rename\": true,\n+ \"no-forward-ref\": true,\n+ \"use-life-cycle-interface\": true,\n+ \"use-pipe-transform-interface\": true,\n+ \"pipe-naming\": [true, \"camelCase\", \"ts\"],\n+ \"component-class-suffix\": true,\n+ \"directive-class-suffix\": true,\n+ \"templates-use-public\": true,\n+ \"no-access-missing-member\": true,\n+ \"invoke-injectable\": true,\n+ \"template-to-ng-template\": true\n},\n\"jsRules\": {\n\"max-line-length\": {\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "tslib \"^1.7.1\"\n\"@ngtools/webpack@^1.6.2\":\n- version \"1.6.2\"\n- resolved \"https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-1.6.2.tgz#70f2af1a59785d7abb9b4927a4aafdff2ef43a49\"\n+ version \"1.7.0\"\n+ resolved \"https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-1.7.0.tgz#100b4ba370b3b9f991936f3d5db09cebffe11583\"\ndependencies:\n+ enhanced-resolve \"^3.1.0\"\nloader-utils \"^1.0.2\"\nmagic-string \"^0.22.3\"\nsource-map \"^0.5.6\"\n@@ -87,8 +88,8 @@ acorn@^4.0.3:\nresolved \"https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787\"\nacorn@^5.0.0:\n- version \"5.1.1\"\n- resolved \"https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75\"\n+ version \"5.1.2\"\n+ resolved \"https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7\"\nafter@0.8.2:\nversion \"0.8.2\"\n@@ -165,6 +166,10 @@ anymatch@^1.1.0, anymatch@^1.3.0:\nmicromatch \"^2.1.5\"\nnormalize-path \"^2.0.0\"\n+app-root-path@^2.0.1:\n+ version \"2.0.1\"\n+ resolved \"https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46\"\n+\nappend-transform@^0.4.0:\nversion \"0.4.0\"\nresolved \"https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991\"\n@@ -443,18 +448,18 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:\nresolved \"https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f\"\nbody-parser@^1.16.1:\n- version \"1.18.0\"\n- resolved \"https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.0.tgz#d3b224d467fa2ce8d43589c0245043267c093634\"\n+ version \"1.18.1\"\n+ resolved \"https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.1.tgz#9c1629370bcfd42917f30641a2dcbe2ec50d4c26\"\ndependencies:\nbytes \"3.0.0\"\n- content-type \"~1.0.2\"\n+ content-type \"~1.0.4\"\ndebug \"2.6.8\"\ndepd \"~1.1.1\"\nhttp-errors \"~1.6.2\"\n- iconv-lite \"0.4.18\"\n+ iconv-lite \"0.4.19\"\non-finished \"~2.3.0\"\n- qs \"6.5.0\"\n- raw-body \"2.3.1\"\n+ qs \"6.5.1\"\n+ raw-body \"2.3.2\"\ntype-is \"~1.6.15\"\nboom@2.x.x:\n@@ -495,14 +500,15 @@ brorand@^1.0.1:\nresolved \"https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f\"\nbrowserify-aes@^1.0.0, browserify-aes@^1.0.4:\n- version \"1.0.6\"\n- resolved \"https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.0.6.tgz#5e7725dbdef1fd5930d4ebab48567ce451c48a0a\"\n+ version \"1.0.8\"\n+ resolved \"https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.0.8.tgz#c8fa3b1b7585bb7ba77c5560b60996ddec6d5309\"\ndependencies:\n- buffer-xor \"^1.0.2\"\n+ buffer-xor \"^1.0.3\"\ncipher-base \"^1.0.0\"\ncreate-hash \"^1.1.0\"\n- evp_bytestokey \"^1.0.0\"\n+ evp_bytestokey \"^1.0.3\"\ninherits \"^2.0.1\"\n+ safe-buffer \"^5.0.1\"\nbrowserify-cipher@^1.0.0:\nversion \"1.0.0\"\n@@ -552,7 +558,7 @@ browserslist@^1.3.6, browserslist@^1.5.2, browserslist@^1.7.6:\ncaniuse-db \"^1.0.30000639\"\nelectron-to-chromium \"^1.2.7\"\n-buffer-xor@^1.0.2:\n+buffer-xor@^1.0.3:\nversion \"1.0.3\"\nresolved \"https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9\"\n@@ -613,8 +619,8 @@ caniuse-api@^1.5.2:\nlodash.uniq \"^4.5.0\"\ncaniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:\n- version \"1.0.30000721\"\n- resolved \"https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000721.tgz#cdc52efe8f82dd13916615b78e86f704ece61802\"\n+ version \"1.0.30000727\"\n+ resolved \"https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000727.tgz#4e22593089b0f35c1b2adcfc28234493a21a4b2e\"\ncaseless@~0.12.0:\nversion \"0.12.0\"\n@@ -652,17 +658,17 @@ chart.js@2.2.2:\nchartjs-color \"^2.0.0\"\nmoment \"^2.10.6\"\n-chartjs-color-string@^0.4.0:\n- version \"0.4.0\"\n- resolved \"https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.4.0.tgz#57748d4530ae28d8db0a5492182ba06dfdf2f468\"\n+chartjs-color-string@^0.5.0:\n+ version \"0.5.0\"\n+ resolved \"https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.5.0.tgz#8d3752d8581d86687c35bfe2cb80ac5213ceb8c1\"\ndependencies:\ncolor-name \"^1.0.0\"\nchartjs-color@^2.0.0:\n- version \"2.1.0\"\n- resolved \"https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.1.0.tgz#9c39ac830ccd98996ae80c9f11086ff12c98a756\"\n+ version \"2.2.0\"\n+ resolved \"https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.2.0.tgz#84a2fb755787ed85c39dd6dd8c7b1d88429baeae\"\ndependencies:\n- chartjs-color-string \"^0.4.0\"\n+ chartjs-color-string \"^0.5.0\"\ncolor-convert \"^0.5.3\"\nchokidar-cli@^1.2.0:\n@@ -747,6 +753,17 @@ code-point-at@^1.0.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77\"\n+codelyzer@^3.2.0:\n+ version \"3.2.0\"\n+ resolved \"https://registry.yarnpkg.com/codelyzer/-/codelyzer-3.2.0.tgz#68eb0a67771ea73006b517053c3035c1838abf14\"\n+ dependencies:\n+ app-root-path \"^2.0.1\"\n+ css-selector-tokenizer \"^0.7.0\"\n+ cssauron \"^1.4.0\"\n+ semver-dsl \"^1.0.1\"\n+ source-map \"^0.5.6\"\n+ sprintf-js \"^1.0.3\"\n+\ncolor-convert@^0.5.3:\nversion \"0.5.3\"\nresolved \"https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd\"\n@@ -854,7 +871,7 @@ constants-browserify@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75\"\n-content-type@~1.0.2:\n+content-type@~1.0.4:\nversion \"1.0.4\"\nresolved \"https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b\"\n@@ -942,8 +959,8 @@ css-color-names@0.0.4:\nresolved \"https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0\"\ncss-loader@^0.28.5:\n- version \"0.28.5\"\n- resolved \"https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.5.tgz#dd02bb91b94545710212ef7f6aaa66663113d754\"\n+ version \"0.28.7\"\n+ resolved \"https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.7.tgz#5f2ee989dd32edd907717f953317656160999c1b\"\ndependencies:\nbabel-code-frame \"^6.11.0\"\ncss-selector-tokenizer \"^0.7.0\"\n@@ -968,6 +985,12 @@ css-selector-tokenizer@^0.7.0:\nfastparse \"^1.1.1\"\nregexpu-core \"^1.0.0\"\n+cssauron@^1.4.0:\n+ version \"1.4.0\"\n+ resolved \"https://registry.yarnpkg.com/cssauron/-/cssauron-1.4.0.tgz#a6602dff7e04a8306dc0db9a551e92e8b5662ad8\"\n+ dependencies:\n+ through X.X.X\n+\ncssesc@^0.1.0:\nversion \"0.1.0\"\nresolved \"https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4\"\n@@ -1094,8 +1117,8 @@ d3-drag@1.0.1:\nd3-selection \"1\"\nd3-dsv@1:\n- version \"1.0.5\"\n- resolved \"https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.5.tgz#419f7db47f628789fc3fdb636e678449d0821136\"\n+ version \"1.0.7\"\n+ resolved \"https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.7.tgz#137076663f398428fc3d031ae65370522492b78f\"\ndependencies:\ncommander \"2\"\niconv-lite \"0.4\"\n@@ -1238,8 +1261,8 @@ d3-time@1.0.2:\nresolved \"https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.2.tgz#25da641a7061af8f68ad08ca173101717b7430fc\"\nd3-timer@1:\n- version \"1.0.6\"\n- resolved \"https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.6.tgz#4044bf15d7025c06ce7d1149f73cd07b54dbd784\"\n+ version \"1.0.7\"\n+ resolved \"https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.7.tgz#df9650ca587f6c96607ff4e60cc38229e8dd8531\"\nd3-timer@1.0.2:\nversion \"1.0.2\"\n@@ -1354,6 +1377,10 @@ decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290\"\n+deep-equal@~1.0.1:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5\"\n+\ndeep-extend@~0.4.0:\nversion \"0.4.2\"\nresolved \"https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f\"\n@@ -1364,7 +1391,14 @@ default-require-extensions@^1.0.0:\ndependencies:\nstrip-bom \"^2.0.0\"\n-defined@^1.0.0:\n+define-properties@^1.1.2:\n+ version \"1.1.2\"\n+ resolved \"https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94\"\n+ dependencies:\n+ foreach \"^2.0.5\"\n+ object-keys \"^1.0.8\"\n+\n+defined@^1.0.0, defined@~1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693\"\n@@ -1398,8 +1432,8 @@ di@^0.0.1:\nresolved \"https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c\"\ndiff@^3.2.0:\n- version \"3.3.0\"\n- resolved \"https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9\"\n+ version \"3.3.1\"\n+ resolved \"https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75\"\ndiffie-hellman@^5.0.0:\nversion \"5.0.2\"\n@@ -1433,8 +1467,8 @@ ee-first@1.1.1:\nresolved \"https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d\"\nelectron-to-chromium@^1.2.7:\n- version \"1.3.18\"\n- resolved \"https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.18.tgz#3dcc99da3e6b665f6abbc71c28ad51a2cd731a9c\"\n+ version \"1.3.21\"\n+ resolved \"https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2\"\nelliptic@^6.0.0:\nversion \"6.4.0\"\n@@ -1495,7 +1529,7 @@ engine.io@1.8.3:\nengine.io-parser \"1.3.2\"\nws \"1.1.2\"\n-enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0:\n+enhanced-resolve@^3.0.0, enhanced-resolve@^3.1.0, enhanced-resolve@^3.4.0:\nversion \"3.4.1\"\nresolved \"https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e\"\ndependencies:\n@@ -1520,6 +1554,24 @@ error-ex@^1.2.0:\ndependencies:\nis-arrayish \"^0.2.1\"\n+es-abstract@^1.5.0:\n+ version \"1.8.2\"\n+ resolved \"https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.2.tgz#25103263dc4decbda60e0c737ca32313518027ee\"\n+ dependencies:\n+ es-to-primitive \"^1.1.1\"\n+ function-bind \"^1.1.1\"\n+ has \"^1.0.1\"\n+ is-callable \"^1.1.3\"\n+ is-regex \"^1.0.4\"\n+\n+es-to-primitive@^1.1.1:\n+ version \"1.1.1\"\n+ resolved \"https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d\"\n+ dependencies:\n+ is-callable \"^1.1.1\"\n+ is-date-object \"^1.0.1\"\n+ is-symbol \"^1.0.1\"\n+\nes5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:\nversion \"0.10.30\"\nresolved \"https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.30.tgz#7141a16836697dbabfaaaeee41495ce29f52c939\"\n@@ -1631,9 +1683,9 @@ events@^1.0.0:\nversion \"1.1.1\"\nresolved \"https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924\"\n-evp_bytestokey@^1.0.0:\n- version \"1.0.2\"\n- resolved \"https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.2.tgz#f66bb88ecd57f71a766821e20283ea38c68bf80a\"\n+evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:\n+ version \"1.0.3\"\n+ resolved \"https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02\"\ndependencies:\nmd5.js \"^1.3.4\"\nsafe-buffer \"^5.1.1\"\n@@ -1787,6 +1839,12 @@ font-awesome@4.3.0:\nversion \"4.3.0\"\nresolved \"https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.3.0.tgz#44eeb790cdf986642786f33fce784764f1841c40\"\n+for-each@~0.3.2:\n+ version \"0.3.2\"\n+ resolved \"https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4\"\n+ dependencies:\n+ is-function \"~1.0.0\"\n+\nfor-in@^0.1.3:\nversion \"0.1.8\"\nresolved \"https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1\"\n@@ -1807,6 +1865,10 @@ for-own@^1.0.0:\ndependencies:\nfor-in \"^1.0.1\"\n+foreach@^2.0.5:\n+ version \"2.0.5\"\n+ resolved \"https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99\"\n+\nforever-agent@~0.6.1:\nversion \"0.6.1\"\nresolved \"https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91\"\n@@ -1855,7 +1917,7 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:\nmkdirp \">=0.5 0\"\nrimraf \"2\"\n-function-bind@^1.0.2:\n+function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.0:\nversion \"1.1.1\"\nresolved \"https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d\"\n@@ -1909,7 +1971,7 @@ glob-parent@^2.0.0:\ndependencies:\nis-glob \"^2.0.0\"\n-glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@~7.1.1:\n+glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@~7.1.1, glob@~7.1.2:\nversion \"7.1.2\"\nresolved \"https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15\"\ndependencies:\n@@ -1985,7 +2047,7 @@ has-unicode@^2.0.0:\nversion \"2.0.1\"\nresolved \"https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9\"\n-has@^1.0.1:\n+has@^1.0.1, has@~1.0.1:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28\"\ndependencies:\n@@ -2075,9 +2137,9 @@ https-browserify@0.0.1:\nversion \"0.0.1\"\nresolved \"https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82\"\n-iconv-lite@0.4, iconv-lite@0.4.18:\n- version \"0.4.18\"\n- resolved \"https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2\"\n+iconv-lite@0.4, iconv-lite@0.4.19:\n+ version \"0.4.19\"\n+ resolved \"https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b\"\nicss-replace-symbols@^1.1.0:\nversion \"1.1.0\"\n@@ -2168,6 +2230,14 @@ is-builtin-module@^1.0.0:\ndependencies:\nbuiltin-modules \"^1.0.0\"\n+is-callable@^1.1.1, is-callable@^1.1.3:\n+ version \"1.1.3\"\n+ resolved \"https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2\"\n+\n+is-date-object@^1.0.1:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16\"\n+\nis-dotfile@^1.0.0:\nversion \"1.0.3\"\nresolved \"https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1\"\n@@ -2202,6 +2272,10 @@ is-fullwidth-code-point@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f\"\n+is-function@~1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5\"\n+\nis-glob@^2.0.0, is-glob@^2.0.1:\nversion \"2.0.1\"\nresolved \"https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863\"\n@@ -2242,6 +2316,12 @@ is-primitive@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575\"\n+is-regex@^1.0.4:\n+ version \"1.0.4\"\n+ resolved \"https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491\"\n+ dependencies:\n+ has \"^1.0.1\"\n+\nis-stream@^1.0.1, is-stream@^1.1.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44\"\n@@ -2252,6 +2332,10 @@ is-svg@^2.0.0:\ndependencies:\nhtml-comment-regex \"^1.1.0\"\n+is-symbol@^1.0.1:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572\"\n+\nis-typedarray@~1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a\"\n@@ -2379,8 +2463,8 @@ jquery@2.1.0:\nresolved \"https://registry.yarnpkg.com/jquery/-/jquery-2.1.0.tgz#1c9a8c971d2b53dae10d72e16cbb5a1df16a4ace\"\njs-base64@^2.1.8, js-base64@^2.1.9:\n- version \"2.1.9\"\n- resolved \"https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce\"\n+ version \"2.3.1\"\n+ resolved \"https://registry.yarnpkg.com/js-base64/-/js-base64-2.3.1.tgz#3705897c35fce0e202132630e750d8a17cd220ec\"\njs-tokens@^3.0.0, js-tokens@^3.0.2:\nversion \"3.0.2\"\n@@ -2767,21 +2851,11 @@ miller-rabin@^4.0.0:\nbn.js \"^4.0.0\"\nbrorand \"^1.0.1\"\n-mime-db@~1.29.0:\n- version \"1.29.0\"\n- resolved \"https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878\"\n-\nmime-db@~1.30.0:\nversion \"1.30.0\"\nresolved \"https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01\"\n-mime-types@^2.1.12, mime-types@~2.1.7:\n- version \"2.1.16\"\n- resolved \"https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.16.tgz#2b858a52e5ecd516db897ac2be87487830698e23\"\n- dependencies:\n- mime-db \"~1.29.0\"\n-\n-mime-types@~2.1.11, mime-types@~2.1.15:\n+mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.7:\nversion \"2.1.17\"\nresolved \"https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a\"\ndependencies:\n@@ -2817,7 +2891,7 @@ minimist@0.0.8:\nversion \"0.0.8\"\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d\"\n-minimist@^1.1.3, minimist@^1.2.0:\n+minimist@^1.1.3, minimist@^1.2.0, minimist@~1.2.0:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284\"\n@@ -2919,8 +2993,8 @@ node-libs-browser@^2.0.0:\nvm-browserify \"0.0.4\"\nnode-pre-gyp@^0.6.36:\n- version \"0.6.36\"\n- resolved \"https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz#db604112cb74e0d477554e9b505b17abddfab786\"\n+ version \"0.6.37\"\n+ resolved \"https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.37.tgz#3c872b236b2e266e4140578fe1ee88f693323a05\"\ndependencies:\nmkdirp \"^0.5.1\"\nnopt \"^4.0.1\"\n@@ -2929,6 +3003,7 @@ node-pre-gyp@^0.6.36:\nrequest \"^2.81.0\"\nrimraf \"^2.6.1\"\nsemver \"^5.3.0\"\n+ tape \"^4.6.3\"\ntar \"^2.2.1\"\ntar-pack \"^3.4.0\"\n@@ -3043,6 +3118,14 @@ object-component@0.0.3:\nversion \"0.0.3\"\nresolved \"https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291\"\n+object-inspect@~1.3.0:\n+ version \"1.3.0\"\n+ resolved \"https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d\"\n+\n+object-keys@^1.0.8:\n+ version \"1.0.11\"\n+ resolved \"https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d\"\n+\nobject.omit@^2.0.0:\nversion \"2.0.1\"\nresolved \"https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa\"\n@@ -3212,8 +3295,8 @@ path-type@^2.0.0:\npify \"^2.0.0\"\npbkdf2@^3.0.3:\n- version \"3.0.13\"\n- resolved \"https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.13.tgz#c37d295531e786b1da3e3eadc840426accb0ae25\"\n+ version \"3.0.14\"\n+ resolved \"https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade\"\ndependencies:\ncreate-hash \"^1.1.2\"\ncreate-hmac \"^1.1.4\"\n@@ -3500,12 +3583,12 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0\nsupports-color \"^3.2.3\"\npostcss@^6.0.1:\n- version \"6.0.10\"\n- resolved \"https://registry.yarnpkg.com/postcss/-/postcss-6.0.10.tgz#c311b89734483d87a91a56dc9e53f15f4e6e84e4\"\n+ version \"6.0.11\"\n+ resolved \"https://registry.yarnpkg.com/postcss/-/postcss-6.0.11.tgz#f48db210b1d37a7f7ab6499b7a54982997ab6f72\"\ndependencies:\nchalk \"^2.1.0\"\nsource-map \"^0.5.7\"\n- supports-color \"^4.2.1\"\n+ supports-color \"^4.4.0\"\nprepend-http@^1.0.0:\nversion \"1.0.4\"\n@@ -3561,9 +3644,9 @@ qjobs@^1.1.4:\nversion \"1.1.5\"\nresolved \"https://registry.yarnpkg.com/qjobs/-/qjobs-1.1.5.tgz#659de9f2cf8dcc27a1481276f205377272382e73\"\n-qs@6.5.0:\n- version \"6.5.0\"\n- resolved \"https://registry.yarnpkg.com/qs/-/qs-6.5.0.tgz#8d04954d364def3efc55b5a0793e1e2c8b1e6e49\"\n+qs@6.5.1:\n+ version \"6.5.1\"\n+ resolved \"https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8\"\nqs@~6.4.0:\nversion \"6.4.0\"\n@@ -3601,13 +3684,13 @@ range-parser@^1.0.3, range-parser@^1.2.0:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e\"\n-raw-body@2.3.1:\n- version \"2.3.1\"\n- resolved \"https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.1.tgz#30f95e2a67a14e2e4413d8d51fdd92c877e8f2ed\"\n+raw-body@2.3.2:\n+ version \"2.3.2\"\n+ resolved \"https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89\"\ndependencies:\nbytes \"3.0.0\"\nhttp-errors \"1.6.2\"\n- iconv-lite \"0.4.18\"\n+ iconv-lite \"0.4.19\"\nunpipe \"1.0.0\"\nraw-loader@^0.5.1:\n@@ -3721,11 +3804,10 @@ regenerator-runtime@^0.11.0:\nresolved \"https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1\"\nregex-cache@^0.4.2:\n- version \"0.4.3\"\n- resolved \"https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145\"\n+ version \"0.4.4\"\n+ resolved \"https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd\"\ndependencies:\nis-equal-shallow \"^0.1.3\"\n- is-primitive \"^2.0.0\"\nregexpu-core@^1.0.0:\nversion \"1.0.0\"\n@@ -3812,25 +3894,25 @@ requires-port@1.x.x:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff\"\n-resolve@^1.3.2:\n+resolve@^1.3.2, resolve@~1.4.0:\nversion \"1.4.0\"\nresolved \"https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86\"\ndependencies:\npath-parse \"^1.0.5\"\n+resumer@~0.0.0:\n+ version \"0.0.0\"\n+ resolved \"https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759\"\n+ dependencies:\n+ through \"~2.3.4\"\n+\nright-align@^0.1.1:\nversion \"0.1.3\"\nresolved \"https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef\"\ndependencies:\nalign-text \"^0.1.1\"\n-rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1:\n- version \"2.6.1\"\n- resolved \"https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d\"\n- dependencies:\n- glob \"^7.0.5\"\n-\n-rimraf@^2.6.0:\n+rimraf@2, rimraf@^2.5.1, rimraf@^2.6.0, rimraf@^2.6.1:\nversion \"2.6.2\"\nresolved \"https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36\"\ndependencies:\n@@ -3893,6 +3975,12 @@ scss-tokenizer@^0.2.3:\njs-base64 \"^2.1.8\"\nsource-map \"^0.4.2\"\n+semver-dsl@^1.0.1:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/semver-dsl/-/semver-dsl-1.0.1.tgz#d3678de5555e8a61f629eed025366ae5f27340a0\"\n+ dependencies:\n+ semver \"^5.3.0\"\n+\n\"semver@2 || 3 || 4 || 5\", semver@^5.0.1, semver@^5.3.0:\nversion \"5.4.1\"\nresolved \"https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e\"\n@@ -4020,8 +4108,8 @@ source-list-map@^2.0.0:\nresolved \"https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085\"\nsource-map-support@^0.4.2:\n- version \"0.4.16\"\n- resolved \"https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.16.tgz#16fecf98212467d017d586a2af68d628b9421cd8\"\n+ version \"0.4.18\"\n+ resolved \"https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f\"\ndependencies:\nsource-map \"^0.5.6\"\n@@ -4055,6 +4143,10 @@ spdx-license-ids@^1.0.2:\nversion \"1.2.2\"\nresolved \"https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57\"\n+sprintf-js@^1.0.3:\n+ version \"1.1.1\"\n+ resolved \"https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.1.tgz#36be78320afe5801f6cea3ee78b6e5aab940ea0c\"\n+\nsprintf-js@~1.0.2:\nversion \"1.0.3\"\nresolved \"https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c\"\n@@ -4119,6 +4211,14 @@ string-width@^2.0.0:\nis-fullwidth-code-point \"^2.0.0\"\nstrip-ansi \"^4.0.0\"\n+string.prototype.trim@~1.1.2:\n+ version \"1.1.2\"\n+ resolved \"https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea\"\n+ dependencies:\n+ define-properties \"^1.1.2\"\n+ es-abstract \"^1.5.0\"\n+ function-bind \"^1.0.2\"\n+\nstring_decoder@^0.10.25, string_decoder@~0.10.x:\nversion \"0.10.31\"\nresolved \"https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94\"\n@@ -4186,9 +4286,9 @@ supports-color@^3.1.2, supports-color@^3.2.3:\ndependencies:\nhas-flag \"^1.0.0\"\n-supports-color@^4.0.0, supports-color@^4.2.1:\n- version \"4.2.1\"\n- resolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836\"\n+supports-color@^4.0.0, supports-color@^4.2.1, supports-color@^4.4.0:\n+ version \"4.4.0\"\n+ resolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e\"\ndependencies:\nhas-flag \"^2.0.0\"\n@@ -4212,6 +4312,24 @@ tapable@^0.2.7:\nversion \"0.2.8\"\nresolved \"https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22\"\n+tape@^4.6.3:\n+ version \"4.8.0\"\n+ resolved \"https://registry.yarnpkg.com/tape/-/tape-4.8.0.tgz#f6a9fec41cc50a1de50fa33603ab580991f6068e\"\n+ dependencies:\n+ deep-equal \"~1.0.1\"\n+ defined \"~1.0.0\"\n+ for-each \"~0.3.2\"\n+ function-bind \"~1.1.0\"\n+ glob \"~7.1.2\"\n+ has \"~1.0.1\"\n+ inherits \"~2.0.3\"\n+ minimist \"~1.2.0\"\n+ object-inspect \"~1.3.0\"\n+ resolve \"~1.4.0\"\n+ resumer \"~0.0.0\"\n+ string.prototype.trim \"~1.1.2\"\n+ through \"~2.3.8\"\n+\ntar-pack@^3.4.0:\nversion \"3.4.0\"\nresolved \"https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984\"\n@@ -4237,6 +4355,10 @@ throttleit@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c\"\n+through@X.X.X, through@~2.3.4, through@~2.3.8:\n+ version \"2.3.8\"\n+ resolved \"https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5\"\n+\ntime-stamp@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357\"\n@@ -4286,8 +4408,8 @@ trim-right@^1.0.1:\nresolved \"https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003\"\nts-loader@^2.3.3:\n- version \"2.3.4\"\n- resolved \"https://registry.yarnpkg.com/ts-loader/-/ts-loader-2.3.4.tgz#904f82f6812406f3f073c1c114eea2759e27f80a\"\n+ version \"2.3.7\"\n+ resolved \"https://registry.yarnpkg.com/ts-loader/-/ts-loader-2.3.7.tgz#a9028ced473bee12f28a75f9c5b139979d33f2fc\"\ndependencies:\nchalk \"^2.0.1\"\nenhanced-resolve \"^3.0.0\"\n@@ -4367,8 +4489,8 @@ typedarray@^0.0.6:\nresolved \"https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777\"\ntypescript@^2.4.2:\n- version \"2.5.1\"\n- resolved \"https://registry.yarnpkg.com/typescript/-/typescript-2.5.1.tgz#ce7cc93ada3de19475cc9d17e3adea7aee1832aa\"\n+ version \"2.5.2\"\n+ resolved \"https://registry.yarnpkg.com/typescript/-/typescript-2.5.2.tgz#038a95f7d9bbb420b1bf35ba31d4c5c1dd3ffe34\"\nuglify-js@^2.6, uglify-js@^2.8.29:\nversion \"2.8.29\"\n@@ -4519,8 +4641,8 @@ webpack-sources@^1.0.1:\nsource-map \"~0.5.3\"\nwebpack@^3.5.5:\n- version \"3.5.5\"\n- resolved \"https://registry.yarnpkg.com/webpack/-/webpack-3.5.5.tgz#3226f09fc8b3e435ff781e7af34f82b68b26996c\"\n+ version \"3.5.6\"\n+ resolved \"https://registry.yarnpkg.com/webpack/-/webpack-3.5.6.tgz#a492fb6c1ed7f573816f90e00c8fbb5a20cc5c36\"\ndependencies:\nacorn \"^5.0.0\"\nacorn-dynamic-import \"^2.0.0\"\n" } ]
Python
Apache License 2.0
google/timesketch
Add angular-specific linter. (#426)
263,122
13.09.2017 10:57:37
-7,200
9441775dfcb0263e9bab34ecaa9abb83a40e4f67
Fix navigation bar broken in
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/sketch/sketch.module.ts", "new_path": "timesketch/ui/sketch/sketch.module.ts", "diff": "@@ -27,7 +27,7 @@ export const tsSketchModule = angular.module('timesketch.sketch', [])\n.directive('tsTimelinesList', tsTimelinesList)\n.directive('tsSavedViewList', tsSavedViewList)\n.directive('tsSearchTemplateList', tsSearchTemplateList)\n- .directive('tsNavigation', downgradeComponent({\n+ .directive('tsSketchNavigation', downgradeComponent({\ncomponent: NavigationComponent, propagateDigest: false,\n}))\n" } ]
Python
Apache License 2.0
google/timesketch
Fix navigation bar broken in #422 (#429)
263,122
13.09.2017 12:04:01
-7,200
32044583d92117d23c649a695602e71986493d25
Add info about running tests to developers guide.
[ { "change_type": "MODIFY", "old_path": "docker/README.md", "new_path": "docker/README.md", "diff": "@@ -13,7 +13,7 @@ cd timesketch\n```\n### Build Timesketch frontend\n-Follow steps \"Installing Node.js and Yarn\" and \"Building Timesketch frontend\" from [developers guide](../docs/Developers-Guide.md).\n+Follow steps \"Frontend dependencies\" and \"Building Timesketch frontend\" from [developers guide](../docs/Developers-Guide.md).\n### Build and Start Containers\n" }, { "change_type": "MODIFY", "old_path": "docs/Developers-Guide.md", "new_path": "docs/Developers-Guide.md", "diff": "We use pip-tools and virtualenv for development. Pip-tools must be installed\ninside a virtualenv, installing it system-wide will cause issues.\nIf you want to add a new python dependency, please add it to `requirements.in`\n-and then run pip-compile to pin it's version in `requirements.txt`.\n+and then run `pip-compile` to pin it's version in `requirements.txt`.\nUse `pip-sync` instead of `pip install -r requirements.txt` when possible.\nUse `pip-compile --upgrade` to keep dependencies up to date.\n-#### Installing Node.js and Yarn\n+#### Frontend dependencies\nAdd Node.js 8.x repo\n$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\n@@ -18,20 +18,41 @@ Add Yarn repo\n$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n$ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n-Install\n+Install Node.js and Yarn\n$ apt-get update && apt-get install nodejs yarn\n-#### Building Timesketch frontend\n-First, cd to timesketch repository root (folder that contains package.json).\n-\n-Install nodejs packages\n+Cd to timesketch repository root (folder that contains `package.json`)\n+and install Node.js packages (this will create `node_modules/` folder in the\n+current directory and install packages from `package.json` there)\n$ yarn install\n-Build frontend files\n+#### Running tests and linters\n+The main entry point is `run_tests.py`. Please note that for testing and\n+linting python/frontend code you need respectively python/frontend dependencies\n+installed.\n+\n+For more information:\n+\n+ $ run_tests.py --help\n+\n+To run frontend tests in watch mode, use\n+\n+ $ yarn run test:watch\n+\n+To run TSLint in watch mode, use\n+\n+ $ yarn run lint:watch\n+\n+#### Building Timesketch frontend\n+To build frontend files and put bundles in `timesketch/static/dist/`, use\n$ yarn run build\n+To watch for changes in code and rebuild automatically, use\n+\n+ $ yarn run build:watch\n+\n#### Packaging\nBefore pushing package to PyPI, make sure you build the frontend before.\n" } ]
Python
Apache License 2.0
google/timesketch
Add info about running tests to developers guide. (#430)
263,122
20.09.2017 16:01:15
-7,200
f20dac6e8723fedbf62fb2e24894f0e51e5855d0
Fix Angular bootstrap broken in
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/main.ts", "new_path": "timesketch/ui/main.ts", "diff": "+import * as $ from 'jquery'\nimport angular from 'angularjs-for-webpack'\nimport {downgradeModule} from '@angular/upgrade/static'\nimport {tsAppModule, AppModule} from 'app.module'\n-angular.element(function () {\n+$(function () {\n// @ngtools/webpack should automatically convert AppModule to\n// AppModuleNgFactory. We are casting it through any to make TypeScript happy\n" } ]
Python
Apache License 2.0
google/timesketch
Fix Angular bootstrap broken in #423 (#439)
263,093
25.09.2017 15:02:43
-7,200
2cf654c2443d2f59f5196a87144b8a9716f9eeeb
align navigation menu
[ { "change_type": "MODIFY", "old_path": "timesketch/templates/base.html", "new_path": "timesketch/templates/base.html", "diff": "@@ -48,6 +48,7 @@ limitations under the License.\n{% block subheader %}\n<div id=\"subheader\">\n<div id=\"navigation\">\n+ <div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"pull-left\">\n{% block navigation %}{% endblock %}\n@@ -58,6 +59,7 @@ limitations under the License.\n</div>\n</div>\n</div>\n+ </div>\n{% endblock %}\n<div id=\"main\">\n" } ]
Python
Apache License 2.0
google/timesketch
align navigation menu (#440)
263,093
28.09.2017 16:02:07
-7,200
bd3d562cb2edaa7ffdf6cfffa8c78243f413f19d
Wrap text when too long
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/css/ts.css", "new_path": "timesketch/ui/css/ts.css", "diff": "@@ -153,6 +153,12 @@ header {\ncursor: pointer;\n}\n+.event-message-wrap {\n+ white-space:nowrap;\n+ overflow:hidden;\n+ text-overflow: ellipsis;\n+}\n+\n.event-message-selected {\nbackground: #fafad2;\n}\n@@ -161,6 +167,10 @@ header {\nbackground: #fff4b3;\n}\n+.event-message-details {\n+ background: #fafad2;\n+}\n+\n.timerange-input {\nwidth: 210px;\noutline: none;\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event.html", "new_path": "timesketch/ui/explore/event.html", "diff": "{{::event._source.datetime}}\n</td>\n- <td width=\"20px;\">\n+ <td width=\"20px\">\n<input type=\"checkbox\" ng-click=\"toggleSelected()\" ng-checked=\"event.selected\">\n</td>\n- <td width=\"25px;\">\n+ <td width=\"25px\">\n<i ng-click=\"event.star = !event.star;toggleStar()\" ng-class=\"{true: 'fa fa-lg fa-star icon-yellow', false: 'fa fa-lg fa-star-o icon-grey'}[event.star]\"></i>\n</td>\n- <td width=\"35px;\">\n+ <td width=\"30px\">\n<i ng-click=\"event.hidden = !event.hidden;toggleHidden()\" ng-class=\"{true: 'fa fa-lg fa-eye-slash', false: 'fa fa-lg fa-eye-slash icon-grey'}[event.hidden]\"></i>\n</td>\n- <td class=\"event-message\" ng-class=\"{'event-message-selected': event.selected, 'event-message-starred': event.star}\" ng-click=\"getDetail();showDetails = !showDetails\">\n- <span ng-show=\"comment\">\n- <i class=\"fa fa-comments\"></i>\n- </span>\n- <span ng-if=\"::event._source.tag\" ng-repeat=\"tag in ::event._source.tag\" class=\"label label-default\">{{::tag}}</span>\n-\n- <span ng-class=\"{true: 'message-hidden'}[event.hidden]\">[{{ event._source.timestamp_desc }}] <span style=white-space:pre-wrap;\">{{ event._source.message|limitTo:500 }}</span></span>\n-\n- <div style=\"width:20px;height:20px;cursor: pointer;\" class=\"pull-right tooltips\"><span>Details</span><i ng-class=\"{true: 'fa fa-minus-square-o', false: 'fa fa-plus-square-o'}[showDetails]\" style=\"color:#999;\"></i></div>\n-\n+ <td width=\"35px\">\n+ <div ng-if=\"enableContextQuery\" style=\"width:20px;height:20px;cursor: pointer;\" class=\"tooltips\" ng-click=\"getContext(event)\">\n+ <span>Context query</span><i class=\"fa fa-search-plus\" style=\"color:#999;\"></i>\n+ </div>\n</td>\n- <td width=\"150px\" style=\"text-align: right;background: #f1f1f1;\">\n- <span class=\"label ts-name-label\">{{::timeline_name}}</span>\n+ <td class=\"event-message\" ng-class=\"{'event-message-selected': event.selected, 'event-message-starred': event.star, 'event-message-wrap': !showDetails, 'event-message-details': showDetails}\" ng-click=\"getDetail();showDetails = !showDetails\">\n+ <span ng-show=\"comment\"><i class=\"fa fa-comments\"></i></span>\n+ <span ng-if=\"::event._source.tag\" ng-repeat=\"tag in ::event._source.tag\" class=\"label label-default\">{{::tag}}</span>\n+ <span ng-class=\"{true: 'message-hidden'}[event.hidden]\">[{{ event._source.timestamp_desc }}] <span title=\"{{ event._source.message }}\">{{ event._source.message|limitTo:1000 }}</span></span>\n+ </td>\n- <div ng-if=\"enableContextQuery\" style=\"width:20px;height:20px;cursor: pointer;\" class=\"tooltips\" ng-click=\"getContext(event)\">\n- <span>Context query</span><i class=\"fa fa-search-plus\" style=\"color:#777;\"></i>\n- </div>\n+ <td width=\"25px\" class=\"event-message\" ng-class=\"{'event-message-selected': event.selected, 'event-message-starred': event.star, 'event-message-details': showDetails}\">\n+ <div style=\"width:20px;height:20px;cursor: pointer;\" class=\"pull-right tooltips\"><span>Details</span><i ng-class=\"{true: 'fa fa-minus-square-o', false: 'fa fa-plus-square-o'}[showDetails]\" ng-click=\"getDetail();showDetails = !showDetails\" style=\"color:#999;\"></i></div>\n+ </td>\n+ <td width=\"150px\" style=\"text-align: right;background: #f1f1f1; white-space:nowrap; overflow:hidden; text-overflow: ellipsis;\">\n+ <span title=\"{{::timeline_name}}\" class=\"label ts-name-label\">{{::timeline_name}}</span>\n</td>\n</tr>\n" } ]
Python
Apache License 2.0
google/timesketch
Wrap text when too long (#443)
263,093
03.10.2017 13:48:49
-7,200
4baf55f5142dd75c39b96484fc214893107519cc
Remove container block
[ { "change_type": "MODIFY", "old_path": "timesketch/templates/base.html", "new_path": "timesketch/templates/base.html", "diff": "@@ -48,7 +48,6 @@ limitations under the License.\n{% block subheader %}\n<div id=\"subheader\">\n<div id=\"navigation\">\n- <div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"pull-left\">\n{% block navigation %}{% endblock %}\n@@ -59,7 +58,6 @@ limitations under the License.\n</div>\n</div>\n</div>\n- </div>\n{% endblock %}\n<div id=\"main\">\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/explore.html", "new_path": "timesketch/templates/sketch/explore.html", "diff": "{% endblock %}\n{% block main %}\n- <div class=\"container\">\n{% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n</div>\n</div>\n{% endif %}\n- </div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/overview.html", "new_path": "timesketch/templates/sketch/overview.html", "diff": "</div>\n</div>\n- <div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding-left:30px; padding-bottom: 30px;\">\n</div>\n</div>\n{% endif %}\n- </div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/stories.html", "new_path": "timesketch/templates/sketch/stories.html", "diff": "{% block main %}\n- <div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n{% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines %}\n{% endif %}\n</div>\n</div>\n- </div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timeline.html", "new_path": "timesketch/templates/sketch/timeline.html", "diff": "</div>\n</div>\n- <div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card card-top\">\n</div>\n</div>\n</div>\n- </div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timelines.html", "new_path": "timesketch/templates/sketch/timelines.html", "diff": "</div>\n{% endif %}\n- <div class=\"container\">\n{% if sketch.timelines %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n</div>\n</div>\n{% endif %}\n- </div>\n- <div class=\"container\">\n{% if sketch.has_permission(current_user, 'write') %}\n{% if timelines %}\n<div class=\"row\">\n</div>\n{% endif %}\n{% endif %}\n- </div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/views.html", "new_path": "timesketch/templates/sketch/views.html", "diff": "{% endblock %}\n{% block main %}\n-\n- <div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n-\n{% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines %}\n<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n{% endif %}\n</div>\n</div>\n- </div>\n-\n{% endblock %}\n" } ]
Python
Apache License 2.0
google/timesketch
Remove container block (#445)
263,122
18.10.2017 12:33:20
-7,200
cdfc2c0a534d547c3241da41d708f93ceb66a051
Graph generation.
[ { "change_type": "MODIFY", "old_path": "timesketch/__init__.py", "new_path": "timesketch/__init__.py", "diff": "@@ -44,6 +44,10 @@ from timesketch.api.v1.resources import TimelineResource\nfrom timesketch.api.v1.resources import TimelineListResource\nfrom timesketch.api.v1.resources import SearchIndexListResource\nfrom timesketch.api.v1.resources import SearchIndexResource\n+from timesketch.api.experimental.resources import WinLoginsResource\n+from timesketch.api.experimental.resources import WinServicesResource\n+from timesketch.api.experimental.resources import CreateGraphResource\n+from timesketch.api.experimental.resources import DeleteGraphResource\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.models import configure_engine\nfrom timesketch.models import init_db\n@@ -154,6 +158,16 @@ def create_app(config=None):\napi_v1.add_resource(GraphResource,\nu'/sketches/<int:sketch_id>/explore/graph/')\n+ api_experimental = Api(app, prefix=u'/api/experimental')\n+ api_experimental.add_resource(\n+ WinLoginsResource, u'/sketches/<int:sketch_id>/win_logins')\n+ api_experimental.add_resource(\n+ WinServicesResource, u'/sketches/<int:sketch_id>/win_services')\n+ api_experimental.add_resource(\n+ CreateGraphResource, u'/sketches/<int:sketch_id>/create_graph')\n+ api_experimental.add_resource(\n+ DeleteGraphResource, u'/sketches/<int:sketch_id>/delete_graph')\n+\n# Register error handlers\n# pylint: disable=unused-variable\n@app.errorhandler(ApiHTTPError)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/api/experimental/__init__.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Experimental parts of the Timesketch API.\"\"\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/api/experimental/resources.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Experimental parts of the Timesketch API.\"\"\"\n+\n+\n+from flask import jsonify\n+from flask_restful import Resource\n+from flask_login import login_required\n+\n+from timesketch.api.v1.resources import ResourceMixin\n+from timesketch.lib.experimental.win_logins import win_logins\n+from timesketch.lib.experimental.win_services import win_services\n+from timesketch.lib.experimental.create_graph import create_graph\n+from timesketch.lib.experimental.delete_graph import delete_graph\n+\n+\n+class WinLoginsResource(Resource):\n+ @login_required\n+ def get(self, sketch_id):\n+ \"\"\"Only for debugging.\"\"\"\n+ return jsonify(win_logins(sketch_id))\n+\n+\n+class WinServicesResource(Resource):\n+ @login_required\n+ def get(self, sketch_id):\n+ \"\"\"Only for debugging.\"\"\"\n+ return jsonify(win_services(sketch_id))\n+\n+\n+class CreateGraphResource(ResourceMixin, Resource):\n+ @login_required\n+ def post(self, sketch_id):\n+ \"\"\"For given sketch, create a lateral movement graph from Elasticsearch\n+ events and save it to Neo4j. Nodes and edges have sketch_id property.\n+ \"\"\"\n+ result = []\n+ params = {\n+ u'sketch_id': sketch_id,\n+ u'win_logins': win_logins(sketch_id),\n+ u'win_services': win_services(sketch_id),\n+ }\n+ for statement in create_graph.split(';'):\n+ statement = statement.strip()\n+ if not statement or statement.startswith('//'):\n+ continue\n+ result.append(self.graph_datastore.query(\n+ statement, params=params))\n+ return jsonify(result)\n+\n+\n+class DeleteGraphResource(ResourceMixin, Resource):\n+ @login_required\n+ def post(self, sketch_id):\n+ \"\"\"Delete all nodes and edges corresponding to given sketch.\"\"\"\n+ result = self.graph_datastore.query(delete_graph, params={\n+ u'sketch_id': sketch_id,\n+ })\n+ return jsonify(result)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -1275,7 +1275,7 @@ class GraphResource(ResourceMixin, Resource):\nif form.validate_on_submit():\nquery = form.query.data\noutput_format = form.output_format.data\n- result = self.graph_datastore.search(\n+ result = self.graph_datastore.query(\nquery, output_format=output_format)\nschema = {\nu'meta': {\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -88,11 +88,12 @@ class Neo4jDataStore(object):\nformatter = formatter_registry.get(default_output_format)\nreturn formatter()\n- def search(self, query, output_format=None, return_rows=False):\n+ def query(self, query, params=None, output_format=None, return_rows=False):\n\"\"\"Search the graph.\nArgs:\nquery: A cypher query\n+ params: A dictionary with query parameters\noutput_format: Name of the output format to use\nreturn_rows: Boolean indicating if rows should be returned\n@@ -102,7 +103,8 @@ class Neo4jDataStore(object):\ndata_content = DATA_GRAPH\nif return_rows:\ndata_content = True\n- query_result = self.client.query(query, data_contents=data_content)\n+ query_result = self.client.query(\n+ query, params=params, data_contents=data_content)\nformatter = self._get_formatter(output_format)\nreturn formatter.format(query_result, return_rows)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j_test.py", "new_path": "timesketch/lib/datastores/neo4j_test.py", "diff": "@@ -56,8 +56,8 @@ class Neo4jTest(BaseTest):\nNone,\nu'stats': {}\n}\n- client = Neo4jDataStore(username=u'test', password=u'test')\n- formatted_response = client.search(query=u'')\n+ datastore = Neo4jDataStore(username=u'test', password=u'test')\n+ formatted_response = datastore.query(query=u'')\nself.assertIsInstance(formatted_response, dict)\nself.assertDictEqual(formatted_response, expected_output)\n@@ -92,8 +92,8 @@ class Neo4jTest(BaseTest):\nu'rows': None,\nu'stats': {}\n}\n- client = Neo4jDataStore(username=u'test', password=u'test')\n- formatted_response = client.search(\n+ datastore = Neo4jDataStore(username=u'test', password=u'test')\n+ formatted_response = datastore.query(\nquery=u'', output_format=u'cytoscape')\nself.assertIsInstance(formatted_response, dict)\nself.assertDictEqual(formatted_response, expected_output)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/__init__.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Experimental parts of Timesketch.\"\"\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/create_graph.cql", "diff": "+// Copyright 2017 Google Inc. All rights reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+// node key constraints are available only in enterprise edition\n+// CREATE CONSTRAINT ON (u:WindowsADUser) ASSERT (u.sketch_id, u.username) IS NODE KEY;\n+// CREATE CONSTRAINT ON (u:WindowsLocalUser) ASSERT (u.sketch_id, u.hostname, u.username) IS NODE KEY;\n+// CREATE CONSTRAINT ON (m:WindowsMachine) ASSERT (m.sketch_id, m.hostname) IS NODE KEY;\n+// CREATE CONSTRAINT ON (s:WindowsService) ASSERT (s.sketch_id, s.service_name) IS NODE KEY;\n+// CREATE CONSTRAINT ON (p:WindowsServiceImagePath) ASSERT (p.sketch_id, p.image_path) IS NODE KEY;\n+// CREATE CONSTRAINT ON ()-[r:ACCESS]-() ASSERT exists(r.sketch_id);\n+// CREATE CONSTRAINT ON ()-[r:START]-() ASSERT exists(r.sketch_id);\n+// CREATE CONSTRAINT ON ()-[r:HAS]-() ASSERT exists(r.sketch_id);\n+\n+UNWIND {win_logins} AS line\n+WITH line\n+WHERE line.src <> line.dst\n+\n+ MERGE (src:WindowsMachine { hostname: line.src, sketch_id: {sketch_id} })\n+ MERGE (dst:WindowsMachine { hostname: line.dst, sketch_id: {sketch_id} })\n+\n+ MERGE (src)-[r:ACCESS]->(dst)\n+ SET r.method = line.method,\n+ r.username = line.user,\n+ r.sketch_id = {sketch_id}\n+;\n+\n+UNWIND {win_logins} AS line\n+WITH line\n+WHERE line.src = line.dst\n+\n+ MERGE (user:WindowsADUser { username: line.user, sketch_id: {sketch_id} })\n+ MERGE (dst:WindowsMachine { hostname: line.dst, sketch_id: {sketch_id} })\n+\n+ MERGE (user)-[r:ACCESS]->(dst)\n+ SET r.method = line.method,\n+ r.username = line.user,\n+ r.sketch_id = {sketch_id}\n+;\n+\n+UNWIND {win_services} AS line\n+WITH line\n+\n+ MERGE (src:WindowsMachine { hostname: line.src, sketch_id: {sketch_id} })\n+ MERGE (service:WindowsService { service_name: line.svc_name, sketch_id: {sketch_id} })\n+ MERGE (image_path:WindowsServiceImagePath { image_path: line.image_path, sketch_id: {sketch_id} })\n+\n+ MERGE (service)-[r:START]->(src)\n+ SET r.start_type = line.start_type,\n+ r.sketch_id = {sketch_id}\n+\n+ MERGE (service)-[h:HAS]->(image_path)\n+ SET h.sketch_id = {sketch_id}\n+;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/create_graph.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Cypher statement to import graph from win_logins and win_services.\"\"\"\n+import os.path\n+\n+\n+THIS_DIR = os.path.dirname(os.path.abspath(__file__))\n+with open(os.path.join(THIS_DIR, 'create_graph.cql')) as f:\n+ create_graph = f.read()\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/delete_graph.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Cypher statement to delete graph corresponding to particular sketch.\"\"\"\n+\n+\n+delete_graph = 'MATCH (n {sketch_id: {sketch_id}}) DETACH DELETE n'\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/utils.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Utilities for generating graphs from elasticsearch data.\"\"\"\n+\n+# pylint: skip-file\n+import sys\n+\n+from timesketch.lib.datastores.elastic import ElasticsearchDataStore\n+from timesketch.models.sketch import Sketch\n+from xml.etree import ElementTree\n+\n+\n+def event_stream(sketch_id, query):\n+ es = ElasticsearchDataStore(u'127.0.0.1', 9200)\n+ sketch = Sketch.query.get(sketch_id)\n+ if not sketch:\n+ sys.exit('No such sketch')\n+ indices = {t.searchindex.index_name for t in sketch.timelines}\n+\n+ result = es.search(\n+ sketch_id=sketch_id,\n+ query_string=query,\n+ query_filter={u'limit': 10000},\n+ query_dsl={},\n+ indices=[u'_all'],\n+ return_fields=[u'xml_string'],\n+ enable_scroll=True)\n+\n+ scroll_id = result[u'_scroll_id']\n+ scroll_size = result[u'hits'][u'total']\n+\n+ for event in result[u'hits'][u'hits']:\n+ yield event\n+\n+ while scroll_size > 0:\n+ result = es.client.scroll(scroll_id=scroll_id, scroll=u'1m')\n+ scroll_id = result[u'_scroll_id']\n+ scroll_size = len(result[u'hits'][u'hits'])\n+ for event in result[u'hits'][u'hits']:\n+ yield event\n+\n+\n+def parse_xml_event(event_xml):\n+ xml_root = ElementTree.fromstring(event_xml)\n+ base = u'.//{http://schemas.microsoft.com/win/2004/08/events/event}'\n+ event_container = {u'System': {}, u'EventData': {}}\n+\n+ def _sanitize_event_value(value):\n+ none_values = [u'-', u' ']\n+ if value in none_values:\n+ return None\n+ return value\n+\n+ for child in xml_root.find(u'{0:s}System'.format(base)):\n+ element_name = child.tag.split(u'}')[1]\n+ element_value = _sanitize_event_value(child.text)\n+ event_container[u'System'][element_name] = {u'value': element_value}\n+ event_container[u'System'][element_name][u'attributes'] = child.attrib\n+\n+ for child in xml_root.find(u'{0:s}EventData'.format(base)):\n+ element_name = child.get(u'Name')\n+ element_value = _sanitize_event_value(child.text)\n+ event_container[u'EventData'][element_name] = element_value\n+\n+ return event_container\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/win_logins.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+# pylint: skip-file\n+import argparse\n+import csv\n+import uuid\n+import json\n+import sys\n+\n+from timesketch.lib.experimental.utils import event_stream\n+from timesketch.lib.experimental.utils import parse_xml_event\n+\n+\n+class KnowledgeBase(object):\n+ def __init__(self):\n+ self.ip2host = {}\n+\n+ def add(self, ip, hostname):\n+ self.ip2host[ip] = hostname\n+\n+ def get(self, ip):\n+ try:\n+ hostname = self.ip2host[ip]\n+ except KeyError:\n+ hostname = ip\n+ return hostname\n+\n+\n+class ParseEvents(object):\n+\n+ LOCALHOST = [u'::1', u'127.0.0.1']\n+\n+ def __init__(self):\n+ super(ParseEvents, self).__init__()\n+ self.events = set()\n+ self.ip2host = dict()\n+ self.kb = KnowledgeBase()\n+\n+ def parse_xml(self, xml):\n+ event_container = dict()\n+\n+ logon_types = {\n+ u'0': u'Unknown',\n+ u'2': u'Interactive',\n+ u'3': u'Network',\n+ u'4': u'Batch',\n+ u'5': u'Service',\n+ u'7': u'Unlock',\n+ u'8': u'NetworkCleartext',\n+ u'9': u'NewCredentials',\n+ u'10': u'RemoteInteractive',\n+ u'11': u'CachedInteractive'\n+ }\n+\n+ event = parse_xml_event(xml)\n+\n+ src_ip = event[u'EventData'].get(u'IpAddress')\n+ event_container[u'src_ip'] = src_ip\n+\n+ src_hostname = event[u'EventData'].get(u'WorkstationName')\n+ if src_hostname:\n+ src_hostname = src_hostname.split(u'.')[0].upper()\n+ event_container[u'src_hostname'] = src_hostname\n+\n+ dst_hostname = event[u'System'][u'Computer'].get(u'value')\n+ if dst_hostname:\n+ dst_hostname = dst_hostname.split(u'.')[0].upper()\n+ event_container[u'dst_hostname'] = dst_hostname\n+\n+ username = event[u'EventData'].get(u'TargetUserName')\n+ event_container[u'username'] = username\n+\n+ logon_type = event[u'EventData'].get(u'LogonType')\n+ event_container[u'logon_type'] = logon_types[logon_type]\n+\n+ if src_ip and src_hostname:\n+ self.kb.add(src_ip, src_hostname)\n+\n+ event_tuple = (\n+ event_container[u'src_ip'],\n+ event_container[u'src_hostname'],\n+ event_container[u'dst_hostname'],\n+ event_container[u'username'],\n+ event_container[u'logon_type'], )\n+ return event_tuple\n+\n+ def parse(self, sketch_id):\n+ events = set()\n+ for timesketch_event in event_stream(\n+ sketch_id=sketch_id, query=u'event_identifier:4624'):\n+ xml_data = timesketch_event[u'_source'].get(u'xml_string')\n+ events.add(self.parse_xml(xml_data))\n+\n+ # Figure out hostname\n+ for event in events:\n+ src_ip = event[0]\n+ src_hostname = event[1]\n+ dst_hostname = event[2]\n+ username = event[3]\n+ logon_type = event[4]\n+\n+ if src_ip in self.LOCALHOST:\n+ src_ip = None\n+\n+ if not src_hostname:\n+ if not src_ip:\n+ src_hostname = dst_hostname\n+ else:\n+ src_hostname = self.kb.get(src_ip)\n+\n+ yield (src_hostname, username, dst_hostname, logon_type)\n+\n+\n+def main():\n+ parser = argparse.ArgumentParser(description='Extract Windows login events')\n+ parser.add_argument(\n+ '--sketch', type=int, required=True, help='ID of Timesketch sketch')\n+ args = parser.parse_args()\n+\n+ parser = ParseEvents()\n+ user2id = {}\n+ sketch_id = args.sketch\n+\n+ csvwriter = csv.writer(sys.stdout, delimiter=',')\n+ csvwriter.writerow([u'user', u'uid', u'src', u'dst', u'method'])\n+ for event in parser.parse(sketch_id=sketch_id):\n+ src_ws, user, dst_ws, method = event\n+ uid = user2id.get(user, None)\n+ if not uid:\n+ user2id[user] = u'a' + uuid.uuid4().hex\n+ uid = user2id[user]\n+ csvwriter.writerow([user, uid, src_ws, dst_ws, method])\n+\n+\n+def win_logins(sketch_id):\n+ parser = ParseEvents()\n+ user2id = {}\n+\n+ result = []\n+\n+ for event in parser.parse(sketch_id=sketch_id):\n+ src_ws, user, dst_ws, method = event\n+ uid = user2id.get(user, None)\n+ if not uid:\n+ user2id[user] = u'a' + uuid.uuid4().hex\n+ uid = user2id[user]\n+ result.append({\n+ u'user': user,\n+ u'uid': uid,\n+ u'src': src_ws,\n+ u'dst': dst_ws,\n+ u'method': method,\n+ })\n+ return result\n+\n+\n+if __name__ == \"__main__\":\n+ from timesketch import create_app\n+ with create_app().app_context():\n+ main()\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/experimental/win_services.py", "diff": "+# Copyright 2017 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+# pylint: skip-file\n+import csv\n+import sys\n+import argparse\n+from xml.etree import ElementTree\n+\n+from timesketch.models.sketch import Sketch\n+from timesketch.lib.experimental.utils import event_stream\n+\n+\n+def parse_xml(data):\n+ base_node = './/{http://schemas.microsoft.com/win/2004/08/events/event}'\n+\n+ root = ElementTree.fromstring(data)\n+ d = dict()\n+ d[u'src_ws'] = root.find(u'{0:s}Computer'.format(base_node)).text\n+ d[u'svc_name'] = root.find(\n+ u'{0:s}Data[@Name=\"ServiceName\"]'.format(base_node)).text\n+ d[u'start_type'] = root.find(\n+ u'{0:s}Data[@Name=\"StartType\"]'.format(base_node)).text\n+ d[u'image_path'] = root.find(\n+ u'{0:s}Data[@Name=\"ImagePath\"]'.format(base_node)).text\n+\n+ return (d[u'src_ws'], d[u'svc_name'], d[u'start_type'], d[u'image_path'])\n+\n+\n+def main():\n+ parser = argparse.ArgumentParser(description='Extract Windows services')\n+ parser.add_argument(\n+ '--sketch', type=int, required=True, help='ID of Timesketch sketch')\n+ args = parser.parse_args()\n+\n+ events = set()\n+ sketch_id = args.sketch\n+\n+ for event in event_stream(\n+ sketch_id=sketch_id, query=u'event_identifier:7045'):\n+ data = event[u'_source'][u'xml_string']\n+ res = parse_xml(data)\n+ if res:\n+ events.add(res)\n+\n+ csvwriter = csv.writer(sys.stdout, delimiter=',')\n+ csvwriter.writerow([u'src', u'svc_name', u'start_type', u'image_path'])\n+ for event in events:\n+ src_ws, svc_name, start_type, image_path = event\n+ src_ws = src_ws.split('.')[0].upper()\n+ csvwriter.writerow([src_ws, svc_name, start_type, image_path])\n+\n+\n+def win_services(sketch_id):\n+ events = set()\n+\n+ for event in event_stream(\n+ sketch_id=sketch_id, query=u'event_identifier:7045'):\n+ data = event[u'_source'][u'xml_string']\n+ res = parse_xml(data)\n+ if res:\n+ events.add(res)\n+\n+ result = []\n+ for event in events:\n+ src_ws, svc_name, start_type, image_path = event\n+ src_ws = src_ws.split('.')[0].upper()\n+ result.append({\n+ u'src': src_ws,\n+ u'svc_name': svc_name,\n+ u'start_type': start_type,\n+ u'image_path': image_path,\n+ })\n+ return result\n+\n+\n+if __name__ == \"__main__\":\n+ from timesketch import create_app\n+ with create_app().app_context():\n+ main()\n" } ]
Python
Apache License 2.0
google/timesketch
Graph generation. (#463)
263,122
18.10.2017 12:51:50
-7,200
80ad61ccc64cb603280c4e2f63c5da8976b51f25
Adjust graph metadata.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -19,28 +19,31 @@ from neo4jrestclient.constants import DATA_GRAPH\n# Schema for Neo4j nodes and edges\nSCHEMA = {\nu'nodes': {\n- u'Machine': {\n- u'label_template': u'{hostname}'\n+ u'WindowsMachine': {\n+ u'label_template': u'{hostname}',\n},\n- u'User': {\n- u'label_template': u'{username}'\n+ u'WindowsADUser': {\n+ u'label_template': u'{username}',\n+ },\n+ u'WindowsLocalUser': {\n+ u'label_template': u'{username}',\n},\nu'WindowsService': {\n- u'label_template': u'{service_name}'\n+ u'label_template': u'{service_name}',\n},\nu'WindowsServiceImagePath': {\n- u'label_template': u'{image_path}'\n+ u'label_template': u'{image_path}',\n}\n},\nu'edges': {\nu'ACCESS': {\n- u'label_template': u'{method}'\n+ u'label_template': u'{method} | {username}',\n},\nu'START': {\n- u'label_template': u'{start_type}'\n+ u'label_template': u'{start_type}',\n},\nu'HAS': {\n- u'label_template': u'{label}'\n+ u'label_template': u'HAS',\n}\n}\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Adjust graph metadata. (#464)
263,122
18.10.2017 14:51:53
-7,200
c6847623d1eb4967597c31ce5d57bf5e461a6dc2
Few unrelated small fixes.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -218,33 +218,6 @@ class CytoscapeOutputFormatter(OutputFormatterBaseClass):\n\"\"\"Initialize the Cytoscape output formatter object.\"\"\"\nsuper(CytoscapeOutputFormatter, self).__init__()\n- def _format_entity(self, entity):\n- \"\"\"Flatten properties and add type attribute to both nodes and edges.\n-\n- Args:\n- entity: Dictionary with Neo4j node or edge.\n-\n- Returns:\n- Dictionary with Cytoscape compatible node or edge.\n- \"\"\"\n- new_entity = dict(id=entity[u'id'])\n-\n- # Depending on if this is a Node or Edge\n- try:\n- new_entity[u'type'] = entity[u'labels'][0]\n- except KeyError:\n- new_entity[u'type'] = entity[u'type']\n- new_entity[u'source'] = entity[u'startNode']\n- new_entity[u'target'] = entity[u'endNode']\n-\n- # Copy over items form Neo4j properties\n- properties = entity.get(u'properties')\n- if properties:\n- properties_copy = properties.copy()\n- new_entity.update(properties_copy)\n-\n- return new_entity\n-\ndef format_node(self, node):\n\"\"\"Format a Cytoscape graph node.\n@@ -254,9 +227,10 @@ class CytoscapeOutputFormatter(OutputFormatterBaseClass):\nReturns:\nDictionary with a Cytoscape formatted node\n\"\"\"\n- node_dict = self._format_entity(node)\n- cytoscape_node = {u'data': node_dict}\n- return cytoscape_node\n+ node_data = dict(id='node' + node[u'id'], type=node[u'labels'][0])\n+ if node.get('properties'):\n+ node_data.update(node['properties'])\n+ return {u'data': node_data}\ndef format_edge(self, edge):\n\"\"\"Format a Cytoscape graph egde.\n@@ -267,6 +241,11 @@ class CytoscapeOutputFormatter(OutputFormatterBaseClass):\nReturns:\nDictionary with a Cytoscape formatted edge\n\"\"\"\n- edge_dict = self._format_entity(edge)\n- cytoscape_edge = {u'data': edge_dict}\n- return cytoscape_edge\n+ edge_data = dict(\n+ id='edge' + edge[u'id'], type=edge[u'type'],\n+ source='node' + edge[u'startNode'],\n+ target='node' + edge[u'endNode'],\n+ )\n+ if edge.get('properties'):\n+ edge_data.update(edge['properties'])\n+ return {u'data': edge_data}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j_test.py", "new_path": "timesketch/lib/datastores/neo4j_test.py", "diff": "@@ -69,23 +69,23 @@ class Neo4jTest(BaseTest):\nu'data': {\nu'username': u'test',\nu'type': u'User',\n- u'id': u'1',\n+ u'id': u'node1',\nu'uid': u'123456'\n}\n}, {\nu'data': {\nu'hostname': u'test',\nu'type': u'Machine',\n- u'id': u'2'\n+ u'id': u'node2'\n}\n}],\nu'edges': [{\nu'data': {\n- u'target': u'2',\n+ u'target': u'node2',\nu'method': u'Network',\n- u'source': u'1',\n+ u'source': u'node1',\nu'type': u'ACCESS',\n- u'id': u'3'\n+ u'id': u'edge3'\n}\n}]\n},\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/css/ts.scss", "new_path": "timesketch/ui/css/ts.scss", "diff": "@@ -677,6 +677,7 @@ ts-graphs-graph-view {\nbox-shadow: 0 0 1px rgba(0,0,0,0.3) !important;\npadding-left: 15px;\npadding-right: 15px;\n+ z-index: 1;\n}\n> div {\n@include ts-graphs-fill-space;\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/cytoscape.component.ts", "new_path": "timesketch/ui/graphs/cytoscape.component.ts", "diff": "@@ -202,7 +202,7 @@ export class CytoscapeComponent implements OnChanges, AfterViewInit {\nconst all_options = [].concat(immutable_options, mutable_options)\nconst options: Opt = {}\nif (this.cytoscapeHostRef) {\n- options['container'] = this.cytoscapeHostRef.nativeElement.childNodes[0]\n+ options['container'] = this.cytoscapeHostRef.nativeElement\n}\nfor (const k of all_options) {\noptions[k] = this[k]\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "@@ -76,7 +76,7 @@ export class GraphViewComponent {\n'width': 'label',\n'height': 'label',\n'padding': 10,\n- 'label': 'data(label)',\n+ 'label': (node) => JSON.stringify(node.data()),\n'text-halign': 'center',\n'text-valign': 'center',\n'color': '#FFFFFF',\n@@ -89,28 +89,28 @@ export class GraphViewComponent {\n},\n},\n{\n- selector: \"node[type = 'User']\",\n+ selector: \"node[type = 'WindowsADUser']\",\nstyle: {\n'background-color': '#FF756E',\n'border-color': '#E06760',\n},\n},\n{\n- selector: \"node[type = 'Machine']\",\n+ selector: \"node[type = 'WindowsMachine']\",\nstyle: {\n'background-color': '#68BDF6',\n'border-color': '#5CA8DB',\n},\n},\n{\n- selector: \"node[type = 'Service']\",\n+ selector: \"node[type = 'WindowsService']\",\nstyle: {\n'background-color': '#6DCE9E',\n'border-color': '#60B58B',\n},\n},\n{\n- selector: \"node[type = 'ServiceImagePath']\",\n+ selector: \"node[type = 'WindowsServiceImagePath']\",\nstyle: {\n'background-color': '#DE9BF9',\n'border-color': '#BF85D6',\n@@ -122,7 +122,7 @@ export class GraphViewComponent {\n'width': 1,\n'curve-style': 'bezier',\n'target-arrow-shape': 'triangle',\n- 'label': 'data(label)',\n+ 'label': (edge) => JSON.stringify(edge.data()),\n'font-size': 10,\n'text-rotation': 'autorotate',\n},\n" } ]
Python
Apache License 2.0
google/timesketch
Few unrelated small fixes. (#466)
263,122
18.10.2017 15:45:22
-7,200
d189f876aeb0967329f3211bdd0aead22f227a64
Graphs: use label templates in frontend.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.ts", "new_path": "timesketch/ui/api/graph.service.ts", "diff": "@@ -5,6 +5,18 @@ import {HttpClient} from '@angular/common/http'\nimport {SKETCH_BASE_URL} from './api.service'\nimport {SketchService} from './sketch.service'\n+export type Graph = {\n+ elements: Cy.ElementsDefinition\n+ schema: {\n+ nodes: {[type: string]: {\n+ label_template: string\n+ }}\n+ edges: {[type: string]: {\n+ label_template: string\n+ }}\n+ }\n+}\n+\n/**\n* Service for fetching graph-related API resources.\n* Relevant backend code:\n@@ -18,11 +30,13 @@ export class GraphService {\nprivate readonly http: HttpClient,\n) {}\n- search(query: string): Observable<Cy.ElementsDefinition> {\n+ search(query: string): Observable<Graph> {\nreturn this.http\n.post(`${SKETCH_BASE_URL}${this.sketchService.sketchId}/explore/graph/`, {\nquery, output_format: 'cytoscape',\n})\n- .map((result) => result['objects'][0]['graph'])\n+ .map((result) => ({\n+ elements: result['objects'][0]['graph'], schema: result['meta']['schema']\n+ }))\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.html", "new_path": "timesketch/ui/graphs/graph-view.component.html", "diff": "</div>\n<ts-graphs-cytoscape\n- [elements]=\"state.elements\"\n+ [elements]=\"state.graph.elements\"\n[style]=\"style\"\n[layout]=\"layout\"\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "import {Component, Input} from '@angular/core'\n+import {Graph} from '../api/graph.service'\nimport {CytoscapeSettings} from './cytoscape-settings.component'\nexport type Empty = {type: 'empty'}\nexport type Loading = {type: 'loading'}\nexport type Ready = {\ntype: 'ready'\n- elements: Cy.ElementsDefinition | Cy.ElementDefinition[]\n+ graph: Graph\n}\nexport type GraphViewState = Empty | Loading | Ready\n+function format(formatString: string, params: {[k: string]: string}): string {\n+ let result = formatString\n+ for (const [k, v] of Object.entries(params)) {\n+ result = result.replace('{' + k + '}', v)\n+ }\n+ return result\n+}\n+\n@Component({\nselector: 'ts-graphs-graph-view',\ntemplateUrl: './graph-view.component.html',\n@@ -68,7 +77,16 @@ export class GraphViewComponent {\nweaver: false,\nnodeDimensionsIncludeLabels: false,\n}\n- style: Array<Cy.Stylesheet & {padding?: number}> = [\n+ nodeLabel(node_data) {\n+ const {label_template} = (this.state as Ready).graph.schema.nodes[node_data.type]\n+ return format(label_template, node_data)\n+ }\n+ edgeLabel(edge_data) {\n+ const {label_template} = (this.state as Ready).graph.schema.edges[edge_data.type]\n+ return format(label_template, edge_data)\n+ }\n+ get style(): Array<Cy.Stylesheet & {padding?: number}> {\n+ return [\n{\nselector: 'node',\nstyle: {\n@@ -76,7 +94,7 @@ export class GraphViewComponent {\n'width': 'label',\n'height': 'label',\n'padding': 10,\n- 'label': (node) => JSON.stringify(node.data()),\n+ 'label': (node) => this.nodeLabel(node.data()),\n'text-halign': 'center',\n'text-valign': 'center',\n'color': '#FFFFFF',\n@@ -122,10 +140,11 @@ export class GraphViewComponent {\n'width': 1,\n'curve-style': 'bezier',\n'target-arrow-shape': 'triangle',\n- 'label': (edge) => JSON.stringify(edge.data()),\n+ 'label': (edge) => this.edgeLabel(edge.data()),\n'font-size': 10,\n'text-rotation': 'autorotate',\n},\n},\n]\n}\n+}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/main.component.ts", "new_path": "timesketch/ui/graphs/main.component.ts", "diff": "@@ -22,8 +22,8 @@ export class MainComponent implements OnChanges {\nonCypherSearch(query: string) {\nthis.graphViewState = {type: 'loading'}\n- this.graphService.search(query).subscribe((elements) => {\n- this.graphViewState = {type: 'ready', elements}\n+ this.graphService.search(query).subscribe((graph) => {\n+ this.graphViewState = {type: 'ready', graph}\n})\n}\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Graphs: use label templates in frontend. (#467)
263,122
18.10.2017 18:11:43
-7,200
c6fb38109883641a05358d42355c15e4a67b6b82
Update unit tests after graph labels change.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.spec.ts", "new_path": "timesketch/ui/api/graph.service.spec.ts", "diff": "@@ -34,12 +34,12 @@ describe('GraphService', () => {\nexpect(request.request.body).toEqual({\nquery: 'FAKE_QUERY', output_format: 'cytoscape',\n})\n- // type is incorrect (typeof 'FAKE_GRAPH' != Cy.ElementsDefinition)\n+ // types are incorrect (for example, typeof 'FAKE_ELEMENTS' != Cy.ElementsDefinition)\n// but we are only checking that data is just passed as-is from http response\n- request.flush({objects: [{graph: 'FAKE_GRAPH'}]})\n+ request.flush({meta: {schema: 'FAKE_SCHEMA'}, objects: [{graph: 'FAKE_ELEMENTS'}]})\nconst graph = await graphPromise\n- expect(graph).toEqual('FAKE_GRAPH')\n+ expect(graph).toEqual({elements: 'FAKE_ELEMENTS', schema: 'FAKE_SCHEMA'})\nhttp.verify()\n})\n})\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.ts", "new_path": "timesketch/ui/api/graph.service.ts", "diff": "@@ -36,7 +36,8 @@ export class GraphService {\nquery, output_format: 'cytoscape',\n})\n.map((result) => ({\n- elements: result['objects'][0]['graph'], schema: result['meta']['schema']\n+ elements: result['objects'][0]['graph'],\n+ schema: result['meta']['schema'],\n}))\n}\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Update unit tests after graph labels change. (#469)
263,093
19.10.2017 17:18:55
-7,200
9a9174c8d54800a967c4edc9e6198d7c67b651f4
Change default zoom levels
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "@@ -29,8 +29,8 @@ export class GraphViewComponent {\n@Input() state: GraphViewState\nsettings: CytoscapeSettings = {\n// interaction options:\n- minZoom: 1e-50,\n- maxZoom: 1e50,\n+ minZoom: 0.1,\n+ maxZoom: 1.5,\nzoomingEnabled: true,\nuserZoomingEnabled: true,\npanningEnabled: true,\n" } ]
Python
Apache License 2.0
google/timesketch
Change default zoom levels (#473)
263,122
19.10.2017 17:41:27
-7,200
20d901a707ee80529183b4434de0e4006052caf7
[WIP] Graph creation actions.
[ { "change_type": "MODIFY", "old_path": "timesketch/__init__.py", "new_path": "timesketch/__init__.py", "diff": "@@ -160,13 +160,13 @@ def create_app(config=None):\n# Experimental API resources\napi_experimental = Api(app, prefix=u'/api/experimental')\napi_experimental.add_resource(WinLoginsResource,\n- u'/sketches/<int:sketch_id>/win_logins')\n+ u'/sketches/<int:sketch_id>/win_logins/')\napi_experimental.add_resource(WinServicesResource,\n- u'/sketches/<int:sketch_id>/win_services')\n+ u'/sketches/<int:sketch_id>/win_services/')\napi_experimental.add_resource(CreateGraphResource,\n- u'/sketches/<int:sketch_id>/create_graph')\n+ u'/sketches/<int:sketch_id>/create_graph/')\napi_experimental.add_resource(DeleteGraphResource,\n- u'/sketches/<int:sketch_id>/delete_graph')\n+ u'/sketches/<int:sketch_id>/delete_graph/')\n# Register error handlers\n# pylint: disable=unused-variable\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -149,6 +149,8 @@ class OutputFormatterBaseClass(object):\nReturns:\nDictionary with formatted graph\n\"\"\"\n+ if graph is None:\n+ return {u'nodes': [], u'edges': []}\nnode_list = []\nedge_list = []\nfor subgraph in graph:\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j_test.py", "new_path": "timesketch/lib/datastores/neo4j_test.py", "diff": "@@ -70,13 +70,13 @@ class Neo4jTest(BaseTest):\nu'username': u'test',\nu'type': u'User',\nu'id': u'node1',\n- u'uid': u'123456'\n+ u'uid': u'123456',\n}\n}, {\nu'data': {\nu'hostname': u'test',\nu'type': u'Machine',\n- u'id': u'node2'\n+ u'id': u'node2',\n}\n}],\nu'edges': [{\n@@ -85,15 +85,31 @@ class Neo4jTest(BaseTest):\nu'method': u'Network',\nu'source': u'node1',\nu'type': u'ACCESS',\n- u'id': u'edge3'\n+ u'id': u'edge3',\n}\n- }]\n+ }],\n},\nu'rows': None,\n- u'stats': {}\n+ u'stats': {},\n}\ndatastore = Neo4jDataStore(username=u'test', password=u'test')\nformatted_response = datastore.query(\nquery=u'', output_format=u'cytoscape')\nself.assertIsInstance(formatted_response, dict)\nself.assertDictEqual(formatted_response, expected_output)\n+\n+ def test_cytoscape_output_empty_graph(self):\n+ \"\"\"Test Cytoscape output format for and empty graph.\"\"\"\n+ expected_output = {\n+ u'graph': {\n+ u'nodes': [],\n+ u'edges': [],\n+ },\n+ u'rows': None,\n+ u'stats': {},\n+ }\n+ datastore = Neo4jDataStore(username=u'test', password=u'test')\n+ formatted_response = datastore.query(\n+ query=u'empty', output_format=u'cytoscape')\n+ self.assertIsInstance(formatted_response, dict)\n+ self.assertDictEqual(formatted_response, expected_output)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/testlib.py", "new_path": "timesketch/lib/testlib.py", "diff": "@@ -204,6 +204,12 @@ class MockGraphDatabase(object):\nself.rows = self.MOCK_ROWS\nself.stats = self.MOCK_ROWS\n+ class MockEmptyQuerySequence(object):\n+ def __init__(self):\n+ self.graph = None\n+ self.rows = {}\n+ self.stats = {}\n+\n# pylint: disable=unused-argument\ndef query(self, *args, **kwargs):\n\"\"\"Mock a search query.\n@@ -211,7 +217,9 @@ class MockGraphDatabase(object):\nReturns:\nA MockQuerySequence instance.\n\"\"\"\n-\n+ query = args[0]\n+ if query == 'empty':\n+ return self.MockEmptyQuerySequence()\nreturn self.MockQuerySequence()\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.ts", "new_path": "timesketch/ui/api/graph.service.ts", "diff": "@@ -40,4 +40,14 @@ export class GraphService {\nschema: result['meta']['schema'],\n}))\n}\n+ regenerate(): Observable<{}> {\n+ return this.http\n+ .post(`/api/experimental/sketches/${this.sketchService.sketchId}/create_graph/`, {})\n+ .map(() => ({}))\n+ }\n+ delete(): Observable<{}> {\n+ return this.http\n+ .post(`/api/experimental/sketches/${this.sketchService.sketchId}/delete_graph/`, {})\n+ .map(() => ({}))\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/css/ts.scss", "new_path": "timesketch/ui/css/ts.scss", "diff": "@@ -648,14 +648,7 @@ ts-graphs-cypher-query {\n}\nts-graphs-cytoscape-settings {\n- position: absolute;\n- left: 0px;\n- top: 30px;\n- z-index: 1;\nmin-width: 250px;\n- background-color: white;\n- box-shadow: 0 0 1px rgba(0,0,0,0.3);\n- padding: 5px;\ninput[type=\"number\"] {\nwidth: 70px;\n}\n@@ -669,18 +662,61 @@ ts-graphs-cytoscape-settings {\n}\n}\n+ts-graphs-graph-actions {\n+ button {\n+ margin: 5px !important;\n+ text-align: left !important;\n+ box-sizing: border-box;\n+ display: block;\n+ width: calc(100% - 10px);\n+ }\n+ .#{&}__modal-background {\n+ position: fixed;\n+ left: 0px;\n+ top: 0px;\n+ right: 0px;\n+ bottom: 0px;\n+ z-index: 1040;\n+ padding-top: 200px;\n+ background-color: rgba(0,0,0,0.5);\n+ text-align: center;\n+ }\n+ .#{&}__modal {\n+ padding: 20px;\n+ background-color: white;\n+ box-shadow: 0 0 6px 2px rgba(0,0,0,0.4);\n+ display: inline-block;\n+ }\n+}\n+\nts-graphs-graph-view {\n@include ts-graphs-fill-space;\n- .graph-view__dropdown {\n+ .#{&}__dropdown {\ndisplay: inline-block;\n+ vertical-align: top;\nposition: relative;\n- box-shadow: 0 0 1px rgba(0,0,0,0.3) !important;\n+ box-shadow: 0 0 1px rgba(0,0,0,0.3);\npadding-left: 15px;\npadding-right: 15px;\nz-index: 1;\n}\n- > div {\n- @include ts-graphs-fill-space;\n+ .#{&}__dropdown-trigger {\n+ display: none;\n+ }\n+ .#{&}__dropdown-content {\n+ position: absolute;\n+ left: 0px;\n+ top: 30px;\n+ z-index: 1;\n+ background-color: white;\n+ box-shadow: 0 0 1px rgba(0,0,0,0.3);\n+ padding: 5px;\n+ }\n+ .#{&}__dropdown-trigger + .#{&}__dropdown-content {\n+ display: none;\n+ }\n+ .#{&}__dropdown-trigger:checked + .#{&}__dropdown-content {\n+ display: block;\n}\nh2 {\ntext-align: center;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/graph-actions.component.html", "diff": "+<button class=\"btn btn-default\" [disabled]=\"regenerationInProgress\" (click)=\"regenerateGraph()\">\n+ <i *ngIf=\"regenerationInProgress\" class=\"fa fa-circle-o-notch fa-spin\"></i>\n+ <i *ngIf=\"!regenerationInProgress\" class=\"fa fa-refresh\"></i>\n+ (re) Generate\n+</button>\n+\n+<button class=\"btn btn-default\" [disabled]=\"deletionInProgress\" (click)=\"showDeletionModal = true\">\n+ <i *ngIf=\"deletionInProgress\" class=\"fa fa-circle-o-notch fa-spin\"></i>\n+ <i *ngIf=\"!deletionInProgress\" class=\"fa fa-trash\"></i>\n+ Delete\n+</button>\n+\n+<div *ngIf=\"showRegenerationDoneModal\" class=\"ts-graphs-graph-actions__modal-background\" (click)=\"showRegenerationDoneModal = false\">\n+ <div class=\"ts-graphs-graph-actions__modal\" (click)=\"$event.stopPropagation()\">\n+ <h3>Graph was successfully regenerated!</h3>\n+ <button class=\"btn btn-default\" (click)=\"showRegenerationDoneModal = false\">\n+ Close\n+ </button>\n+ </div>\n+</div>\n+\n+<div *ngIf=\"showDeletionModal\" class=\"ts-graphs-graph-actions__modal-background\" (click)=\"showDeletionModal = false\">\n+ <div class=\"ts-graphs-graph-actions__modal\" (click)=\"$event.stopPropagation()\">\n+ <h3>Are you sure you want to delete the graph?</h3>\n+ <button class=\"btn btn-default\" [disabled]=\"deletionInProgress\" (click)=\"showDeletionModal = false\">\n+ No, thanks.\n+ </button>\n+ <button class=\"btn btn-default\" [disabled]=\"deletionInProgress\" (click)=\"deleteGraph()\">\n+ <i *ngIf=\"deletionInProgress\" class=\"fa fa-circle-o-notch fa-spin\"></i>\n+ <i *ngIf=\"!deletionInProgress\" class=\"fa fa-trash\"></i>\n+ Yes, Delete all nodes and edges\n+ </button>\n+ </div>\n+</div>\n" }, { "change_type": "ADD", "old_path": "timesketch/ui/graphs/graph-actions.component.spec.ts", "new_path": "timesketch/ui/graphs/graph-actions.component.spec.ts", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/graph-actions.component.ts", "diff": "+import {Component, Output, EventEmitter, ElementRef} from '@angular/core'\n+\n+import {GraphService} from '../api/graph.service'\n+\n+@Component({\n+ selector: 'ts-graphs-graph-actions',\n+ templateUrl: './graph-actions.component.html',\n+})\n+export class GraphActionsComponent {\n+ @Output() actionComplete = new EventEmitter<'delete' | 'regenerate'>()\n+ regenerationInProgress = false\n+ deletionInProgress = false\n+\n+ private _showRegenerationDoneModal = false\n+ get showRegenerationDoneModal() {return this._showRegenerationDoneModal}\n+ set showRegenerationDoneModal(value: boolean) {\n+ if (value) {\n+ this.elem.nativeElement.style.display = 'block'\n+ } else {\n+ this.elem.nativeElement.style.display = ''\n+ }\n+ this._showRegenerationDoneModal = value\n+ }\n+\n+ private _showDeletionModal = false\n+ get showDeletionModal() {return this._showDeletionModal}\n+ set showDeletionModal(value: boolean) {\n+ if (value) {\n+ this.elem.nativeElement.style.display = 'block'\n+ } else {\n+ this.elem.nativeElement.style.display = ''\n+ }\n+ this._showDeletionModal = value\n+ }\n+\n+ constructor(\n+ private readonly graphService: GraphService,\n+ private readonly elem: ElementRef,\n+ ) {}\n+\n+ async regenerateGraph() {\n+ this.regenerationInProgress = true\n+ await this.graphService.regenerate().toPromise()\n+ this.regenerationInProgress = false\n+ this.showRegenerationDoneModal = true\n+ this.actionComplete.emit('regenerate')\n+ }\n+\n+ async deleteGraph() {\n+ this.deletionInProgress = true\n+ await this.graphService.delete().toPromise()\n+ this.showDeletionModal = false\n+ this.deletionInProgress = false\n+ this.actionComplete.emit('delete')\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.html", "new_path": "timesketch/ui/graphs/graph-view.component.html", "diff": "-<div *ngIf=\"state.type === 'empty'\">\n- <h2>Please type a query.</h2>\n+<div class=\"ts-graphs-graph-view__dropdown\">\n+ <label for=\"ts-graphs-graph-view__toggle-cytoscape-settings\">\n+ Cytoscape settings\n+ </label>\n+ <input\n+ type=\"checkbox\" id=\"ts-graphs-graph-view__toggle-cytoscape-settings\"\n+ class=\"ts-graphs-graph-view__dropdown-trigger\"\n+ >\n+ <ts-graphs-cytoscape-settings\n+ [settings]=\"settings\"\n+ class=\"ts-graphs-graph-view__dropdown-content\"\n+ ></ts-graphs-cytoscape-settings>\n</div>\n-<div *ngIf=\"state.type === 'loading'\">\n- <h2>\n+<div class=\"ts-graphs-graph-view__dropdown\">\n+ <label for=\"ts-graphs-graph-view__toggle-graph-actions\">\n+ Graph actions\n+ </label>\n+ <input\n+ type=\"checkbox\" id=\"ts-graphs-graph-view__toggle-graph-actions\"\n+ class=\"ts-graphs-graph-view__dropdown-trigger\"\n+ >\n+ <ts-graphs-graph-actions\n+ class=\"ts-graphs-graph-view__dropdown-content\"\n+ (actionComplete)=\"invalidate.emit()\"\n+ ></ts-graphs-graph-actions>\n+</div>\n+\n+<h2 *ngIf=\"state.type === 'empty'\">\n+ Please type a query.\n+</h2>\n+\n+<h2 *ngIf=\"state.type === 'loading'\">\n<i class=\"fa fa-circle-o-notch fa-spin\"></i>\nLoading...\n</h2>\n-</div>\n-\n-<div *ngIf=\"state.type === 'ready'\">\n- <div class=\"graph-view__dropdown\">\n- <style type=\"text/css\">\n- input ~ ts-graphs-cytoscape-settings {\n- display: none;\n- }\n- input:checked ~ ts-graphs-cytoscape-settings {\n- display: block;\n- }\n- </style>\n- <input type=\"checkbox\" id=\"toggleCytoscapeSettings\" style=\"display: none\">\n- <label for=\"toggleCytoscapeSettings\"> Cytoscape settings </label>\n- <ts-graphs-cytoscape-settings [settings]=\"settings\">\n- </ts-graphs-cytoscape-settings>\n- </div>\n<ts-graphs-cytoscape\n+ *ngIf=\"state.type === 'ready'\"\n+\n[elements]=\"state.graph.elements\"\n[style]=\"style\"\n[layout]=\"layout\"\n[wheelSensitivity]=\"settings.wheelSensitivity\"\n[pixelRatio]=\"settings.pixelRatio\"\n></ts-graphs-cytoscape>\n-</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "-import {Component, Input} from '@angular/core'\n+import {Component, Input, Output, EventEmitter} from '@angular/core'\nimport {Graph} from '../api/graph.service'\nimport {CytoscapeSettings} from './cytoscape-settings.component'\n@@ -27,6 +27,7 @@ function format(formatString: string, params: {[k: string]: string}): string {\nexport class GraphViewComponent {\n// tslint:disable-next-line:no-unused-variable\n@Input() state: GraphViewState\n+ @Output() invalidate = new EventEmitter<{}>()\nsettings: CytoscapeSettings = {\n// interaction options:\nminZoom: 0.1,\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graphs.module.ts", "new_path": "timesketch/ui/graphs/graphs.module.ts", "diff": "@@ -23,6 +23,7 @@ import {CytoscapeComponent} from './cytoscape.component'\nimport {CypherQueryComponent} from './cypher-query.component'\nimport {GraphViewComponent} from './graph-view.component'\nimport {CytoscapeSettingsComponent} from './cytoscape-settings.component'\n+import {GraphActionsComponent} from './graph-actions.component'\nimport {MainComponent} from './main.component'\nimport {ApiModule} from '../api/api.module'\n@@ -35,7 +36,7 @@ export const tsGraphsModule = angular.module('timesketch.graphs', [])\nimports: [CommonModule, FormsModule, ApiModule],\ndeclarations: [\nCytoscapeComponent, CypherQueryComponent, GraphViewComponent,\n- CytoscapeSettingsComponent, MainComponent,\n+ CytoscapeSettingsComponent, GraphActionsComponent, MainComponent,\n],\nentryComponents: [MainComponent],\n})\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/main.component.html", "new_path": "timesketch/ui/graphs/main.component.html", "diff": "-<ts-graphs-cypher-query (cypherSearch)=\"onCypherSearch($event)\"></ts-graphs-cypher-query>\n+<ts-graphs-cypher-query\n+ (cypherSearch)=\"onCypherSearch($event)\"\n+></ts-graphs-cypher-query>\n+\n<div class=\"card\">\n- <ts-graphs-graph-view [state]=\"graphViewState\"></ts-graphs-graph-view>\n+ <ts-graphs-graph-view\n+ [state]=\"graphViewState\"\n+ (invalidate)=\"onInvalidate()\"\n+ ></ts-graphs-graph-view>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/main.component.ts", "new_path": "timesketch/ui/graphs/main.component.ts", "diff": "@@ -14,7 +14,10 @@ export class MainComponent implements OnChanges {\ngraphViewState: GraphViewState = {type: 'empty'}\n- constructor(private sketchService: SketchService, private graphService: GraphService) {}\n+ constructor(\n+ private readonly sketchService: SketchService,\n+ private readonly graphService: GraphService,\n+ ) {}\nngOnChanges(changes: SimpleChanges) {\nthis.sketchService.sketchId = Number(this.sketchId)\n@@ -26,4 +29,8 @@ export class MainComponent implements OnChanges {\nthis.graphViewState = {type: 'ready', graph}\n})\n}\n+\n+ onInvalidate() {\n+ this.graphViewState = {type: 'empty'}\n+ }\n}\n" } ]
Python
Apache License 2.0
google/timesketch
[WIP] Graph creation actions. (#474)
263,122
23.10.2017 14:17:07
-7,200
43fa2011811220f77b1673980b75c9ec606547bb
Fix memory leak - destroy Cytoscape instances when not used.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/cytoscape.component.ts", "new_path": "timesketch/ui/graphs/cytoscape.component.ts", "diff": "import {\nComponent, ViewChild, ElementRef, Input, Output, OnChanges, SimpleChanges, EventEmitter,\n- AfterViewInit,\n+ AfterViewInit, OnDestroy, NgZone,\n} from '@angular/core'\nimport * as cytoscape from 'cytoscape'\n@@ -100,7 +100,7 @@ const mutable_options = [\nselector: 'ts-graphs-cytoscape',\ntemplate: '<div #cytoscapeHostElement></div>',\n})\n-export class CytoscapeComponent implements OnChanges, AfterViewInit {\n+export class CytoscapeComponent implements OnChanges, AfterViewInit, OnDestroy {\n@ViewChild('cytoscapeHostElement')\nprivate cytoscapeHostRef: ElementRef\nprivate _cy: Cy.Core\n@@ -114,6 +114,8 @@ export class CytoscapeComponent implements OnChanges, AfterViewInit {\nreturn this._cy\n}\n+ constructor(private zone: NgZone) {}\n+\n// tslint:disable:no-unused-variable\n// very commonly used options\n@@ -207,14 +209,14 @@ export class CytoscapeComponent implements OnChanges, AfterViewInit {\nfor (const k of all_options) {\noptions[k] = this[k]\n}\n- this._cy = cytoscape(options)\n+ this._cy = this.zone.runOutsideAngular(() => cytoscape(options))\nthis.initEvents()\n}\nngOnChanges(changes: SimpleChanges) {\nif (!this.cy) return\nconst changed = (k) =>\n- changes[k].previousValue !== changes[k].currentValue\n+ k in changes && changes[k].previousValue !== changes[k].currentValue\nconst options: Opt = {}\nlet needs_rebuild = false\nfor (const k of Object.keys(changes)) {\n@@ -232,6 +234,10 @@ export class CytoscapeComponent implements OnChanges, AfterViewInit {\nthis.initCytoscape()\n} else {\n(this.cy.json as any)(options)\n+ if (changed('layout')) {\n+ const layout: any = this.cy.layout(this.layout as Cy.LayoutOptions)\n+ layout.run()\n+ }\n}\n}\n@@ -255,4 +261,7 @@ export class CytoscapeComponent implements OnChanges, AfterViewInit {\n}\n}\n+ ngOnDestroy() {\n+ this.cy.destroy()\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.html", "new_path": "timesketch/ui/graphs/graph-view.component.html", "diff": "</h2>\n<ts-graphs-cytoscape\n- *ngIf=\"state.type === 'ready'\"\n+ [style.visibility]=\"state.type === 'ready' ? 'visible' : 'hidden'\"\n- [elements]=\"state.graph.elements\"\n+ [elements]=\"state.type === 'ready' ? state.graph.elements : null\"\n[style]=\"style\"\n[layout]=\"layout\"\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "@@ -12,6 +12,10 @@ export type Ready = {\nexport type GraphViewState = Empty | Loading | Ready\n+export type Layout = Cy.LayoutOptions & {animationThreshold?: number}\n+\n+export type Style = Array<Cy.Stylesheet & {padding?: number}>\n+\nfunction format(formatString: string, params: {[k: string]: string}): string {\nlet result = formatString\nfor (const [k, v] of Object.entries(params)) {\n@@ -54,7 +58,7 @@ export class GraphViewComponent {\nwheelSensitivity: 1,\npixelRatio: ('auto' as any),\n}\n- layout: Cy.LayoutOptions & {animationThreshold?: number} = {\n+ private _layout: Layout = {\nname: 'cose',\nanimate: true,\nanimationThreshold: 250,\n@@ -78,16 +82,31 @@ export class GraphViewComponent {\nweaver: false,\nnodeDimensionsIncludeLabels: false,\n}\n+ private _null_layout: Layout = {name: 'null'}\n+ get layout(): Layout {\n+ if (this.state.type === 'ready') {\n+ return this._layout\n+ } else {\n+ return this._null_layout\n+ }\n+ }\nnodeLabel(node_data) {\n- const {label_template} = (this.state as Ready).graph.schema.nodes[node_data.type]\n+ if (this.state.type === 'ready') {\n+ const {label_template} = this.state.graph.schema.nodes[node_data.type]\nreturn format(label_template, node_data)\n+ } else {\n+ return ''\n+ }\n}\nedgeLabel(edge_data) {\n- const {label_template} = (this.state as Ready).graph.schema.edges[edge_data.type]\n+ if (this.state.type === 'ready') {\n+ const {label_template} = this.state.graph.schema.edges[edge_data.type]\nreturn format(label_template, edge_data)\n+ } else {\n+ return ''\n+ }\n}\n- get style(): Array<Cy.Stylesheet & {padding?: number}> {\n- return [\n+ style: Style = [\n{\nselector: 'node',\nstyle: {\n@@ -148,4 +167,3 @@ export class GraphViewComponent {\n},\n]\n}\n-}\n" } ]
Python
Apache License 2.0
google/timesketch
Fix memory leak - destroy Cytoscape instances when not used. (#477)
263,122
23.10.2017 15:52:02
-7,200
2ee2c78b2b2f7057fc80270810c77547ae060b8a
Move hard-coded values from graph-view.component to graph-view.data
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.ts", "new_path": "timesketch/ui/api/graph.service.ts", "diff": "@@ -5,17 +5,7 @@ import {HttpClient} from '@angular/common/http'\nimport {SKETCH_BASE_URL} from './api.service'\nimport {SketchService} from './sketch.service'\n-export type Graph = {\n- elements: Cy.ElementsDefinition\n- schema: {\n- nodes: {[type: string]: {\n- label_template: string\n- }}\n- edges: {[type: string]: {\n- label_template: string\n- }}\n- }\n-}\n+import {Graph} from '../graphs/models'\n/**\n* Service for fetching graph-related API resources.\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/cytoscape-settings.component.ts", "new_path": "timesketch/ui/graphs/cytoscape-settings.component.ts", "diff": "import {Component, Input} from '@angular/core'\n-/**\n- * A subset of Cytoscape initialization options.\n- * Does not include the first 6: container, elements, style, layout, zoom, pan.\n- * @see {@link http://js.cytoscape.org/#core/initialisation}\n- */\n-export interface CytoscapeSettings {\n- // interaction options\n- minZoom?: number\n- maxZoom?: number\n- zoomingEnabled?: boolean\n- userZoomingEnabled?: boolean\n- panningEnabled?: boolean\n- userPanningEnabled?: boolean\n- boxSelectionEnabled?: boolean\n- selectionType?: 'additive' | 'single'\n- touchTapThreshold?: number\n- desktopTapThreshold?: number\n- autolock?: boolean\n- autoungrabify?: boolean\n- autounselectify?: boolean\n-\n- // rendering options\n- headless?: boolean\n- styleEnabled?: boolean\n- hideEdgesOnViewport?: boolean\n- hideLabelsOnViewport?: boolean\n- textureOnViewport?: boolean\n- motionBlur?: boolean\n- motionBlurOpacity?: number\n- wheelSensitivity?: number\n- pixelRatio?: number\n-}\n+import {CytoscapeSettings} from './models'\n@Component({\nselector: 'ts-graphs-cytoscape-settings',\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "import {Component, Input, Output, EventEmitter} from '@angular/core'\n-import {Graph} from '../api/graph.service'\n-import {CytoscapeSettings} from './cytoscape-settings.component'\n+import {GraphState, CytoscapeLayout} from './models'\n-export type Empty = {type: 'empty'}\n-export type Loading = {type: 'loading'}\n-export type Ready = {\n- type: 'ready'\n- graph: Graph\n-}\n-\n-export type GraphViewState = Empty | Loading | Ready\n-\n-export type Layout = Cy.LayoutOptions & {animationThreshold?: number}\n-\n-export type Style = Array<Cy.Stylesheet & {padding?: number}>\n+import * as data from './graph-view.data'\nfunction format(formatString: string, params: {[k: string]: string}): string {\nlet result = formatString\n@@ -30,67 +18,22 @@ function format(formatString: string, params: {[k: string]: string}): string {\n})\nexport class GraphViewComponent {\n// tslint:disable-next-line:no-unused-variable\n- @Input() state: GraphViewState\n+ @Input() state: GraphState\n@Output() invalidate = new EventEmitter<{}>()\n- settings: CytoscapeSettings = {\n- // interaction options:\n- minZoom: 0.1,\n- maxZoom: 1.5,\n- zoomingEnabled: true,\n- userZoomingEnabled: true,\n- panningEnabled: true,\n- userPanningEnabled: true,\n- boxSelectionEnabled: true,\n- selectionType: 'single',\n- touchTapThreshold: 8,\n- desktopTapThreshold: 4,\n- autolock: false,\n- autoungrabify: false,\n- autounselectify: false,\n- // rendering options:\n- headless: false,\n- styleEnabled: true,\n- hideEdgesOnViewport: false,\n- hideLabelsOnViewport: false,\n- textureOnViewport: false,\n- motionBlur: false,\n- motionBlurOpacity: 0.2,\n- wheelSensitivity: 1,\n- pixelRatio: ('auto' as any),\n- }\n- private _layout: Layout = {\n- name: 'cose',\n- animate: true,\n- animationThreshold: 250,\n- animationDuration: 1000,\n- refresh: 20,\n- fit: true,\n- padding: 30,\n- boundingBox: undefined,\n- randomize: true,\n- componentSpacing: 200,\n- nodeRepulsion: () => 400000,\n- nodeOverlap: 10,\n- idealEdgeLength: () => 10,\n- edgeElasticity: () => 100,\n- nestingFactor: 5,\n- gravity: 50,\n- numIter: 1000,\n- initialTemp: 200,\n- coolingFactor: 0.95,\n- minTemp: 1.0,\n- weaver: false,\n- nodeDimensionsIncludeLabels: false,\n- }\n- private _null_layout: Layout = {name: 'null'}\n- get layout(): Layout {\n+\n+ settings = data.settings\n+\n+ private _layout = data.layout\n+ private _null_layout = {name: 'null'}\n+ get layout(): CytoscapeLayout {\nif (this.state.type === 'ready') {\nreturn this._layout\n} else {\n- return this._null_layout\n+ return this._null_layout as CytoscapeLayout\n}\n}\n- nodeLabel(node_data) {\n+\n+ nodeLabel = (node_data) => {\nif (this.state.type === 'ready') {\nconst {label_template} = this.state.graph.schema.nodes[node_data.type]\nreturn format(label_template, node_data)\n@@ -98,7 +41,7 @@ export class GraphViewComponent {\nreturn ''\n}\n}\n- edgeLabel(edge_data) {\n+ edgeLabel = (edge_data) => {\nif (this.state.type === 'ready') {\nconst {label_template} = this.state.graph.schema.edges[edge_data.type]\nreturn format(label_template, edge_data)\n@@ -106,64 +49,8 @@ export class GraphViewComponent {\nreturn ''\n}\n}\n- style: Style = [\n- {\n- selector: 'node',\n- style: {\n- 'shape': 'roundrectangle',\n- 'width': 'label',\n- 'height': 'label',\n- 'padding': 10,\n- 'label': (node) => this.nodeLabel(node.data()),\n- 'text-halign': 'center',\n- 'text-valign': 'center',\n- 'color': '#FFFFFF',\n- 'font-size': '10',\n- 'background-color': '#68BDF6',\n- 'border-color': '#5CA8DB',\n- 'border-width': '1',\n- 'text-wrap': 'wrap',\n- 'text-max-width': '20',\n- },\n- },\n- {\n- selector: \"node[type = 'WindowsADUser']\",\n- style: {\n- 'background-color': '#FF756E',\n- 'border-color': '#E06760',\n- },\n- },\n- {\n- selector: \"node[type = 'WindowsMachine']\",\n- style: {\n- 'background-color': '#68BDF6',\n- 'border-color': '#5CA8DB',\n- },\n- },\n- {\n- selector: \"node[type = 'WindowsService']\",\n- style: {\n- 'background-color': '#6DCE9E',\n- 'border-color': '#60B58B',\n- },\n- },\n- {\n- selector: \"node[type = 'WindowsServiceImagePath']\",\n- style: {\n- 'background-color': '#DE9BF9',\n- 'border-color': '#BF85D6',\n- },\n- },\n- {\n- selector: 'edge',\n- style: {\n- 'width': 1,\n- 'curve-style': 'bezier',\n- 'target-arrow-shape': 'triangle',\n- 'label': (edge) => this.edgeLabel(edge.data()),\n- 'font-size': 10,\n- 'text-rotation': 'autorotate',\n- },\n- },\n- ]\n+ style = data.style({\n+ nodeLabel: this.nodeLabel,\n+ edgeLabel: this.edgeLabel,\n+ })\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/graph-view.data.ts", "diff": "+import {CytoscapeSettings, CytoscapeLayout, CytoscapeStyle} from './models'\n+\n+export const settings: CytoscapeSettings = {\n+ // interaction options:\n+ minZoom: 0.1,\n+ maxZoom: 1.5,\n+ zoomingEnabled: true,\n+ userZoomingEnabled: true,\n+ panningEnabled: true,\n+ userPanningEnabled: true,\n+ boxSelectionEnabled: true,\n+ selectionType: 'single',\n+ touchTapThreshold: 8,\n+ desktopTapThreshold: 4,\n+ autolock: false,\n+ autoungrabify: false,\n+ autounselectify: false,\n+ // rendering options:\n+ headless: false,\n+ styleEnabled: true,\n+ hideEdgesOnViewport: false,\n+ hideLabelsOnViewport: false,\n+ textureOnViewport: false,\n+ motionBlur: false,\n+ motionBlurOpacity: 0.2,\n+ wheelSensitivity: 1,\n+ pixelRatio: ('auto' as any),\n+}\n+\n+export const layout: CytoscapeLayout = {\n+ name: 'cose',\n+ animate: true,\n+ animationThreshold: 250,\n+ animationDuration: 1000,\n+ refresh: 20,\n+ fit: true,\n+ padding: 30,\n+ boundingBox: undefined,\n+ randomize: true,\n+ componentSpacing: 200,\n+ nodeRepulsion: () => 400000,\n+ nodeOverlap: 10,\n+ idealEdgeLength: () => 10,\n+ edgeElasticity: () => 100,\n+ nestingFactor: 5,\n+ gravity: 50,\n+ numIter: 1000,\n+ initialTemp: 200,\n+ coolingFactor: 0.95,\n+ minTemp: 1.0,\n+ weaver: false,\n+ nodeDimensionsIncludeLabels: false,\n+}\n+\n+export const style = ({nodeLabel, edgeLabel}): CytoscapeStyle => [\n+ {\n+ selector: 'node',\n+ style: {\n+ 'shape': 'roundrectangle',\n+ 'width': 'label',\n+ 'height': 'label',\n+ 'padding': 10,\n+ 'label': (node) => nodeLabel(node.data()),\n+ 'text-halign': 'center',\n+ 'text-valign': 'center',\n+ 'color': '#FFFFFF',\n+ 'font-size': '10',\n+ 'background-color': '#68BDF6',\n+ 'border-color': '#5CA8DB',\n+ 'border-width': '1',\n+ 'text-wrap': 'wrap',\n+ 'text-max-width': '20',\n+ },\n+ },\n+ {\n+ selector: \"node[type = 'WindowsADUser']\",\n+ style: {\n+ 'background-color': '#FF756E',\n+ 'border-color': '#E06760',\n+ },\n+ },\n+ {\n+ selector: \"node[type = 'WindowsMachine']\",\n+ style: {\n+ 'background-color': '#68BDF6',\n+ 'border-color': '#5CA8DB',\n+ },\n+ },\n+ {\n+ selector: \"node[type = 'WindowsService']\",\n+ style: {\n+ 'background-color': '#6DCE9E',\n+ 'border-color': '#60B58B',\n+ },\n+ },\n+ {\n+ selector: \"node[type = 'WindowsServiceImagePath']\",\n+ style: {\n+ 'background-color': '#DE9BF9',\n+ 'border-color': '#BF85D6',\n+ },\n+ },\n+ {\n+ selector: 'edge',\n+ style: {\n+ 'width': 1,\n+ 'curve-style': 'bezier',\n+ 'target-arrow-shape': 'triangle',\n+ 'label': (edge) => edgeLabel(edge.data()),\n+ 'font-size': 10,\n+ 'text-rotation': 'autorotate',\n+ },\n+ },\n+]\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/main.component.html", "new_path": "timesketch/ui/graphs/main.component.html", "diff": "<div class=\"card\">\n<ts-graphs-graph-view\n- [state]=\"graphViewState\"\n+ [state]=\"graphState\"\n(invalidate)=\"onInvalidate()\"\n></ts-graphs-graph-view>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/main.component.ts", "new_path": "timesketch/ui/graphs/main.component.ts", "diff": "@@ -2,7 +2,7 @@ import {Component, Input, OnChanges, SimpleChanges} from '@angular/core'\nimport {SketchService} from '../api/sketch.service'\nimport {GraphService} from '../api/graph.service'\n-import {GraphViewState} from './graph-view.component'\n+import {GraphState} from './models'\n@Component({\nselector: 'ts-graphs-main',\n@@ -12,7 +12,7 @@ import {GraphViewState} from './graph-view.component'\nexport class MainComponent implements OnChanges {\n@Input() sketchId: string\n- graphViewState: GraphViewState = {type: 'empty'}\n+ graphState: GraphState = {type: 'empty'}\nconstructor(\nprivate readonly sketchService: SketchService,\n@@ -24,13 +24,13 @@ export class MainComponent implements OnChanges {\n}\nonCypherSearch(query: string) {\n- this.graphViewState = {type: 'loading'}\n+ this.graphState = {type: 'loading'}\nthis.graphService.search(query).subscribe((graph) => {\n- this.graphViewState = {type: 'ready', graph}\n+ this.graphState = {type: 'ready', graph}\n})\n}\nonInvalidate() {\n- this.graphViewState = {type: 'empty'}\n+ this.graphState = {type: 'empty'}\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/models.ts", "diff": "+export type Graph = {\n+ elements: Cy.ElementsDefinition\n+ schema: {\n+ nodes: {[type: string]: {\n+ label_template: string\n+ }}\n+ edges: {[type: string]: {\n+ label_template: string\n+ }}\n+ }\n+}\n+\n+type Empty = {type: 'empty'}\n+type Loading = {type: 'loading'}\n+type Ready = {\n+ type: 'ready'\n+ graph: Graph\n+}\n+\n+export type GraphState = Empty | Loading | Ready\n+\n+export type CytoscapeLayout = Cy.LayoutOptions & {animationThreshold?: number}\n+\n+export type CytoscapeStyle = Array<Cy.Stylesheet & {padding?: number}>\n+\n+/**\n+ * A subset of Cytoscape initialization options.\n+ * Does not include the first 6: container, elements, style, layout, zoom, pan.\n+ * @see {@link http://js.cytoscape.org/#core/initialisation}\n+ */\n+export type CytoscapeSettings = {\n+ // interaction options\n+ minZoom?: number\n+ maxZoom?: number\n+ zoomingEnabled?: boolean\n+ userZoomingEnabled?: boolean\n+ panningEnabled?: boolean\n+ userPanningEnabled?: boolean\n+ boxSelectionEnabled?: boolean\n+ selectionType?: 'additive' | 'single'\n+ touchTapThreshold?: number\n+ desktopTapThreshold?: number\n+ autolock?: boolean\n+ autoungrabify?: boolean\n+ autounselectify?: boolean\n+\n+ // rendering options\n+ headless?: boolean\n+ styleEnabled?: boolean\n+ hideEdgesOnViewport?: boolean\n+ hideLabelsOnViewport?: boolean\n+ textureOnViewport?: boolean\n+ motionBlur?: boolean\n+ motionBlurOpacity?: number\n+ wheelSensitivity?: number\n+ pixelRatio?: number\n+}\n+\n+export type PredefinedQuery = {\n+ name: string\n+ query: string\n+}\n" } ]
Python
Apache License 2.0
google/timesketch
Move hard-coded values from graph-view.component to graph-view.data (#480)
263,122
23.10.2017 15:52:50
-7,200
3d91e4b1eb02441ee4326cffc2cdefac85df1b07
Move predefined queries from cypher-query.component to cypher-query.data
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/cypher-query.component.ts", "new_path": "timesketch/ui/graphs/cypher-query.component.ts", "diff": "import {Component, EventEmitter, Output} from '@angular/core'\n+import * as data from './cypher-query.data'\n+\n@Component({\nselector: 'ts-graphs-cypher-query',\ntemplateUrl: './cypher-query.component.html',\n@@ -8,16 +10,7 @@ export class CypherQueryComponent {\n@Output() cypherSearch = new EventEmitter<string>()\nquery = ''\n- predefinedQueries = [\n- {\n- name: 'Interactive logins',\n- query: 'MATCH (user:WindowsADUser)-[r1:ACCESS]->(m1:WindowsMachine) WHERE r1.method = \"Interactive\" RETURN *',\n- },\n- {\n- name: 'Entire graph',\n- query: 'MATCH (a)-[e]->(b) RETURN *',\n- },\n- ]\n+ predefinedQueries = data.predefinedQueries\nonQuerySelect(query) {\nthis.query = query\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/cypher-query.data.ts", "diff": "+import {PredefinedQuery} from './models'\n+\n+export const predefinedQueries: PredefinedQuery[] = [\n+ {\n+ name: 'Interactive logins',\n+ query: 'MATCH (user:WindowsADUser)-[r1:ACCESS]->(m1:WindowsMachine) WHERE r1.method = \"Interactive\" RETURN *',\n+ },\n+ {\n+ name: 'Entire graph',\n+ query: 'MATCH (a)-[e]->(b) RETURN *',\n+ },\n+]\n" } ]
Python
Apache License 2.0
google/timesketch
Move predefined queries from cypher-query.component to cypher-query.data (#481)
263,122
25.10.2017 16:09:29
-7,200
626c99b03af7c502964830c1b70a8bb8e6b42058
[WIP] Show event list next to graph.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/neo4j.py", "new_path": "timesketch/lib/datastores/neo4j.py", "diff": "@@ -17,7 +17,7 @@ from neo4jrestclient.client import GraphDatabase\nfrom neo4jrestclient.constants import DATA_GRAPH\nHIDDEN_FIELDS = [\n- 'type', 'id', 'sketch_id', 'source', 'target', 'es_index_name', 'es_query',\n+ 'type', 'id', 'sketch_id', 'source', 'target',\n]\n# Schema for Neo4j nodes and edges\n@@ -48,14 +48,17 @@ SCHEMA = {\nu'ACCESS': {\nu'label': u'\\uf090\\u00A0\\u00A0{method} | {username}',\nu'hidden_fields': HIDDEN_FIELDS,\n+ u'es_query': u'event_identifier:4624 AND xml_string:\"{username}\" AND xml_string:\"{target.hostname}*\"', # pylint: disable=line-too-long\n},\nu'START': {\nu'label': u'\\uf135\\u00A0\\u00A0{start_type}',\nu'hidden_fields': HIDDEN_FIELDS,\n+ u'es_query': u'event_identifier:7045 AND xml_string:\"{start_type}\" AND xml_string:\"{source.service_name}\" AND xml_string:\"{target.hostname}*\"', # pylint: disable=line-too-long\n},\nu'HAS': {\nu'label': u'\\uf1e6\\u00A0\\u00A0HAS',\nu'hidden_fields': HIDDEN_FIELDS,\n+ u'es_query': u'event_identifier:7045 AND xml_string:\"{target.image_path}\" AND xml_string:\"{source.service_name}\"', # pylint: disable=line-too-long\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.spec.ts", "new_path": "timesketch/ui/api/graph.service.spec.ts", "diff": "@@ -28,18 +28,49 @@ describe('GraphService', () => {\nconst http = TestBed.get(HttpTestingController)\nsketchService.sketchId = 42\n+ http.expectOne('/api/v1/sketches/42/').flush({objects: ['FAKE_SKETCH']})\n+\nconst graphPromise = graphService.search('FAKE_QUERY').toPromise()\nconst request = http.expectOne('/api/v1/sketches/42/explore/graph/')\nexpect(request.request.body).toEqual({\nquery: 'FAKE_QUERY', output_format: 'cytoscape',\n})\n- // types are incorrect (for example, typeof 'FAKE_ELEMENTS' != Cy.ElementsDefinition)\n- // but we are only checking that data is just passed as-is from http response\n- request.flush({meta: {schema: {nodes: {}, edges: {}}}, objects: [{graph: {nodes: [], edges: []}}]})\n+ request.flush({\n+ meta: {schema: {\n+ nodes: {'Machine': {label: '{hostname} ({...ip_addresses})'}},\n+ edges: {'ACCESS': {label: '{source.hostname} --{username}--> {target.hostname}'}},\n+ }},\n+ objects: [{graph: {\n+ nodes: [\n+ {data: {type: 'Machine', id: 'node1', hostname: 'M1', ip_addresses: ['1']}},\n+ {data: {type: 'Machine', id: 'node2', hostname: 'M2', ip_addresses: ['2', '2', '2']}},\n+ ],\n+ edges: [\n+ {data: {type: 'ACCESS', id: 'edge1', source: 'node1', target: 'node2', username: 'user1'}},\n+ ],\n+ }}],\n+ })\nconst graph = await graphPromise\n- expect(graph).toEqual({nodes: [], edges: []})\n+ expect(graph).toEqual({\n+ nodes: [\n+ {\n+ data: {type: 'Machine', id: 'node1', hostname: 'M1', ip_addresses: ['1']},\n+ scratch: {label: 'M1 (1)'},\n+ },\n+ {\n+ data: {type: 'Machine', id: 'node2', hostname: 'M2', ip_addresses: ['2', '2', '2']},\n+ scratch: {label: 'M2 (2, 2, 2)'},\n+ },\n+ ],\n+ edges: [\n+ {\n+ data: {type: 'ACCESS', id: 'edge1', source: 'node1', target: 'node2', username: 'user1'},\n+ scratch: {label: 'M1 --user1--> M2'},\n+ },\n+ ],\n+ })\nhttp.verify()\n})\n})\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/graph.service.ts", "new_path": "timesketch/ui/api/graph.service.ts", "diff": "@@ -21,6 +21,13 @@ export class GraphService {\n) {}\nsearch(query: string): Observable<GraphDef> {\n+ type Dict<T> = {[k: string]: T}\n+ function object_map<V, W>(obj: Dict<V>, func: (k: string, v: V) => [string, W]): Dict<W> {\n+ const parts = Object.entries(obj)\n+ .map(([k, v]) => func(k, v))\n+ .map(([k, v]) => ({[k]: v}))\n+ return Object.assign({}, ...parts)\n+ }\nfunction format(formatString: string, params: ElementData): string {\nlet result = formatString\nfor (const [k, v] of Object.entries(params)) {\n@@ -32,22 +39,23 @@ export class GraphService {\n}\nreturn result\n}\n- function element_scratch(element_schema: ElementScratch, element_data: ElementData): ElementScratch {\n- function transform([k, v]: [keyof ElementScratch, ElementScratch[keyof ElementScratch]]) {\n- if (typeof v === 'string') {\n- return {[k]: format(v, element_data)}\n- } else {\n- return {[k]: v}\n- }\n- }\n- return Object.assign({}, ...Object.entries(element_schema).map(transform))\n- }\n+ const element_scratch = (element_schema: ElementScratch, element_data: ElementData): ElementScratch =>\n+ object_map(element_schema, (k, v): any =>\n+ typeof v === 'string' ? [k, format(v, element_data)] : [k, v]\n+ ) as any\nfunction format_graph({schema, elements}) {\n+ const nodes_by_id = {}\nfor (const node of elements.nodes) {\nnode.scratch = element_scratch(schema.nodes[node.data.type], node.data)\n+ nodes_by_id[node.data.id] = node\n}\nfor (const edge of elements.edges) {\n- edge.scratch = element_scratch(schema.edges[edge.data.type], edge.data)\n+ const edge_data = {\n+ ...object_map(nodes_by_id[edge.data.source].data, (k, v) => ['source.' + k, v]),\n+ ...object_map(nodes_by_id[edge.data.target].data, (k, v) => ['target.' + k, v]),\n+ ...edge.data,\n+ }\n+ edge.scratch = element_scratch(schema.edges[edge.data.type], edge_data)\n}\nreturn elements\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/sketch.service.spec.ts", "new_path": "timesketch/ui/api/sketch.service.spec.ts", "diff": "@@ -26,14 +26,89 @@ describe('SketchService', () => {\nconst http = TestBed.get(HttpTestingController)\nsketchService.sketchId = 42\n- const sketchPromise = sketchService.getSketch().toPromise()\n// type is incorrect (typeof 'FAKE_SKETCH' != models.Sketch)\n// but we are only checking that data is just passed as-is from http response\nhttp.expectOne('/api/v1/sketches/42/').flush({objects: ['FAKE_SKETCH']})\n- const sketch = await sketchPromise\n+ const sketch = sketchService.sketch\nexpect(sketch).toEqual('FAKE_SKETCH')\nhttp.verify()\n})\n})\n+\n+ describe('.search()', () => {\n+ it('should return a proper response', async () => {\n+ const sketchService = TestBed.get(SketchService)\n+ const http = TestBed.get(HttpTestingController)\n+\n+ sketchService.sketchId = 42\n+ http.expectOne('/api/v1/sketches/42/').flush({objects: ['FAKE_SKETCH']})\n+\n+ const resultsPromise = sketchService.search('FAKE_QUERY').toPromise()\n+ // type is incorrect (typeof 'FAKE_EVENT' != models.Event)\n+ // but we are only checking that data is just passed as-is from http response\n+ http.expectOne('/api/v1/sketches/42/explore/').flush({objects: ['FAKE_EVENT']})\n+\n+ const results = await resultsPromise\n+ expect(results).toEqual(['FAKE_EVENT'])\n+ http.verify()\n+ })\n+ })\n+\n+ describe('.getEvent()', () => {\n+ it('should return a proper response', async () => {\n+ const sketchService = TestBed.get(SketchService)\n+ const http = TestBed.get(HttpTestingController)\n+\n+ sketchService.sketchId = 42\n+ http.expectOne('/api/v1/sketches/42/').flush({objects: ['FAKE_SKETCH']})\n+\n+ const eventPromise = sketchService.getEvent('1', '2').toPromise()\n+ // type is incorrect (typeof 'FAKE_EVENT_DETAIL' != models.EventDetail)\n+ // but we are only checking that data is just passed as-is from http response\n+ http\n+ .expectOne('/api/v1/sketches/42/event/?searchindex_id=1&event_id=2')\n+ .flush({objects: ['FAKE_EVENT_DETAIL']})\n+\n+ const event = await eventPromise\n+ expect(event).toEqual('FAKE_EVENT_DETAIL')\n+ http.verify()\n+ })\n+ })\n+\n+ describe('.getTimelineFromIndexName()', () => {\n+ it('should not throw exceptions when there is no sketch', async () => {\n+ const sketchService = TestBed.get(SketchService)\n+ const http = TestBed.get(HttpTestingController)\n+\n+ expect(sketchService.getTimelineFromIndexName('blah')).toBeNull()\n+ http.verify()\n+ })\n+\n+ it('should not throw exceptions when there is no timeline', async () => {\n+ const sketchService = TestBed.get(SketchService)\n+ const http = TestBed.get(HttpTestingController)\n+\n+ sketchService.sketchId = 42\n+ http.expectOne('/api/v1/sketches/42/').flush({objects: [{timelines: []}]})\n+\n+ expect(sketchService.getTimelineFromIndexName('blah')).toBeNull()\n+ http.verify()\n+ })\n+\n+ it('should return a proper timeline if it exists for given index_name', async () => {\n+ const sketchService = TestBed.get(SketchService)\n+ const http = TestBed.get(HttpTestingController)\n+\n+ sketchService.sketchId = 42\n+ http.expectOne('/api/v1/sketches/42/').flush({objects: [{timelines: [\n+ {name: 'fake_timeline', searchindex: {index_name: 'fake_index'}},\n+ ]}]})\n+\n+ expect(sketchService.getTimelineFromIndexName('fake_index')).toEqual({\n+ name: 'fake_timeline', searchindex: {index_name: 'fake_index'},\n+ })\n+ http.verify()\n+ })\n+ })\n})\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/api/sketch.service.ts", "new_path": "timesketch/ui/api/sketch.service.ts", "diff": "import {Observable} from 'rxjs'\nimport {Injectable} from '@angular/core'\n-import {HttpClient} from '@angular/common/http'\n+import {HttpClient, HttpParams} from '@angular/common/http'\nimport {SKETCH_BASE_URL} from './api.service'\n-import {Sketch} from './models'\n+import {Sketch, Timeline} from './models'\n+import {Event, EventDetail} from '../graphs/models'\n/**\n* A service that is intended to gather most of the resources defined in\n@@ -19,14 +20,51 @@ import {Sketch} from './models'\n*/\n@Injectable()\nexport class SketchService {\n- sketchId: number\n+ private _sketchId: number\n+ public sketch: Sketch\n+\n+ get sketchId(): number {\n+ return this._sketchId\n+ }\n+\n+ set sketchId(id: number) {\n+ this._sketchId = id\n+ this.getSketch().subscribe((sketch) => {\n+ this.sketch = sketch\n+ })\n+ }\nconstructor(private http: HttpClient) {}\n- getSketch(): Observable<Sketch> {\n+ private getSketch(): Observable<Sketch> {\nreturn this.http\n.get(`${SKETCH_BASE_URL}${this.sketchId}/`)\n.map((response) => response['objects'][0])\n}\n+ search(query: string): Observable<Event[]> {\n+ return this.http\n+ .post(`${SKETCH_BASE_URL}${this.sketchId}/explore/`, {\n+ query, filter: {limit: 100}, dsl: {},\n+ })\n+ .map((result) => result['objects'])\n+ }\n+\n+ getEvent(searchindex_id: string, event_id: string): Observable<EventDetail> {\n+ const params = new HttpParams()\n+ .append('searchindex_id', searchindex_id)\n+ .append('event_id', event_id)\n+ .toString()\n+ return this.http\n+ .get(`${SKETCH_BASE_URL}${this.sketchId}/event/?${params}`)\n+ .map((result) => result['objects'][0])\n+ }\n+\n+ getTimelineFromIndexName(index_name: string): Timeline {\n+ if (!this.sketch) return null\n+ for (const timeline of this.sketch.timelines) {\n+ if (timeline.searchindex.index_name === index_name) return timeline\n+ }\n+ return null\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/css/ts.scss", "new_path": "timesketch/ui/css/ts.scss", "diff": "@@ -740,6 +740,10 @@ ts-graphs-graph-view {\noverflow-x: hidden;\noverflow-y: auto;\n}\n+ .#{&}__sidebar-hint {\n+ padding: 20px;\n+ text-align: center;\n+ }\n.#{&}__sidebar-width {\ndisplay: none;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/event-list.component.html", "diff": "+<form class=\"form-inline\" (ngSubmit)=\"onSubmit()\">\n+ <div class=\"input-group\">\n+ <input\n+ [(ngModel)]=\"local_query\"\n+ type=\"search\"\n+ class=\"search-input\"\n+ placeholder=\"Search\"\n+ [ngModelOptions]=\"{standalone: true}\"\n+ autofocus\n+ >\n+ <span class=\"input-group-btn\">\n+ <button type=\"submit\" class=\"btn search-input\">\n+ <i class=\"fa fa-search\"></i>\n+ </button>\n+ </span>\n+ </div>\n+</form>\n+\n+<h3 *ngIf=\"!events\">\n+ <i class=\"fa fa-circle-o-notch fa-spin\"></i>\n+ Loading...\n+</h3>\n+\n+<ul *ngIf=\"events\">\n+ <h4 style=\"padding: 20px\" *ngIf=\"events.length === 0\">\n+ No events.\n+ </h4>\n+ <li *ngFor=\"let event of events\">\n+ <ts-graphs-event [event]=\"event\">\n+ </ts-graphs-event>\n+ </li>\n+</ul>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/event-list.component.ts", "diff": "+import {Component, Input, ChangeDetectorRef} from '@angular/core'\n+\n+import {SketchService} from '../api/sketch.service'\n+import {Event} from './models'\n+\n+@Component({\n+ selector: 'ts-graphs-event-list',\n+ templateUrl: './event-list.component.html',\n+})\n+export class EventListComponent {\n+ events?: Event[]\n+ private _query = ''\n+ local_query: string\n+\n+ constructor(\n+ private readonly sketchService: SketchService,\n+ private readonly changeDetectorRef: ChangeDetectorRef,\n+ ) {}\n+\n+ @Input()\n+ set query(query: string) {\n+ this._query = query\n+ this.local_query = query\n+ delete this.events\n+ this.sketchService.search(query).subscribe((events) => {\n+ this.events = events\n+ this.changeDetectorRef.detectChanges()\n+ })\n+ }\n+\n+ get query() {\n+ return this._query\n+ }\n+\n+ onSubmit() {\n+ this.query = this.local_query\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/event.component.html", "diff": "+<table id=\"search-result-table\" width=\"100%\">\n+ <tr>\n+ <td [style.background-color]=\"'#' + timeline.color\" width=\"210px\">\n+ {{event._source.datetime}}\n+ </td>\n+\n+ <td width=\"25px\">\n+ <i\n+ [class.fa.fa-lg]=\"true\"\n+ [class.fa-star.icon-yellow]=\"hasStar\"\n+ [class.fa-star-o.icon-grey]=\"!hasStar\"\n+ ></i>\n+ </td>\n+\n+ <td\n+ [class.event-message]=\"true\"\n+ [class.event-message-starred]=\"hasStar\"\n+ [class.event-message-wrap]=\"!showDetails\"\n+ [class.event-message-details]=\"showDetails\"\n+ (click)=\"toggleDetails()\"\n+ >\n+ <span *ngIf=\"hasComment\"><i class=\"fa fa-comments\"></i></span>\n+ <span *ngIf=\"event._source.tag\">\n+ <span *ngFor=\"let tag of event._source.tag\" class=\"label label-default\">\n+ {{tag}}\n+ </span>\n+ </span>\n+ <span>[{{ event._source.timestamp_desc }}] <span title=\"{{ event._source.message }}\">{{ event._source.message }}</span></span>\n+ </td>\n+\n+ <td width=\"150px\" style=\"text-align: right;background: #f1f1f1; white-space:nowrap; overflow:hidden; text-overflow: ellipsis;\">\n+ <span title=\"{{timeline.name}}\" class=\"label ts-name-label\">{{timeline.name}}</span>\n+ </td>\n+\n+ </tr>\n+</table>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/ui/graphs/event.component.ts", "diff": "+import {Component, Input} from '@angular/core'\n+\n+import {SketchService} from '../api/sketch.service'\n+import {Timeline} from '../api/models'\n+import {Event} from './models'\n+\n+@Component({\n+ selector: 'ts-graphs-event',\n+ templateUrl: './event.component.html',\n+})\n+export class EventComponent {\n+ @Input() event: Event\n+ showDetails = false\n+\n+ constructor(private readonly sketchService: SketchService) {}\n+\n+ get timeline(): Timeline {\n+ return this.sketchService.getTimelineFromIndexName(this.event._index)\n+ }\n+\n+ stringify(event) {\n+ return JSON.stringify(event).slice(0, 80)\n+ }\n+\n+ get hasStar(): boolean {\n+ return this.event._source.label.indexOf('__ts_star') > -1\n+ }\n+\n+ get hasComment(): boolean {\n+ return this.event._source.label.indexOf('__ts_comment') > -1\n+ }\n+\n+ toggleDetails() {\n+ this.showDetails = !this.showDetails\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.html", "new_path": "timesketch/ui/graphs/graph-view.component.html", "diff": "<input\ntype=\"checkbox\" id=\"ts-graphs-graph-view__toggle-sidebar\"\nclass=\"ts-graphs-graph-view__dropdown-trigger\"\n+ [(ngModel)]=\"showSidebar\"\n>\n<input type=\"radio\" name=\"width\" id=\"ts-graphs-graph-view__sidebar-width15\" class=\"ts-graphs-graph-view__sidebar-width\">\n<label for=\"ts-graphs-graph-view__sidebar-width15\" class=\"btn btn-default ts-graphs-graph-view__sidebar-width-label\">\n<label for=\"ts-graphs-graph-view__sidebar-width60\" class=\"btn btn-default ts-graphs-graph-view__sidebar-width-label\">\n<i class=\"fa fa-battery-3\"></i>\n</label>\n-<div class=\"ts-graphs-graph-view__dropdown-content ts-graphs-graph-view__sidebar\">\n- <h3 *ngIf=\"selectedElement.type === 'empty'\">\n- Click on nodes/edges to see details. Click on an edge to see relevant events.\n- </h3>\n+<div *ngIf=\"showSidebar\" class=\"ts-graphs-graph-view__dropdown-content ts-graphs-graph-view__sidebar\">\n+ <div *ngIf=\"selectedElement.type === 'empty'\" class=\"ts-graphs-graph-view__sidebar-hint\">\n+ <h3>Click on nodes/edges to see details.</h3>\n+ <h3>Click on an edge to see relevant events.</h3>\n+ </div>\n<ts-graphs-sidebar *ngIf=\"selectedElement.type !== 'empty'\" [element]=\"selectedElement.element\">\n</ts-graphs-sidebar>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.ts", "new_path": "timesketch/ui/graphs/graph-view.component.ts", "diff": "@@ -12,6 +12,8 @@ export class GraphViewComponent {\n@Input() state: GraphState\n@Output() invalidate = new EventEmitter<{}>()\n+ showSidebar = false\n+\nselectedElement: SelectedElement = {type: 'empty'}\nstyle = data.style\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graphs.module.ts", "new_path": "timesketch/ui/graphs/graphs.module.ts", "diff": "@@ -25,6 +25,8 @@ import {GraphViewComponent} from './graph-view.component'\nimport {CytoscapeSettingsComponent} from './cytoscape-settings.component'\nimport {GraphActionsComponent} from './graph-actions.component'\nimport {SidebarComponent} from './sidebar.component'\n+import {EventListComponent} from './event-list.component'\n+import {EventComponent} from './event.component'\nimport {MainComponent} from './main.component'\nimport {ApiModule} from '../api/api.module'\n@@ -38,7 +40,7 @@ export const tsGraphsModule = angular.module('timesketch.graphs', [])\ndeclarations: [\nCytoscapeComponent, CypherQueryComponent, GraphViewComponent,\nCytoscapeSettingsComponent, GraphActionsComponent, SidebarComponent,\n- MainComponent,\n+ EventListComponent, EventComponent, MainComponent,\n],\nentryComponents: [MainComponent],\n})\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/models.ts", "new_path": "timesketch/ui/graphs/models.ts", "diff": "type Empty = {type: 'empty'}\ntype Loading = {type: 'loading'}\n+export type Event = {\n+ _index: string\n+} & {\n+ [k: string]: any\n+}\n+export type EventDetail = {}\n+\n/**\n* GraphDef - received from GraphService\n*\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/sidebar.component.html", "new_path": "timesketch/ui/graphs/sidebar.component.html", "diff": "<td width=\"150px\">{{row.key}}</td><td>{{row.value}}</td>\n</tr>\n</tbody></table>\n+\n+<ts-graphs-event-list *ngIf=\"es_query\" [query]=\"es_query\">\n+</ts-graphs-event-list>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/sidebar.component.ts", "new_path": "timesketch/ui/graphs/sidebar.component.ts", "diff": "@@ -17,6 +17,10 @@ export class SidebarComponent {\nreturn this.element.data().type\n}\n+ get es_query(): string {\n+ return this.element.scratch().es_query\n+ }\n+\nget data_rows(): Array<{key: string, value: string}> {\nreturn Object\n.entries(this.element.data())\n" } ]
Python
Apache License 2.0
google/timesketch
[WIP] Show event list next to graph. (#483)
263,122
02.11.2017 17:42:42
-3,600
f8dbcc400168cd5cd2de3a91e1bde0e93a3ab2ba
Fix stale data being rendered in Cytoscape.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/graphs/graph-view.component.html", "new_path": "timesketch/ui/graphs/graph-view.component.html", "diff": "<ts-graphs-cytoscape\n[style.visibility]=\"state.type === 'ready' ? 'visible' : 'hidden'\"\n- [elements]=\"state.type === 'ready' ? state.elements : null\"\n+ [elements]=\"state.type === 'ready' ? state.elements : []\"\n[style]=\"style\"\n[layout]=\"layout\"\n" } ]
Python
Apache License 2.0
google/timesketch
Fix stale data being rendered in Cytoscape. (#488)
263,122
02.11.2017 17:54:26
-3,600
5a8b619e9c227fa4ef5abbafa340264a0b00d3e5
Change sidebar background.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/css/ts.scss", "new_path": "timesketch/ui/css/ts.scss", "diff": "@@ -739,7 +739,8 @@ ts-graphs-graph-view {\npadding: 10px;\noverflow-x: hidden;\noverflow-y: auto;\n- background-color: #f9f9f9;\n+ background-color: white;\n+ border-right: solid 1px #eeeeee;\nopacity: 0.9;\nbox-shadow: none;\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Change sidebar background. (#489)
263,093
08.11.2017 20:36:15
28,800
15819bb0800676a761786ef2a98a8cbbd0afe0af
Load jquery before angular
[ { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "+const webpack = require('webpack');\nconst path = require('path')\nconst ExtractTextPlugin = require('extract-text-webpack-plugin')\nconst AotPlugin = require('@ngtools/webpack').AotPlugin\n@@ -14,6 +15,13 @@ const aotPlugin = new AotPlugin({\nentryModule: path.resolve(__dirname, 'timesketch/ui/app.module#AppModule'),\n})\n+// Make sure JQuery is loaded before Angular\n+const jqueryLoader = new webpack.ProvidePlugin({\n+ $: \"jquery\",\n+ jQuery: \"jquery\",\n+ \"window.jQuery\": \"jquery\"\n+})\n+\nmodule.exports = {\nentry: './timesketch/ui/main.ts',\nmodule: {\n@@ -55,5 +63,5 @@ module.exports = {\nfilename: 'bundle.js',\npath: path.resolve(__dirname, 'timesketch/static/dist/'),\n},\n- plugins: [extractSass, aotPlugin],\n+ plugins: [extractSass, aotPlugin, jqueryLoader],\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Load jquery before angular (#492)
263,093
08.12.2017 10:45:41
-3,600
a4ddaf6868ef5172a4a634dca03e331adf5e9bca
Bugfix in e2e test script
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -31,6 +31,7 @@ echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | tee -a /e\nwget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -\necho \"deb https://debian.neo4j.org/repo stable/\" | tee /etc/apt/sources.list.d/neo4j.list\n+if [ \"$VAGRANT\" = true ]; then\n# Add Node.js 8.x repo\ncurl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -\nVERSION=node_8.x\n" } ]
Python
Apache License 2.0
google/timesketch
Bugfix in e2e test script
263,121
17.12.2017 13:53:29
18,000
839e74742c8cf771821aa920e5a18142eb5f3c02
Update install instructions for ES 5.x Update ES 2.x references to ES 5.x
[ { "change_type": "MODIFY", "old_path": "docs/Installation.md", "new_path": "docs/Installation.md", "diff": "@@ -16,10 +16,10 @@ Install Java\n$ sudo apt-get install openjdk-8-jre-headless\n$ sudo apt-get install apt-transport-https\n-Install the latest Elasticsearch 2.x release (5.x is not yet supported):\n+Install the latest Elasticsearch 5.x release:\n- $ wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.3/elasticsearch-2.4.3.deb\n- $ sudo dpkg -i elasticsearch-2.4.3.deb\n+ $ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.5.deb\n+ $ sudo dpkg -i elasticsearch-5.6.5.deb\n**Configure Elasticsearch**\n" } ]
Python
Apache License 2.0
google/timesketch
Update install instructions for ES 5.x (#501) Update ES 2.x references to ES 5.x
263,121
17.12.2017 14:39:29
18,000
478b6623855d471d8be930233672552dcda8e1aa
add direct link to specific event
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event.html", "new_path": "timesketch/ui/explore/event.html", "diff": "</table>\n</div>\n<div class=\"col-md-4\">\n+ <div style=\"margin-bottom:10px;\">\n+ <a style=\"color:#666\" href=\"/sketch/{{ sketchId }}/explore/?q=_id:{{event._id}}&index={{ event._index }}\">\n+ <i class=\"fa fa-lg fa-link icon-grey\"></i> Direct link to this event\n+ </a>\n+ </div>\n+\n<div ng-repeat=\"comment in comments\">\n<div class=\"comment-bubble\">\n<div class=\"comment-name\">{{::comment.user.username}}</div>\n" } ]
Python
Apache License 2.0
google/timesketch
add direct link to specific event (#414) (#503)
263,162
20.12.2017 09:01:57
21,600
f946913e944d3646480f2d2edc14081975bd1d23
Update link to Daemonizing Celery workers
[ { "change_type": "MODIFY", "old_path": "docs/EnablePlasoUpload.md", "new_path": "docs/EnablePlasoUpload.md", "diff": "@@ -29,4 +29,4 @@ https://github.com/log2timeline/plaso/wiki/Ubuntu-Packaged-Release\n$ celery -A timesketch.lib.tasks worker --loglevel=info\n-Read on how to run the Celery worker in the background over at the [official Celery documentation](http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html#daemonizing).\n+Read on how to run the Celery worker in the background over at the [official Celery documentation](http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#daemonizing).\n" } ]
Python
Apache License 2.0
google/timesketch
Update link to Daemonizing Celery workers (#506)
263,162
04.01.2018 07:14:16
21,600
7b02980eef5ce4741ac334658303e3c9fecf5e15
Update Installation.md Correct ES install procedure to run "apt-get update" after sources config to ensure local package lists include ES 5.x.
[ { "change_type": "MODIFY", "old_path": "docs/Installation.md", "new_path": "docs/Installation.md", "diff": "@@ -20,6 +20,7 @@ Install the latest Elasticsearch 5.x release:\n$ sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -\n$ sudo echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | tee -a /etc/apt/sources.list.d/elastic-5.x.list\n+ $ sudo apt-get update\n$ sudo apt-get install elasticsearch\n**Configure Elasticsearch**\n" } ]
Python
Apache License 2.0
google/timesketch
Update Installation.md (#509) Correct ES install procedure to run "apt-get update" after sources config to ensure local package lists include ES 5.x.
263,162
13.01.2018 10:26:09
21,600
51efdad0a1fed74fcb2477f40a165736a0592ba2
Apply config file host+port
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/experimental/utils.py", "new_path": "timesketch/lib/experimental/utils.py", "diff": "# pylint: skip-file\nimport sys\n+from flask import current_app\n+\nfrom timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.models.sketch import Sketch\nfrom xml.etree import ElementTree\ndef event_stream(sketch_id, query):\n- es = ElasticsearchDataStore(u'127.0.0.1', 9200)\n+ es = ElasticsearchDataStore(\n+ host=current_app.config[u'ELASTIC_HOST'],\n+ port=current_app.config[u'ELASTIC_PORT'])\nsketch = Sketch.query.get(sketch_id)\nif not sketch:\nsys.exit('No such sketch')\n" } ]
Python
Apache License 2.0
google/timesketch
Apply config file host+port (#519)
263,093
16.01.2018 23:42:59
-3,600
6c582c867faea07220961b82f02dfc8c513154d9
Use UgliFyJS to minimize bundle
[ { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "@@ -15,6 +15,10 @@ const aotPlugin = new AotPlugin({\nentryModule: path.resolve(__dirname, 'timesketch/ui/app.module#AppModule'),\n})\n+const minimizePlugin = new webpack.optimize.UglifyJsPlugin({\n+ mangle: false\n+})\n+\n// Make sure JQuery is loaded before Angular\nconst jqueryLoader = new webpack.ProvidePlugin({\n$: \"jquery\",\n@@ -63,5 +67,5 @@ module.exports = {\nfilename: 'bundle.js',\npath: path.resolve(__dirname, 'timesketch/static/dist/'),\n},\n- plugins: [extractSass, aotPlugin, jqueryLoader],\n+ plugins: [extractSass, aotPlugin, jqueryLoader, minimizePlugin],\n}\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -2940,9 +2940,9 @@ mkdirp@0.5.0:\ndependencies:\nminimist \"0.0.8\"\n-moment@2.10.3:\n- version \"2.10.3\"\n- resolved \"https://registry.yarnpkg.com/moment/-/moment-2.10.3.tgz#0abb99f307f65218308c6935efe29c57b1a0a27f\"\n+moment@2.11.2:\n+ version \"2.11.2\"\n+ resolved \"https://registry.yarnpkg.com/moment/-/moment-2.11.2.tgz#87968e5f95ac038c2e42ac959c75819cd3f52901\"\nmoment@^2.10.6:\nversion \"2.18.1\"\n" } ]
Python
Apache License 2.0
google/timesketch
Use UgliFyJS to minimize bundle (#526)
263,093
24.01.2018 12:40:11
-3,600
3102e5d754ff2923bf078e5c0c38c82c855b9024
Upgrade to jquery 3.0.0
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"hammerjs\": \"^2.0.8\",\n\"istanbul-instrumenter-loader\": \"^3.0.0\",\n\"jasmine\": \"^2.8.0\",\n- \"jquery\": \"2.1.0\",\n+ \"jquery\": \"3.0.0\",\n\"karma\": \"^1.7.1\",\n\"karma-coverage-istanbul-reporter\": \"^1.3.0\",\n\"karma-jasmine\": \"^1.1.0\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -2480,9 +2480,9 @@ jasmine@^2.8.0:\nglob \"^7.0.6\"\njasmine-core \"~2.8.0\"\n-jquery@2.1.0:\n- version \"2.1.0\"\n- resolved \"https://registry.yarnpkg.com/jquery/-/jquery-2.1.0.tgz#1c9a8c971d2b53dae10d72e16cbb5a1df16a4ace\"\n+jquery@3.0.0:\n+ version \"3.0.0\"\n+ resolved \"https://registry.yarnpkg.com/jquery/-/jquery-3.0.0.tgz#95a2a9541291a9f819e016f85ba247116d03e4ab\"\njs-base64@^2.1.8, js-base64@^2.1.9:\nversion \"2.3.1\"\n" } ]
Python
Apache License 2.0
google/timesketch
Upgrade to jquery 3.0.0 (#532)
263,093
26.01.2018 11:22:38
-3,600
2672ac76a40ec44acef25ee68748c168907fa4ce
Don't delete index on error
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/tasks.py", "new_path": "timesketch/lib/tasks.py", "diff": "@@ -44,10 +44,6 @@ def _set_timeline_status(index_name, status, error_msg=None):\nsearchindex = SearchIndex.query.filter_by(index_name=index_name).first()\ntimelines = Timeline.query.filter_by(searchindex=searchindex).all()\n- es = ElasticsearchDataStore(\n- host=current_app.config[u'ELASTIC_HOST'],\n- port=current_app.config[u'ELASTIC_PORT'])\n-\n# Set status\nsearchindex.set_status(status)\nfor timeline in timelines:\n@@ -58,7 +54,6 @@ def _set_timeline_status(index_name, status, error_msg=None):\nif error_msg and status == u'fail':\n# TODO: Don't overload the description field.\nsearchindex.description = error_msg\n- es.delete_index(index_name)\n# Commit changes to database\ndb_session.add(searchindex)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timeline.html", "new_path": "timesketch/templates/sketch/timeline.html", "diff": "<strong>Oops.. something is wrong with this timeline:</strong>\n<br>\n<br>\n+ <pre>\n{{ timeline.searchindex.description }}\n+ </pre>\n</div>\n{% endif %}\n" } ]
Python
Apache License 2.0
google/timesketch
Don't delete index on error (#533)
263,129
01.02.2018 17:58:43
-3,600
adffe577a800ee73f2ae31d3cd7d1b6b9a2d3d78
Show labels for labeled events
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event.html", "new_path": "timesketch/ui/explore/event.html", "diff": "<td class=\"event-message\" ng-class=\"{'event-message-selected': event.selected, 'event-message-starred': event.star, 'event-message-wrap': !showDetails, 'event-message-details': showDetails}\" ng-click=\"getDetail();showDetails = !showDetails\">\n<span ng-show=\"comment\"><i class=\"fa fa-comments\"></i></span>\n- <span ng-if=\"::event._source.tag\" ng-repeat=\"tag in ::event._source.tag\" class=\"label label-default\">{{::tag}}</span>\n+ <span ng-if=\"::event._source.tag\" ng-repeat=\"tag in ::event._source.tag\" class=\"label label-success\">{{::tag}}</span>\n+ <span ng-if=\"::event._source.label\" ng-repeat=\"label in ::event._source.label\">\n+ <span ng-if=\"::label.indexOf('__') != 0\" class=\"label label-success\">{{::label}}</span>\n+ </span>\n<span ng-class=\"{true: 'message-hidden'}[event.hidden]\">[{{ event._source.timestamp_desc }}] <span title=\"{{ event._source.message }}\">{{ event._source.message|limitTo:1000 }}</span></span>\n</td>\n" } ]
Python
Apache License 2.0
google/timesketch
Show labels for labeled events (#538)
263,162
06.03.2018 05:11:20
21,600
9e98dc7eb05e3031b569ec5751c93bc2f3e2ef93
Fix for CSV issue
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -902,6 +902,7 @@ class UploadFileResource(ResourceMixin, Resource):\n_filename, _extension = os.path.splitext(file_storage.filename)\nfile_extension = _extension.lstrip(u'.')\ntimeline_name = form.name.data or _filename.rstrip(u'.')\n+ delimiter = u','\nsketch = None\nif sketch_id:\n@@ -953,6 +954,7 @@ class UploadFileResource(ResourceMixin, Resource):\ntimeline_name,\nindex_name,\nfile_extension,\n+ delimiter,\nusername\n),\ntask_id=index_name\n" } ]
Python
Apache License 2.0
google/timesketch
Fix for CSV issue #548 (#549)
263,173
09.03.2018 01:01:58
28,800
37ae91fcbdf357417f39c0892249eaae29e605a1
set task arguments
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -948,15 +948,18 @@ class UploadFileResource(ResourceMixin, Resource):\n# Run the task in the background\ntask = task_directory.get(file_extension)\n- task.apply_async(\n- (\n- file_path,\n- timeline_name,\n- index_name,\n- file_extension,\n- delimiter,\n+ task_args = {\n+ u'plaso': (\n+ file_path, timeline_name, index_name, file_extension,\nusername\n),\n+ u'default': (\n+ file_path, timeline_name, index_name, file_extension,\n+ delimiter, username\n+ )\n+ }\n+ task.apply_async(\n+ task_args.get(file_extension, task_args[u'default']),\ntask_id=index_name\n)\n" } ]
Python
Apache License 2.0
google/timesketch
set task arguments (#556)
263,093
17.03.2018 18:11:29
-3,600
746828e2e83970c65e82bc1376c11af9c1061322
Run celery as the current user
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -117,6 +117,8 @@ mkdir -p /var/{lib,log,run}/celery\nchown $RUN_AS_USER /var/{lib,log,run}/celery\ncp \"${VAGRANT_PATH}\"/celery.service /etc/systemd/system/\ncp \"${VAGRANT_PATH}\"/celery.conf /etc/\n+sed -i s/\"User=vagrant\"/\"User=${RUN_AS_USER}\"/ /etc/systemd/system/celery.service\n+sed -i s/\"Group=vagrant\"/\"Group=${RUN_AS_USER}\"/ /etc/systemd/system/celery.service\n/bin/systemctl daemon-reload\n/bin/systemctl enable celery.service\n/bin/systemctl start celery.service\n" } ]
Python
Apache License 2.0
google/timesketch
Run celery as the current user (#553)
263,093
19.03.2018 14:38:50
-3,600
b54101c215f6d49bcf275f34fe6506a932bb7bd0
Update momentjs and fix deprication bug
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"karma-phantomjs-launcher\": \"^1.0.4\",\n\"karma-webpack\": \"^2.0.4\",\n\"medium-editor\": \"5.16.1\",\n- \"moment\": \"2.11.2\",\n+ \"moment\": \"2.19.3\",\n\"node-sass\": \"^4.5.3\",\n\"null-loader\": \"^0.1.1\",\n\"numeral\": \"2.0.6\",\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/filter.directive.ts", "new_path": "timesketch/ui/explore/filter.directive.ts", "diff": "@@ -73,6 +73,14 @@ export const tsFilter = function () {\nctrl.search(scope.query, scope.filter, scope.queryDsl)\n}\n+ // Make typescript compiler happy.\n+ const getDurationUnit = function (unit) {\n+ if (!unit) {\n+ return 'm'\n+ }\n+ return unit\n+ }\n+\nscope.parseFilterDate = function (datevalue, datevalue_end) {\nif (datevalue != null) {\nconst datetimetemplate = 'YYYY-MM-DDTHH:mm:ss'\n@@ -83,12 +91,11 @@ export const tsFilter = function () {\nconst match = offsetRegexp.exec(datevalue)\nif (match != null) {\n- let filterbase = match[1]\n+ const filterbase = moment.utc(match[1], 'YYYY-MM-DD HH:mm:ssZZ')\nconst filteroffset = match[2]\nconst filteramount = match[3]\n- const filtertype = match[4]\n+ const filtertype = getDurationUnit(match[4])\n- filterbase = moment.utc(filterbase, 'YYYY-MM-DD HH:mm:ssZZ')\n// calculate filter start and end datetimes\nif (filteroffset == '+') {\nscope.filter.time_start = moment.utc(filterbase).format(datetimetemplate)\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -2940,9 +2940,9 @@ mkdirp@0.5.0:\ndependencies:\nminimist \"0.0.8\"\n-moment@2.11.2:\n- version \"2.11.2\"\n- resolved \"https://registry.yarnpkg.com/moment/-/moment-2.11.2.tgz#87968e5f95ac038c2e42ac959c75819cd3f52901\"\n+moment@2.19.3:\n+ version \"2.19.3\"\n+ resolved \"https://registry.yarnpkg.com/moment/-/moment-2.19.3.tgz#bdb99d270d6d7fda78cc0fbace855e27fe7da69f\"\nmoment@^2.10.6:\nversion \"2.18.1\"\n" } ]
Python
Apache License 2.0
google/timesketch
Update momentjs and fix deprication bug (#561)
263,093
19.03.2018 18:54:03
-3,600
847fc1e7e3b1ba656354fecaabeb1bad055c37c7
strip domain from username if present
[ { "change_type": "MODIFY", "old_path": "timesketch/views/sketch.py", "new_path": "timesketch/views/sketch.py", "diff": "@@ -94,6 +94,7 @@ def overview(sketch_id):\nreturn redirect(url_for(u'sketch_views.overview', sketch_id=sketch.id))\n# Toggle public/private form POST\n+ # TODO: Move these resources to the API.\nif permission_form.validate_on_submit():\nif not sketch.has_permission(current_user, u'write'):\nabort(HTTP_STATUS_CODE_FORBIDDEN)\n@@ -102,8 +103,9 @@ def overview(sketch_id):\n# TODO(jbn): Make write permission off by default\n# and selectable in the UI\nif permission_form.username.data:\n- user = User.query.filter_by(\n- username=permission_form.username.data).first()\n+ username = permission_form.username.data\n+ base_username = username.split(u'@')[0]\n+ user = User.query.filter_by(username=base_username).first()\nif user:\nsketch.grant_permission(permission=u'read', user=user)\nsketch.grant_permission(permission=u'write', user=user)\n" } ]
Python
Apache License 2.0
google/timesketch
strip domain from username if present (#551)
263,093
23.03.2018 13:20:49
-3,600
f96c43ea8aead33028bd1ec65e49d5964258564a
Don't build pager when there are no results
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event.directive.ts", "new_path": "timesketch/ui/explore/event.directive.ts", "diff": "@@ -167,7 +167,6 @@ export const tsEventList = ['timesketchApi', function (timesketchApi) {\nevent_count = $scope.meta.es_total_count\n$scope.showLimitedResults = $scope.dataLoaded && false\n}\n-\ntotal_pages = Math.ceil(event_count / $scope.filter.size) - 1\nif (total_pages !== $scope.totalPages) {\n$scope.currentPage = 0\n@@ -218,18 +217,15 @@ export const tsEventList = ['timesketchApi', function (timesketchApi) {\n$scope.$watch('meta', function (value) {\nif (angular.isDefined(value)) {\n- // reciprocal dataLoaded check\n- if (angular.isDefined($scope.events) && $scope.events.length && value.es_total_count > 0) {\n+ if (angular.isDefined($scope.events)) {\n$scope.dataLoaded = true\n$scope.getEventCount()\n- $scope.buildPager()\n}\n}\n})\n$scope.$watch('events', function (value) {\nif (angular.isDefined(value)) {\n- // reciprocal dataLoaded check\nif (angular.isDefined($scope.meta) && $scope.meta.es_total_count > 0 && value.length ) {\n$scope.dataLoaded = true\n$scope.getEventCount()\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/search.directive.ts", "new_path": "timesketch/ui/explore/search.directive.ts", "diff": "@@ -117,7 +117,6 @@ export const tsSearch = ['$location', 'timesketchApi', function ($location, time\n$scope.query = query\n$scope.filter = filter\n$scope.queryDsl = queryDsl\n- $scope.dataLoaded = false\ntimesketchApi.search($scope.sketchId, query, filter, queryDsl)\n.success(function (data) {\n" } ]
Python
Apache License 2.0
google/timesketch
Don't build pager when there are no results (#573)
263,093
23.03.2018 13:30:00
-3,600
f6a659325807b5c3e57016cd62d814c018059658
Remove unused abstraction base class
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -613,7 +613,6 @@ class ExploreResource(ResourceMixin, Resource):\nquery_dsl,\nindices,\naggregations=None,\n- return_results=True,\nreturn_fields=None,\nenable_scroll=False)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/aggregators.py", "new_path": "timesketch/lib/aggregators.py", "diff": "@@ -95,7 +95,6 @@ def heatmap(es_client, sketch_id, query_string, query_filter, query_dsl,\nquery_dsl,\nindices,\naggregations=aggregation,\n- return_results=False,\nreturn_fields=None,\nenable_scroll=False)\n@@ -177,8 +176,7 @@ def histogram(es_client, sketch_id, query_string, query_filter, query_dsl,\nquery_filter,\nquery_dsl,\nindices,\n- aggregations=aggregation,\n- return_results=False)\n+ aggregations=aggregation)\nelse:\nsearch_result = {}\n" }, { "change_type": "DELETE", "old_path": "timesketch/lib/datastore.py", "new_path": null, "diff": "-# Copyright 2014 Google Inc. All rights reserved.\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Datastore abstraction.\"\"\"\n-\n-import abc\n-\n-\n-class DataStore(object):\n- \"\"\"Abstract datastore.\"\"\"\n-\n- __metaclass__ = abc.ABCMeta\n-\n- @abc.abstractmethod\n- def search(self, sketch_id, query_string, query_filter, query_dsl, indices,\n- count, aggregations, return_results, return_fields,\n- enable_scroll):\n- \"\"\"Return search results.\n-\n- Args:\n- sketch_id: Integer of sketch primary key\n- query: Query string\n- query_filter: Dictionary containing filters to apply\n- query_dsl: Dictionary containing Elasticsearch DSL query\n- indices: List of indices to query\n- count: Boolean indicating if we should only return result count\n- aggregations: Dict of Elasticsearch aggregations\n- return_results: Boolean indicating if results should be returned\n- return_fields: List of fields to return\n- enable_scroll: If Elasticsearch scroll API should be used\n- \"\"\"\n-\n- @abc.abstractmethod\n- def get_event(self, searchindex_id, event_id):\n- \"\"\"Get single event from the datastore.\n-\n- Args:\n- searchindex_id: String of ElasticSearch index id\n- event_id: String of ElasticSearch event id\n- \"\"\"\n-\n- @abc.abstractmethod\n- def set_label(self,\n- searchindex_id,\n- event_id,\n- event_type,\n- sketch_id,\n- user_id,\n- label,\n- toggle=False):\n- \"\"\"Add label to an event.\n-\n- Args:\n- searchindex_id: String of ElasticSearch index id\n- event_id: String of ElasticSearch event id\n- sketch_id: Integer of sketch primary key\n- user_id: Integer of user primary key\n- label: String with the name of the label\n- toggle: Optional boolean value if the label should be toggled\n- (add/remove). The default is False.\n- \"\"\"\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/elastic.py", "new_path": "timesketch/lib/datastores/elastic.py", "diff": "@@ -24,7 +24,6 @@ from elasticsearch.exceptions import NotFoundError\nfrom elasticsearch.exceptions import ConnectionError\nfrom flask import abort\n-from timesketch.lib import datastore\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_NOT_FOUND\n# Setup logging\n@@ -32,7 +31,7 @@ es_logger = logging.getLogger(u'elasticsearch')\nes_logger.addHandler(logging.NullHandler())\n-class ElasticsearchDataStore(datastore.DataStore):\n+class ElasticsearchDataStore(object):\n\"\"\"Implements the datastore.\"\"\"\n# Number of events to queue up when bulk inserting events.\n@@ -215,7 +214,6 @@ class ElasticsearchDataStore(datastore.DataStore):\nindices,\ncount=False,\naggregations=None,\n- return_results=True,\nreturn_fields=None,\nenable_scroll=False):\n\"\"\"Search ElasticSearch. This will take a query string from the UI\n@@ -230,7 +228,6 @@ class ElasticsearchDataStore(datastore.DataStore):\nindices: List of indices to query\ncount: Boolean indicating if we should only return result count\naggregations: Dict of Elasticsearch aggregations\n- return_results: Boolean indicating if results should be returned\nreturn_fields: List of fields to return\nenable_scroll: If Elasticsearch scroll API should be used\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/testlib.py", "new_path": "timesketch/lib/testlib.py", "diff": "@@ -18,7 +18,6 @@ import json\nfrom flask_testing import TestCase\nfrom timesketch import create_app\n-from timesketch.lib import datastore\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_REDIRECT\nfrom timesketch.models import init_db\nfrom timesketch.models import drop_all\n@@ -46,7 +45,7 @@ class TestConfig(object):\nGRAPH_BACKEND_ENABLED = False\n-class MockDataStore(datastore.DataStore):\n+class MockDataStore(object):\n\"\"\"A mock implementation of a Datastore.\"\"\"\nevent_dict = {\nu'_index': [],\n" }, { "change_type": "MODIFY", "old_path": "timesketch/views/sketch.py", "new_path": "timesketch/views/sketch.py", "diff": "@@ -453,8 +453,7 @@ def export(sketch_id):\nquery_filter,\nquery_dsl,\nindices,\n- aggregations=None,\n- return_results=True)\n+ aggregations=None)\ncsv_out = StringIO()\ncsv_writer = csv.DictWriter(\n" } ]
Python
Apache License 2.0
google/timesketch
Remove unused abstraction base class (#574)
263,162
17.04.2018 11:47:34
25,200
e26ae3bf279593a9d895f3214faffc1ef83442e7
Update setup.py Update setup.py to find pip dependencies for > pip 10
[ { "change_type": "MODIFY", "old_path": "setup.py", "new_path": "setup.py", "diff": "@@ -24,8 +24,12 @@ import time\nfrom setuptools import find_packages\nfrom setuptools import setup\n-from pip.req import parse_requirements\n+try: # for pip >= 10\n+ from pip._internal.download import PipSession\n+ from pip._internal.req import parse_requirements\n+except ImportError: # for pip <= 9.0.3\nfrom pip.download import PipSession\n+ from pip.req import parse_requirements\ntimesketch_version = u'20170721'\n" } ]
Python
Apache License 2.0
google/timesketch
Update setup.py (#583) Update setup.py to find pip dependencies for > pip 10
263,162
29.04.2018 03:29:39
18,000
655dadb80df2f1dab46cf335e02f5cd0bf5bb561
Update bootstrap.sh Don't trample debian pip.
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -52,7 +52,7 @@ apt-get install -y \\\npython-pip python-dev libffi-dev redis-server python-plaso plaso-tools jq\n# Install python dependencies\n-pip install --upgrade pip\n+# pip -v install --upgrade pip # don't do this https://github.com/pypa/pip/issues/5221\npip install gunicorn pylint nose flask-testing coverage mock BeautifulSoup\nif [ \"$VAGRANT\" = true ]; then\n" } ]
Python
Apache License 2.0
google/timesketch
Update bootstrap.sh (#588) Don't trample debian pip.
263,093
04.05.2018 15:17:27
-7,200
aafd8468970abd2779576c5a20a7a3ff48866619
Enable upload by default when using Vagrant
[ { "change_type": "MODIFY", "old_path": "vagrant/bootstrap.sh", "new_path": "vagrant/bootstrap.sh", "diff": "@@ -93,16 +93,16 @@ chown \"${RUN_AS_USER}\" /var/lib/timesketch\ncp \"${TIMESKETCH_PATH}\"/timesketch.conf /etc/\n# Set session key for Timesketch\n-sed s/\"SECRET_KEY = u'<KEY_GOES_HERE>'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n-mv /etc/timesketch.conf.new /etc/timesketch.conf\n+sed -i s/\"SECRET_KEY = u'<KEY_GOES_HERE>'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf\n# Configure the DB password\n-sed s/\"<USERNAME>:<PASSWORD>@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n-mv /etc/timesketch.conf.new /etc/timesketch.conf\n+sed -i s/\"<USERNAME>:<PASSWORD>@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf\n# Configure the Neo4j password\n-sed s/\"<N4J_PASSWORD>\"/\"neo4j\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n-mv /etc/timesketch.conf.new /etc/timesketch.conf\n+sed -i s/\"<N4J_PASSWORD>\"/\"neo4j\"/ /etc/timesketch.conf\n+\n+# Enable upload\n+sed -i s/\"UPLOAD_ENABLED = False\"/\"UPLOAD_ENABLED = True\"/ /etc/timesketch.conf\n# Copy groovy scripts\ncp \"${TIMESKETCH_PATH}\"/contrib/*.groovy /etc/elasticsearch/scripts/\n" } ]
Python
Apache License 2.0
google/timesketch
Enable upload by default when using Vagrant (#593)
263,093
04.05.2018 16:10:32
-7,200
a43ddaf23c543b79732d531d90ebda35aeae0243
Consistent null state
[ { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/explore.html", "new_path": "timesketch/templates/sketch/explore.html", "diff": "<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- <br>\n- <a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add timeline</a>\n</div>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/overview.html", "new_path": "timesketch/templates/sketch/overview.html", "diff": "<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- <br>\n- <a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add timeline</a>\n</div>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/stories.html", "new_path": "timesketch/templates/sketch/stories.html", "diff": "<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- <br>\n- <a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add timeline</a>\n</div>\n</div>\n{% else %}\n{% if story %}\n<ts-story sketch-id=\"{{ sketch.id }}\" story-id=\"{{ story.id }}\"></ts-story>\n{% else %}\n- <h4 class=\"pull-left\">Stories</h4>\n- <br>\n+ <h4>Stories</h4>\n<ts-story-list sketch-id=\"{{ sketch.id }}\" show-create-button=\"true\"></ts-story-list>\n{% endif %}\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timelines.html", "new_path": "timesketch/templates/sketch/timelines.html", "diff": "</div>\n{% endif %}\n- {% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines and not timelines%}\n+ {% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines and not timelines and not upload_enabled %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"text-center\" style=\"padding:100px;\">\n<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No timelines in the system yet</h3>\n- <p>Get started by importing a Plaso storage file</p>\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+ <p>Uploads are disabled. See the <a href=\"https://github.com/google/timesketch/blob/master/docs/EnablePlasoUpload.md\" rel=\"noreferrer\" target=\"_blank\">documentation</a> on how to enable the upload feature and get started.</p>\n</div>\n</div>\n</div>\n<th>Created</th>\n</thead>\n{% for timeline in timelines %}\n- {% if timeline.get_status.status == 'new' %}\n+ {% if timeline.get_status.status == 'ready' %}\n<tr>\n<td><input name=\"timelines\" type=\"checkbox\" value={{ timeline.id }}></td>\n<td>{{ timeline.name }}</td>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/views.html", "new_path": "timesketch/templates/sketch/views.html", "diff": "<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- <br>\n- <a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add timeline</a>\n</div>\n</div>\n{% else %}\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/sketch/search-template-list.html", "new_path": "timesketch/ui/sketch/search-template-list.html", "diff": "<div ng-show=\"searchTemplates.length\">\n+ <br><br>\n<h4 ng-show=\"searchTemplates.length\">Search templates</h4>\n<table class=\"table table-hover\" ng-hide=\"!searchTemplates.length\">\n<thead>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/sketch/views-list.html", "new_path": "timesketch/ui/sketch/views-list.html", "diff": "</div>\n<div ng-if=\"showSearchTemplates\">\n- <br><br>\n<ts-search-template-list sketch-id=\"sketchId\"></ts-search-template-list>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/ui/story/list.html", "new_path": "timesketch/ui/story/list.html", "diff": "<div ng-if=\"stories.length < 1\">\n- <br>\nNo stories written yet\n</div>\n" }, { "change_type": "MODIFY", "old_path": "timesketch/views/sketch.py", "new_path": "timesketch/views/sketch.py", "diff": "@@ -233,10 +233,6 @@ def explore(sketch_id, view_id=None, searchtemplate_id=None):\nif url_size:\nquery_filter[u'size'] = url_size\nview.query_filter = view.validate_filter(query_filter)\n- print \"query_filter before:\"\n- print query_filter\n- print \"query_filter after:\"\n- print view.query_filter\nview.query_dsl = None\nsave_view = True\n" } ]
Python
Apache License 2.0
google/timesketch
Consistent null state (#594)
263,096
09.05.2018 21:38:36
-7,200
1cb24e359fc140fef34ff78ec2cb59d71c4aa237
Fixed a typo Small issue that I stumbled across
[ { "change_type": "MODIFY", "old_path": "docs/Community-Guide.md", "new_path": "docs/Community-Guide.md", "diff": "@@ -8,7 +8,7 @@ Use your favorite IRC client or try the [Freenode web based IRC client](http://w\n### Slack community\nJoin the [Timesketch Slack community](https://timesketch.slack.com/) by sending an email to get-slack-invite@timesketch.org.\n-You will get an invite in your inbox as soon as soon as possible.\n+You will get an invite in your inbox as soon as possible.\n**Why do I need to email you to get access to the Slack community?**\nA: Because Slack doesn't have a \"Request access to this community\" feature and I need an email address to send the invite to. If you have a better idea than sending me (Johan) an email to get an invite please feel free to reach out via IRC (j4711 on freenode) or send a [Twitter DM](https://twitter.com/jberggren).\n" } ]
Python
Apache License 2.0
google/timesketch
Fixed a typo (#597) Small issue that I stumbled across
263,096
15.05.2018 09:49:20
-7,200
a293c33763cd65819665738ce1fc71fabbd8d814
User guide first version * Create Users-Guide.md * tsctl started to cover tsctl * added an index table, but needs a lot more love . * Update Users-Guide.md * Update Users-Guide.md * s/comand/command
[ { "change_type": "ADD", "old_path": null, "new_path": "docs/Users-Guide.md", "diff": "+## Table of Contents\n+1. [Demo](#demo)\n+2. [tsctl](#tsctl)\n+ - [Start timesketch](#start-timesketch)\n+ - [User management](#user-management)\n+ - [Adding users](#adding-users)\n+ - [Removing users](#removing-users)\n+ - [Group Management](#group-management)\n+ - [Adding groups](#adding-groups)\n+ - [Removing groups](#removing-groups)\n+ - [Managing group membership](#managing-group-membership)\n+ - [Add index](#add_index)\n+ - [Migrate database](#migrate-db)\n+ - [Drop database](#drop-database)\n+ - [Import JSON to timesketch](#import-json-to-timesketch)\n+ - [Purge](#purge)\n+ - [Search template](#search_template)\n+ - [similarity_score](#similarity_score)\n+3. [Concepts](#concepts)\n+ - [Adding Timelines](#adding-timelines)\n+ - [Using Stories](#stories)\n+4. [Searching](#searching)\n+\n+\n+## Demo\n+\n+To play with timesketch without any installation visit [demo.timesketch.org](https://demo.timesketch.org)\n+\n+## tsctl\n+\n+tsctl is a command line tool to control timesketch.\n+\n+Parameters:\n+```\n+--config / -c (optional)\n+```\n+\n+Example\n+```\n+tsctl runserver -c /etc/timesketch.conf\n+```\n+\n+\n+### Start timesketch\n+\n+Will start the timesketch server\n+\n+Command:\n+```\n+tsctl runserver\n+```\n+\n+### User management\n+\n+#### Adding users\n+\n+Command:\n+```\n+tsctl add_user\n+```\n+\n+Parameters:\n+```\n+--name / -n\n+--password / -p (optional)\n+```\n+\n+Example\n+```\n+tsctl add_user --name foo\n+```\n+\n+#### Removing users\n+\n+Not yet implemented.\n+\n+### Group management\n+\n+#### Adding groups\n+\n+Command:\n+```\n+tsctl add_group\n+```\n+\n+Parameters:\n+```\n+--name / -n\n+```\n+\n+#### Removing groups\n+\n+Not yet implemented\n+\n+#### Managing group membership\n+\n+Add or remove a user to a group\n+\n+Command:\n+```\n+tsctl manage_group\n+```\n+\n+Parameters:\n+```\n+--add / -a\n+--remove / -r\n+--group / -g\n+--user / -u\n+```\n+\n+Example:\n+```\n+tsctl manage_group -a -u user_foo -g group_bar\n+```\n+\n+### add_index\n+\n+Create a new Timesketch searchindex.\n+\n+Command:\n+```\n+tsctl add_index\n+```\n+\n+Parameters:\n+```\n+--name / -n\n+--index / -i\n+--user / -u\n+```\n+\n+Example:\n+```\n+tsctl add_index -u user_foo -i test_index_name -n sample\n+```\n+\n+### Migrate db\n+\n+Command:\n+```\n+tsctl db\n+```\n+\n+### Drop database\n+\n+Will drop all databases.\n+\n+Comand:\n+```\n+tsctl drop_db\n+```\n+\n+### Import json to Timesketch\n+\n+Command:\n+```\n+tsctl json2ts\n+```\n+\n+### Purge\n+\n+Comand:\n+```\n+tsctl purge\n+```\n+\n+### search_template\n+\n+Export/Import search templates to/from file.\n+\n+Command:\n+```\n+tsctl search_template\n+```\n+\n+Parameters:\n+```\n+--import / -i\n+--export / -e\n+```\n+\n+import_location: Path to the yaml file to import templates.\n+export_location: Path to the yaml file to export templates.\n+\n+### similarity_score\n+\n+Command:\n+```\n+tsctl similarity_score\n+```\n+\n+## Concepts\n+\n+Timesketch is built on multiple sketches, where one sketch is ussually one case.\n+Every sketch can consist of multiple timelines with multiple views.\n+\n+### Sketches\n+\n+### Adding Timelines\n+\n+* [Create timeline from JSON/JSONL/CSV file](docs/CreateTimelineFromJSONorCSV.md)\n+* [Create timeline from Plaso file](docs/CreateTimelineFromPlaso.md)\n+* [Enable Plaso upload via HTTP](docs/EnablePlasoUpload.md)\n+\n+### Views\n+\n+#### Hiding events from a view\n+\n+All about reducing noise in the result views.\n+Hit the little eye to hide events from the list making it possible to\n+curate views to emphasize the important things.\n+The events are still there and can be easily shown for those who want to see them.\n+Hit the big red button to show/hide the events.\n+\n+### Heatmap\n+\n+The heatmap aggregation calculates on which day of the week and at which hour events happened. This can be very useful e.g. when analyzing lateral movement or login events.\n+\n+### Stories\n+\n+A story is a place where you can capture the narrative of your technical investigation and add detail to your story with raw timeline data.\n+The editor let you to write and capture the story behind your investigation and at the same time enable you to share detailed findings without spending hours writing reports.\n+\n+you can add events from previously saved searches.\n+Just hit enter to start a new paragraph and choose the saved search from the dropdown menu.\n+\n+See [Medium article](https://medium.com/timesketch/timesketch-2016-7-db3083e78156)\n+\n+## Searching\n+\n+All data within Timesketch is stored in elasticsearch. So the search works similar to ES.\n+\n+Using the advances search, a JSON can be passed to Timesketch\n+```json\n+{\n+ \"query\": {\n+ \"bool\": {\n+ \"must\": [\n+ {\n+ \"query_string\": {\n+ \"query\": \"*\"\n+ }\n+ }\n+ ]\n+ }\n+ },\n+ \"sort\": {\n+ \"datetime\": \"asc\"\n+ }\n+}\n+```\n" } ]
Python
Apache License 2.0
google/timesketch
User guide first version (#599) * Create Users-Guide.md * tsctl started to cover tsctl * added an index table, but needs a lot more love . * Update Users-Guide.md * Update Users-Guide.md * s/comand/command
263,093
16.05.2018 22:29:05
-7,200
33c98f4c9592c812901d28c257ff1cca672c64de
Add MICROSECONDS_PER_SECOND to definitions
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/definitions.py", "new_path": "timesketch/lib/definitions.py", "diff": "@@ -21,3 +21,6 @@ HTTP_STATUS_CODE_BAD_REQUEST = 400\nHTTP_STATUS_CODE_UNAUTHORIZED = 401\nHTTP_STATUS_CODE_FORBIDDEN = 403\nHTTP_STATUS_CODE_NOT_FOUND = 404\n+\n+# Time and date\n+MICROSECONDS_PER_SECOND = 1000000\n" } ]
Python
Apache License 2.0
google/timesketch
Add MICROSECONDS_PER_SECOND to definitions (#606)
263,096
17.05.2018 16:07:35
-7,200
0801afe65d300fa7c42bc673d0a2b67de749f339
Adding the users guide to README.md
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -20,6 +20,10 @@ Timesketch is an open source tool for collaborative forensic timeline analysis.\n* [Create timeline from Plaso file](docs/CreateTimelineFromPlaso.md)\n* [Enable Plaso upload via HTTP](docs/EnablePlasoUpload.md)\n+#### Using Timesketch\n+\n+* [Users guide](docs/Users-Guide.md)\n+\n## Community\n* [Community guide](docs/Community-Guide.md)\n" } ]
Python
Apache License 2.0
google/timesketch
Adding the users guide to README.md (#611)
263,142
18.05.2018 15:53:15
-28,800
9e61fbecfe3e9bea3de7b8d740dc0fadee7c67a6
clean code. delete unused comma
[ { "change_type": "MODIFY", "old_path": "timesketch.conf", "new_path": "timesketch.conf", "diff": "@@ -77,7 +77,7 @@ UPLOAD_FOLDER = u'/tmp'\n# Celery broker configuration. You need to change ip/port to where your Redis\n# server is running.\n-CELERY_BROKER_URL = 'redis://127.0.0.1:6379',\n+CELERY_BROKER_URL = 'redis://127.0.0.1:6379'\nCELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'\n# Path to plaso data directory.\n" } ]
Python
Apache License 2.0
google/timesketch
clean code. delete unused comma (#610)
263,093
08.06.2018 16:09:00
-7,200
1b54c9321b4c22ba54b085a47cd0c3cad432222e
Rename cypher lib dir
[ { "change_type": "MODIFY", "old_path": "timesketch/api/v1/resources.py", "new_path": "timesketch/api/v1/resources.py", "diff": "@@ -73,7 +73,7 @@ from timesketch.lib.forms import StoryForm\nfrom timesketch.lib.forms import GraphExploreForm\nfrom timesketch.lib.forms import SearchIndexForm\nfrom timesketch.lib.utils import get_validated_indices\n-from timesketch.lib.cypher_transpilation import transpile_query, InvalidQuery\n+from timesketch.lib.cypher import transpile_query, InvalidQuery\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import Event\nfrom timesketch.models.sketch import SearchIndex\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/__init__.py", "new_path": "timesketch/lib/cypher/__init__.py", "diff": "" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/append_return_clause.py", "new_path": "timesketch/lib/cypher/append_return_clause.py", "diff": "" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/append_return_clause_test.py", "new_path": "timesketch/lib/cypher/append_return_clause_test.py", "diff": "\"\"\"Tests.\"\"\"\nimport unittest\n-from timesketch.lib.cypher_transpilation.append_return_clause import \\\n+from timesketch.lib.cypher.append_return_clause import \\\nappend_return_clause\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/insertable_string.py", "new_path": "timesketch/lib/cypher/insertable_string.py", "diff": "" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/invalid_query.py", "new_path": "timesketch/lib/cypher/invalid_query.py", "diff": "" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/restrict_query_to_sketch.py", "new_path": "timesketch/lib/cypher/restrict_query_to_sketch.py", "diff": "\"\"\"Module containing the restrict_query_to_sketch function.\"\"\"\nimport pycypher\n-from timesketch.lib.cypher_transpilation.insertable_string import \\\n+from timesketch.lib.cypher.insertable_string import \\\nInsertableString\n-from timesketch.lib.cypher_transpilation.invalid_query import InvalidQuery\n+from timesketch.lib.cypher.invalid_query import InvalidQuery\ndef query_is_restricted_to_sketch(query, sketch_id):\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/restrict_query_to_sketch_test.py", "new_path": "timesketch/lib/cypher/restrict_query_to_sketch_test.py", "diff": "@@ -16,9 +16,9 @@ import unittest\nfrom parameterized import parameterized\n-from timesketch.lib.cypher_transpilation.restrict_query_to_sketch import \\\n+from timesketch.lib.cypher.restrict_query_to_sketch import \\\nrestrict_query_to_sketch\n-from timesketch.lib.cypher_transpilation.invalid_query import InvalidQuery\n+from timesketch.lib.cypher.invalid_query import InvalidQuery\n# pylint: disable=bad-continuation\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/transpile_query.py", "new_path": "timesketch/lib/cypher/transpile_query.py", "diff": "\"\"\"Entry point module for cypher transpilation.\"\"\"\nimport pycypher\n-from timesketch.lib.cypher_transpilation.restrict_query_to_sketch import \\\n+from timesketch.lib.cypher.restrict_query_to_sketch import \\\nrestrict_query_to_sketch\n-from timesketch.lib.cypher_transpilation.append_return_clause import \\\n+from timesketch.lib.cypher.append_return_clause import \\\nappend_return_clause\n-from timesketch.lib.cypher_transpilation.unwind_timestamps import \\\n+from timesketch.lib.cypher.unwind_timestamps import \\\nunwind_timestamps\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/transpile_query_test.py", "new_path": "timesketch/lib/cypher/transpile_query_test.py", "diff": "\"\"\"Tests.\"\"\"\nimport unittest\n-from timesketch.lib.cypher_transpilation.transpile_query import \\\n+from timesketch.lib.cypher.transpile_query import \\\ntranspile_query\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/unwind_timestamps.py", "new_path": "timesketch/lib/cypher/unwind_timestamps.py", "diff": "\"\"\"Module containing the unwind_timestamps function.\"\"\"\nimport pycypher\n-from timesketch.lib.cypher_transpilation.insertable_string import \\\n+from timesketch.lib.cypher.insertable_string import \\\nInsertableString\n" }, { "change_type": "RENAME", "old_path": "timesketch/lib/cypher_transpilation/unwind_timestamps_test.py", "new_path": "timesketch/lib/cypher/unwind_timestamps_test.py", "diff": "\"\"\"Tests.\"\"\"\nimport unittest\n-from timesketch.lib.cypher_transpilation.unwind_timestamps import \\\n+from timesketch.lib.cypher.unwind_timestamps import \\\nunwind_timestamps\n" } ]
Python
Apache License 2.0
google/timesketch
Rename cypher lib dir (#613)
263,093
14.08.2018 10:54:55
-7,200
a8fda77f5d059d7cd944a369d0829ab71722a173
Update event-add.html
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event-add.html", "new_path": "timesketch/ui/explore/event-add.html", "diff": "<div class=\"col-md-6\">\n<span class=\"form-group\">\n<label for=\"eventTimestampInput\">Timestamp: </label>\n- <input class=\"form-control\" id=\"eventTimestampInput\" placeholder=\"Timestamp\" ng-model=\"addEventData[event._id].timestamp\"/>\n+ <input class=\"form-control\" id=\"eventTimestampInput\" placeholder=\"Timestamp\" required ng-model=\"addEventData[event._id].timestamp\"/>\n</span>\n<span class=\"form-group\">\n<label for=\"eventTimestampDescInput\">Timestamp description: </label>\n- <input class=\"form-control\" id=\"eventTimestampDescInput\" placeholder=\"Attack mitigated\" ng-model=\"addEventData[event._id].timestamp_desc\"/>\n+ <input class=\"form-control\" id=\"eventTimestampDescInput\" placeholder=\"Attack mitigated\" required ng-model=\"addEventData[event._id].timestamp_desc\"/>\n</span>\n</div>\n<div class=\"col-md-6\">\n<span class=\"form-group\" style=\"width: 100%;\">\n<label for=\"eventMessageTextarea\">Message: </label>\n- <textarea class=\"form-control\" id=\"eventMessageTextarea\" style=\"width: 100%;\" placeholder=\"Ruleset updated to block traffic\" ng-model=\"addEventData[event._id].message\"></textarea>\n+ <textarea class=\"form-control\" id=\"eventMessageTextarea\" style=\"width: 100%;\" placeholder=\"Ruleset updated to block traffic\" required ng-model=\"addEventData[event._id].message\"></textarea>\n</span>\n</div>\n</div>\n" } ]
Python
Apache License 2.0
google/timesketch
Update event-add.html (#636)
263,093
25.09.2018 22:55:07
-7,200
4ac85161a46fd0e533f26d11f77055d5c4ab6976
Update views-list.html Small bug that showed the template list twice.
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/sketch/views-list.html", "new_path": "timesketch/ui/sketch/views-list.html", "diff": "<ul class=\"content-list\" ng-hide=\"!savedViews.length\">\n- <ts-search-template-list sketch-id=\"sketchId\"></ts-search-template-list>\n<li class=\"content-item\" ng-repeat=\"view in savedViews\">\n<div ng-if=\"showDelete\">\n<i ng-click=\"confirmDelete =! confirmDelete\" ng-hide=\"confirmDelete\" class=\"fa fa-trash pull-right\" style=\"cursor: pointer; margin-top:3px;margin-left:10px;\"></i>\n" } ]
Python
Apache License 2.0
google/timesketch
Update views-list.html Small bug that showed the template list twice.
263,173
02.10.2018 06:11:29
25,200
cef47d78cadf5c278d7dc2202ff15be0a0546a26
normalize datetime and timestamp from csv file import.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/utils.py", "new_path": "timesketch/lib/utils.py", "diff": "@@ -59,11 +59,15 @@ def read_and_validate_csv(path, delimiter):\nraise RuntimeError(\nu'Missing fields in CSV header: {0:s}'.format(missing_fields))\nfor row in reader:\n- if u'timestamp' not in csv_header and u'datetime' in csv_header:\ntry:\n+ # normalize datetime to ISO 8601 format if it's not the case.\nparsed_datetime = parser.parse(row[u'datetime'])\n- row[u'timestamp'] = str(\n- int(time.mktime(parsed_datetime.timetuple())))\n+ row[u'datetime'] = parsed_datetime.isoformat()\n+\n+ normalized_timestamp = int(\n+ time.mktime(parsed_datetime.utctimetuple()) * 1000000)\n+ normalized_timestamp += parsed_datetime.microsecond\n+ row[u'timestamp'] = str(normalized_timestamp)\nexcept ValueError:\ncontinue\n" } ]
Python
Apache License 2.0
google/timesketch
normalize datetime and timestamp from csv file import. (#661)
263,093
03.10.2018 11:15:45
-7,200
f406bad63675f5bbb4adedbc7b94587929b895eb
Close db session
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/elastic.py", "new_path": "timesketch/lib/datastores/elastic.py", "diff": "@@ -29,7 +29,7 @@ from timesketch.lib.definitions import HTTP_STATUS_CODE_NOT_FOUND\n# Setup logging\nes_logger = logging.getLogger(u'elasticsearch')\nes_logger.addHandler(logging.NullHandler())\n-\n+es_logger.setLevel(logging.WARNING)\nADD_LABEL_SCRIPT = \"\"\"\nif( ! ctx._source.timesketch_label.contains (params.timesketch_label)) {\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/tasks.py", "new_path": "timesketch/lib/tasks.py", "diff": "@@ -32,6 +32,16 @@ celery = create_celery_app()\nflask_app = create_app()\n+class SqlAlchemyTask(celery.Task):\n+ \"\"\"An abstract task that runs on task completion.\"\"\"\n+ abstract = True\n+\n+ def after_return(self, *args, **kwargs):\n+ \"\"\"Close the database session on task completion.\"\"\"\n+ db_session.remove()\n+ super(SqlAlchemyTask, self).after_return(*args, **kwargs)\n+\n+\ndef _set_timeline_status(index_name, status, error_msg=None):\n\"\"\"Helper function to set status for searchindex and all related timelines.\n@@ -59,10 +69,9 @@ def _set_timeline_status(index_name, status, error_msg=None):\n# Commit changes to database\ndb_session.add(searchindex)\ndb_session.commit()\n- db_session.remove()\n-@celery.task(track_started=True)\n+@celery.task(track_started=True, base=SqlAlchemyTask)\ndef run_plaso(source_file_path, timeline_name, index_name, source_type,\nusername=None):\n\"\"\"Create a Celery task for processing Plaso storage file.\n@@ -103,7 +112,7 @@ def run_plaso(source_file_path, timeline_name, index_name, source_type,\nreturn cmd_output\n-@celery.task(track_started=True)\n+@celery.task(track_started=True, base=SqlAlchemyTask)\ndef run_csv_jsonl(source_file_path, timeline_name, index_name, source_type,\ndelimiter=None, username=None):\n\"\"\"Create a Celery task for processing a CSV or JSONL file.\n" }, { "change_type": "MODIFY", "old_path": "vagrant/test.csv", "new_path": "vagrant/test.csv", "diff": "-timestamp,message,timestamp_desc,datetime,timesketch_label,tag\n+timestamp,message,timestamp_desc,datetime,extra_field1,extra_field2\n1331698658276340,\"[7036 / 0x1b7c] Source Name: Service Control Manager Strings: ['Windows Modules Installer', 'stopped', '540072007500730074006500640049006E007300740061006C006C00650072002F0031000000'] Computer Name: WKS-WIN764BITB.shieldbase.local Record Number: 12050 Event Level: 4\",Content Modification Time,2012-03-14T04:17:38+00:00,,[]\n1331698663354562,\"[105 / 0x0069] Source Name: Microsoft-Windows-Eventlog Strings: ['System', 'C:\\Windows\\System32\\Winevt\\Logs\\Archive-System-2012-03-14-04-17-39-932.evtx'] Computer Name: WKS-WIN764BITB.shieldbase.local Record Number: 12049 Event Level: 4\",Content Modification Time,2012-03-14T04:17:43+00:00,,[]\n1331699591957337,\"[7036 / 0x1b7c] Source Name: Service Control Manager Strings: ['WinHTTP Web Proxy Auto-Discovery Service', 'stopped', '570069006E0048007400740070004100750074006F00500072006F00780079005300760063002F0031000000'] Computer Name: WKS-WIN764BITB.shieldbase.local Record Number: 12051 Event Level: 4\",Content Modification Time,2012-03-14T04:33:12+00:00,,[]\n" } ]
Python
Apache License 2.0
google/timesketch
Close db session (#667)
263,096
05.11.2018 12:04:14
-3,600
80a94251d9fa0c5f6cd2aca4eeecb58c494b6d2a
Add comment_event and label_event to the client I found it way easier to use comment_event and label_event than the current available version of label_events.
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -460,6 +460,45 @@ class Sketch(BaseResource):\nresponse = self.api.session.post(resource_url, json=form_data)\nreturn response.json()\n+ def comment_event(self, event_id, index, comment_text):\n+ \"\"\"\n+ Adds a comment to a single event.\n+\n+ :param event_id:\n+ :param index:\n+ :param comment_text:\n+ :return: a json data of the query.\n+ \"\"\"\n+ form_data = \\\n+ {\"annotation\": comment_text,\n+ \"annotation_type\": \"comment\",\n+ \"events\": {\"_id\": event_id, \"_index\": index,\n+ \"_type\": \"generic_event\"}}\n+ resource_url = u'{0:s}/sketches/{1:d}/event/annotate/'.format(\n+ self.api.api_root, self.id)\n+ response = self.api.session.post(resource_url, json=form_data)\n+ return response.json()\n+\n+ def label_event(self, event_id, index, label_text):\n+ \"\"\"\n+ Adds a comment to a single event.\n+\n+ :param event_id:\n+ :param index:\n+ :param label_text:\n+ :return: a json data of the query.\n+ \"\"\"\n+ form_data = \\\n+ {\"annotation\": label_text,\n+ \"annotation_type\": \"label\",\n+ \"events\": {\"_id\": event_id, \"_index\": index,\n+ \"_type\": \"generic_event\"}}\n+ resource_url = u'{0:s}/sketches/{1:d}/event/annotate/'.format(\n+ self.api.api_root, self.id)\n+ response = self.api.session.post(resource_url, json=form_data)\n+ return response.json()\n+\n+\ndef label_events(self, events, label_name):\n\"\"\"Labels one or more events with label_name.\n" } ]
Python
Apache License 2.0
google/timesketch
Add comment_event and label_event to the client I found it way easier to use comment_event and label_event than the current available version of label_events.
263,173
07.11.2018 01:19:02
28,800
5a1a42bafce80775f5eb7fdedd9a869923eecb8e
add _index to export
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/definitions.py", "new_path": "timesketch/lib/definitions.py", "diff": "@@ -30,6 +30,7 @@ DEFAULT_FIELDS = [\nu'datetime',\nu'timestamp',\nu'timestamp_desc',\n+ u'_index',\nu'message']\nDEFAULT_SOURCE_FIELDS = DEFAULT_FIELDS + [\nu'timesketch_label',\n" }, { "change_type": "MODIFY", "old_path": "timesketch/views/sketch.py", "new_path": "timesketch/views/sketch.py", "diff": "@@ -473,8 +473,11 @@ def export(sketch_id):\ncsv_writer = csv.DictWriter(csv_out, fieldnames=fieldnames)\ncsv_writer.writeheader()\nfor _event in result[u'hits'][u'hits']:\n- csv_writer.writerow(\n- dict((k, v.encode(u'utf-8') if isinstance(v, basestring) else v)\n- for k, v in _event[u'_source'].iteritems()))\n+ row = dict((k, v.encode(u'utf-8') if isinstance(v, basestring) else v)\n+ for k, v in _event[u'_source'].iteritems())\n+ row[u'_index'] = _event[u'_index']\n+ if isinstance(row[u'_index'], basestring):\n+ row[u'_index'] = row[u'_index'].encode(u'utf-8')\n+ csv_writer.writerow(row)\nreturn csv_out.getvalue()\n" } ]
Python
Apache License 2.0
google/timesketch
add _index to export (#699)
263,096
16.11.2018 15:57:06
-3,600
297064f3e32e3db62a14a9da1f30cdb5ccd8712b
The former wiki link no longer exists Thus redirecting the user to the docs
[ { "change_type": "MODIFY", "old_path": "timesketch/templates/sketch/timelines.html", "new_path": "timesketch/templates/sketch/timelines.html", "diff": "</p>\n<ts-core-upload sketch-id=\"{{ sketch.id }}\" visible=\"true\" btn-text=\"'Select file'\"></ts-core-upload>\n<br>\n- <p>If you are uploading a CSV or JSONL file make sure to read the <a href=\"https://github.com/google/timesketch/wiki/UserGuideTimelineFromFile\" rel=\"noreferrer\" target=\"_blank\">documentation</a> to learn what columns are mandatory.</p>\n+ <p>If you are uploading a CSV or JSONL file make sure to read the <a href=\"https://github.com/google/timesketch/blob/master/docs/Users-Guide.md#adding-timelines\" rel=\"noreferrer\" target=\"_blank\">documentation</a> to learn what columns are mandatory.</p>\n</div>\n{% endif %}\n" } ]
Python
Apache License 2.0
google/timesketch
The former wiki link no longer exists (#703) Thus redirecting the user to the docs
263,093
23.11.2018 15:57:59
-3,600
897ed1dd6d2b680049c0b1779457d7d88ad69767
Development environment with Docker
[ { "change_type": "ADD", "old_path": null, "new_path": "docker/Dockerfile-dev", "diff": "+# Use the official Docker Hub Ubuntu 14.04 base image\n+FROM ubuntu:16.04\n+\n+# Copy the entrypoint script into the container\n+COPY docker/timesketch-dev-entrypoint.sh /docker-entrypoint.sh\n+RUN chmod a+x /docker-entrypoint.sh\n+\n+# Load the entrypoint script to be run later\n+ENTRYPOINT [\"/docker-entrypoint.sh\"]\n+\n+# Invoke the entrypoint script\n+CMD [\"timesketch\"]\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docker/timesketch-dev-compose.yml", "diff": "+version: '3'\n+services:\n+ timesketch:\n+ build:\n+ context: ../\n+ dockerfile: ./docker/Dockerfile-dev\n+ ports:\n+ - \"127.0.0.1:5000:5000\"\n+ links:\n+ - elasticsearch\n+ - postgres\n+ - redis\n+ environment:\n+ - POSTGRES_USER=timesketch\n+ - POSTGRES_PASSWORD=password\n+ - POSTGRES_ADDRESS=postgres\n+ - POSTGRES_PORT=5432\n+ - ELASTIC_ADDRESS=elasticsearch\n+ - ELASTIC_PORT=9200\n+ - REDIS_ADDRESS=redis\n+ - REDIS_PORT=6379\n+ - NEO4J_ADDRESS=neo4j\n+ - NEO4J_PORT=7474\n+ - TIMESKETCH_USER=dev\n+ - TIMESKETCH_PASSWORD=dev\n+ restart: always\n+ volumes:\n+ - ../:/usr/local/src/timesketch/\n+\n+ elasticsearch:\n+ image: elasticsearch:6.4.2\n+ restart: always\n+\n+ postgres:\n+ image: postgres\n+ environment:\n+ - POSTGRES_USER=timesketch\n+ - POSTGRES_PASSWORD=password\n+ restart: always\n+\n+ redis:\n+ image: redis\n+\n+ neo4j:\n+ image: neo4j\n+ environment:\n+ - NEO4J_AUTH=none\n+ restart: always\n" }, { "change_type": "ADD", "old_path": null, "new_path": "docker/timesketch-dev-entrypoint.sh", "diff": "+#!/bin/bash\n+\n+# Run the container the default way\n+if [ \"$1\" = 'timesketch' ]; then\n+\n+ # Update the base image\n+ apt-get update && apt-get -y upgrade\n+\n+ # Setup install environment and Timesketch dependencies\n+ apt-get -y install apt-transport-https\\\n+ curl\\\n+ git\\\n+ libffi-dev\\\n+ lsb-release\\\n+ python-dev\\\n+ python-pip\\\n+ python-psycopg2\n+\n+ curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -\n+ VERSION=node_8.x\n+ DISTRO=\"$(lsb_release -s -c)\"\n+ echo \"deb https://deb.nodesource.com/$VERSION $DISTRO main\" > /etc/apt/sources.list.d/nodesource.list\n+ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -\n+ echo \"deb https://dl.yarnpkg.com/debian/ stable main\" > /etc/apt/sources.list.d/yarn.list\n+\n+ # Install Plaso and Yarn\n+ apt-get -y install software-properties-common\n+ add-apt-repository ppa:gift/stable && apt-get update\n+ apt-get update && apt-get -y install python-plaso plaso-tools nodejs yarn\n+\n+ # Install Timesketch from volume\n+ cd /usr/local/src/timesketch && yarn install && yarn run build\n+ pip install -e /usr/local/src/timesketch/\n+\n+ # Copy the Timesketch configuration file into /etc\n+ cp /usr/local/src/timesketch/timesketch.conf /etc\n+\n+ # Set SECRET_KEY in /etc/timesketch.conf if it isn't already set\n+ if grep -q \"SECRET_KEY = u'<KEY_GOES_HERE>'\" /etc/timesketch.conf; then\n+ OPENSSL_RAND=$( openssl rand -base64 32 )\n+ # Using the pound sign as a delimiter to avoid problems with / being output from openssl\n+ sed -i 's#SECRET_KEY = u\\x27\\x3CKEY_GOES_HERE\\x3E\\x27#SECRET_KEY = u\\x27'$OPENSSL_RAND'\\x27#' /etc/timesketch.conf\n+ fi\n+\n+ # Set up the Postgres connection\n+ if [ $POSTGRES_USER ] && [ $POSTGRES_PASSWORD ] && [ $POSTGRES_ADDRESS ] && [ $POSTGRES_PORT ]; then\n+ sed -i 's#postgresql://<USERNAME>:<PASSWORD>@localhost#postgresql://'$POSTGRES_USER':'$POSTGRES_PASSWORD'@'$POSTGRES_ADDRESS':'$POSTGRES_PORT'#' /etc/timesketch.conf\n+ else\n+ # Log an error since we need the above-listed environment variables\n+ echo \"Please pass values for the POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_ADDRESS, and POSTGRES_PORT environment variables\"\n+ exit 1\n+ fi\n+\n+ # Set up the Elastic connection\n+ if [ $ELASTIC_ADDRESS ] && [ $ELASTIC_PORT ]; then\n+ sed -i 's#ELASTIC_HOST = u\\x27127.0.0.1\\x27#ELASTIC_HOST = u\\x27'$ELASTIC_ADDRESS'\\x27#' /etc/timesketch.conf\n+ sed -i 's#ELASTIC_PORT = 9200#ELASTIC_PORT = '$ELASTIC_PORT'#' /etc/timesketch.conf\n+ else\n+ # Log an error since we need the above-listed environment variables\n+ echo \"Please pass values for the ELASTIC_ADDRESS and ELASTIC_PORT environment variables\"\n+ fi\n+\n+ # Set up the Redis connection\n+ if [ $REDIS_ADDRESS ] && [ $REDIS_PORT ]; then\n+ sed -i 's#UPLOAD_ENABLED = False#UPLOAD_ENABLED = True#' /etc/timesketch.conf\n+ sed -i 's#^CELERY_BROKER_URL =.*#CELERY_BROKER_URL = \\x27redis://'$REDIS_ADDRESS':'$REDIS_PORT'\\x27#' /etc/timesketch.conf\n+ sed -i 's#^CELERY_RESULT_BACKEND =.*#CELERY_RESULT_BACKEND = \\x27redis://'$REDIS_ADDRESS':'$REDIS_PORT'\\x27#' /etc/timesketch.conf\n+ else\n+ # Log an error since we need the above-listed environment variables\n+ echo \"Please pass values for the REDIS_ADDRESS and REDIS_PORT environment variables\"\n+ fi\n+\n+ # Set up the Neo4j connection\n+ if [ $NEO4J_ADDRESS ] && [ $NEO4J_PORT ]; then\n+ sed -i 's#GRAPH_BACKEND_ENABLED = False#GRAPH_BACKEND_ENABLED = True#' /etc/timesketch.conf\n+ sed -i 's#NEO4J_HOST =.*#NEO4J_HOST = u\\x27'$NEO4J_ADDRESS'\\x27#' /etc/timesketch.conf\n+ sed -i 's#NEO4J_PORT =.*#NEO4J_PORT = '$NEO4J_PORT'#' /etc/timesketch.conf\n+ else\n+ # Log an error since we need the above-listed environment variables\n+ echo \"Please pass values for the NEO4J_ADDRESS and NEO4J_PORT environment variables if you want graph support\"\n+ fi\n+\n+ # Add web user\n+ tsctl add_user -u \"${TIMESKETCH_USER}\" -p \"${TIMESKETCH_USER}\"\n+\n+ # Sleep forever to keep the container running\n+ sleep infinity\n+fi\n+\n+# Run a custom command on container start\n+exec \"$@\"\n" } ]
Python
Apache License 2.0
google/timesketch
Development environment with Docker (#718)
263,093
28.11.2018 11:43:38
-3,600
8594e6ab4733abc8ed2aa4cb4200ff0502735535
Enable debug and analyzers
[ { "change_type": "MODIFY", "old_path": "docker/timesketch-dev-entrypoint.sh", "new_path": "docker/timesketch-dev-entrypoint.sh", "diff": "@@ -80,9 +80,19 @@ if [ \"$1\" = 'timesketch' ]; then\necho \"Please pass values for the NEO4J_ADDRESS and NEO4J_PORT environment variables if you want graph support\"\nfi\n+ # Enable debug for the development server\n+ sed -i s/\"DEBUG = False\"/\"DEBUG = True\"/ /etc/timesketch.conf\n+\n+ # Enable index and sketch analyzers\n+ sed -i s/\"ENABLE_INDEX_ANALYZERS = False\"/\"ENABLE_INDEX_ANALYZERS = True\"/ /etc/timesketch.conf\n+ sed -i s/\"ENABLE_SKETCH_ANALYZERS = False\"/\"ENABLE_SKETCH_ANALYZERS = True\"/ /etc/timesketch.conf\n+ sed -i s/\"ENABLE_EXPERIMENTAL_UI = False\"/\"ENABLE_EXPERIMENTAL_UI = True\"/ /etc/timesketch.conf\n+\n# Add web user\ntsctl add_user -u \"${TIMESKETCH_USER}\" -p \"${TIMESKETCH_USER}\"\n+ echo \"Timesketch development server is ready!\"\n+\n# Sleep forever to keep the container running\nsleep infinity\nfi\n" } ]
Python
Apache License 2.0
google/timesketch
Enable debug and analyzers (#722)
263,173
04.12.2018 13:29:08
28,800
240cc0dc49aa39f8b0d347ba24f1e181439459a4
set max events size to export
[ { "change_type": "MODIFY", "old_path": "timesketch/views/sketch.py", "new_path": "timesketch/views/sketch.py", "diff": "@@ -451,6 +451,7 @@ def export(sketch_id):\n# Export more than the 500 first results.\nmax_events_to_fetch = 10000\nquery_filter[u'limit'] = max_events_to_fetch\n+ query_filter[u'size'] = max_events_to_fetch\ndatastore = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\n" } ]
Python
Apache License 2.0
google/timesketch
set max events size to export (#723)
263,096
05.12.2018 10:08:10
-3,600
5ef9ae355c2bd742315ea154178f76082b6bde3b
Add Event_to_sketch in api * First shot on Not yet ready to merge * Update client.py * makes sense
[ { "change_type": "MODIFY", "old_path": "api_client/python/timesketch_api_client/client.py", "new_path": "api_client/python/timesketch_api_client/client.py", "diff": "@@ -512,6 +512,27 @@ class Sketch(BaseResource):\n}\nreturn self.explore(query_dsl=json.dumps({'query': query}))\n+ def add_event(self, message, timestamp, timestamp_desc):\n+ \"\"\"Adds an event to the sketch specific timeline.\n+\n+ Args:\n+ message: Array of JSON objects representing events.\n+ timestamp: Micro seconds since 1970-01-01 00:00:00.\n+ timestamp_desc : Description of the timestamp.\n+\n+ Returns:\n+ Dictionary with query results.\n+ \"\"\"\n+ form_data = {\n+ 'timestamp': timestamp,\n+ 'timestamp_desc': timestamp_desc,\n+ 'message': message\n+ }\n+\n+ resource_url = u'{0:s}/sketches/{1:d}/event/create/'.format(\n+ self.api.api_root, self.id)\n+ response = self.api.session.post(resource_url, json=form_data)\n+ return response.json()\nclass SearchIndex(BaseResource):\n\"\"\"Timesketch searchindex object.\n" } ]
Python
Apache License 2.0
google/timesketch
Add Event_to_sketch in api (#692) * First shot on https://github.com/google/timesketch/issues/691 Not yet ready to merge * Update client.py * makes sense Co-Authored-By: deralexxx <deralexxx@users.noreply.github.com>
263,093
07.12.2018 17:57:02
-3,600
5c963ad700456368a8dadfbefd65f829cf7e4374
Move emojis to the left
[ { "change_type": "MODIFY", "old_path": "timesketch/ui/explore/event.html", "new_path": "timesketch/ui/explore/event.html", "diff": "<span style=\"margin-right:2px;\" ng-if=\"::event._source.label\" ng-repeat=\"label in ::event._source.label\">\n<span ng-if=\"::label.indexOf('__') != 0\" class=\"label label-default\">{{::label}}</span>\n</span>\n- <span ng-class=\"{true: 'message-hidden'}[event.hidden]\">[{{ event._source.timestamp_desc }}] <span ng-bind-html=\"event._source.__ts_emojis | unsafe\"></span><span title=\"{{ (event._source.human_readable) || (event._source.message) }}\">{{ (event._source.human_readable|limitTo:1000) || (event._source.message|limitTo:1000) }}</span></span>\n+ <span ng-class=\"{true: 'message-hidden'}[event.hidden]\"><span ng-bind-html=\"event._source.__ts_emojis | unsafe\"> [{{ event._source.timestamp_desc }}] </span><span title=\"{{ (event._source.human_readable) || (event._source.message) }}\">{{ (event._source.human_readable|limitTo:1000) || (event._source.message|limitTo:1000) }}</span></span>\n</td>\n<td width=\"25px\" class=\"event-message\" ng-class=\"{'event-message-selected': event.selected, 'event-message-starred': event.star, 'event-message-details': showDetails}\">\n" } ]
Python
Apache License 2.0
google/timesketch
Move emojis to the left (#730)
263,093
10.12.2018 15:04:34
-3,600
6960eddad625a6732d843a11320a10e08dcb0a86
Don't remove session when engine is created
[ { "change_type": "MODIFY", "old_path": "timesketch/models/__init__.py", "new_path": "timesketch/models/__init__.py", "diff": "@@ -42,7 +42,6 @@ def configure_engine(url):\n# TODO: Can we wrap this in a class?\nglobal engine, session_maker, db_session\nengine = create_engine(url)\n- db_session.remove()\n# Set the query class to our own AclBaseQuery\nsession_maker.configure(\nautocommit=False, autoflush=False, bind=engine, query_cls=AclBaseQuery)\n" } ]
Python
Apache License 2.0
google/timesketch
Don't remove session when engine is created (#731)
263,093
13.12.2018 18:45:03
-3,600
b35f814a5f90d5142ee86d1878e5fe11320350f1
Add method for adding human readable message to events
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/interface.py", "new_path": "timesketch/lib/analyzers/interface.py", "diff": "@@ -152,6 +152,15 @@ class Event(object):\ndb_session.commit()\nself.add_label(label='__ts_comment')\n+ def set_human_readable(self, human_readable):\n+ \"\"\"Set a human readable string to event.\n+\n+ Args:\n+ human_readable: human readable string.\n+ \"\"\"\n+ human_readable_attribute = {'human_readable': human_readable}\n+ self.add_attributes(human_readable_attribute)\n+\nclass Sketch(object):\n\"\"\"Sketch object with helper methods.\n" } ]
Python
Apache License 2.0
google/timesketch
Add method for adding human readable message to events (#732)
263,093
17.12.2018 12:59:16
-3,600
1ca337c3a02acbff1d7297de619e9a6360a990fd
Add definition file for emojis and adjust analyzers
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/browser_search.py", "new_path": "timesketch/lib/analyzers/browser_search.py", "diff": "@@ -13,9 +13,9 @@ else:\nfrom urllib import parse as urlparse # pylint: disable=no-name-in-module\nBYTES_TYPE = bytes\n-\nfrom timesketch.lib.analyzers import interface\nfrom timesketch.lib.analyzers import manager\n+from timesketch.lib import emojis\nclass BrowserSearchSketchPlugin(interface.BaseSketchAnalyzer):\n@@ -175,8 +175,6 @@ class BrowserSearchSketchPlugin(interface.BaseSketchAnalyzer):\nevents = self.event_stream(\nquery_string=query, return_fields=return_fields)\n- search_emoji = '&#x1F50E'\n-\nfor event in events:\nurl = event.source.get('url')\nmessage = event.source.get('message')\n@@ -205,7 +203,7 @@ class BrowserSearchSketchPlugin(interface.BaseSketchAnalyzer):\nevent.set_human_readable('{0:s} search: {1:s} - {2:s}'.format(\nengine, search_query, message))\n- event.add_emojis([search_emoji])\n+ event.add_emojis([emojis.MAGNIFYING_GLASS])\nevent.add_tags(['browser_search'])\n# We break at the first hit of a successful search engine.\nbreak\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/emojis.py", "diff": "+# Copyright 2018 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Emoji codepoint definitions.\n+\n+See https://emojipedia.org for list of available unicode emojis.\n+\"\"\"\n+\n+from __future__ import unicode_literals\n+\n+\n+MAGNIFYING_GLASS = '&#x1F50E'\n+LOCOMOTIVE = '&#x1F682'\n+WASTEBASKET = '&#x1F5D1'\n+CAMERA = '&#x1F4F7'\n+GLOBE = '&#x1F30D'\n" } ]
Python
Apache License 2.0
google/timesketch
Add definition file for emojis and adjust analyzers (#742)
263,133
17.12.2018 13:10:41
0
8f5044016ae344410b32ba091765b1894546a240
Added more logic to set_human_readable.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/interface.py", "new_path": "timesketch/lib/analyzers/interface.py", "diff": "@@ -152,13 +152,36 @@ class Event(object):\ndb_session.commit()\nself.add_label(label='__ts_comment')\n- def set_human_readable(self, human_readable):\n+ def set_human_readable(self, human_readable, append=True, overwrite=False):\n\"\"\"Set a human readable string to event.\nArgs:\nhuman_readable: human readable string.\n+ append: boolean defining whether the data should be appended\n+ or prepended to the human readable string, if it has already\n+ been defined. Defaults to True, and does nothing if\n+ human_readable is not defined.\n+ overwrite: a boolean that if set to True will ignore previously\n+ defined human_readable fields and overwrite it. Defaults\n+ to False.\n\"\"\"\n- human_readable_attribute = {'human_readable': human_readable}\n+ # TODO: Check if \"message\" field already exists in human readable and\n+ # make sure it is not repeated.\n+ existing_human_readable = self.source.get('human_readable')\n+\n+ if overwrite:\n+ human_readable_string = human_readable\n+ elif existing_human_readable:\n+ if append:\n+ human_readable_string = '{0:s} - {1:s}'.format(\n+ existing_human_readable, human_readable)\n+ else:\n+ human_readable_string = '{0:s} - {1:s}'.format(\n+ human_readable, existing_human_readable)\n+ else:\n+ human_readable_string = human_readable\n+\n+ human_readable_attribute = {'human_readable': human_readable_string}\nself.add_attributes(human_readable_attribute)\n" } ]
Python
Apache License 2.0
google/timesketch
Added more logic to set_human_readable. (#744)
263,105
26.12.2018 03:37:42
28,800
0713e24e0c76e715db3c9c71afa4ca57755174a3
Update Installation.md Missing sudo for "apt-key add -" and "tee -a /etc/apt/sources.list.d/elastic-6.x.list"
[ { "change_type": "MODIFY", "old_path": "docs/Installation.md", "new_path": "docs/Installation.md", "diff": "@@ -18,8 +18,8 @@ Install Java\nInstall the latest Elasticsearch 6.x release:\n- $ sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -\n- $ sudo echo \"deb https://artifacts.elastic.co/packages/6.x/apt stable main\" | tee -a /etc/apt/sources.list.d/elastic-6.x.list\n+ $ sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -\n+ $ sudo echo \"deb https://artifacts.elastic.co/packages/6.x/apt stable main\" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list\n$ sudo apt-get update\n$ sudo apt-get install elasticsearch\n" } ]
Python
Apache License 2.0
google/timesketch
Update Installation.md (#759) Missing sudo for "apt-key add -" and "tee -a /etc/apt/sources.list.d/elastic-6.x.list"
263,093
26.12.2018 12:38:22
-3,600
3b475e13677198a12baa7f02938fde26f16f92f1
Only create view if there are any hits
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/browser_search.py", "new_path": "timesketch/lib/analyzers/browser_search.py", "diff": "@@ -209,6 +209,7 @@ class BrowserSearchSketchPlugin(interface.BaseSketchAnalyzer):\n# We break at the first hit of a successful search engine.\nbreak\n+ if simple_counter > 0:\nself.sketch.add_view(\n'Browser Search', query_string='tag:\"browser_search\"')\n" } ]
Python
Apache License 2.0
google/timesketch
Only create view if there are any hits (#756)
263,093
26.12.2018 12:38:54
-3,600
337ad7f3be04faf3980ca75781eb709b99d63cd2
Upgrade urllib3 due to security fix
[ { "change_type": "MODIFY", "old_path": "requirements.in", "new_path": "requirements.in", "diff": "@@ -22,6 +22,7 @@ PyJWT\nrequests>=2.20.0\ncryptography>=2.3\nPyYAML\n+urllib3>=1.23\n# dev-requirements:\nFlask-Testing\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "@@ -65,7 +65,7 @@ requests==2.20.1\nsingledispatch==3.4.0.3 # via astroid, pylint\nsix==1.10.0 # via astroid, bcrypt, cryptography, flask-restful, mock, pylint, python-dateutil, singledispatch\nsqlalchemy==1.1.13\n-urllib3==1.22 # via elasticsearch, requests\n+urllib3==1.24.1\nvine==1.1.4 # via amqp\nwerkzeug==0.14.1 # via flask\nwrapt==1.10.11 # via astroid\n" } ]
Python
Apache License 2.0
google/timesketch
Upgrade urllib3 due to security fix (#752)
263,093
03.01.2019 11:55:04
-3,600
03e6c51db2683de909664def5049dd0560b43b8c
Only create one view
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/browser_search.py", "new_path": "timesketch/lib/analyzers/browser_search.py", "diff": "@@ -212,7 +212,8 @@ class BrowserSearchSketchPlugin(interface.BaseSketchAnalyzer):\nif simple_counter > 0:\nself.sketch.add_view(\n- 'Browser Search', query_string='tag:\"browser_search\"')\n+ view_name='Browser Search', analyzer_name=self.NAME,\n+ query_string='tag:\"browser_search\"')\nreturn (\n'Browser Search completed with {0:d} search results '\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/interface.py", "new_path": "timesketch/lib/analyzers/interface.py", "diff": "@@ -198,12 +198,13 @@ class Sketch(object):\nif not self.sql_sketch:\nraise RuntimeError('No such sketch')\n- def add_view(self, name, query_string=None, query_dsl=None,\n- query_filter=None):\n+ def add_view(self, view_name, analyzer_name, query_string=None,\n+ query_dsl=None, query_filter=None):\n\"\"\"Add saved view to the Sketch.\nArgs:\n- name: The name of the view.\n+ view_name: The name of the view.\n+ analyzer_name: The name of the analyzer.\nquery_string: Elasticsearch query string.\nquery_dsl: Dictionary with Elasticsearch DSL query.\nquery_filter: Dictionary with Elasticsearch filters.\n@@ -219,11 +220,13 @@ class Sketch(object):\nif not query_filter:\nquery_filter = {'indices': '_all'}\n- view = View(name=name, sketch=self.sql_sketch, user=None,\n- query_string=query_string, query_filter=query_filter,\n- query_dsl=query_dsl, searchtemplate=None)\n-\n+ name = '[{0:s}] {1:s}'.format(analyzer_name, view_name)\n+ view = View.get_or_create(name=name, sketch=self.sql_sketch, user=None)\n+ view.query_string = query_string\nview.query_filter = view.validate_filter(query_filter)\n+ view.query_dsl = query_dsl\n+ view.searchtemplate = None\n+\ndb_session.add(view)\ndb_session.commit()\nreturn view\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/interface_test.py", "new_path": "timesketch/lib/analyzers/interface_test.py", "diff": "@@ -56,7 +56,8 @@ class TestAnalysisSketch(BaseTest):\ndef test_add_view(self):\n\"\"\"Test adding a view to a sketch.\"\"\"\nsketch = interface.Sketch(sketch_id=self.SKETCH_ID)\n- view = sketch.add_view('MockView', query_string='test')\n+ view = sketch.add_view(\n+ view_name='MockView', analyzer_name=\"Test\", query_string='test')\nself.assertIsInstance(view, View)\ndef test_get_all_instances(self):\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/phishy_domains.py", "new_path": "timesketch/lib/analyzers/phishy_domains.py", "diff": "@@ -270,7 +270,8 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nif similar_domain_counter:\nself.sketch.add_view(\n- 'Phishy Domains', query_string='tag:\"phishy_domain\"')\n+ view_name='Phishy Domains', analyzer_name=self.NAME,\n+ query_string='tag:\"phishy_domain\"')\nreturn (\n'Domain extraction ({0:d} domains discovered with {1:d} TLDs) '\n" } ]
Python
Apache License 2.0
google/timesketch
Only create one view (#765)
263,093
04.01.2019 14:03:44
-3,600
405d158b61f083ca994603b53da6477ec0541edd
Simple domain analyzer * Move some domain analysis to it's own analyzer * Remove unused var * Don't run celery task when testing Refactor phishy domains and break out common functions. * Remove unecessary return fields * Alpha order for emojis
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/__init__.py", "new_path": "timesketch/lib/analyzers/__init__.py", "diff": "# Register all analyzers here by importing them.\nfrom timesketch.lib.analyzers import browser_search\n+from timesketch.lib.analyzers import domain\nfrom timesketch.lib.analyzers import phishy_domains\nfrom timesketch.lib.analyzers import similarity_scorer\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/analyzers/domain.py", "diff": "+\"\"\"Sketch analyzer plugin for domain.\"\"\"\n+from __future__ import unicode_literals\n+\n+import collections\n+\n+from timesketch.lib import emojis\n+from timesketch.lib.analyzers import interface\n+from timesketch.lib.analyzers import manager\n+from timesketch.lib.analyzers import utils\n+\n+\n+class DomainSketchPlugin(interface.BaseSketchAnalyzer):\n+ \"\"\"Sketch analyzer for Domain.\"\"\"\n+\n+ NAME = 'domain'\n+\n+ DEPENDENCIES = frozenset()\n+\n+ def __init__(self, index_name, sketch_id):\n+ \"\"\"Initialize The Sketch Analyzer.\n+\n+ Args:\n+ index_name: Elasticsearch index name\n+ sketch_id: Sketch ID\n+ \"\"\"\n+ self.index_name = index_name\n+ super(DomainSketchPlugin, self).__init__(index_name, sketch_id)\n+\n+ def run(self):\n+ \"\"\"Entry point for the analyzer.\n+\n+ Returns:\n+ String with summary of the analyzer result\n+ \"\"\"\n+ query = (\n+ '{\"query\": { \"bool\": { \"should\": [ '\n+ '{ \"exists\" : { \"field\" : \"url\" }}, '\n+ '{ \"exists\" : { \"field\" : \"domain\" }} ] } } }')\n+\n+ return_fields = ['domain', 'url']\n+\n+ events = self.event_stream(\n+ '', query_dsl=query, return_fields=return_fields)\n+\n+ domains = {}\n+ domain_counter = collections.Counter()\n+ tld_counter = collections.Counter()\n+\n+ for event in events:\n+ domain = event.source.get('domain')\n+\n+ if not domain:\n+ url = event.source.get('url')\n+ if not url:\n+ continue\n+ domain = utils.get_domain_from_url(url)\n+ event.add_attributes({'domain': domain})\n+\n+ if not domain:\n+ continue\n+\n+ domain_counter[domain] += 1\n+ domains.setdefault(domain, [])\n+ domains[domain].append(event)\n+\n+ tld = '.'.join(domain.split('.')[-2:])\n+ tld_counter[tld] += 1\n+\n+ satellite_emoji = emojis.get_emoji('SATELLITE')\n+ for domain, count in domain_counter.iteritems():\n+ emojis_to_add = [satellite_emoji]\n+ text = '{0:s} seen {1:d} times'.format(domain, count)\n+\n+ for event in domains.get(domain, []):\n+ event.add_emojis(emojis_to_add)\n+ event.add_human_readable(text, self.NAME, append=False)\n+ event.add_attributes({'domain_count': count})\n+\n+ return (\n+ '{0:d} domains discovered with {1:d} TLDs.').format(\n+ len(domains), len(tld_counter))\n+\n+\n+manager.AnalysisManager.register_analyzer(DomainSketchPlugin)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/analyzers/domain_test.py", "diff": "+\"\"\"Tests for DomainPlugin.\"\"\"\n+from __future__ import unicode_literals\n+\n+import mock\n+\n+from timesketch.lib.analyzers import domain\n+from timesketch.lib.testlib import BaseTest\n+from timesketch.lib.testlib import MockDataStore\n+\n+\n+class TestDomainPlugin(BaseTest):\n+ \"\"\"Tests the functionality of the analyzer.\"\"\"\n+\n+ def __init__(self, *args, **kwargs):\n+ super(TestDomainPlugin, self).__init__(*args, **kwargs)\n+\n+ # Mock the Elasticsearch datastore.\n+ @mock.patch(\n+ u'timesketch.lib.analyzers.interface.ElasticsearchDataStore',\n+ MockDataStore)\n+ def test_domain_analyzer_class(self):\n+ \"\"\"Test core functionality of the analyzer class.\"\"\"\n+ index_name = 'test'\n+ sketch_id = 1\n+ analyzer = domain.DomainSketchPlugin(index_name, sketch_id)\n+ self.assertEquals(analyzer.index_name, index_name)\n+ self.assertEquals(analyzer.sketch.id, sketch_id)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/phishy_domains.py", "new_path": "timesketch/lib/analyzers/phishy_domains.py", "diff": "@@ -5,24 +5,21 @@ import collections\nimport difflib\nfrom flask import current_app\n-\n-try:\n- from urlparse import urlparse\n-except ImportError:\n- from urllib import parse as urlparse # pylint: disable=no-name-in-module\n-\nfrom datasketch.minhash import MinHash\nfrom timesketch.lib import emojis\nfrom timesketch.lib import similarity\nfrom timesketch.lib.analyzers import interface\nfrom timesketch.lib.analyzers import manager\n+from timesketch.lib.analyzers import utils\n-class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\n- \"\"\"Sketch analyzer for domains.\"\"\"\n+class PhishyDomainsSketchPlugin(interface.BaseSketchAnalyzer):\n+ \"\"\"Sketch analyzer for phishy domains.\"\"\"\n- NAME = 'domains'\n+ NAME = 'phishy_domains'\n+\n+ DEPENDENCIES = frozenset(['domain'])\n# This list contains entries from Alexa top 10 list (as of 2018-12-27).\n# They are used to create the base of a domain watch list. For custom\n@@ -40,14 +37,15 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nsketch_id: Sketch ID\n\"\"\"\nself.index_name = index_name\n- super(DomainsSketchPlugin, self).__init__(index_name, sketch_id)\n+ super(PhishyDomainsSketchPlugin, self).__init__(index_name, sketch_id)\nself.domain_scoring_threshold = current_app.config.get(\n'DOMAIN_ANALYZER_WATCHED_DOMAINS_SCORE_THRESHOLD', 0.75)\nself.domain_scoring_whitelist = current_app.config.get(\n'DOMAIN_ANALYZER_WHITELISTED_DOMAINS', [])\n- def _get_minhash_from_domain(self, domain):\n+ @staticmethod\n+ def _get_minhash_from_domain(domain):\n\"\"\"Get the Minhash value from a domain name.\nThis function takes a domain, removes the TLD extension\n@@ -98,10 +96,10 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nthe similar domains as well as the Jaccard distance between\nthe supplied domain and the matching one.\n\"\"\"\n- domain = self._strip_www(domain)\n+ domain = utils.strip_www_from_domain(domain)\nsimilar = []\n- if not '.' in domain:\n+ if '.' not in domain:\nreturn similar\nif domain in domain_dict:\n@@ -144,24 +142,6 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nreturn similar\n- def _get_tld(self, domain):\n- \"\"\"Get the top level domain from a domain string.\n-\n- Args:\n- domain: string with a full domain, eg. www.google.com\n-\n- Returns:\n- string: TLD or a top level domain extracted from the domain,\n- eg: google.com\n- \"\"\"\n- return '.'.join(domain.split('.')[-2:])\n-\n- def _strip_www(self, domain):\n- \"\"\"Strip www. from beginning of domain names.\"\"\"\n- if domain.startswith('www.'):\n- return domain[4:]\n- return domain\n-\ndef run(self):\n\"\"\"Entry point for the analyzer.\n@@ -185,15 +165,6 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nfor event in events:\ndomain = event.source.get('domain')\n- if not domain:\n- url = event.source.get('url')\n- if not url:\n- continue\n- domain_parsed = urlparse(url)\n- domain_full = domain_parsed.netloc\n- domain, _, _ = domain_full.partition(':')\n- event.add_attributes({'domain': domain})\n-\nif not domain:\ncontinue\n@@ -201,7 +172,7 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\ndomains.setdefault(domain, [])\ndomains[domain].append(event)\n- tld = self._get_tld(domain)\n+ tld = utils.get_tld_from_domain(domain)\ntld_counter[tld] += 1\nwatched_domains_list = current_app.config.get(\n@@ -209,8 +180,8 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\ndomain_threshold = current_app.config.get(\n'DOMAIN_ANALYZER_WATCHED_DOMAINS_THRESHOLD', 10)\nwatched_domains_list.extend([\n- self._strip_www(x) for x, _ in domain_counter.most_common(\n- domain_threshold)])\n+ utils.strip_www_from_domain(x)\n+ for x, _ in domain_counter.most_common(domain_threshold)])\nwatched_domains_list.extend([\nx for x, _ in tld_counter.most_common(domain_threshold)])\nwatched_domains_list.extend(self.WATCHED_DOMAINS_BASE_LIST)\n@@ -222,7 +193,7 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nif any(domain.endswith(x) for x in self.domain_scoring_whitelist):\ncontinue\n- if not '.' in domain:\n+ if '.' not in domain:\ncontinue\nwatched_domains_list.append(domain)\n@@ -232,18 +203,12 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nwatched_domains[domain] = minhash\nsimilar_domain_counter = 0\n- satellite_emoji = emojis.get_emoji('SATELLITE')\nevil_emoji = emojis.get_emoji('SKULL_CROSSBONE')\n- for domain, count in domain_counter.iteritems():\n- emojis_to_add = [satellite_emoji]\n+ phishing_emoji = emojis.get_emoji('FISHING_POLE')\n+ for domain, _ in domain_counter.iteritems():\n+ emojis_to_add = []\ntags_to_add = []\n-\n- if count == 1:\n- text = 'Domain [{0:s}]: only occurance of domain'.format(\n- domain)\n- else:\n- text = 'Domain [{0:s}] seen: {1:d} times'.format(\n- domain, count)\n+ text = None\nsimilar_domains = self._get_similar_domains(\ndomain, watched_domains)\n@@ -251,32 +216,31 @@ class DomainsSketchPlugin(interface.BaseSketchAnalyzer):\nif similar_domains:\nsimilar_domain_counter += 1\nemojis_to_add.append(evil_emoji)\n- tags_to_add.append('phishy_domain')\n- similar_text_list = ['{0:s} [{1:.2f}]'.format(\n+ emojis_to_add.append(phishing_emoji)\n+ tags_to_add.append('phishy-domain')\n+ similar_text_list = ['{0:s} [score: {1:.2f}]'.format(\nphishy_domain,\nscore) for phishy_domain, score in similar_domains]\n- added_text = 'domain {0:s} similar to: {1:s}'.format(\n+ text = 'Domain {0:s} is similar to {1:s}'.format(\ndomain, ', '.join(similar_text_list))\n- text = '{0:s} - {1:s}'.format(added_text, text)\nif any(domain.endswith(\nx) for x in self.domain_scoring_whitelist):\n- tags_to_add.append('known_network')\n+ tags_to_add.append('known-network')\nfor event in domains.get(domain, []):\nevent.add_emojis(emojis_to_add)\nevent.add_tags(tags_to_add)\n+ if text:\nevent.add_human_readable(text, self.NAME, append=False)\n- event.add_attributes({'domain_count': count})\nif similar_domain_counter:\nself.sketch.add_view(\nview_name='Phishy Domains', analyzer_name=self.NAME,\n- query_string='tag:\"phishy_domain\"')\n+ query_string='tag:\"phishy-domain\"')\nreturn (\n- 'Domain extraction ({0:d} domains discovered with {1:d} TLDs) '\n- 'and {2:d} potentially evil domains discovered.').format(\n- len(domains), len(tld_counter), similar_domain_counter)\n+ '{0:d} potentially phishy domains discovered.').format(\n+ similar_domain_counter)\n-manager.AnalysisManager.register_analyzer(DomainsSketchPlugin)\n+manager.AnalysisManager.register_analyzer(PhishyDomainsSketchPlugin)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/analyzers/phishy_domains_test.py", "new_path": "timesketch/lib/analyzers/phishy_domains_test.py", "diff": "@@ -35,7 +35,7 @@ class TestDomainsPlugin(BaseTest):\nMockDataStore)\ndef test_minhash(self):\n\"\"\"Test minhash function.\"\"\"\n- analyzer = phishy_domains.DomainsSketchPlugin('test_index', 1)\n+ analyzer = phishy_domains.PhishyDomainsSketchPlugin('test_index', 1)\ndomain = 'www.mbl.is'\n# pylint: disable=protected-access\nminhash = analyzer._get_minhash_from_domain(domain)\n@@ -54,7 +54,7 @@ class TestDomainsPlugin(BaseTest):\nMockDataStore)\ndef test_get_similar_domains(self):\n\"\"\"Test get_similar_domains function.\"\"\"\n- analyzer = phishy_domains.DomainsSketchPlugin('test_index', 1)\n+ analyzer = phishy_domains.PhishyDomainsSketchPlugin('test_index', 1)\ndomain = 'login.stortmbl.is'\n# pylint: disable=protected-access\nminhash = analyzer._get_minhash_from_domain(domain)\n@@ -68,43 +68,3 @@ class TestDomainsPlugin(BaseTest):\n# pylint: disable=protected-access\nsimilar = analyzer._get_similar_domains('www.google.com', domain_dict)\nself.assertEquals(len(similar), 0)\n-\n- # Mock the Elasticsearch datastore.\n- @mock.patch(\n- u'timesketch.lib.analyzers.interface.ElasticsearchDataStore',\n- MockDataStore)\n- def test_get_tld(self):\n- \"\"\"Test get_tld function.\"\"\"\n- analyzer = phishy_domains.DomainsSketchPlugin('test_index', 1)\n- domain = 'this.is.a.subdomain.evil.com'\n- # pylint: disable=protected-access\n- tld = analyzer._get_tld(domain)\n- self.assertEquals(tld, 'evil.com')\n-\n- domain = 'a'\n- # pylint: disable=protected-access\n- tld = analyzer._get_tld(domain)\n- self.assertEquals(tld, 'a')\n-\n- domain = 'foo.com'\n- # pylint: disable=protected-access\n- tld = analyzer._get_tld(domain)\n- self.assertEquals(tld, 'foo.com')\n-\n-\n- # Mock the Elasticsearch datastore.\n- @mock.patch(\n- u'timesketch.lib.analyzers.interface.ElasticsearchDataStore',\n- MockDataStore)\n- def test_strip_www(self):\n- \"\"\"Test strip_www function.\"\"\"\n- analyzer = phishy_domains.DomainsSketchPlugin('test_index', 1)\n- domain = 'www.mbl.is'\n- # pylint: disable=protected-access\n- stripped = analyzer._strip_www(domain)\n- self.assertEquals(stripped, 'mbl.is')\n-\n- domain = 'mbl.is'\n- # pylint: disable=protected-access\n- stripped = analyzer._strip_www(domain)\n- self.assertEquals(stripped, domain)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/analyzers/utils.py", "diff": "+# Copyright 2019 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"This file contains utilities for analyzers.\"\"\"\n+\n+from __future__ import unicode_literals\n+\n+try:\n+ from urlparse import urlparse\n+except ImportError:\n+ from urllib import parse as urlparse # pylint: disable=no-name-in-module\n+\n+\n+def get_domain_from_url(url):\n+ \"\"\"Extract domain from URL.\n+\n+ Args:\n+ url: URL to parse.\n+\n+ Returns:\n+ String with domain from URL.\n+ \"\"\"\n+ # TODO: See if we can optimize this because it is rather slow.\n+ domain_parsed = urlparse(url)\n+ domain_full = domain_parsed.netloc\n+ domain, _, _ = domain_full.partition(':')\n+ return domain\n+\n+\n+def get_tld_from_domain(domain):\n+ \"\"\"Get the top level domain from a domain string.\n+\n+ Args:\n+ domain: string with a full domain, eg. www.google.com\n+\n+ Returns:\n+ string: TLD or a top level domain extracted from the domain,\n+ eg: google.com\n+ \"\"\"\n+ return '.'.join(domain.split('.')[-2:])\n+\n+\n+def strip_www_from_domain(domain):\n+ \"\"\"Strip www. from beginning of domain names.\n+\n+ Args:\n+ domain: string with a full domain, eg. www.google.com\n+\n+ Returns:\n+ string: Domain without any www, eg: google.com\n+ \"\"\"\n+ if domain.startswith('www.'):\n+ return domain[4:]\n+ return domain\n" }, { "change_type": "ADD", "old_path": null, "new_path": "timesketch/lib/analyzers/utils_test.py", "diff": "+# Copyright 2019 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Tests for analysis utils.\"\"\"\n+\n+from __future__ import unicode_literals\n+\n+from timesketch.lib.testlib import BaseTest\n+from timesketch.lib.analyzers import utils\n+\n+\n+class TestAnalyzerUtils(BaseTest):\n+ \"\"\"Tests the functionality of the utilities.\"\"\"\n+\n+ def __init__(self, *args, **kwargs):\n+ super(TestAnalyzerUtils, self).__init__(*args, **kwargs)\n+\n+ def test_get_domain_from_url(self):\n+ \"\"\"Test get_domain_from_url function.\"\"\"\n+ url = 'http://www.example.com/?foo=bar'\n+ domain = utils.get_domain_from_url(url)\n+ self.assertEquals(domain, 'www.example.com')\n+\n+ def test_get_tld_from_domain(self):\n+ \"\"\"Test get_tld_from_domain function.\"\"\"\n+ domain = 'this.is.a.subdomain.example.com'\n+ tld = utils.get_tld_from_domain(domain)\n+ self.assertEquals(tld, 'example.com')\n+\n+ domain = 'a'\n+ tld = utils.get_tld_from_domain(domain)\n+ self.assertEquals(tld, 'a')\n+\n+ domain = 'example.com'\n+ tld = utils.get_tld_from_domain(domain)\n+ self.assertEquals(tld, 'example.com')\n+\n+ def test_strip_www_from_domain(self):\n+ \"\"\"Test strip_www_from_domain function.\"\"\"\n+ domain = 'www.mbl.is'\n+ stripped = utils.strip_www_from_domain(domain)\n+ self.assertEquals(stripped, 'mbl.is')\n+\n+ domain = 'mbl.is'\n+ stripped = utils.strip_www_from_domain(domain)\n+ self.assertEquals(stripped, domain)\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/emojis.py", "new_path": "timesketch/lib/emojis.py", "diff": "@@ -26,13 +26,14 @@ emoji = collections.namedtuple('emoji', 'code help')\nEMOJI_MAP = {\n'CAMERA': emoji('&#x1F4F7', 'Screenshot activity'),\n+ 'FISHING_POLE': emoji('&#x1F3A3', 'Phishing'),\n'LOCK': emoji('&#x1F512', 'Logon activity'),\n'LOCOMOTIVE': emoji('&#x1F682', 'Execution activity'),\n'MAGNIFYING_GLASS': emoji('&#x1F50E', 'Search related activity'),\n'SATELLITE': emoji('&#x1F4E1', 'Domain activity'),\n'SKULL_CROSSBONE': emoji('&#x2620', 'Suspicious entry'),\n'UNLOCK': emoji('&#x1F513', 'Logoff activity'),\n- 'WASTEBASKET': emoji('&#x1F5D1', 'Deletion activity'),\n+ 'WASTEBASKET': emoji('&#x1F5D1', 'Deletion activity')\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Simple domain analyzer (#766) * Move some domain analysis to it's own analyzer * Remove unused var * Don't run celery task when testing Refactor phishy domains and break out common functions. * Remove unecessary return fields * Alpha order for emojis
263,093
10.01.2019 15:08:07
-3,600
de785d9775229b86dc451463189ceb98ab9a432d
Don't use SERVER_NAME, and construct URLs safely
[ { "change_type": "MODIFY", "old_path": "timesketch.conf", "new_path": "timesketch.conf", "diff": "@@ -190,6 +190,5 @@ EMAIL_SMTP_SERVER = 'localhost'\n# Only send emails to these users.\nEMAIL_USER_WHITELIST = []\n-# Configuration needed for Flask to construct URLs for resources. Only activate\n-# this if you have a real deployment with an external reachable domain.\n-#SERVER_NAME = '192.168.57.128:5000'\n\\ No newline at end of file\n+# Configuration to construct URLs for resources.\n+EXTERNAL_HOST_URL = 'https://localhost'\n" }, { "change_type": "MODIFY", "old_path": "timesketch/lib/tasks.py", "new_path": "timesketch/lib/tasks.py", "diff": "@@ -246,6 +246,8 @@ def run_email_result_task(index_name, sketch_id=None):\nReturns:\nEmail sent status.\n\"\"\"\n+ # We need to get a fake request context so that url_for() will work.\n+ with current_app.test_request_context():\nsearchindex = SearchIndex.query.filter_by(index_name=index_name).first()\nsketch = None\n@@ -270,10 +272,12 @@ def run_email_result_task(index_name, sketch_id=None):\nsketch.external_url)\nanalysis_results = searchindex.description.replace('\\n', '<br>')\n- body = body + '<br><br><b>Analysis</b>{0:s}'.format(analysis_results)\n+ body = body + '<br><br><b>Analysis</b>{0:s}'.format(\n+ analysis_results)\nif view_links:\n- body = body + '<br><br><b>Views</b><br>' + '<br>'.join(view_links)\n+ body = body + '<br><br><b>Views</b><br>' + '<br>'.join(\n+ view_links)\nto_username = searchindex.user.username\n" }, { "change_type": "MODIFY", "old_path": "timesketch/models/sketch.py", "new_path": "timesketch/models/sketch.py", "diff": "@@ -22,6 +22,7 @@ from sqlalchemy import Unicode\nfrom sqlalchemy import UnicodeText\nfrom sqlalchemy.orm import relationship\n+from flask import current_app\nfrom flask import url_for\nfrom timesketch.models import BaseModel\n@@ -81,10 +82,10 @@ class Sketch(AccessControlMixin, LabelMixin, StatusMixin, CommentMixin,\nReturns:\nFull URL to the sketch as string.\n\"\"\"\n- url = url_for(\n- u'sketch_views.overview', sketch_id=self.id, _external=True,\n- _scheme=u'https')\n- return url\n+ url_host = current_app.config.get(\n+ u'EXTERNAL_HOST_URL', u'https://localhost')\n+ url_path = url_for(u'sketch_views.overview', sketch_id=self.id)\n+ return url_host + url_path\ndef get_view_urls(self):\n\"\"\"Get external URL for all views in the sketch.\n@@ -92,11 +93,14 @@ class Sketch(AccessControlMixin, LabelMixin, StatusMixin, CommentMixin,\nReturns:\nDictionary with url as key and view name as value.\n\"\"\"\n+\nviews = {}\nfor view in self.get_named_views:\n- url = url_for(\n- u'sketch_views.explore', sketch_id=self.id, view_id=view.id,\n- _external=True, _scheme=u'https')\n+ url_host = current_app.config.get(\n+ u'EXTERNAL_HOST_URL', u'https://localhost')\n+ url_path = url_for(\n+ u'sketch_views.explore', sketch_id=self.id, view_id=view.id)\n+ url = url_host + url_path\nviews[url] = view.name\nreturn views\n" } ]
Python
Apache License 2.0
google/timesketch
Don't use SERVER_NAME, and construct URLs safely (#776)
263,093
23.01.2019 17:25:49
-3,600
5d740c6a2f7117d15c2b8f280ad818e70f225ac3
Expose volume to container
[ { "change_type": "MODIFY", "old_path": "docker/docker-compose.yml", "new_path": "docker/docker-compose.yml", "diff": "@@ -24,6 +24,8 @@ services:\n- TIMESKETCH_USER=${TIMESKETCH_USER}\n- TIMESKETCH_PASSWORD=${TIMESKETCH_PASSWORD}\nrestart: always\n+ volumes:\n+ - ../:/usr/local/src/timesketch/\nelasticsearch:\n# uncomment the following lines to control JVM memory utilization\n" } ]
Python
Apache License 2.0
google/timesketch
Expose volume to container (#804)
263,133
29.01.2019 17:54:45
0
9b7e0fd7d93155fddeb66988b4f8cbe3564b26db
Micro change.
[ { "change_type": "MODIFY", "old_path": "timesketch/lib/datastores/elastic.py", "new_path": "timesketch/lib/datastores/elastic.py", "diff": "@@ -519,7 +519,7 @@ class ElasticsearchDataStore(object):\n# Make sure we have decoded strings in the event dict.\nevent = {\nk.decode(u'utf8'): (v.decode(u'utf8')\n- if isinstance(v, basestring) else v)\n+ if isinstance(v, str) else v)\nfor k, v in event.items()\n}\n" } ]
Python
Apache License 2.0
google/timesketch
Micro change. (#808)
263,102
06.02.2019 03:02:41
28,800
e7b1b23fd8a85f1bbed7e9bfce9a4af374f0949e
Update docker-entrypoint.sh Fix the password pass error which was previously seen and reported in an older issue "0859a73cd1731904f2b7575b17f47cd74a988c86"
[ { "change_type": "MODIFY", "old_path": "docker/docker-entrypoint.sh", "new_path": "docker/docker-entrypoint.sh", "diff": "@@ -48,11 +48,11 @@ if [ \"$1\" = 'timesketch' ]; then\nfi\n# Set up web credentials\n- if [ -z ${TIMESKETCH_USER+x} ]; then\n+ if [ -z ${TIMESKETCH_USER:+x} ]; then\nTIMESKETCH_USER=\"admin\"\necho \"TIMESKETCH_USER set to default: ${TIMESKETCH_USER}\";\nfi\n- if [ -z ${TIMESKETCH_PASSWORD+x} ]; then\n+ if [ -z ${TIMESKETCH_PASSWORD:+x} ]; then\nTIMESKETCH_PASSWORD=\"$(openssl rand -base64 32)\"\necho \"TIMESKETCH_PASSWORD set randomly to: ${TIMESKETCH_PASSWORD}\";\nfi\n" } ]
Python
Apache License 2.0
google/timesketch
Update docker-entrypoint.sh (#817) Fix the password pass error which was previously seen and reported in an older issue "0859a73cd1731904f2b7575b17f47cd74a988c86"
263,093
07.02.2019 14:48:12
-3,600
486a7e722df0725fdddc8655b6db7dfe0e2560a7
Remove the last u''
[ { "change_type": "MODIFY", "old_path": "timesketch.conf", "new_path": "timesketch.conf", "diff": "@@ -15,7 +15,7 @@ DEBUG = False\n# This should be a unique random string. Don't share this with anyone.\n# To generate a key, you can for example use openssl:\n# $ openssl rand -base64 32\n-SECRET_KEY = u'<KEY_GOES_HERE>'\n+SECRET_KEY = '<KEY_GOES_HERE>'\n# Setup the database.\n#\n@@ -32,7 +32,7 @@ SQLALCHEMY_DATABASE_URI = 'postgresql://<USERNAME>:<PASSWORD>@localhost/timesket\n# Make sure that the Elasticsearch server is properly secured and not accessible\n# from the internet. See the following link for more information:\n# http://www.elasticsearch.org/blog/scripting-security/\n-ELASTIC_HOST = u'127.0.0.1'\n+ELASTIC_HOST = '127.0.0.1'\nELASTIC_PORT = 9200\n#-------------------------------------------------------------------------------\n@@ -44,7 +44,7 @@ ELASTIC_PORT = 9200\n# another name you can configure that here.\nSSO_ENABLED = False\n-SSO_USER_ENV_VARIABLE = u'REMOTE_USER'\n+SSO_USER_ENV_VARIABLE = 'REMOTE_USER'\n# Some SSO systems provides group information as environment variable.\n# Timesketch can automatically create groups and add users as members.\n@@ -54,11 +54,11 @@ SSO_GROUP_ENV_VARIABLE = None\n# Different systems use different separators in the string returned in the\n# environment variable.\n-SSO_GROUP_SEPARATOR = u';'\n+SSO_GROUP_SEPARATOR = ';'\n# Some SSO systems uses a special prefix for the group name to indicate that\n# the user is not a member of that group. Set this if that is the case, i.e.\n-# u'-'.\n+# '-'.\nSSO_GROUP_NOT_MEMBER_SIGN = None\n#-------------------------------------------------------------------------------\n@@ -77,19 +77,19 @@ GOOGLE_IAP_ENABLED = False\n# This information is available via the Google Cloud console:\n# https://cloud.google.com/iap/docs/signed-headers-howto\n-GOOGLE_IAP_PROJECT_NUMBER = u''\n-GOOGLE_IAP_BACKEND_ID = u''\n+GOOGLE_IAP_PROJECT_NUMBER = ''\n+GOOGLE_IAP_BACKEND_ID = ''\n# DON'T EDIT: Google IAP expected audience is based on Cloud project number and\n# backend ID.\n-GOOGLE_IAP_AUDIENCE = u'/projects/{}/global/backendServices/{}'.format(\n+GOOGLE_IAP_AUDIENCE = '/projects/{}/global/backendServices/{}'.format(\nGOOGLE_IAP_PROJECT_NUMBER,\nGOOGLE_IAP_BACKEND_ID\n)\n-GOOGLE_IAP_ALGORITHM = u'ES256'\n-GOOGLE_IAP_ISSUER = u'https://cloud.google.com/iap'\n-GOOGLE_IAP_PUBLIC_KEY_URL = u'https://www.gstatic.com/iap/verify/public_key'\n+GOOGLE_IAP_ALGORITHM = 'ES256'\n+GOOGLE_IAP_ISSUER = 'https://cloud.google.com/iap'\n+GOOGLE_IAP_PUBLIC_KEY_URL = 'https://www.gstatic.com/iap/verify/public_key'\n#-------------------------------------------------------------------------------\n# Google Cloud OpenID Connect (OIDC) authentication configuration.\n@@ -121,7 +121,7 @@ UPLOAD_ENABLED = False\n# Folder for temporarily storage of Plaso dump files before being processed and\n# inserted into the datastore.\n-UPLOAD_FOLDER = u'/tmp'\n+UPLOAD_FOLDER = '/tmp'\n# Celery broker configuration. You need to change ip/port to where your Redis\n# server is running.\n@@ -130,7 +130,7 @@ CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'\n# Path to plaso data directory.\n# If not set, defaults to system prefix + share/plaso\n-#PLASO_DATA_LOCATION = u'/path/to/dir/with/plaso/data/files'\n+#PLASO_DATA_LOCATION = '/path/to/dir/with/plaso/data/files'\n#-------------------------------------------------------------------------------\n# Graph backend configuration.\n@@ -138,10 +138,10 @@ CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'\nGRAPH_BACKEND_ENABLED = False\n# Neo4j server configuration\n-NEO4J_HOST = u'127.0.0.1'\n+NEO4J_HOST = '127.0.0.1'\nNEO4J_PORT = 7474\n-NEO4J_USERNAME = u'neo4j'\n-NEO4J_PASSWORD = u'<N4J_PASSWORD>'\n+NEO4J_USERNAME = 'neo4j'\n+NEO4J_PASSWORD = '<NEO4J_PASSWORD>'\n#-------------------------------------------------------------------------------\n# Auto analyzers.\n" }, { "change_type": "MODIFY", "old_path": "timesketch/models/annotations.py", "new_path": "timesketch/models/annotations.py", "diff": "@@ -41,7 +41,7 @@ class BaseAnnotation(object):\nReturns:\nA column (instance of sqlalchemy.Column)\n\"\"\"\n- return Column(Integer, ForeignKey(u'user.id'))\n+ return Column(Integer, ForeignKey('user.id'))\n@declared_attr\ndef user(self):\n@@ -50,7 +50,7 @@ class BaseAnnotation(object):\nReturns:\nA relationship (instance of sqlalchemy.orm.relationship)\n\"\"\"\n- return relationship(u'User')\n+ return relationship('User')\nclass Label(BaseAnnotation):\n@@ -224,5 +224,5 @@ class StatusMixin(object):\nThe status as a string\n\"\"\"\nif not self.status:\n- self.status.append(self.Status(user=None, status=u'new'))\n+ self.status.append(self.Status(user=None, status='new'))\nreturn self.status[0]\n" } ]
Python
Apache License 2.0
google/timesketch
Remove the last u'' (#827)
263,093
07.02.2019 15:24:16
-3,600
d9519081ac28f515890cdd61602e64325fa2cd10
Update to Ubuntu 18.04 for both Docker and Vagrant
[ { "change_type": "MODIFY", "old_path": "docker/Dockerfile", "new_path": "docker/Dockerfile", "diff": "# Use the official Docker Hub Ubuntu 14.04 base image\n-FROM ubuntu:16.04\n+FROM ubuntu:18.04\n# Update the base image\nRUN apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade\n" }, { "change_type": "MODIFY", "old_path": "docker/Dockerfile-dev", "new_path": "docker/Dockerfile-dev", "diff": "# Use the official Docker Hub Ubuntu 14.04 base image\n-FROM ubuntu:16.04\n+FROM ubuntu:18.04\n# Copy the entrypoint script into the container\nCOPY docker/timesketch-dev-entrypoint.sh /docker-entrypoint.sh\n" }, { "change_type": "MODIFY", "old_path": "docker/docker-entrypoint.sh", "new_path": "docker/docker-entrypoint.sh", "diff": "@@ -59,7 +59,7 @@ if [ \"$1\" = 'timesketch' ]; then\n# Sleep to allow the other processes to start\nsleep 5\n- tsctl add_user -u \"$TIMESKETCH_USER\" -p \"$TIMESKETCH_PASSWORD\"\n+ tsctl add_user --username \"$TIMESKETCH_USER\" --password \"$TIMESKETCH_PASSWORD\"\n# Run the Timesketch server (without SSL)\nexec `bash -c \"/usr/local/bin/celery -A timesketch.lib.tasks worker --uid nobody --loglevel info &\\\n" }, { "change_type": "MODIFY", "old_path": "docker/timesketch-dev-entrypoint.sh", "new_path": "docker/timesketch-dev-entrypoint.sh", "diff": "@@ -93,7 +93,7 @@ if [ \"$1\" = 'timesketch' ]; then\nsed -i s/\"ENABLE_EXPERIMENTAL_UI = False\"/\"ENABLE_EXPERIMENTAL_UI = True\"/ /etc/timesketch.conf\n# Add web user\n- tsctl add_user -u \"${TIMESKETCH_USER}\" -p \"${TIMESKETCH_USER}\"\n+ tsctl add_user --username \"${TIMESKETCH_USER}\" --password \"${TIMESKETCH_USER}\"\necho \"Timesketch development server is ready!\"\n" }, { "change_type": "MODIFY", "old_path": "vagrant/Vagrantfile", "new_path": "vagrant/Vagrantfile", "diff": "@@ -9,7 +9,7 @@ unless Vagrant.has_plugin?(\"vagrant-disksize\")\nend\nVagrant.configure(2) do |config|\n- config.vm.box = \"ubuntu/xenial64\"\n+ config.vm.box = \"ubuntu/bionic64\"\nconfig.disksize.size = \"50GB\"\nconfig.vm.box_check_update = true\n" } ]
Python
Apache License 2.0
google/timesketch
Update to Ubuntu 18.04 for both Docker and Vagrant (#825)