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 |
|---|---|---|---|---|---|---|---|---|---|
139,068 | 22.12.2022 19:09:57 | -3,600 | 3c1856265f249bf7c14e377d6769b7ba3239fff0 | Remove loader preproc from 1.17 docs | [
{
"change_type": "DELETE",
"old_path": "docs/1.17/content/zencode/Preprocessors/LoaderPreprocessor.md",
"new_path": null,
"diff": "-# Loader Preprocessor\n-\n-The loader preprocessor is really simple, it affects where and when the script is loaded.\n-As of writing this script, there are two loaders: `crafttweaker` and `contenttweaker`.\n-\n-`crafttweaker` is the default loader, where most things take place. Scripts here will get executed whenever resources get reloaded, on world join, or when running the `/reload` command.\n-\n-The `contenttweaker` loader loads its scripts a bit early, before regular registration, so that Objects that need to be registered while the game is starting are registered and present. This means that this loader doesn't allow you to `/reload` and requires you to restart the game to apply changes.\n-\n-Loaders are independent. You will not be able to add recipes in a `contenttweaker` loader or create an item in a `crafttweaker` loader.\n-\n-# How to use\n-\n-Simply append `#loader name` to the top of the script.\n-\n-```zenscript\n-#loader contenttweaker\n-\n-import mods.contenttweaker.fluid.FluidBuilder;\n-\n-new FluidBuilder(false, 0xff0000)\n- .build(\"black_water\");\n-\n-```\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.17/content/zencode/Preprocessors/Preprocessors.md",
"new_path": "docs/1.17/content/zencode/Preprocessors/Preprocessors.md",
"diff": "@@ -6,7 +6,7 @@ They run various actions on scripts. A preprocessor is called by placing `#prepr\nThe list of Preprocessors is:\n- Debug Preprocessor\n-- [Loader Preprocessor](/zencode/Preprocessors/LoaderPreprocessor)\n+- Loader Preprocessor\n- LoadFirst Preprocessor\n- LoadLast Preprocessor\n- ModLoaded Preprocessor\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Remove loader preproc from 1.17 docs |
139,068 | 05.01.2023 22:24:28 | -3,600 | 1dd8fdea2d24fc636eddc15afa0d51c9806a860e | Update LoaderPreproc example | [
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/LoaderPreprocessor.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/LoaderPreprocessor.md",
"diff": "# Loader Preprocessor\nThe loader preprocessor is really simple, it affects where and when the script is loaded.\n-As of writing this script, there are two loaders: `crafttweaker` and `contenttweaker`.\n+As of writing this script, there are three loaders registered by CraftTweaker: `initialise`, `tags`, and `crafttweaker`\n`crafttweaker` is the default loader, where most things take place. Scripts here will get executed whenever resources get reloaded, on world join, or when running the `/reload` command.\n+You don't need to have `#loader crafttweaker` at the top of your script.\n-The `contenttweaker` loader loads its scripts a bit early, before regular registration, so that Objects that need to be registered while the game is starting are registered and present. This means that this loader doesn't allow you to `/reload` and requires you to restart the game to apply changes.\n-\n-Loaders are independent. You will not be able to add recipes in a `contenttweaker` loader or create an item in a `crafttweaker` loader.\n+Loaders are independent. You will not be able to add recipes in a `tags` loader or create an item in a `crafttweaker` loader.\n# How to use\nSimply append `#loader name` to the top of the script.\n```zenscript\n-#loader contenttweaker\n+#loader tags\n-import contenttweaker.builder.vanilla.block.Basic;\n-import contenttweaker.object.vanilla.property.StandardBlockProperties;\n+<tag:items:minecraft:planks>.addId(<resource:minecraft:tnt>);\n-val veryBasicBlock = <factory:block>.typed<Basic>()\n- .material(<material:minecraft:metal>)\n- .lightLevel(14)\n- .tab(<tab:examplesTab>)\n- .build(\"very_basic_block\");\n```\n+\n+Other mods may register other loaders under different names.\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Update LoaderPreproc example |
139,068 | 06.01.2023 00:32:20 | -3,600 | aed4e9497d5f39397aaa5c158925b703803a743d | Add TagsLoader docs | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/1.19/content/zencode/TagsLoader.md",
"diff": "+# Loader Tags\n+\n+The `tags` loader is a [Loader](/zencode/Preprocessors/LoaderPreprocessor) added by CraftTweaker that provides the scripter with a new location in time to load scripts.\n+\n+The unique purpose of the loader is to give you a window where tags can be manipulated, before mods and CraftTweaker load recipes and scripts respectively.\n+\n+This means:\n+\n+- If you use the `tags` loader, you can forget about having to add [priority](/zencode/Preprocessors/PriorityPreprocessor) to your scripts so the\n+scripts that modify tags load earlier than the ones that actually use them.\n+- If you modify tags before mods certain conditional recipes added by mods can be tweaked, using the updated tag contents.\n+- Since the `tags` loader loads before the `crafttweaker` one, which is the default, you have access to almost no types at all.\n+You only have access to `<tags>` and `<resources>`\n+\n+\n+```zenscript\n+#loader tags\n+\n+<tag:items:minecraft:planks>.addId(<resource:minecraft:tnt>);\n+```\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/docs.json",
"new_path": "docs/1.19/docs.json",
"diff": "\"Preprocessors\": \"zencode/Preprocessors/Preprocessors.md\",\n\"Loader Preprocessor\": \"zencode/Preprocessors/LoaderPreprocessor.md\",\n\"Priority Preprocessor\": \"zencode/Preprocessors/PriorityPreprocessor.md\"\n- }\n+ },\n+ \"Tags Loader\" : \"zencode/TagsLoader.md\"\n},\n\"Mod Dev\": {\n\"CraftTweaker in a Development Environment\" : \"integration/Introduction.md\",\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Add TagsLoader docs |
139,068 | 06.01.2023 00:42:10 | -3,600 | 146de30e354934062133530d2260b5577bb2cc5d | Add the Debug Preprocessor, update the Priority one | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/1.19/content/zencode/Preprocessors/DebugPreprocessor.md",
"diff": "+# Debug Preprocessor\n+\n+The debug preprocessor is an utility preprocessor used to save the generated classes your script compiles into.\n+In case you're confused, ZenCode scripts compile into Java code, which interacts with the game code.\n+\n+In general, this is worthless to the average user, as the generated classes are a Java class you need to know Java in order to read.\n+\n+This preprocessor is generally used by advanced users or by the developers of CraftTweaker to find bugs in generated code.\n+\n+The generated classes appear inside `.minecraft/classes`.\n+\n+## How to use\n+\n+Simply append `#debug` to the top of the script.\n+\n+```zenscript\n+#debug\n+\n+println(\"Hello World\");\n+```\n+\n+For the curious: The above compiles to:\n+\n+```java\n+package scripts.preprocessors;\n+\n+import com.blamejared.crafttweaker.api.zencode.CraftTweakerGlobals;\n+\n+public class debug {\n+ public static void run() {\n+ CraftTweakerGlobals.println(\"Hello World\");\n+ }\n+}\n+```\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/Preprocessors.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/Preprocessors.md",
"diff": "@@ -5,7 +5,7 @@ They run various actions on scripts. A preprocessor is called by placing `#prepr\nThe list of Preprocessors is:\n-- Debug Preprocessor\n+- [Debug Preprocessor](/zencode/Preprocessors/DebugPreprocessor)\n- [Loader Preprocessor](/zencode/Preprocessors/LoaderPreprocessor)\n- LoadFirst Preprocessor\n- LoadLast Preprocessor\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/PriorityPreprocessor.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/PriorityPreprocessor.md",
"diff": "@@ -8,7 +8,7 @@ Scripts with the same priority will be executed in the same order that scripts w\nPriority is important for ZenClasses, global variables, or even tags. If your script references another script, make sure the script you're referencing from is already loaded by the time you import values or functions!\n-# How to use\n+## How to use\nSimply append `#priority [amount]` to the top of the script.\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/docs.json",
"new_path": "docs/1.19/docs.json",
"diff": "\"Functions\" : \"zencode/Functions.md\",\n\"Preprocessors\": {\n\"Preprocessors\": \"zencode/Preprocessors/Preprocessors.md\",\n+ \"Debug Preprocessor\" : \"zencode/Preprocessors/DebugPreprocessor\",\n\"Loader Preprocessor\": \"zencode/Preprocessors/LoaderPreprocessor.md\",\n\"Priority Preprocessor\": \"zencode/Preprocessors/PriorityPreprocessor.md\"\n},\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Add the Debug Preprocessor, update the Priority one |
139,068 | 06.01.2023 01:01:18 | -3,600 | 599f5041d9f0ba499e2018c961b1e6beb5cd6f43 | Add TagsLoader to 1.18 | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/1.18/content/zencode/TagsLoader.md",
"diff": "+# Loader Tags\n+\n+The `tags` loader is a [Loader](/zencode/Preprocessors/LoaderPreprocessor) added by CraftTweaker that provides the scripter with a new location in time to load scripts.\n+\n+The unique purpose of the loader is to give you a window where tags can be manipulated, before mods and CraftTweaker load recipes and scripts respectively.\n+\n+This means:\n+\n+- If you use the `tags` loader, you can forget about having to add [priority](/zencode/Preprocessors/PriorityPreprocessor) to your scripts so the\n+ scripts that modify tags load earlier than the ones that actually use them.\n+- If you modify tags before mods certain conditional recipes added by mods can be tweaked, using the updated tag contents.\n+- Since the `tags` loader loads before the `crafttweaker` one, which is the default, you have access to almost no types at all.\n+ You only have access to `<tags>`, `<tagmanager>` and `<resources>`\n+\n+\n+```zenscript\n+#loader tags\n+\n+<tag:items:minecraft:planks>.addId(<resource:minecraft:tnt>);\n+```\n+\n+The complete list of classes you can access is the following:\n+\n+```\n+ResourceLocation\n+Many\n+UnknownTag\n+MCTag\n+UnknownTagManager\n+ITagManager\n+TagManager\n+INumberData\n+IData\n+ICollectionData\n+CommandStringDisplayable\n+```\n+\n+****\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.18/docs.json",
"new_path": "docs/1.18/docs.json",
"diff": "\"Preprocessors\": \"zencode/Preprocessors/Preprocessors.md\",\n\"Loader Preprocessor\": \"zencode/Preprocessors/LoaderPreprocessor.md\",\n\"Priority Preprocessor\": \"zencode/Preprocessors/PriorityPreprocessor.md\"\n- }\n+ },\n+ \"Tags Loader\" : \"zencode/TagsLoader.md\"\n},\n\"Mod Dev\": {\n\"CraftTweaker in a Development Environment\" : \"integration/Introduction.md\",\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/LoaderPreprocessor.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/LoaderPreprocessor.md",
"diff": "@@ -8,7 +8,7 @@ You don't need to have `#loader crafttweaker` at the top of your script.\nLoaders are independent. You will not be able to add recipes in a `tags` loader or create an item in a `crafttweaker` loader.\n-# How to use\n+## How to use\nSimply append `#loader name` to the top of the script.\n@@ -16,7 +16,7 @@ Simply append `#loader name` to the top of the script.\n#loader tags\n<tag:items:minecraft:planks>.addId(<resource:minecraft:tnt>);\n-\n```\n-Other mods may register other loaders under different names.\n\\ No newline at end of file\n+Other mods may register other loaders under different names. As such, they might load at different points in time and\n+provide certain classes.\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/TagsLoader.md",
"new_path": "docs/1.19/content/zencode/TagsLoader.md",
"diff": "@@ -10,7 +10,7 @@ This means:\nscripts that modify tags load earlier than the ones that actually use them.\n- If you modify tags before mods certain conditional recipes added by mods can be tweaked, using the updated tag contents.\n- Since the `tags` loader loads before the `crafttweaker` one, which is the default, you have access to almost no types at all.\n-You only have access to `<tags>` and `<resources>`\n+You only have access to `<tags>`, `<tagmanager>` and `<resources>`\n```zenscript\n@@ -19,3 +19,19 @@ You only have access to `<tags>` and `<resources>`\n<tag:items:minecraft:planks>.addId(<resource:minecraft:tnt>);\n```\n+The complete list of classes you can access is the following:\n+\n+```\n+ResourceLocation\n+Many\n+UnknownTag\n+MCTag\n+UnknownTagManager\n+ITagManager\n+TagManager\n+INumberData\n+IData\n+ICollectionData\n+CommandStringDisplayable\n+```\n+\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Add TagsLoader to 1.18 |
139,068 | 06.01.2023 01:20:17 | -3,600 | cf5764a04c1feed28d8211b5888f62f175c52d49 | Fix the loader preproc | [
{
"change_type": "MODIFY",
"old_path": "docs/1.19/docs.json",
"new_path": "docs/1.19/docs.json",
"diff": "\"Functions\" : \"zencode/Functions.md\",\n\"Preprocessors\": {\n\"Preprocessors\": \"zencode/Preprocessors/Preprocessors.md\",\n- \"Debug Preprocessor\" : \"zencode/Preprocessors/DebugPreprocessor\",\n+ \"Debug Preprocessor\" : \"zencode/Preprocessors/DebugPreprocessor.md\",\n\"Loader Preprocessor\": \"zencode/Preprocessors/LoaderPreprocessor.md\",\n\"Priority Preprocessor\": \"zencode/Preprocessors/PriorityPreprocessor.md\"\n},\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Fix the loader preproc |
139,068 | 06.01.2023 21:28:09 | -3,600 | 26e8f5be81bbb749e76aaeb0db8df030e874ba35 | Fix debug preproc and add modloaded | [
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/DebugPreprocessor.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/DebugPreprocessor.md",
"diff": "@@ -22,7 +22,7 @@ println(\"Hello World\");\nFor the curious: The above compiles to:\n```java\n-package scripts.preprocessors;\n+package scripts;\nimport com.blamejared.crafttweaker.api.zencode.CraftTweakerGlobals;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/1.19/content/zencode/Preprocessors/ModLoadedPreprocessor.md",
"diff": "+# Modloaded Preprocessor\n+\n+The modloaded preprocessor determines whether a script can be loaded or not by checking whether a mod is loaded (by searching for the provided modid).\n+\n+Be careful, as sometimes the modid might differ from the file name. Always try to check the modid by either looking at the assets folder or by looking at the\n+identifying file for each modloader. Alternatively, check the mod's github for the actual modid or ask them!\n+\n+It is useful to have this in places where you suspect a mod might be added, removed, or for when you want to write scripts that don't crash when taken outside of\n+their environment. Theoretically, you could make a MultiLoader modpack that uses the same scripts on both sides if you're smart about it!\n+\n+## How to use\n+\n+The syntax of it in ZenCode would be similar to:\n+\n+```zenscript\n+modloaded(modids as string[])\n+```\n+\n+So, you supply the preprocessor, followed by a list of modids that are required for the script to load.\n+All modids need to be present in order for the script to be loaded, otherwise, it is skipped.\n+\n+```zenscript\n+#modloaded crafttweaker\n+\n+println(\"CraftTweaker is installed\");\n+println(\"This is useless, and it won't ever stop our script from loading\");\n+```\n+\n+Another example of the above would be:\n+\n+```zenscript\n+#modloaded botania botanypots\n+\n+//The purpose of this mini script is to add a different\n+\n+craftingTable.removeByName(\"botania:mana_pool\");\n+\n+craftingTable.addShaped(\"pool_pot_recipe\", <item:botania:mana_pool>, [\n+ [<tag:items:botania:petals>, <tag:items:botania:petals>],\n+ [<tag:items:botanypots:all_botany_pots>, <tag:items:botanypots:all_botany_pots>]\n+]);\n+```\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/zencode/Preprocessors/Preprocessors.md",
"new_path": "docs/1.19/content/zencode/Preprocessors/Preprocessors.md",
"diff": "@@ -9,7 +9,8 @@ The list of Preprocessors is:\n- [Loader Preprocessor](/zencode/Preprocessors/LoaderPreprocessor)\n- LoadFirst Preprocessor\n- LoadLast Preprocessor\n-- ModLoaded Preprocessor\n+- [Modloaded Preprocessor](/zencode/Preprocessors/ModLoadedPreprocessor)\n+- Modloader Preprocessor\n- NoLoad Preprocessor\n- [Priority Preprocessor](/zencode/Preprocessors/PriorityPreprocessor)\n- Replace Preprocessor\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/1.19/docs.json",
"new_path": "docs/1.19/docs.json",
"diff": "\"Preprocessors\": \"zencode/Preprocessors/Preprocessors.md\",\n\"Debug Preprocessor\" : \"zencode/Preprocessors/DebugPreprocessor.md\",\n\"Loader Preprocessor\": \"zencode/Preprocessors/LoaderPreprocessor.md\",\n+ \"Modloaded Preprocessor\" : \"zencode/Preprocessors/ModLoadedPreprocessor.md\",\n\"Priority Preprocessor\": \"zencode/Preprocessors/PriorityPreprocessor.md\"\n},\n\"Tags Loader\" : \"zencode/TagsLoader.md\"\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Fix debug preproc and add modloaded |
139,068 | 29.01.2023 15:29:15 | -3,600 | a5c4cd9d38f8a4a0e411e0029d0523431e0d9919 | Add follow up to getting started page | [
{
"change_type": "MODIFY",
"old_path": "docs/1.19/content/getting_started.md",
"new_path": "docs/1.19/content/getting_started.md",
"diff": "@@ -64,3 +64,11 @@ multiline comment! */\n```\nJust note, that `#` comments are also used for [PreProcessors](/zencode/Preprocessors/Preprocessors), so while they are still valid comments, they could cause unwanted side effects.\n+\n+## The next step\n+\n+Now you know the absolute basics of how to create scripts. Now, what you do is up to you!\n+Feel free to browse the Docs for any pages that interest you.\n+\n+However, if you're getting started, we recommend checking out the Tutorial tab, more specifically the\n+[Crafting Table Tutorial](/tutorial/Recipes/Crafting/crafting_table) as well as the [Recipe Managers](/tutorial/Recipes/RecipeManagers) page for information on how to add and remove different kinds of recipes.\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Add follow up to getting started page |
139,068 | 05.02.2023 13:33:14 | -3,600 | 3ab89731272192b8b617fc8d22f0bd6ab5beccae | Fix prefix on creative tabs | [
{
"change_type": "MODIFY",
"old_path": "docs/1.12/content/Mods/ContentTweaker/Vanilla/Creatable_Content/Creative_Tab.md",
"new_path": "docs/1.12/content/Mods/ContentTweaker/Vanilla/Creatable_Content/Creative_Tab.md",
"diff": "@@ -50,6 +50,6 @@ tab.register();\nimport mods.contenttweaker.CreativeTab;\nimport mods.contenttweaker.VanillaFactory;\n-val zsTab = VanillaFactory.createCreativeTab(\"contenttweaker\", <minecraft:dragon_egg>);\n+val zsTab = VanillaFactory.createCreativeTab(\"contenttweaker\", <item:minecraft:dragon_egg>);\nzsTab.register();\n```\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | crafttweaker/crafttweaker-documentation | Fix prefix on creative tabs |
263,093 | 19.01.2017 10:17:35 | -3,600 | 0d75867fb7c4ce0ccac42667d5df9ff6913f4b63 | Initial Elasticsearch 5.x support | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -52,31 +52,25 @@ class ElasticSearchDataStore(datastore.DataStore):\nElasticsearch query as a dictionary.\n\"\"\"\nquery_dict = {\n- u'query': {\n- u'filtered': {\n- u'filter': {\n- u'nested': {\n- u'filter': {\n- u'bool': {\n- u'must': [\n+ \"query\": {\n+ \"nested\": {\n+ \"query\": {\n+ \"bool\": {\n+ \"must\": [\n{\n- u'term': {\n- u'timesketch_label.name':\n- label_name\n+ \"term\": {\n+ \"timesketch_label.name\": label_name\n}\n},\n{\n- u'term': {\n- u'timesketch_label.sketch_id':\n- sketch_id\n+ \"term\": {\n+ \"timesketch_label.sketch_id\": sketch_id\n}\n}\n]\n}\n},\n- u'path': u'timesketch_label'\n- }\n- }\n+ \"path\": \"timesketch_label\"\n}\n}\n}\n@@ -115,8 +109,8 @@ class ElasticSearchDataStore(datastore.DataStore):\nfield_aggregation = {\nu'field_aggregation': {\nu'terms': {\n- u'field': field_name,\n- u'size': 0}\n+ u'field': u'{0:s}.keyword'.format(field_name)\n+ }\n}\n}\nreturn field_aggregation\n@@ -147,17 +141,21 @@ class ElasticSearchDataStore(datastore.DataStore):\nif not query_dsl:\nquery_dsl = {\nu'query': {\n- u'filtered': {\n- u'query': {\n+ u'bool': {\n+ u'must': [{\nu'query_string': {\nu'query': query_string\n}\n- }\n+ }]\n}\n}\n}\nif query_filter.get(u'time_start', None):\n- query_dsl[u'query'][u'filtered'][u'filter'] = {\n+ # TODO(jberggren): Add support for multiple time ranges.\n+ query_dsl[u'query'][u'bool'][u'filter'] = {\n+ u'bool': {\n+ u'should': [\n+ {\nu'range': {\nu'datetime': {\nu'gte': query_filter[u'time_start'],\n@@ -165,14 +163,19 @@ class ElasticSearchDataStore(datastore.DataStore):\n}\n}\n}\n+ ]\n+ }\n+ }\nif query_filter.get(u'exclude', None):\n- query_dsl[u'filter'] = {\n- u'not': {\n+ query_dsl[u'post_filter'] = {\n+ u'bool': {\n+ u'must_not': {\nu'terms': {\nu'data_type': query_filter[u'exclude']\n}\n}\n}\n+ }\nelse:\nquery_dsl = json.loads(query_dsl)\n@@ -190,33 +193,21 @@ class ElasticSearchDataStore(datastore.DataStore):\n# Add any pre defined aggregations\ndata_type_aggregation = self._build_field_aggregator(u'data_type')\n+\nif aggregations:\n- if isinstance(aggregations, dict):\n- if query_filter.get(u'exclude', None):\n- aggregations = {\n- u'exclude': {\n- u'filter': {\n- u'not': {\n- u'terms': {\n- u'field_aggregation':\n- query_filter[u'exclude']\n- }\n- }\n- },\n- u'aggregations': aggregations\n- },\n- u'data_type':\n- data_type_aggregation[u'field_aggregation']\n- }\n+ # post_filter happens after aggregation so we need to move the\n+ # filter to the query instead.\n+ if query_dsl.get(u'post_filter', None):\n+ query_dsl[u'query'][u'bool'][u'filter'] = query_dsl[u'post_filter']\n+ query_dsl.pop(\"post_filter\", None)\nquery_dsl[u'aggregations'] = aggregations\nelse:\nquery_dsl[u'aggregations'] = data_type_aggregation\n-\nreturn query_dsl\ndef search(\nself, sketch_id, query_string, query_filter, query_dsl, indices,\n- aggregations=None, return_results=True):\n+ aggregations=None, return_results=True, return_attributes=None):\n\"\"\"Search ElasticSearch. This will take a query string from the UI\ntogether with a filter definition. Based on this it will execute the\nsearch request on ElasticSearch and get result back.\n@@ -252,16 +243,18 @@ class ElasticSearchDataStore(datastore.DataStore):\n# Default search type for elasticsearch is query_then_fetch.\nsearch_type = u'query_then_fetch'\nif not return_results:\n- search_type = u'count'\n+ LIMIT_RESULTS = 0\n# Suppress the lint error because elasticsearch-py adds parameters\n# to the function with a decorator and this makes pylint sad.\n# pylint: disable=unexpected-keyword-arg\n+ if not return_attributes:\n+ return_attributes = [\n+ u'datetime', u'timestamp', u'message', u'timestamp_desc',\n+ u'timesketch_label', u'tag']\nreturn self.client.search(\nbody=query_dsl, index=list(indices), size=LIMIT_RESULTS,\n- search_type=search_type, _source_include=[\n- u'datetime', u'timestamp', u'message', u'timestamp_desc',\n- u'timesketch_label', u'tag'])\n+ search_type=search_type, _source_include=return_attributes)\ndef get_event(self, searchindex_id, event_id):\n\"\"\"Get one event from the datastore.\n@@ -313,6 +306,7 @@ class ElasticSearchDataStore(datastore.DataStore):\nscript_name = u'toggle_label'\nscript = {\nu'script': {\n+ u'lang': u'groovy',\nu'file': script_name,\nu'params': {\nu'timesketch_label': {\n"
}
] | Python | Apache License 2.0 | google/timesketch | Initial Elasticsearch 5.x support |
263,093 | 19.01.2017 13:50:20 | -3,600 | 279ccec07c64a4bc0d326a76b5dfb27a60950cc4 | Refactor create_search_index in prep for move | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -76,7 +76,7 @@ def run_plaso(source_file_path, timeline_name, index_name, username=None):\noutput_module.SetUserName(username)\n# Start process the Plaso storage file.\n-\ncounter = frontend.ExportEvents(storage_reader, output_module)\nreturn dict(counter)\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "@@ -29,3 +29,4 @@ def random_color():\nhue %= 1\nrgb = tuple(int(i * 256) for i in colorsys.hsv_to_rgb(hue, 0.5, 0.95))\nreturn u'{0:02X}{1:02X}{2:02X}'.format(rgb[0], rgb[1], rgb[2])\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "@@ -226,21 +226,6 @@ class CreateTimelineBase(Command):\nself.counter = Counter()\nself.events = []\n- @staticmethod\n- def create_search_index(index_name, timeline_name):\n- \"\"\"Create searchindex in the Timesketch database.\n-\n- Args:\n- index_name: Then name of the index in Elasticsearch\n- timeline_name: The name of the timeline in Timesketch\n- \"\"\"\n- searchindex = SearchIndex.get_or_create(\n- name=timeline_name, description=timeline_name,\n- user=None, index_name=index_name)\n- searchindex.grant_permission(u'read')\n- db_session.add(searchindex)\n- db_session.commit()\n-\ndef add_event(self, es, flush_interval, index_name, event_type, event):\n\"\"\"Add event to Elasticsearch.\n@@ -282,7 +267,14 @@ class CreateTimelineBase(Command):\nes.client.bulk(\nindex=index_name, doc_type=event_type, body=self.events)\n- self.create_search_index(index_name, timeline_name)\n+ # Create a searchindex in the Timesketch database.\n+ searchindex = SearchIndex.get_or_create(\n+ name=timeline_name, description=timeline_name,\n+ user=None, index_name=index_name)\n+ searchindex.grant_permission(u'read')\n+ db_session.add(searchindex)\n+ db_session.commit()\n+\nsys.stdout.write(\nu'Timeline name: {0:s}\\nElasticsearch index: {1:s}\\n'\nu'Events inserted: {2:d}\\n'.format(\n"
}
] | Python | Apache License 2.0 | google/timesketch | Refactor create_search_index in prep for move |
263,093 | 19.01.2017 22:51:01 | -3,600 | 475c03806e3cd54298a06b06bb2f48a89b75bfcc | Refactor CSV import code | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "# 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-\"\"\"ElasticSearch datastore.\"\"\"\n+\"\"\"Elasticsearch datastore.\"\"\"\n+from collections import Counter\nimport json\nimport logging\n@@ -39,6 +40,8 @@ class ElasticSearchDataStore(datastore.DataStore):\nself.client = Elasticsearch([\n{u'host': host, u'port': port}\n])\n+ self.import_counter = Counter()\n+ self.import_events = []\n@staticmethod\ndef _build_label_query(sketch_id, label_name):\n@@ -359,3 +362,33 @@ class ElasticSearchDataStore(datastore.DataStore):\nindex_name = unicode(index_name.decode(encoding=u'utf-8'))\ndoc_type = unicode(doc_type.decode(encoding=u'utf-8'))\nreturn index_name, doc_type\n+\n+ def import_event(self, flush_interval, index_name, event_type, event=None):\n+ \"\"\"Add event to Elasticsearch.\n+\n+ Args:\n+ flush_interval: Number of events to queue up before indexing\n+ index_name: Name of the index in Elasticsearch\n+ event_type: Type of event (e.g. plaso_event)\n+ event: Event dictionary\n+ \"\"\"\n+ if not event:\n+ if self.import_events:\n+ self.client.bulk(\n+ index=index_name, doc_type=event_type,\n+ body=self.import_events)\n+\n+ # Header needed by Elasticsearch when bulk inserting.\n+ self.import_events.append({\n+ u'index': {\n+ u'_index': index_name, u'_type': event_type\n+ }\n+ })\n+ self.import_events.append(event)\n+ self.import_counter[u'events'] += 1\n+ print self.import_counter[u'events']\n+ if self.import_counter[u'events'] % int(flush_interval) == 0:\n+ self.client.bulk(\n+ index=index_name, doc_type=event_type, body=self.import_events)\n+ self.import_events = []\n+ return self.import_counter[u'events']\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "\"\"\"Common functions and utilities.\"\"\"\nimport colorsys\n+import csv\nimport random\n@@ -30,3 +31,14 @@ def random_color():\nrgb = tuple(int(i * 256) for i in colorsys.hsv_to_rgb(hue, 0.5, 0.95))\nreturn u'{0:02X}{1:02X}{2:02X}'.format(rgb[0], rgb[1], rgb[2])\n+\n+def read_csv(path):\n+ \"\"\"Generator for reading a CSV file.\n+\n+ Args:\n+ path: Path to the CSV file\n+ \"\"\"\n+ with open(path, u'rb') as fh:\n+ reader = csv.DictReader(fh)\n+ for row in reader:\n+ yield row\n"
},
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "# limitations under the License.\n\"\"\"This module is for management of the timesketch application.\"\"\"\n-from collections import Counter\n-import csv\nimport json\nimport sys\nfrom uuid import uuid4\n@@ -33,12 +31,15 @@ from sqlalchemy.exc import IntegrityError\nfrom timesketch import create_app\nfrom timesketch.lib.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.utils import read_csv\nfrom timesketch.models import db_session\nfrom timesketch.models import drop_all\nfrom timesketch.models.user import Group\nfrom timesketch.models.user import User\nfrom timesketch.models.sketch import SearchIndex\n+reload(sys)\n+sys.setdefaultencoding(u'UTF8')\nclass DropDataBaseTables(Command):\n\"\"\"Drop all database tables.\"\"\"\n@@ -223,50 +224,15 @@ class CreateTimelineBase(Command):\ndef __init__(self):\nsuper(CreateTimelineBase, self).__init__()\n- self.counter = Counter()\n- self.events = []\n- def add_event(self, es, flush_interval, index_name, event_type, event):\n- \"\"\"Add event to Elasticsearch.\n+ @staticmethod\n+ def create_searchindex(timeline_name, index_name):\n+ \"\"\"Create the timeline in Timesketch.\nArgs:\n- es = Elasticsearch client (instance of\n- timesketch.lib.datastores.elastic.ElasticSearchDatastore)\n- flush_interval: Number of events to queue up before indexing\n- index_name: Name of the index in Elasticsearch\n- event_type: Type of event (e.g. plaso_event)\n- event: Event dictionary\n- \"\"\"\n- # Header needed by Elasticsearch when bulk inserting.\n- self.events.append({\n- u'index': {\n- u'_index': index_name, u'_type': event_type\n- }\n- })\n- self.events.append(event)\n- self.counter[u'events'] += 1\n- if self.counter[u'events'] % int(flush_interval) == 0:\n- sys.stdout.write(\n- u'Events inserted: {0:d}\\n'.format(self.counter[u'events']))\n- es.client.bulk(\n- index=index_name, doc_type=event_type,\n- body=self.events)\n- self.events = []\n-\n- def finish(self, es, timeline_name, index_name, event_type):\n- \"\"\"Send any last events for indexing and create the timeline.\n-\n- Args:\n- es = Elasticsearch client (instance of\n- timesketch.lib.datastores.elastic.ElasticSearchDatastore)\ntimeline_name: The name of the timeline in Timesketch\nindex_name: Name of the index in Elasticsearch\n- event_type: Type of event (e.g. plaso_event)\n\"\"\"\n- if self.events:\n- es.client.bulk(\n- index=index_name, doc_type=event_type, body=self.events)\n-\n# Create a searchindex in the Timesketch database.\nsearchindex = SearchIndex.get_or_create(\nname=timeline_name, description=timeline_name,\n@@ -275,11 +241,6 @@ class CreateTimelineBase(Command):\ndb_session.add(searchindex)\ndb_session.commit()\n- sys.stdout.write(\n- u'Timeline name: {0:s}\\nElasticsearch index: {1:s}\\n'\n- u'Events inserted: {2:d}\\n'.format(\n- timeline_name, index_name, self.counter[u'events']))\n-\ndef run(self, timeline_name, index_name, file_path, event_type,\nflush_interval):\n\"\"\"Flask-script entrypoint for running the command.\n@@ -355,10 +316,15 @@ class CreateTimelineFromJson(CreateTimelineBase):\n# TODO: Check file size and bail out if big.\nes.create_index(index_name=index_name, doc_type=event_type)\nfor event in json.load(fh):\n- self.add_event(\n- es, flush_interval, index_name, event_type, event)\n- # Insert any remaining events.\n- self.finish(es, timeline_name, index_name, event_type)\n+ _counter = es.import_event(\n+ flush_interval, index_name, event_type, event)\n+ if _counter % int(flush_interval) == 0:\n+ sys.stdout.write(\n+ u'Events inserted: {0:d}\\n'.format(_counter))\n+\n+ # Import the remaining events in the queue\n+ es.import_event(flush_interval, index_name, event_type)\n+ self.create_searchindex(timeline_name, index_name)\nclass CreateTimelineFromCsv(CreateTimelineBase):\n@@ -385,21 +351,17 @@ class CreateTimelineFromCsv(CreateTimelineBase):\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n- def read_csv(path):\n- \"\"\"Generator for reading a CSV file.\n-\n- Args:\n- path: Path to the CSV file\n- \"\"\"\n- with open(path, u'rb') as fh:\n- reader = csv.DictReader(fh)\n- for row in reader:\n- yield row\n-\nes.create_index(index_name=index_name, doc_type=event_type)\nfor event in read_csv(file_path):\n- self.add_event(es, flush_interval, index_name, event_type, event)\n- self.finish(es, timeline_name, index_name, event_type)\n+ _counter = es.import_event(\n+ flush_interval, index_name, event_type, event)\n+ if _counter % int(flush_interval) == 0:\n+ sys.stdout.write(\n+ u'Events inserted: {0:d}\\n'.format(_counter))\n+\n+ # Import the remaining events in the queue\n+ es.import_event(flush_interval, index_name, event_type)\n+ self.create_searchindex(timeline_name, index_name)\nif __name__ == '__main__':\n"
}
] | Python | Apache License 2.0 | google/timesketch | Refactor CSV import code |
263,093 | 20.01.2017 11:44:13 | -3,600 | adc7f59b8e02fb25f2072033facb9adbbb441661 | CSV import from upload API | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -872,7 +872,7 @@ class EventAnnotationResource(ResourceMixin, Resource):\nclass UploadFileResource(ResourceMixin, Resource):\n\"\"\"Resource that processes uploaded files.\"\"\"\n@login_required\n- def post(self):\n+ def post(self, sketch_id=None):\n\"\"\"Handles POST request to the resource.\nReturns:\n@@ -884,11 +884,29 @@ class UploadFileResource(ResourceMixin, Resource):\nUPLOAD_ENABLED = current_app.config[u'UPLOAD_ENABLED']\nUPLOAD_FOLDER = current_app.config[u'UPLOAD_FOLDER']\n+ sketch = None\n+ if sketch_id:\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+\nform = UploadFileForm()\nif form.validate_on_submit() and UPLOAD_ENABLED:\nfrom timesketch.lib.tasks import run_plaso\n+ from timesketch.lib.tasks import run_csv\n+\n+ # Map the right task based on the file type\n+ task_directory = {\n+ u'plaso': run_plaso,\n+ u'csv': run_csv\n+ }\n+\nfile_storage = form.file.data\ntimeline_name = form.name.data\n+ _, _extension = os.path.splitext(file_storage.filename)\n+ file_extension = _extension.lstrip(u'.')\n+\n+ # Current user\n+ username = current_user.username\n+\n# We do not need a human readable filename or\n# datastore index name, so we use UUIDs here.\nfilename = unicode(uuid.uuid4().hex)\n@@ -897,23 +915,38 @@ class UploadFileResource(ResourceMixin, Resource):\nfile_path = os.path.join(UPLOAD_FOLDER, filename)\nfile_storage.save(file_path)\n- search_index = SearchIndex.get_or_create(\n+ # Create the search index in the Timesketch database\n+ searchindex = SearchIndex.get_or_create(\nname=timeline_name, description=timeline_name,\nuser=current_user, index_name=index_name)\n- search_index.grant_permission(permission=u'read', user=current_user)\n- search_index.grant_permission(\n+ searchindex.grant_permission(permission=u'read', user=current_user)\n+ searchindex.grant_permission(\npermission=u'write', user=current_user)\n- search_index.grant_permission(\n+ searchindex.grant_permission(\npermission=u'delete', user=current_user)\n- search_index.set_status(u'processing')\n- db_session.add(search_index)\n+ searchindex.set_status(u'processing')\n+ db_session.add(searchindex)\n+ db_session.commit()\n+\n+ if sketch and sketch.has_permission(current_user, u'write'):\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)\ndb_session.commit()\n- run_plaso.apply_async(\n- (file_path, timeline_name, index_name), task_id=index_name)\n+ # Run the task in the background\n+ task = task_directory.get(file_extension)\n+ task.apply_async(\n+ (file_path, timeline_name, index_name, username),\n+ task_id=index_name)\nreturn self.to_json(\n- search_index, status_code=HTTP_STATUS_CODE_CREATED)\n+ searchindex, status_code=HTTP_STATUS_CODE_CREATED)\nelse:\nraise ApiHTTPError(\nmessage=form.errors[u'file'][0],\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/forms.py",
"new_path": "timesketch/lib/forms.py",
"diff": "@@ -192,8 +192,8 @@ class UploadFileForm(BaseForm):\nu'file', validators=[\nFileRequired(),\nFileAllowed(\n- [u'plaso'],\n- u'Unknown file extension. Allowed file extensions: .plaso')])\n+ [u'plaso', u'csv'],\n+ u'Unknown file extension. Allowed file extensions: .plaso or .csv')])\nname = StringField(u'Timeline name', validators=[DataRequired()])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "\"\"\"Celery task for processing Plaso storage files.\"\"\"\nimport os\n+import logging\nimport sys\nfrom flask import current_app\n@@ -26,6 +27,10 @@ except ImportError:\npass\nfrom timesketch import create_celery_app\n+from timesketch.lib.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.utils import read_csv\n+from timesketch.models import db_session\n+from timesketch.models.sketch import SearchIndex\ncelery = create_celery_app()\n@@ -80,3 +85,44 @@ def run_plaso(source_file_path, timeline_name, index_name, username=None):\nreturn dict(counter)\n+\n+@celery.task(track_started=True)\n+def run_csv(source_file_path, timeline_name, index_name):\n+ \"\"\"Create a Celery task for processing a CSV file.\n+\n+ Args:\n+ source_file_path: Path to CSV file.\n+ timeline_name: Name of the Timesketch timeline.\n+ index_name: Name of the datastore index.\n+\n+ Returns:\n+ Dictionary with count of processed events.\n+ \"\"\"\n+ flush_interval = 1000 # events to queue before bulk index\n+ event_type = u'generic_event' # Document type for Elasticsearch\n+\n+ # Log information to Celery\n+ logging.info(u'Index name: {0:s}'.format(index_name))\n+ logging.info(u'Timeline name: {0:s}'.format(timeline_name))\n+ logging.info(u'Flush interval: {0:d}'.format(flush_interval))\n+ logging.info(u'Document type: {0:s}'.format(event_type))\n+\n+ es = ElasticSearchDataStore(\n+ host=current_app.config[u'ELASTIC_HOST'],\n+ port=current_app.config[u'ELASTIC_PORT'])\n+\n+ es.create_index(index_name=index_name, doc_type=event_type)\n+ for event in read_csv(source_file_path):\n+ es.import_event(\n+ flush_interval, index_name, event_type, event)\n+\n+ # Import the remaining events\n+ total_events = es.import_event(flush_interval, index_name, event_type)\n+\n+ # We are done so let's remove the processing status flag\n+ search_index = SearchIndex.query.filter_by(index_name=index_name).first()\n+ search_index.status.remove(search_index.status[0])\n+ db_session.add(search_index)\n+ db_session.commit()\n+\n+ return {u'Events processed': total_events}\n"
}
] | Python | Apache License 2.0 | google/timesketch | CSV import from upload API |
263,093 | 20.01.2017 14:03:23 | -3,600 | 9ba1d4ba47c7ecaafc57758077fe808b2750c383 | Add validation for the CSV header | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -28,7 +28,7 @@ except ImportError:\nfrom timesketch import create_celery_app\nfrom timesketch.lib.datastores.elastic import ElasticSearchDataStore\n-from timesketch.lib.utils import read_csv\n+from timesketch.lib.utils import read_and_validate_csv\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import SearchIndex\n@@ -112,7 +112,7 @@ def run_csv(source_file_path, timeline_name, index_name):\nport=current_app.config[u'ELASTIC_PORT'])\nes.create_index(index_name=index_name, doc_type=event_type)\n- for event in read_csv(source_file_path):\n+ for event in read_and_validate_csv(source_file_path):\nes.import_event(\nflush_interval, index_name, event_type, event)\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "@@ -32,13 +32,27 @@ def random_color():\nreturn u'{0:02X}{1:02X}{2:02X}'.format(rgb[0], rgb[1], rgb[2])\n-def read_csv(path):\n+def read_and_validate_csv(path):\n\"\"\"Generator for reading a CSV file.\nArgs:\npath: Path to the CSV file\n\"\"\"\n+ # Columns that must be present in the CSV file\n+ mandatory_fields = [\n+ u'message', u'timestamp', u'datetime', u'timestamp_desc']\n+\nwith open(path, u'rb') as fh:\nreader = csv.DictReader(fh)\n+ csv_header = reader.fieldnames\n+ missing_fields = []\n+ # Validate the CSV header\n+ for field in mandatory_fields:\n+ if field not in csv_header:\n+ missing_fields.append(field)\n+ if missing_fields:\n+ raise RuntimeError(\n+ u'Missing fields in CSV header: {0:s}'.format(missing_fields))\n+\nfor row in reader:\nyield row\n"
},
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "@@ -31,7 +31,7 @@ from sqlalchemy.exc import IntegrityError\nfrom timesketch import create_app\nfrom timesketch.lib.datastores.elastic import ElasticSearchDataStore\n-from timesketch.lib.utils import read_csv\n+from timesketch.lib.utils import read_and_validate_csv\nfrom timesketch.models import db_session\nfrom timesketch.models import drop_all\nfrom timesketch.models.user import Group\n@@ -350,7 +350,7 @@ class CreateTimelineFromCsv(CreateTimelineBase):\nport=current_app.config[u'ELASTIC_PORT'])\nes.create_index(index_name=index_name, doc_type=event_type)\n- for event in read_csv(file_path):\n+ for event in read_and_validate_csv(file_path):\nevent_counter = es.import_event(\nflush_interval, index_name, event_type, event)\nif event_counter % int(flush_interval) == 0:\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add validation for the CSV header |
263,093 | 20.01.2017 14:39:14 | -3,600 | 67cf00a73de7a44c101876378f81d4df5066d9eb | Rename Elasticsearch class and fix logging lint error | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -52,7 +52,7 @@ 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.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.lib.forms import AddTimelineForm\nfrom timesketch.lib.forms import AggregationForm\n@@ -184,7 +184,7 @@ class ResourceMixin(object):\nReturns:\nInstance of timesketch.lib.datastores.elastic.ElasticSearchDatastore\n\"\"\"\n- return ElasticSearchDataStore(\n+ return ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources_test.py",
"new_path": "timesketch/api/v1/resources_test.py",
"diff": "@@ -193,7 +193,7 @@ class ExploreResourceTest(BaseTest):\n}\n@mock.patch(\n- u'timesketch.api.v1.resources.ElasticSearchDataStore', MockDataStore)\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_search(self):\n\"\"\"Authenticated request to query the datastore.\"\"\"\nself.login()\n@@ -210,7 +210,7 @@ class AggregationResourceTest(BaseTest):\nresource_url = u'/api/v1/sketches/1/aggregation/'\n@mock.patch(\n- u'timesketch.api.v1.resources.ElasticSearchDataStore', MockDataStore)\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_heatmap_aggregation(self):\n\"\"\"Authenticated request to get heatmap aggregation.\"\"\"\nself.login()\n@@ -240,7 +240,7 @@ class EventResourceTest(BaseTest):\n}\n@mock.patch(\n- u'timesketch.api.v1.resources.ElasticSearchDataStore', MockDataStore)\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_get_event(self):\n\"\"\"Authenticated request to get an event from the datastore.\"\"\"\nself.login()\n@@ -250,7 +250,7 @@ class EventResourceTest(BaseTest):\nself.assert200(response)\n@mock.patch(\n- u'timesketch.api.v1.resources.ElasticSearchDataStore', MockDataStore)\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_invalid_index(self):\n\"\"\"\nAuthenticated request to get an event from the datastore, but in the\n@@ -267,7 +267,7 @@ class EventAnnotationResourceTest(BaseTest):\nresource_url = u'/api/v1/sketches/1/event/annotate/'\n@mock.patch(\n- u'timesketch.api.v1.resources.ElasticSearchDataStore', MockDataStore)\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\ndef test_post_annotate_resource(self):\n\"\"\"Authenticated request to create an annotation.\"\"\"\nself.login()\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -32,11 +32,11 @@ es_logger = logging.getLogger(u'elasticsearch')\nes_logger.addHandler(logging.NullHandler())\n-class ElasticSearchDataStore(datastore.DataStore):\n+class ElasticsearchDataStore(datastore.DataStore):\n\"\"\"Implements the datastore.\"\"\"\ndef __init__(self, host=u'127.0.0.1', port=9200):\n\"\"\"Create a Elasticsearch client.\"\"\"\n- super(ElasticSearchDataStore, self).__init__()\n+ super(ElasticsearchDataStore, self).__init__()\nself.client = Elasticsearch([\n{u'host': host, u'port': port}\n])\n@@ -305,6 +305,7 @@ 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, doc_type=event_type, id=event_id,\n@@ -374,7 +375,9 @@ class ElasticSearchDataStore(datastore.DataStore):\n\"\"\"\nif event:\n# Make sure we have decoded strings in the event dict.\n- event = {k.decode('utf8'): v.decode('utf8') for k, v in event.items()}\n+ event = {\n+ k.decode(u'utf8'): v.decode(u'utf8') for k, v in event.items()\n+ }\n# Header needed by Elasticsearch when bulk inserting.\nself.import_events.append({\n@@ -386,7 +389,8 @@ class ElasticSearchDataStore(datastore.DataStore):\nself.import_counter[u'events'] += 1\nif self.import_counter[u'events'] % int(flush_interval) == 0:\nself.client.bulk(\n- index=index_name, doc_type=event_type, body=self.import_events)\n+ index=index_name, doc_type=event_type,\n+ body=self.import_events)\nself.import_events = []\nelse:\nif self.import_events:\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/forms.py",
"new_path": "timesketch/lib/forms.py",
"diff": "@@ -193,7 +193,7 @@ class UploadFileForm(BaseForm):\nFileRequired(),\nFileAllowed(\n[u'plaso', u'csv'],\n- u'Unknown file extension. Allowed file extensions: .plaso or .csv')])\n+ u'Allowed file extensions: .plaso or .csv')])\nname = StringField(u'Timeline name', validators=[DataRequired()])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -27,7 +27,7 @@ except ImportError:\npass\nfrom timesketch import create_celery_app\n-from timesketch.lib.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.utils import read_and_validate_csv\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import SearchIndex\n@@ -87,7 +87,7 @@ def run_plaso(source_file_path, timeline_name, index_name, username=None):\n@celery.task(track_started=True)\n-def run_csv(source_file_path, timeline_name, index_name):\n+def run_csv(source_file_path, timeline_name, index_name, username=None):\n\"\"\"Create a Celery task for processing a CSV file.\nArgs:\n@@ -102,12 +102,13 @@ def run_csv(source_file_path, timeline_name, index_name):\nevent_type = u'generic_event' # Document type for Elasticsearch\n# Log information to Celery\n- logging.info(u'Index name: {0:s}'.format(index_name))\n- logging.info(u'Timeline name: {0:s}'.format(timeline_name))\n- logging.info(u'Flush interval: {0:d}'.format(flush_interval))\n- logging.info(u'Document type: {0:s}'.format(event_type))\n+ logging.info(u'Index name: %s', index_name)\n+ logging.info(u'Timeline name: %s', timeline_name)\n+ logging.info(u'Flush interval: %d', flush_interval)\n+ logging.info(u'Document type: %s', event_type)\n+ logging.info(u'Owner: %s', username)\n- es = ElasticSearchDataStore(\n+ es = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/sketch.py",
"new_path": "timesketch/ui/views/sketch.py",
"diff": "@@ -46,7 +46,7 @@ from timesketch.models.sketch import Timeline\nfrom timesketch.models.sketch import View\nfrom timesketch.models.user import Group\nfrom timesketch.models.user import User\n-from timesketch.lib.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_FORBIDDEN\nfrom timesketch.lib.definitions import HTTP_STATUS_CODE_NOT_FOUND\n@@ -255,7 +255,7 @@ def export(sketch_id):\nquery_dsl = json.loads(view.query_dsl)\nindices = query_filter.get(u'indices', [])\n- datastore = ElasticSearchDataStore(\n+ datastore = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n"
},
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "@@ -30,7 +30,7 @@ from flask_script import prompt_pass\nfrom sqlalchemy.exc import IntegrityError\nfrom timesketch import create_app\n-from timesketch.lib.datastores.elastic import ElasticSearchDataStore\n+from timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.utils import read_and_validate_csv\nfrom timesketch.models import db_session\nfrom timesketch.models import drop_all\n@@ -169,7 +169,7 @@ class AddSearchIndex(Command):\n# pylint: disable=arguments-differ, method-hidden\ndef run(self, name, index, username):\n\"\"\"Create the SearchIndex.\"\"\"\n- es = ElasticSearchDataStore(\n+ es = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\nuser = User.query.filter_by(username=username).first()\n@@ -305,7 +305,7 @@ class CreateTimelineFromJson(CreateTimelineBase):\n\"\"\"\ntimeline_name = unicode(timeline_name.decode(encoding=u'utf-8'))\nindex_name = unicode(index_name.decode(encoding=u'utf-8'))\n- es = ElasticSearchDataStore(\n+ es = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n@@ -345,7 +345,7 @@ class CreateTimelineFromCsv(CreateTimelineBase):\n\"\"\"\ntimeline_name = unicode(timeline_name.decode(encoding=u'utf-8'))\nindex_name = unicode(index_name.decode(encoding=u'utf-8'))\n- es = ElasticSearchDataStore(\n+ es = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n"
}
] | Python | Apache License 2.0 | google/timesketch | Rename Elasticsearch class and fix logging lint error |
263,093 | 24.01.2017 17:57:00 | -3,600 | 921ca919a9f471d3b1a74f14c2ceaf50939dbf75 | Fix bug with using the wrong app context | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -121,6 +121,7 @@ def run_csv(source_file_path, timeline_name, index_name, username=None):\ntotal_events = es.import_event(flush_interval, index_name, event_type)\n# We are done so let's remove the processing status flag\n+ with celery.app.app_context():\nsearch_index = SearchIndex.query.filter_by(index_name=index_name).first()\nsearch_index.status.remove(search_index.status[0])\ndb_session.add(search_index)\n"
}
] | Python | Apache License 2.0 | google/timesketch | Fix bug with using the wrong app context |
263,093 | 25.01.2017 15:52:01 | -3,600 | efa4e620806b43de7e5293cb77e77c3904e00f08 | Remove depricated search feature when adding timelines | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "<thead>\n<tr>\n<th></th>\n- <th width=\"110\">Created by</th>\n- <th width=\"60\">Status</th>\n- <th width=\"80\">Timelines</th>\n- <th width=\"100\">Saved views</th>\n- <th width=\"130px\">Last activity</th>\n+ <th>Created by</th>\n+ <th>Status</th>\n+ <th>Timelines</th>\n+ <th>Views</th>\n+ <th>Last activity</th>\n</tr>\n</thead>\n<tbody>\n<td><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a></td>\n<td>{{ sketch.user.name }}</td>\n<td>{{ sketch.get_status.status }}</td>\n- <td style=\"text-align: center;\"><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">{{ sketch.timelines|count }}</a></td>\n- <td style=\"text-align: center;\"><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\">{{ sketch.get_named_views|count }}</a></td>\n+ <td><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">{{ sketch.timelines|count }}</a></td>\n+ <td><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\">{{ sketch.get_named_views|count }}</a></td>\n<td>{{ sketch.updated_at.strftime('%Y-%m-%d %H:%M') }}</td>\n</tr>\n{% endif %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "<tr>\n<th width=\"50px\"></th>\n<th></th>\n- <th width=\"110px\">Added by</th>\n- <th width=\"130px\">Added</th>\n- <th width=\"130px\">Edit</th>\n+ <th width=>Added by</th>\n+ <th width=>Added</th>\n+ <th width=>Edit</th>\n</tr>\n<tbody>\n{% for timeline in sketch.timelines %}\n<table class=\"table table-hover\">\n<thead>\n<th width=\"30px\"></th>\n- <th></th>\n- <th width=\"100px\">Created</th>\n+ <th>Timeline</th>\n+ <th>Created</th>\n</thead>\n{% for timeline in timelines %}\n{% if timeline.get_status.status == 'new' %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/sketch.py",
"new_path": "timesketch/ui/views/sketch.py",
"diff": "@@ -286,22 +286,12 @@ def timelines(sketch_id):\nReturns:\nTemplate with context.\n\"\"\"\n- TIMELINES_TO_SHOW = 20\n-\nsketch = Sketch.query.get_with_acl(sketch_id)\nsearchindices_in_sketch = [t.searchindex.id for t in sketch.timelines]\n- query = request.args.get(u'q', None)\nindices = SearchIndex.all_with_acl(\ncurrent_user).order_by(\ndesc(SearchIndex.created_at)).filter(\nnot_(SearchIndex.id.in_(searchindices_in_sketch)))\n- filtered = False\n-\n- if query:\n- indices = indices.filter(SearchIndex.name.contains(query)).limit(500)\n- filtered = True\n- if not filtered:\n- indices = indices.limit(TIMELINES_TO_SHOW)\n# Setup the form\nform = AddTimelineForm()\n@@ -324,7 +314,7 @@ def timelines(sketch_id):\nreturn render_template(\nu'sketch/timelines.html', sketch=sketch, timelines=indices.all(),\n- form=form, filtered=filtered)\n+ form=form)\n@sketch_views.route(\n"
}
] | Python | Apache License 2.0 | google/timesketch | Remove depricated search feature when adding timelines |
263,093 | 25.01.2017 17:07:25 | -3,600 | 2c431e5df57a5bf19ba607608bc40b062f138a2b | Roll back task fix. Not needed anymore. | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -94,6 +94,7 @@ def run_csv(source_file_path, timeline_name, index_name, username=None):\nsource_file_path: Path to CSV file.\ntimeline_name: Name of the Timesketch timeline.\nindex_name: Name of the datastore index.\n+ username: Username of the user who will own the timeline.\nReturns:\nDictionary with count of processed events.\n@@ -121,7 +122,6 @@ def run_csv(source_file_path, timeline_name, index_name, username=None):\ntotal_events = es.import_event(flush_interval, index_name, event_type)\n# We are done so let's remove the processing status flag\n- with celery.app.app_context():\nsearch_index = SearchIndex.query.filter_by(index_name=index_name).first()\nsearch_index.status.remove(search_index.status[0])\ndb_session.add(search_index)\n"
}
] | Python | Apache License 2.0 | google/timesketch | Roll back task fix. Not needed anymore. |
263,093 | 25.01.2017 22:11:06 | -3,600 | e8f0ee444b32246efd805bbcc25a95313a9747d1 | Add app context to db operations in CSV task | [
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -190,5 +190,4 @@ def create_celery_app():\nreturn TaskBase.__call__(self, *args, **kwargs)\ncelery.Task = ContextTask\n- celery.app = app\nreturn celery\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/tasks.py",
"new_path": "timesketch/lib/tasks.py",
"diff": "@@ -26,6 +26,7 @@ try:\nexcept ImportError:\npass\n+from timesketch import create_app\nfrom timesketch import create_celery_app\nfrom timesketch.lib.datastores.elastic import ElasticsearchDataStore\nfrom timesketch.lib.utils import read_and_validate_csv\n@@ -101,6 +102,7 @@ def run_csv(source_file_path, timeline_name, index_name, username=None):\n\"\"\"\nflush_interval = 1000 # events to queue before bulk index\nevent_type = u'generic_event' # Document type for Elasticsearch\n+ app = create_app()\n# Log information to Celery\nlogging.info(u'Index name: %s', index_name)\n@@ -122,7 +124,9 @@ def run_csv(source_file_path, timeline_name, index_name, username=None):\ntotal_events = es.import_event(flush_interval, index_name, event_type)\n# We are done so let's remove the processing status flag\n- search_index = SearchIndex.query.filter_by(index_name=index_name).first()\n+ with app.app_context():\n+ search_index = SearchIndex.query.filter_by(\n+ index_name=index_name).first()\nsearch_index.status.remove(search_index.status[0])\ndb_session.add(search_index)\ndb_session.commit()\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add app context to db operations in CSV task |
263,093 | 27.01.2017 09:14:13 | -3,600 | c5c894cf28dc448d02f28641b94919c7720880a0 | List instead of table | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -534,3 +534,16 @@ h3.editable {\nbottom: 0;\nleft: 0;\n}\n+\n+ul.content-list {\n+ list-style: none;\n+}\n+\n+ul.content-list>li {\n+ padding: 10px 0;\n+ border-bottom: 1px solid #eee;\n+ display: block;\n+ margin: 0;\n+}\n+\n+ul.content-list>li:last-child { border-bottom: none; }\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "</div>\n<br><br><br>\n- {% if sketches.all() or query %}\n+ {% if sketches.all() %}\n- <div class=\"card\">\n+ <div class=\"card\" style=\"padding: 40px;\">\n+ <ul class=\"content-list\">\n+ {% for sketch in sketches.all() %}\n+ <li class=\"content-item\">\n+ <div class=\"pull-right\" style=\"margin-top:10px;\">\n+ <span style=\"margin-right:10px;\"><i class=\"fa fa-clock-o\"></i> {{ sketch.timelines|count }}</span>\n+ <span><i class=\"fa fa-eye\"></i> {{ sketch.get_named_views|count }}</span>\n+ </div>\n+ <div class=\"title\">\n+ <a style=\"text-decoration: none; font-weight: 600;font-size: 1.1em;\" href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a>\n+ <br>\n+ Created {{ sketch.created_at.strftime('%Y-%m-%d') }} by {{ sketch.user.username }}\n+ </div>\n+ </li>\n+ {% endfor %}\n+ </ul>\n+\n+\n+ <!--\n<table class=\"table table-hover table-striped\">\n<thead>\n<tr>\n{% endfor %}\n</tbody>\n</table>\n+ -->\n</div>\n{% endif %}\n<div class=\"col-md-1\"></div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | List instead of table |
263,093 | 30.01.2017 10:04:28 | -3,600 | a193ef7befc58bd5a330addea8c13517186f1edd | New navigation experiment | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -20,11 +20,12 @@ i {\nbody {\nbackground: #f9f9f9;\n+ background: #fff;\n}\nheader {\nwidth: 100%;\n- height: 55px;\n+ height: 75px;\nbackground: #34495e;\nposition: fixed;\ntop:0;\n@@ -32,6 +33,14 @@ header {\npadding:11px 21px 11px 11px;\n}\n+#sub-header {\n+ background: #3a5a78;\n+ min-height:200px;\n+ padding-top:85px;\n+ color:#fff;\n+\n+}\n+\ntable {\ntable-layout: fixed;\nword-wrap: break-word;\n@@ -45,7 +54,7 @@ table {\nwidth:210px;\nheight:55px;\npadding:20px;\n- padding-top:15px;\n+ padding-top:25px;\nbackground: #34495e;\nposition: fixed;\ntop:0;\n@@ -67,7 +76,7 @@ table {\nmargin-bottom: 20px;\nbackground: #fff;\npadding: 20px;\n- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15)\n+ #box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15)\n}\n.card-header {\n@@ -540,10 +549,14 @@ ul.content-list {\n}\nul.content-list>li {\n- padding: 10px 0;\n+ padding: 15px;\nborder-bottom: 1px solid #eee;\ndisplay: block;\nmargin: 0;\n}\n+ul.content-list>li:hover {\n+ background: #fcfcfc;\n+}\n+\nul.content-list>li:last-child { border-bottom: none; }\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -63,12 +63,13 @@ limitations under the License.\n</a>\n<header>\n<div ts-butterbar id=\"butterbar\">Loading..</div>\n- <div class=\"pull-right\" style=\"margin-top:5px;margin-right:30px;\">\n+ <div class=\"pull-right\" style=\"margin-top:15px;margin-right:30px;\">\n{% block header_left %}{% endblock %}\n<span style=\"color:#fff;margin-right:20px;margin-left: 20px;\">{{ current_user.username }}</span>\n<a style=\"color:#fff;\" href=\"/logout/\">Logout</a>\n</div>\n</header>\n+ {% block subheader %}{% endblock %}\n<div id=\"main\">\n{% block main %}{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n+\n<div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-10\" style=\"margin-top: 70px;\">\n+ <!--\n<div class=\"pull-right\">\n<div class=\"btn-group\">\n<div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n</div>\n</div>\n<br><br><br>\n+ -->\n{% if sketches.all() %}\n- <div class=\"card\" style=\"padding: 40px;\">\n+ <div>\n<ul class=\"content-list\">\n{% for sketch in sketches.all() %}\n<li class=\"content-item\">\n<div class=\"pull-right\" style=\"margin-top:10px;\">\n+ <span style=\"margin-right:20px;\">{{ sketch.user.username }}</span>\n<span style=\"margin-right:10px;\"><i class=\"fa fa-clock-o\"></i> {{ sketch.timelines|count }}</span>\n<span><i class=\"fa fa-eye\"></i> {{ sketch.get_named_views|count }}</span>\n+\n</div>\n<div class=\"title\">\n- <a style=\"text-decoration: none; font-weight: 600;font-size: 1.1em;\" href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a>\n+ <a style=\"text-decoration: none; font-weight: 500;font-size: 1.2em;\" href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a>\n<br>\n- Created {{ sketch.created_at.strftime('%Y-%m-%d') }} by {{ sketch.user.username }}\n+ Last activity {{ sketch.updated_at.strftime('%Y-%m-%d') }}\n</div>\n</li>\n{% endfor %}\n-->\n</div>\n{% endif %}\n- <div class=\"col-md-1\"></div>\n</div>\n+ <div class=\"col-md-1\"></div>\n</div>\n{% endif %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "{% extends \"base.html\" %}\n+\n+{% block subheader %}\n+ <div id=\"sub-header\">\n+\n+ <div style=\"padding:20px;padding-left:35px; padding-right: 35px;\">\n+\n+ <div class=\"pull-right\" style=\"margin-right:10px;margin-top:10px;\">\n+ <div class=\"btn-group\">\n+ {% if sketch.has_permission(user=current_user, permission='write') %}\n+ <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#edit-sketch-modal\"><i class=\"fa fa-pencil\"></i></button>\n+ <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#status-modal\">Status: {{ sketch.get_status.status|title }}</button>\n+ {% endif %}\n+\n+ {% if sketch.has_permission(user=current_user, permission='delete') %}\n+ <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#trash-modal\"><i class=\"fa fa-trash\"></i></button>\n+ {% endif %}\n+\n+ <button data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n+ {% if sketch.is_public %}\n+ <i class=\"fa fa-globe\"></i> Share</button>\n+ {% else %}\n+ <i class=\"fa fa-lock\"></i> Share</button>\n+ {% endif %}\n+ </div>\n+ </div>\n+\n+ <h3>{{ sketch.name }}</h3>\n+\n+ <p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n+\n+ {% if sketch.collaborators or sketch.groups %}\n+ <br>\n+ <span style=\"margin-right:10px;\">Shared with</span>\n+ {% for group in sketch.groups %}\n+ <span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with group {{ group.name }}\"><i class=\"fa fa-group\"></i>{{ group.name }}</span>\n+ {% endfor %}\n+ {% for collaborator in sketch.collaborators %}\n+ <span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with user {{ collaborator.username }}\"><i class=\"fa fa-user\"></i>{{ collaborator.username }}</span>\n+ {% endfor %}\n+ {% endif %}\n+ </div>\n+\n+ </div>\n+\n+{% endblock %}\n+\n{% block main %}\n<div class=\"modal\" id=\"new-sketch-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n</ul>\n<div class=\"container\">\n- <div class=\"row\">\n- <div class=\"col-md-12\">\n- <div class=\"card card-top\">\n- <div class=\"row\">\n- <div class=\"col-md-12\">\n- <div class=\"pull-right\" style=\"margin-right:10px;\">\n- <div class=\"btn-group\">\n- {% if sketch.has_permission(user=current_user, permission='write') %}\n- <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#edit-sketch-modal\"><i class=\"fa fa-pencil\"></i></button>\n- <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#status-modal\">Status: {{ sketch.get_status.status|title }}</button>\n- {% endif %}\n-\n- {% if sketch.has_permission(user=current_user, permission='delete') %}\n- <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#trash-modal\"><i class=\"fa fa-trash\"></i></button>\n- {% endif %}\n-\n- <button data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n- {% if sketch.is_public %}\n- <i class=\"fa fa-globe\"></i> Share</button>\n- {% else %}\n- <i class=\"fa fa-lock\"></i> Share</button>\n- {% endif %}\n- </div>\n- </div>\n-\n- <h3>{{ sketch.name }}</h3>\n- <p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n-\n- {% if sketch.collaborators or sketch.groups %}\n- <br>\n- <span style=\"margin-right:10px;\">Shared with</span>\n- {% for group in sketch.groups %}\n- <span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with group {{ group.name }}\"><i class=\"fa fa-group\"></i>{{ group.name }}</span>\n- {% endfor %}\n- {% for collaborator in sketch.collaborators %}\n- <span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with user {{ collaborator.username }}\"><i class=\"fa fa-user\"></i>{{ collaborator.username }}</span>\n- {% endfor %}\n- {% endif %}\n-\n- </div>\n- </div>\n- </div>\n- </div>\n- </div>\n{% if not sketch.timelines %}\n<div class=\"card\">\n{% else %}\n<!-- Single metric info cards -->\n+ <!--\n<div class=\"row\">\n<div class=\"col-md-4\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n</div>\n</div>\n</div>\n+ -->\n<div class=\"row\">\n<div class=\"col-md-6\">\n<ts-story-list sketch-id=\"{{ sketch.id }}\"></ts-story-list>\n</div>\n</div>\n-\n+ {% endif %}\n</div>\n</div>\n- {% endif %}\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | New navigation experiment |
263,093 | 01.02.2017 11:18:35 | -3,600 | 0fad9c65ab2d1a879728405f3f8aacf11e2f7077 | Make empty sketch info consistent | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -37,12 +37,6 @@ header {\nmargin-left:200px;\n}\n-#subheader {\n- background: #fff;\n- height:85px;\n- padding-top:85px;\n-}\n-\ntable {\ntable-layout: fixed;\nword-wrap: break-word;\n@@ -419,7 +413,7 @@ rect.bordered {\nmargin-top:-12px;\nborder: none;\nfont-weight: normal;\n- background-color: transparent;\n+ background: transparent;\nmargin-right:7px;\nborder-radius: 0;\n}\n@@ -433,7 +427,7 @@ rect.bordered {\nfont-weight: bold;\nborder:none;\ncursor: pointer;\n- background: #2b3e51;\n+ background: #3d5267;\n}\n.nav-tabs {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -67,7 +67,7 @@ limitations under the License.\n</div>\n<div ts-butterbar id=\"butterbar\">Loading..</div>\n- <div class=\"pull-right\" style=\"margin-top:15px;margin-right:30px;\">\n+ <div class=\"pull-right\" style=\"margin-top:10px;margin-right:30px;\">\n{% block header_left %}{% endblock %}\n<span style=\"color:#fff;margin-right:20px;margin-left: 20px;\">{{ current_user.username }}</span>\n<a style=\"color:#fff;\" href=\"/logout/\">Logout</a>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "<div class=\"container\">\n- {% if not sketch.timelines %}\n-\n- <div class=\"col-md-12\">\n- <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- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\n- </div>\n- </div>\n- </div>\n-\n- {% else %}\n-\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding-left:30px; padding-bottom: 30px;\">\n-\n<div class=\"pull-right\" style=\"margin-right:10px;margin-top:10px;\">\n<div class=\"btn-group\">\n{% if sketch.has_permission(user=current_user, permission='write') %}\n{% endif %}\n</div>\n</div>\n-\n<h3 style=\"margin-top:10px;\">{{ sketch.name }}</h3>\n-\n<p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n-\n{% if sketch.collaborators or sketch.groups %}\n<br>\n<span style=\"margin-right:10px;\">Shared with</span>\n</div>\n</div>\n+ {% if not sketch.timelines %}\n+\n+ <div class=\"col-md-12\">\n+ <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+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\n+ </div>\n+ </div>\n+ </div>\n+\n+ {% else %}\n<!-- Single metric info cards -->\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "{% endblock %}\n{% block main %}\n+ {% if not sketch.timelines %}\n+ <div class=\"col-md-12\">\n+ <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+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\n+ </div>\n+ </div>\n+ </div>\n+ {% else %}\n<div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"card\">\n</div>\n</div>\n</div>\n+ {% endif %}\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% block main %}\n<div class=\"container\">\n<div class=\"col-md-12\">\n-\n{% if sketch.timelines %}\n<div class=\"card\">\n<h4>Timelines</h4>\n</table>\n</div>\n{% endif %}\n-\n</div>\n<div class=\"col-md-12\">\n{% if sketch.has_permission(current_user, 'write') %}\n{{ form.csrf_token }}\n<button class=\"btn btn-success\" type=\"submit\"><i class=\"fa fa-plus\"></i> Add to sketch</button>\n</form>\n-\n{% endif %}\n</div>\n{% endif %}\n</div>\n</div>\n- </div>\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "{% endblock %}\n{% block main %}\n+ {% if not sketch.timelines %}\n+ <div class=\"col-md-12\">\n+ <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+ <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\n+ </div>\n+ </div>\n+ </div>\n+ {% else %}\n<div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"card\">\n</div>\n</div>\n</div>\n-\n+ {% endif %}\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make empty sketch info consistent |
263,093 | 01.02.2017 11:56:10 | -3,600 | 7aec6311921e8f8276359bdb9bde3f26ec335ea5 | Make most screen 10 columns wide | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "<div class=\"container\">\n<div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\" style=\"margin-top: 70px;\">\n+ <div class=\"col-md-10\">\n<div class=\"card\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n</div>\n- <div class=\"container\">\n+ <div class=\"col-md-1\"></div>\n+\n+ <div class=\"col-md-10\">\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding-left:30px; padding-bottom: 30px;\">\n{% else %}\n<!-- Single metric info cards -->\n-\n-\n<div class=\"col-md-6\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n<div class=\"text-center\">\n</div>\n</div>\n-\n<div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height:300px;max-height:620px;overflow-y: auto\">\n</div>\n{% endif %}\n+\n</div>\n+ <div class=\"col-md-1\"></div>\n+\n+\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "{% endblock %}\n{% block main %}\n+\n+ <div class=\"col-md-1\"></div>\n+\n+ <div class=\"col-md-10\">\n+\n{% if not sketch.timelines %}\n<div class=\"col-md-12\">\n<div class=\"card\">\n</div>\n</div>\n{% endif %}\n+ <div class=\"col-md-10\">\n+\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make most screen 10 columns wide |
263,093 | 02.02.2017 10:03:44 | -3,600 | 6c6ed9cb5d805fa4e92e9c6d7a072c91ba82f6fb | Make pages consistent | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search.html",
"new_path": "timesketch/ui/static/components/explore/explore-search.html",
"diff": "</ts-filter>\n</div>\n- <div ng-show=\"showCharts\">\n-\n- <ul class=\"nav nav-tabs\" role=\"tablist\">\n- <li role=\"presentation\" class=\"active\"><a href=\"#heatmap\" aria-controls=\"heatmap\" role=\"tab\" data-toggle=\"tab\"><i class=\"fa fa-th\"></i> Heatmap</a></li>\n- <li role=\"presentation\"><a href=\"#histogram-tab\" aria-controls=\"histogram-tab\" role=\"tab\" data-toggle=\"tab\"><i class=\"fa fa-bar-chart\"></i> Histogram</a></li>\n+ <div ng-show=\"showCharts\" style=\"margin-top:35px;\">\n+ <ul class=\"nav nav-tabs nav-tabs-light\" role=\"tablist\">\n+ <li role=\"presentation\" class=\"active\"><a href=\"#heatmap\" aria-controls=\"heatmap\" role=\"tab\" data-toggle=\"tab\"><span class=\"tab-filler\"></span><i class=\"fa fa-th\"></i> Heatmap</a></li>\n+ <li role=\"presentation\"><a href=\"#histogram-tab\" aria-controls=\"histogram-tab\" role=\"tab\" data-toggle=\"tab\"><span class=\"tab-filler\"></span><i class=\"fa fa-bar-chart\"></i> Histogram</a></li>\n</ul>\n<div class=\"container\">\n<div class=\"row\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"diff": "-<h4 class=\"pull-left\">Views</h4>\n-<a ng-if=\"!showDelete\" href=\"/sketch/{{ sketchId }}/views/\" class=\"btn btn-default btn-sm pull-right\" style=\"margin-top:-5px;\"><i class=\"fa fa-edit\"></i> Manage views</a>\n+<h3 class=\"pull-left\">Views</h3>\n+<a ng-if=\"!showDelete\" href=\"/sketch/{{ sketchId }}/views/\" class=\"btn btn-default pull-right\" style=\"margin-top:-5px;\"><i class=\"fa fa-edit\"></i> Manage views</a>\n<br><br>\n<span ng-hide=\"savedViews.length\">No saved views</span>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "-<h4 class=\"pull-left\">Stories</h4>\n-<button class=\"btn btn-success btn-sm pull-right\" style=\"margin-top:-5px;\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Story</button>\n+<h3 style=\"margin-left:15px;\" class=\"pull-left\">Stories</h3>\n+<button class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Write a story</button>\n<br><br>\n+\n<div ng-if=\"stories.length < 1\">\nThere are no stories written yet\n</div>\n<br>\n+\n<div ng-if=\"stories.length > 0\">\n- <table ng-if=\"stories.length > 0\" class=\"table table-hover table-striped\">\n- <thead>\n- <tr>\n- <th>Title</th>\n- <th>Author</th>\n- <th>Created</th>\n- </tr>\n- </thead>\n- <tbody>\n- <tr ng-repeat=\"story in stories\">\n- <td><a href=\"/sketch/{{ sketchId }}/stories/{{ story.id }}/\"><b>{{ story.title||'Untitled story' }}</b></a></td>\n- <td>{{ story.user.username }}</td>\n- <td>{{ story.created_at }}</td>\n- </tr>\n- </table>\n+ <ul class=\"content-list\">\n+ <li class=\"content-item\" ng-repeat=\"story in stories\">\n+ <div class=\"pull-right\" style=\"margin-top:10px;\">\n+ <span>{{ story.created_at }}</span>\n+ </div>\n+ <div class=\"title\">\n+ <a href=\"/sketch/{{ sketchId }}/stories/{{ story.id }}/\"><b>{{ story.title||'Untitled story' }}</b></a>\n+ <br>\n+ Created by {{ story.user.username }}\n+ </div>\n+ </li>\n+ </ul>\n</div>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -20,7 +20,6 @@ i {\nbody {\nbackground: #f9f9f9;\n- font-family: \"Roboto\", Helvetica, Arial, sans-serif;\n}\nheader {\n@@ -407,6 +406,15 @@ rect.bordered {\nstroke-width: 1px;\n}\n+.nav-tabs {\n+ border: none;\n+ letter-spacing: .06rem;\n+}\n+\n+.nav-tabs>li>a:hover {\n+ background: transparent;\n+}\n+\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\ncolor:#d1d1d1;\npadding: 23px 15px 23px 15px;\n@@ -418,8 +426,20 @@ rect.bordered {\nborder-radius: 0;\n}\n-.nav-tabs>li>a:hover {\n- background: transparent;\n+.nav-tabs-light>li>a, .nav-tabs-light>li>a:hover {\n+ color:#333;\n+ padding: 15px 15px 15px 15px;\n+ margin-top:-12px;\n+}\n+\n+.nav-tabs-light>li.active .tab-filler {\n+ width:100%;\n+ height:3px;\n+ background-color:#fff;\n+ position:absolute;\n+ bottom:0;\n+ left:0;\n+ z-index:10;\n}\n.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\n@@ -430,9 +450,12 @@ rect.bordered {\nbackground: #3d5267;\n}\n-.nav-tabs {\n- border: none;\n- letter-spacing: .06rem;\n+.nav-tabs-light>li.active>a, .nav-tabs-light>li.active>a:hover, .nav-tabs-light>li.active>a:focus {\n+ color:#333;\n+ font-weight: bold;\n+ cursor: pointer;\n+ background: #fff;\n+ box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);\n}\n.timeline-bubble {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "<form action=\"{{ url_for('home_views.home') }}\" method=\"post\">\n{{ form.name }}\n{{ form.description }}\n- <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-plus\"></i> Create new sketch</button>\n+ <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-plus\"></i> New sketch</button>\n{{ form.csrf_token }}\n</form>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n<div class=\"col-md-1\"></div>\n-\n<div class=\"col-md-10\">\n<div class=\"col-md-12\">\n</div>\n<div class=\"col-md-6\">\n- <div class=\"card\" style=\"min-height:300px;max-height:620px;overflow-y: auto\">\n+ <div class=\"card\" style=\"min-height:300px;\">\n- <h4 class=\"pull-left\">Timelines</h4>\n+ <h3 class=\"pull-left\">Timelines</h3>\n{% if sketch.has_permission(current_user, 'write') %}\n- <a class=\"btn btn-success btn-sm pull-right\" style=\"margin-top:-5px;\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Timeline</a>\n+ <a class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Timeline</a>\n{% endif %}\n<br><br>\n{% if not sketch.timelines %}\n<thead>\n<tr>\n<th>Timeline</th>\n- <th>Added by</th>\n<th>Added</th>\n</tr>\n<tbody>\n<div style=\"height:5px;\"></div>\n</td>\n- <td>{{ timeline.user.name }}</td>\n<td>\n<div style=\"margin-top:5px;\">{{ timeline.created_at.strftime('%Y-%m-%d') }}</div>\n</td>\n</div>\n<div class=\"col-md-6\">\n- <div class=\"card\" style=\"min-height: 300px;max-height:300px;overflow-y: auto\">\n+ <div class=\"card\" style=\"min-height: 300px;\">\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\"></ts-saved-view-list>\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "{% block main %}\n<div class=\"col-md-1\"></div>\n-\n<div class=\"col-md-10\">\n{% if not sketch.timelines %}\n{% else %}\n<div class=\"container\">\n<div class=\"col-md-12\">\n- <div class=\"card\">\n+ <div class=\"card\" style=\"padding:30px;\">\n{% if story %}\n<ts-story sketch-id=\"{{ sketch.id }}\" story-id=\"{{ story.id }}\"></ts-story>\n{% else %}\n</div>\n</div>\n{% endif %}\n+ </div>\n<div class=\"col-md-10\">\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% endblock %}\n{% block main %}\n+\n+ <div class=\"col-md-1\"></div>\n+ <div class=\"col-md-10\">\n+\n<div class=\"container\">\n<div class=\"col-md-12\">\n{% if sketch.timelines %}\n- <div class=\"card\">\n- <h4>Timelines</h4>\n+ <div class=\"card\" style=\"padding:30px;\">\n+ <h3>Timelines</h3>\n<table class=\"table table-hover\">\n<thead>\n<tr>\n<th width=\"50px\"></th>\n<th></th>\n- <th width=>Added by</th>\n- <th width=>Added</th>\n- <th width=>Edit</th>\n+ <th>Added by</th>\n+ <th>Added</th>\n+ <th></th>\n</tr>\n<tbody>\n{% for timeline in sketch.timelines %}\n{% endif %}\n</div>\n</div>\n+\n+ </div>\n+ <div class=\"col-md-10\">\n+\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "{% endblock %}\n{% block main %}\n+\n+ <div class=\"col-md-1\"></div>\n+ <div class=\"col-md-10\">\n+\n{% if not sketch.timelines %}\n<div class=\"col-md-12\">\n<div class=\"card\">\n{% else %}\n<div class=\"container\">\n<div class=\"col-md-12\">\n- <div class=\"card\">\n+ <div class=\"card\" style=\"padding:30px;\">\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\" show-search-templates=\"true\" show-delete=\"true\"></ts-saved-view-list>\n</div>\n</div>\n</div>\n{% endif %}\n+\n+ </div>\n+ <div class=\"col-md-10\">\n+\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make pages consistent |
263,093 | 03.02.2017 10:14:20 | -3,600 | 189e5c5ef3645fd8731f53e0f6ca3af7b26c9531 | Make upload to sketch possible | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -872,7 +872,7 @@ class EventAnnotationResource(ResourceMixin, Resource):\nclass UploadFileResource(ResourceMixin, Resource):\n\"\"\"Resource that processes uploaded files.\"\"\"\n@login_required\n- def post(self, sketch_id=None):\n+ def post(self):\n\"\"\"Handles POST request to the resource.\nReturns:\n@@ -884,10 +884,6 @@ class UploadFileResource(ResourceMixin, Resource):\nUPLOAD_ENABLED = current_app.config[u'UPLOAD_ENABLED']\nUPLOAD_FOLDER = current_app.config[u'UPLOAD_FOLDER']\n- sketch = None\n- if sketch_id:\n- sketch = Sketch.query.get_with_acl(sketch_id)\n-\nform = UploadFileForm()\nif form.validate_on_submit() and UPLOAD_ENABLED:\nfrom timesketch.lib.tasks import run_plaso\n@@ -899,11 +895,16 @@ class UploadFileResource(ResourceMixin, Resource):\nu'csv': run_csv\n}\n+ sketch_id = form.sketch_id.data\nfile_storage = form.file.data\ntimeline_name = form.name.data\n_, _extension = os.path.splitext(file_storage.filename)\nfile_extension = _extension.lstrip(u'.')\n+ sketch = None\n+ if sketch_id > 0:\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+\n# Current user\nusername = current_user.username\n@@ -1119,7 +1120,11 @@ class CountEventsResource(ResourceMixin, Resource):\nNumber of events in JSON (instance of flask.wrappers.Response)\n\"\"\"\nsketch = Sketch.query.get_with_acl(sketch_id)\n- indices = [i.searchindex.index_name for i in sketch.timelines]\n+ indices = []\n+ for timeline in sketch.timelines:\n+ if not timeline.searchindex.get_status.status == u'processing':\n+ indices.append(timeline.searchindex.index_name)\n+ #indices = [i.searchindex.index_name for i in sketch.timelines]\ncount = self.datastore.count(indices)\nmeta = dict(count=count)\nschema = dict(meta=meta, objects=[])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/forms.py",
"new_path": "timesketch/lib/forms.py",
"diff": "@@ -195,6 +195,7 @@ class UploadFileForm(BaseForm):\n[u'plaso', u'csv'],\nu'Allowed file extensions: .plaso or .csv')])\nname = StringField(u'Timeline name', validators=[DataRequired()])\n+ sketch_id = IntegerField(u'Sketch ID', validators=[Optional()])\nclass StoryForm(BaseForm):\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/api/api-service.js",
"new_path": "timesketch/ui/static/components/api/api-service.js",
"diff": "@@ -298,11 +298,12 @@ limitations under the License.\nreturn $http.post(resource_url, params)\n};\n- this.uploadFile = function(file, name) {\n+ this.uploadFile = function(file, name, sketch_id) {\n/**\n* Handles the upload form and send a POST request to the server.\n* @param file - File object.\n* @param name - Name if the timeline to be created.\n+ * @param sketch_id - (optional) Sketch id to add the timeline to.\n* @returns A $http promise with two methods, success and error.\n*/\nvar resource_url = '/api/v1/upload/';\n@@ -319,6 +320,7 @@ limitations under the License.\nvar formData = new FormData();\nformData.append('file', file);\nformData.append('name', name);\n+ formData.append('sketch_id', sketch_id);\nreturn $http.post(resource_url, formData, config)\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"new_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"diff": "return {\nrestrict: 'E',\ntemplateUrl: '/static/components/core/core-upload.html',\n- scope: {},\n+ scope: {\n+ sketchId: '=?'\n+ },\ncontroller: function($scope) {\n$scope.uploadForm = {};\n$scope.clearForm = function() {\n$scope.uploadForm = {}\n};\n+ if (!$scope.sketchId) {\n+ $scope.sketchId = 0;\n+ }\n$scope.uploadFile = function() {\nif ($scope.uploadForm.name) {\n- timesketchApi.uploadFile($scope.uploadForm.file, $scope.uploadForm.name).success(function () {\n+ timesketchApi.uploadFile($scope.uploadForm.file, $scope.uploadForm.name, $scope.sketchId).success(function () {\n$scope.uploadForm = {}\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "<div class=\"col-md-10\">\n<div class=\"card\">\n-\n- <!--\n- <div class=\"pull-right\">\n- <div class=\"btn-group\">\n- <div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n- <form action=\"{{ url_for('home_views.home') }}\" method=\"post\">\n- {{ form.name }}\n- {{ form.description }}\n- <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-plus\"></i> Create new sketch</button>\n- {{ form.csrf_token }}\n- </form>\n- </div>\n- {% if upload_enabled %}\n- <ts-core-upload class=\"pull-left\" style=\"margin-left:5px;margin-top: -6px;\"></ts-core-upload>\n- {% endif %}\n-\n- </div>\n- </div>\n- <br><br><br>\n- -->\n-\n{% if sketches.all() %}\n-\n<div>\n<ul class=\"content-list\">\n{% for sketch in sketches.all() %}\n<span style=\"margin-right:20px;\">{{ sketch.user.username }}</span>\n<span style=\"margin-right:10px;\"><i class=\"fa fa-clock-o\"></i> {{ sketch.timelines|count }}</span>\n<span><i class=\"fa fa-eye\"></i> {{ sketch.get_named_views|count }}</span>\n-\n</div>\n<div class=\"title\">\n<a style=\"text-decoration: none; font-weight: 500;font-size: 1.2em;\" href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a>\n</li>\n{% endfor %}\n</ul>\n-\n-\n- <!--\n- <table class=\"table table-hover table-striped\">\n- <thead>\n- <tr>\n- <th></th>\n- <th>Created by</th>\n- <th>Status</th>\n- <th>Timelines</th>\n- <th>Views</th>\n- <th>Last activity</th>\n- </tr>\n- </thead>\n- <tbody>\n-\n- {% if not sketches.all() and query %}\n- <tr><td colspan=\"6\" style=\"text-align: center;\">No results</td></tr>\n- {% endif %}\n-\n- {% for sketch in sketches.all() %}\n- {% if sketch.get_status.status == 'closed' and not query %}\n- {% else %}\n- <tr>\n- <td><a href=\"{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}\">{{ sketch.name }}</a></td>\n- <td>{{ sketch.user.name }}</td>\n- <td>{{ sketch.get_status.status }}</td>\n- <td><a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">{{ sketch.timelines|count }}</a></td>\n- <td><a href=\"{{ url_for('sketch_views.views', sketch_id=sketch.id) }}\">{{ sketch.get_named_views|count }}</a></td>\n- <td>{{ sketch.updated_at.strftime('%Y-%m-%d %H:%M') }}</td>\n- </tr>\n- {% endif %}\n- {% endfor %}\n- </tbody>\n- </table>\n- -->\n</div>\n{% endif %}\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "<span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with user {{ collaborator.username }}\"><i class=\"fa fa-user\"></i>{{ collaborator.username }}</span>\n{% endfor %}\n{% endif %}\n+\n+ <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+\n</div>\n</div>\n+\n+\n{% if not sketch.timelines %}\n<div class=\"col-md-12\">\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make upload to sketch possible |
263,093 | 03.02.2017 16:02:11 | -3,600 | 5f8bacce2854b2e34bbefe8b9b987736f5d4e21e | Add import button in sketch | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -902,7 +902,7 @@ class UploadFileResource(ResourceMixin, Resource):\nfile_extension = _extension.lstrip(u'.')\nsketch = None\n- if sketch_id > 0:\n+ if sketch_id:\nsketch = Sketch.query.get_with_acl(sketch_id)\n# Current user\n@@ -1120,11 +1120,14 @@ class CountEventsResource(ResourceMixin, Resource):\nNumber of events in JSON (instance of flask.wrappers.Response)\n\"\"\"\nsketch = Sketch.query.get_with_acl(sketch_id)\n+\n+ # Exclude any timeline that is processing, i.e. not ready yet.\nindices = []\nfor timeline in sketch.timelines:\n- if not timeline.searchindex.get_status.status == u'processing':\n+ if timeline.searchindex.get_status.status == u'processing':\n+ continue\nindices.append(timeline.searchindex.index_name)\n- #indices = [i.searchindex.index_name for i in sketch.timelines]\n+\ncount = self.datastore.count(indices)\nmeta = dict(count=count)\nschema = dict(meta=meta, objects=[])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/api/api-service.js",
"new_path": "timesketch/ui/static/components/api/api-service.js",
"diff": "@@ -298,12 +298,12 @@ limitations under the License.\nreturn $http.post(resource_url, params)\n};\n- this.uploadFile = function(file, name, sketch_id) {\n+ this.uploadFile = function(file, name, sketchId) {\n/**\n* Handles the upload form and send a POST request to the server.\n* @param file - File object.\n* @param name - Name if the timeline to be created.\n- * @param sketch_id - (optional) Sketch id to add the timeline to.\n+ * @param sketchId - (optional) Sketch id to add the timeline to.\n* @returns A $http promise with two methods, success and error.\n*/\nvar resource_url = '/api/v1/upload/';\n@@ -320,7 +320,7 @@ limitations under the License.\nvar formData = new FormData();\nformData.append('file', file);\nformData.append('name', name);\n- formData.append('sketch_id', sketch_id);\n+ formData.append('sketch_id', sketchId);\nreturn $http.post(resource_url, formData, config)\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"new_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"diff": "(function() {\nvar module = angular.module('timesketch.core.upload.directive', []);\n- module.directive('tsCoreUpload', ['timesketchApi', '$rootScope', function (timesketchApi, $rootScope) {\n+ module.directive('tsCoreUpload', ['timesketchApi', '$rootScope', '$window', function (timesketchApi, $rootScope, $window) {\n/**\n* Upload directive that handles the form and API call.\n*/\n$scope.clearForm = function() {\n$scope.uploadForm = {}\n};\n+ // We need an integer here because Flask WTF form don't validate\n+ // undefined values.\nif (!$scope.sketchId) {\n$scope.sketchId = 0;\n}\n$scope.uploadFile = function() {\nif ($scope.uploadForm.name) {\ntimesketchApi.uploadFile($scope.uploadForm.file, $scope.uploadForm.name, $scope.sketchId).success(function () {\n- $scope.uploadForm = {}\n+ $scope.uploadForm = {};\n+ $window.location.reload();\n});\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload.html",
"new_path": "timesketch/ui/static/components/core/core-upload.html",
"diff": "<form name=\"uploadform\" class=\"form-inline\" ng-submit=\"uploadFile()\">\n<span class=\"form-group\">\n- <span class=\"btn btn-primary btn-file\">\n+ <span class=\"btn btn-success btn-file\">\n<i class=\"fa fa-cloud-upload\" style=\"margin-right: 5px;\"></i>\n- <span ng-hide=\"uploadForm.file\">Upload Plaso file</span>\n+ <span ng-hide=\"uploadForm.file\">Import timeline</span>\n<span ng-show=\"uploadForm.file\">{{ uploadForm.file.name }}</span>\n<input type=\"file\" class=\"form-control\" ts-core-file-model=\"uploadForm.file\" />\n</span>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"diff": "<h3 class=\"pull-left\">Views</h3>\n<a ng-if=\"!showDelete\" href=\"/sketch/{{ sketchId }}/views/\" class=\"btn btn-default pull-right\" style=\"margin-top:-5px;\"><i class=\"fa fa-edit\"></i> Manage views</a>\n-<br><br>\n+<br><br><br>\n<span ng-hide=\"savedViews.length\">No saved views</span>\n-<br>\n+\n<table class=\"table table-hover\" ng-hide=\"!savedViews.length\">\n<thead>\n<tr>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "{% if sketch.timelines %}\n<ts-search sketch-id=\"{{ sketch.id }}\" view-id=\"{{ view.id }}\" named-view=\"{{ named_view }}\" searchtemplate-id=\"{{ searchtemplate_id }}\" autoload=\"true\" redirect=\"true\"></ts-search>\n{% else %}\n- <div class=\"container\">\n+ <div class=\"col-md-1\"></div>\n+ <div class=\"col-md-10\">\n+\n<div class=\"col-md-12\">\n+\n<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- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\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+ </div>\n</div>\n</div>\n</div>\n</div>\n+ <div class=\"col-md-1\"></div>\n{% endif %}\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "<div class=\"btn-group\">\n{% if sketch.has_permission(user=current_user, permission='write') %}\n<button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#edit-sketch-modal\"><i class=\"fa fa-pencil\"></i></button>\n- <button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#status-modal\">Status: {{ sketch.get_status.status|title }}</button>\n{% endif %}\n{% if sketch.has_permission(user=current_user, permission='delete') %}\n<i class=\"fa fa-lock\"></i> Share</button>\n{% endif %}\n</div>\n+\n</div>\n<h3 style=\"margin-top:10px;\">{{ sketch.name }}</h3>\n<p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n+\n{% if sketch.collaborators or sketch.groups %}\n<br>\n<span style=\"margin-right:10px;\">Shared with</span>\n<span class=\"label label-default\" style=\"font-size: 0.9em;\" title=\"Shared with user {{ collaborator.username }}\"><i class=\"fa fa-user\"></i>{{ collaborator.username }}</span>\n{% endfor %}\n{% endif %}\n-\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n-\n</div>\n</div>\n<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- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\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</div>\n</div>\n</div>\n<h3 class=\"pull-left\">Timelines</h3>\n{% if sketch.has_permission(current_user, 'write') %}\n- <a class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Timeline</a>\n+ <ts-core-upload class=\"pull-right\" style=\"margin-top:-5px;\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n{% endif %}\n<br><br>\n{% if not sketch.timelines %}\n<th>Added</th>\n</tr>\n<tbody>\n- {% for timeline in sketch.timelines %}\n+ {% for timeline in sketch.timelines|sort(attribute='created_at', reverse = True) %}\n<tr>\n<td>\n<div>\n{% if timeline.searchindex.get_status.status == 'processing' %}\n- <i class=\"fa fa-spinner fa-spin\"></i>\n+ <div style=\"margin-top:5px;\">\n+ <i style=\"margin-left:8px;\" class=\"fa fa-circle-o-notch fa-spin\"></i>\n+ </div>\n{% else %}\n<div class=\"color-box\" style=\"background:#{{ timeline.color }};\"></div>\n{% endif %}\n</div>\n<div style=\"margin-top:-25px;margin-left:45px\">\n{% if timeline.searchindex.get_status.status == 'processing' %}\n- {{ timeline.name }}\n+ <div style=\"margin-top:5px;\">{{ timeline.name }}</div>\n{% else %}\n<a href=\"/sketch/{{ sketch.id }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n{% endif %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/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- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\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</div>\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% if sketch.has_permission(current_user, 'write') %}\n{% if timelines %}\n<div class=\"card\">\n- <h4>Add timeline</h4>\n+ <h4 class=\"pull-left\">Add timeline</h4>\n+ <ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+\n<form method=\"post\" action=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">\n<table class=\"table table-hover\">\n<thead>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/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- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\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</div>\n</div>\n</div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add import button in sketch |
263,093 | 04.02.2017 23:25:14 | -3,600 | b2b8c6c255041d7d4fce9a5eb81e11a36fb60426 | Initial vagrant support | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "# Test files\n.coverage\ntests-coverage.txt\n+\n+# Exclude Vagrant runtime files\n+vagrant/.vagrant/\n+vagrant/*.log\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "vagrant/Vagrantfile",
"diff": "+# -*- mode: ruby -*-\n+# vi: set ft=ruby :\n+\n+# Set VirtualBox as default provider\n+ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'\n+\n+Vagrant.configure(2) do |config|\n+ config.vm.box = \"ubuntu/xenial64\"\n+ config.vm.box_check_update = true\n+\n+ # Forward the default Timesketch webserver port\n+ config.vm.network :forwarded_port, guest: 5000, host: 5000\n+\n+ # Access to Elasticsearch\n+ config.vm.network :forwarded_port, guest: 9200, host: 9200\n+\n+ # Share folder to the guest VM\n+ config.vm.synced_folder \"../\", \"/usr/local/src/timesketch\"\n+\n+ # VirtualBox configuration\n+ config.vm.provider \"virtualbox\" do |vb|\n+ vb.name = \"timesketch-dev\"\n+ vb.cpus = 2\n+ vb.memory = 4096\n+ end\n+\n+ # Setup the system with a shell script\n+ config.vm.provision :shell, path: \"bootstrap.sh\"\n+ config.vm.hostname = \"timesketch-dev\"\n+end\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "vagrant/bootstrap.sh",
"diff": "+#!/usr/bin/env bash\n+\n+# Generate random passwords for DB and session key\n+PSQL_PW=\"$(openssl rand -hex 32)\"\n+SECRET_KEY=\"$(openssl rand -hex 32)\"\n+\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\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+\n+# Configure PostgreSQL\n+sudo -u postgres sh -c 'echo \"local all timesketch md5\" >> /etc/postgresql/9.5/main/pg_hba.conf'\n+\n+# Install Timesketch\n+apt-get install -y python-pip python-dev libffi-dev\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\n+\n+# Java is needed for Elasticsearch\n+apt-get install -y openjdk-8-jre-headless\n+\n+# Install Elasticsearch 2.x\n+wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.4/elasticsearch-2.4.4.deb\n+echo \"27074f49a251bc87795822e803de3ddecb275125 *elasticsearch-2.4.4.deb\" | sha1sum -c -\n+dpkg -i ./elasticsearch-2.4.4.deb\n+\n+# Install Elasticsearch 5.x\n+#apt-get install apt-transport-https\n+#wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -\n+#echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list\n+#apt-get update\n+#apt-get install elasticsearch\n+\n+# Copy groovy scripts\n+cp /usr/local/src/timesketch/contrib/*.groovy /etc/elasticsearch/scripts/\n+\n+# Start Elasticsearch automatically\n+/bin/systemctl daemon-reload\n+/bin/systemctl enable elasticsearch.service\n+/bin/systemctl start elasticsearch.service\n+\n+# Install Plaso\n+apt-get install -y python-plaso\n+\n+# Initialize Timesketch\n+mkdir -p /var/lib/timesketch/\n+chown ubuntu /var/lib/timesketch\n+cp /vagrant/timesketch.conf /etc/\n+\n+# Set session key for Timesketch\n+sed s/\"SECRET_KEY = u'this is just a dev environment'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n+mv /etc/timesketch.conf.new /etc/timesketch.conf\n+\n+# Configure the DB password\n+sed s/\"timesketch:foobar@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n+mv /etc/timesketch.conf.new /etc/timesketch.conf\n+\n+# Create test user\n+sudo -u ubuntu tsctl add_user --username spock --password spock\n+\n+# Create a test timeline\n+sudo -u ubuntu psort.py -o timesketch /vagrant/test.plaso --name test-timeline\n"
},
{
"change_type": "ADD",
"old_path": "vagrant/test.plaso",
"new_path": "vagrant/test.plaso",
"diff": "Binary files /dev/null and b/vagrant/test.plaso differ\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "vagrant/timesketch.conf",
"diff": "+# Timesketch configuration\n+#\n+# The default location for this configuration file is in /etc/timesketch.conf\n+# If you put it somewhere else you can pass the path to tsctl\n+# Example:\n+#\n+# $ tsctl -c /path/to/this/timesketch.conf runserver\n+\n+# Show debug information.\n+#\n+# Note: It is a security risk to have this enabled in production.\n+DEBUG = True\n+\n+# Key for signing cookies and for CSRF protection.\n+#\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'this is just a dev environment'\n+\n+# Setup the database.\n+#\n+# For more options, see the official documentation:\n+# https://pythonhosted.org/Flask-SQLAlchemy/config.html\n+# By default sqlite is used.\n+#SQLALCHEMY_DATABASE_URI = u'sqlite:////var/lib/timesketch/database.db'\n+SQLALCHEMY_DATABASE_URI = u'postgresql://timesketch:foobar@localhost/timesketch'\n+\n+# Configure where your Elasticsearch server is located.\n+#\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_PORT = 9200\n+\n+#-------------------------------------------------------------------------------\n+\n+# Single Sign On (SSO) configuration.\n+#\n+# Your web server can handle authentication for you by setting a environment\n+# variable when the user is successfully authenticated. The standard environment\n+# variable is REMOTE_USER and this is the default, but if your SSO system uses\n+# another name you can configure that here.\n+SSO_ENABLED = False\n+SSO_USER_ENV_VARIABLE = u'REMOTE_USER'\n+\n+#-------------------------------------------------------------------------------\n+\n+# Upload and processing of Plaso storage files.\n+#\n+# To enable this feature you need to configure an upload directory and\n+# how to reach the Redis database used by the distributed task queue.\n+\n+UPLOAD_ENABLED = False\n+\n+# Folder for temporarily storage of Plaso dump files before being processed and\n+# inserted into the datastore.\n+UPLOAD_FOLDER = u'/tmp'\n+\n+# Celery broker configuration. You need to change ip/port to where your Redis\n+# server is running.\n+CELERY_BROKER_URL='redis://ip:port',\n+CELERY_RESULT_BACKEND='redis://ip:port'\n+\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"
}
] | Python | Apache License 2.0 | google/timesketch | Initial vagrant support |
263,093 | 09.02.2017 10:26:11 | -3,600 | e5e24dc8a6871ca6ed96ebb3ac6f5b4fa19d2ab3 | Move navigation | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -33,7 +33,7 @@ header {\n}\n#navigation {\n- margin-left:200px;\n+ margin-left:15px;\n}\ntable {\n@@ -45,6 +45,13 @@ table {\nmargin:95px 15px 15px 15px;\n}\n+#subheader {\n+ height: 50px;\n+ background: #fff;\n+ margin-top:65px;\n+ border-bottom: 1px solid #f1f1f1;\n+}\n+\n#logo {\nwidth:210px;\nheight:55px;\n@@ -417,15 +424,25 @@ rect.bordered {\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\ncolor:#d1d1d1;\n- padding: 23px 15px 23px 15px;\n- margin-top:-12px;\n+ #padding: 23px 15px 23px 15px;\n+ margin-top:5px;\nborder: none;\nfont-weight: normal;\n- background: transparent;\n+ background: #fff;\nmargin-right:7px;\nborder-radius: 0;\n}\n+.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\n+ color:#fff;\n+ color:#333;\n+ font-weight: bold;\n+ border:none;\n+ cursor: pointer;\n+ background: #3d5267;\n+ background: #f1f1f1;\n+}\n+\n.nav-tabs-light>li>a, .nav-tabs-light>li>a:hover {\ncolor:#333;\npadding: 15px 15px 15px 15px;\n@@ -442,14 +459,6 @@ rect.bordered {\nz-index:10;\n}\n-.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\n- color:#fff;\n- font-weight: bold;\n- border:none;\n- cursor: pointer;\n- background: #3d5267;\n-}\n-\n.nav-tabs-light>li.active>a, .nav-tabs-light>li.active>a:hover, .nav-tabs-light>li.active>a:focus {\ncolor:#333;\nfont-weight: bold;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -56,28 +56,29 @@ limitations under the License.\n</head>\n<body>\n+ <header>\n<a href=\"/\">\n<div id=\"logo\">\n- <img src=\"/static/img/logo.png\" />\n+ <img src=\"/static/img/logo.png\">\n</div>\n</a>\n- <header>\n- <div id=\"navigation\" class=\"pull-left\">\n- {% block navigation %}{% endblock %}\n- </div>\n<div ts-butterbar id=\"butterbar\">Loading..</div>\n-\n<div class=\"pull-right\" style=\"margin-top:10px;margin-right:30px;\">\n{% block header_left %}{% endblock %}\n<span style=\"color:#fff;margin-right:20px;margin-left: 20px;\">{{ current_user.username }}</span>\n<a style=\"color:#fff;\" href=\"/logout/\">Logout</a>\n</div>\n-\n</header>\n- {% block subheader %}{% endblock %}\n+\n+ <div id=\"subheader\">\n+ <div id=\"navigation\" class=\"pull-left\">\n+ {% block navigation %}{% endblock %}\n+ </div>\n+ </div>\n<div id=\"main\">\n{% block main %}{% endblock %}\n</div>\n+\n</body>\n</html>\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | google/timesketch | Move navigation |
263,093 | 10.02.2017 11:10:37 | -3,600 | 6f707b1c7231ee22d5ab9d94e85bcf8e3619d03f | Subheader navigation | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"diff": "-<h3>Views</h3>\n-\n<ul class=\"content-list\" ng-hide=\"!savedViews.length\">\n<li class=\"content-item\" ng-repeat=\"view in savedViews\">\n<div ng-if=\"showDelete\">\n</li>\n</ul>\n+<div ng-if=\"!savedViews.length\">\n+ There are no views saved yet.\n+</div>\n+\n<div ng-if=\"showSearchTemplates\">\n<br><br>\n<ts-search-template-list sketch-id=\"sketchId\"></ts-search-template-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "-<h3 class=\"pull-left\">Stories</h3>\n<button class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Write a story</button>\n<br><br><br>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -22,9 +22,14 @@ body {\nbackground: #f9f9f9;\n}\n+table {\n+ table-layout: fixed;\n+ word-wrap: break-word;\n+}\n+\nheader {\nwidth: 100%;\n- height: 65px;\n+ height: 50px;\nbackground: #34495e;\nposition: fixed;\ntop:0;\n@@ -32,41 +37,32 @@ header {\npadding:11px 21px 11px 11px;\n}\n-#navigation {\n- margin-left:15px;\n-}\n-\n-table {\n- table-layout: fixed;\n- word-wrap: break-word;\n+#logo {\n+ height:50px;\n+ padding-top:15px;\n+ margin-left:30px;\n+ position: fixed;\n+ top:0;\n}\n-#main {\n- margin:95px 15px 15px 15px;\n+#logo img {\n+ width:100px;\n+ height:17px;\n}\n#subheader {\n- height: 50px;\n+ height: 60px;\nbackground: #fff;\n- margin-top:65px;\n+ margin-top:50px;\nborder-bottom: 1px solid #f1f1f1;\n}\n-#logo {\n- width:210px;\n- height:55px;\n- padding:20px;\n- padding-top:20px;\n- background: #34495e;\n- position: fixed;\n- top:0;\n- z-index:9999;\n+#navigation {\n+ margin-left:15px;\n}\n-#logo img {\n- margin-left:15px;\n- width:100px;\n- height:17px;\n+#main {\n+ margin:20px 15px 15px 15px;\n}\n#sketch-name {\n@@ -414,6 +410,7 @@ rect.bordered {\n}\n.nav-tabs {\n+ background: transparent;\nborder: none;\nletter-spacing: .06rem;\n}\n@@ -423,24 +420,22 @@ rect.bordered {\n}\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\n- color:#d1d1d1;\n- #padding: 23px 15px 23px 15px;\n- margin-top:5px;\n+ background: transparent;\n+ color:#555;\n+ padding-bottom: 17px;\n+ margin-top:10px;\nborder: none;\nfont-weight: normal;\n- background: #fff;\nmargin-right:7px;\nborder-radius: 0;\n}\n.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\n- color:#fff;\n+ background: transparent;\ncolor:#333;\n- font-weight: bold;\nborder: none;\n+ border-bottom:2px solid #428bca;\ncursor: pointer;\n- background: #3d5267;\n- background: #f1f1f1;\n}\n.nav-tabs-light>li>a, .nav-tabs-light>li>a:hover {\n@@ -465,6 +460,7 @@ rect.bordered {\ncursor: pointer;\nbackground: #fff;\nbox-shadow: 0 0 1px rgba(0, 0, 0, 0.15);\n+ border: none;\n}\n.timeline-bubble {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -63,18 +63,26 @@ limitations under the License.\n</div>\n</a>\n<div ts-butterbar id=\"butterbar\">Loading..</div>\n- <div class=\"pull-right\" style=\"margin-top:10px;margin-right:30px;\">\n- {% block header_left %}{% endblock %}\n+ <div class=\"pull-right\" style=\"margin-top:3px;margin-right:30px;\">\n+ {% block header_right %}{% endblock %}\n<span style=\"color:#fff;margin-right:20px;margin-left: 20px;\">{{ current_user.username }}</span>\n<a style=\"color:#fff;\" href=\"/logout/\">Logout</a>\n</div>\n</header>\n+{% block subheader %}\n<div id=\"subheader\">\n- <div id=\"navigation\" class=\"pull-left\">\n+ <div id=\"navigation\">\n+ <div class=\"col-md-1\"></div>\n+ <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n{% block navigation %}{% endblock %}\n</div>\n</div>\n+ <div class=\"col-md-1\"></div>\n+ </div>\n+ </div>\n+{% endblock %}\n<div id=\"main\">\n{% block main %}{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "{% extends \"base.html\" %}\n-{% block header_left %}\n+{% block header_right %}\n+ {% if sketches.all() %}\n<div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n<form action=\"{{ url_for('home_views.home') }}\" method=\"post\">\n{{ form.name }}\n{{ form.csrf_token }}\n</form>\n</div>\n+ {% endif %}\n{% endblock %}\n+{% block subheader %}{% endblock %}\n+\n{% block main %}\n- {% if not sketches.all() and not query %}\n+ <div style=\"margin-top:80px;\">\n+\n+ {% if not sketches.all() %}\n<div style=\"text-align: center\">\n<br><br>\n<h3>Welcome to Timesketch</h3>\n</form>\n</div>\n{% else %}\n-\n- <div class=\"container\">\n-\n<div class=\"col-md-1\"></div>\n<div class=\"col-md-10\">\n-\n- <div class=\"card\" style=\"margin-top:50px;\">\n+ <div class=\"col-md-12\">\n+ <div class=\"card\">\n{% if sketches.all() %}\n<div>\n<ul class=\"content-list\">\n{% endif %}\n</div>\n</div>\n-\n+ </div>\n<div class=\"col-md-1\"></div>\n+ {% endif %}\n</div>\n- {% endif %}\n{% endblock %}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/ui/templates/sketch/base.html",
"diff": "+{% extends \"base.html\" %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "-{% extends \"base.html\" %}\n+{% extends \"sketch/base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "-{% extends \"base.html\" %}\n+{% extends \"sketch/base.html\" %}\n-{% block header_left %}\n+{% block header_right %}\n<div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n<button data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n{% if sketch.is_public %}\n{% else %}\n<i class=\"fa fa-lock\"></i> Share</button>\n{% endif %}\n-\n</div>\n{% endblock %}\n<button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#trash-modal\"><i class=\"fa fa-trash\"></i></button>\n{% endif %}\n- {% if sketch.has_permission(current_user, 'write') %}\n+ {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n<ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n{% endif %}\n<div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height:300px;\">\n- <h3>Timelines</h3>\n+ <h4>Timelines</h4>\n{% if not sketch.timelines %}\n<br>\n<div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height: 300px;\">\n+ <h4>Views</h4>\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\"></ts-saved-view-list>\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "-{% extends \"base.html\" %}\n+{% extends \"sketch/base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timeline.html",
"new_path": "timesketch/ui/templates/sketch/timeline.html",
"diff": "-{% extends \"base.html\" %}\n-{% block main %}\n+{% extends \"sketch/base.html\" %}\n+\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('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+{% endblock %}\n+\n+{% block main %}\n<div class=\"modal\" id=\"edit-timeline-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n<div class=\"modal-dialog\">\n</div>\n</div>\n+ <div class=\"col-md-1\"></div>\n+ <div class=\"col-md-10\">\n+\n<div class=\"container\">\n- <div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card card-top\">\n<div class=\"pull-left\" style=\"width:50px;height:50px;background:#{{ timeline.color }};cursor: pointer\" data-toggle=\"modal\" data-target=\"#edit-timeline-modal\"></div>\n{% if sketch.has_permission(user=current_user, permission='write') %}\n<button class=\"btn btn-default pull-right \" data-toggle=\"modal\" data-target=\"#edit-timeline-modal\" style=\"margin-left:10px;width:50px;\"><i class=\"fa fa-pencil\"></i></button>\n{% endif %}\n- <h3 style=\"margin-left:80px;padding-top: 6px;\">{{ timeline.name }}</h3>\n+ <h4 style=\"margin-left:80px;padding-top: 17px;\">{{ timeline.name }}</h4>\n<br>\n{% if timeline.description != timeline.name %}\n<p style=\"white-space: pre-wrap;word-wrap: break-word;\">{{ timeline.description }}</p>\n</div>\n</div>\n</div>\n+ <div class=\"col-md-1\"></div>\n+\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "-{% extends \"base.html\" %}\n+{% extends \"sketch/base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n<div class=\"col-md-12\">\n{% if sketch.timelines %}\n<div class=\"card\" style=\"padding:30px;\">\n- <h3>Timelines</h3>\n<table class=\"table table-hover\">\n<thead>\n<tr>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "-{% extends \"base.html\" %}\n+{% extends \"sketch/base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
}
] | Python | Apache License 2.0 | google/timesketch | Subheader navigation |
263,093 | 13.02.2017 09:35:56 | -3,600 | 0be61368c3f9bc6f616a058c746f8065bdbc8f43 | Wide navigation | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "<button class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Write a story</button>\n-<br><br><br>\n+<br><br>\n<div ng-if=\"stories.length < 1\">\n- There are no stories written yet\n+ There are no stories written yet.\n</div>\n<div ng-if=\"stories.length > 0\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -20,6 +20,8 @@ i {\nbody {\nbackground: #f9f9f9;\n+ line-height: 1.5;\n+ color: #333;\n}\ntable {\n@@ -29,31 +31,30 @@ table {\nheader {\nwidth: 100%;\n- height: 50px;\n+ height: 55px;\nbackground: #34495e;\nposition: fixed;\ntop:0;\nz-index:9998;\n- padding:11px 21px 11px 11px;\n+ padding:11px 21px 11px 15px;\n}\n#logo {\nheight:50px;\n- padding-top:15px;\n- margin-left:30px;\n+ padding-top:16px;\nposition: fixed;\ntop:0;\n}\n#logo img {\n- width:100px;\n- height:17px;\n+ width:110px;\n+ height:19px;\n}\n#subheader {\n- height: 60px;\n+ height: 50px;\nbackground: #fff;\n- margin-top:50px;\n+ margin-top:55px;\nborder-bottom: 1px solid #f1f1f1;\n}\n@@ -415,21 +416,23 @@ rect.bordered {\nletter-spacing: .06rem;\n}\n-.nav-tabs>li>a:hover {\n- background: transparent;\n-}\n-\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\nbackground: transparent;\ncolor:#555;\n- padding-bottom: 17px;\n- margin-top:10px;\n+ #padding-bottom: 10px;\n+ padding: 11px 5px 10px 5px;\n+ margin-top:7px;\nborder: none;\nfont-weight: normal;\n- margin-right:7px;\n+ margin-right:20px;\nborder-radius: 0;\n}\n+.nav-tabs>li>a:hover {\n+ background: transparent;\n+ border-bottom:2px solid #f1f1f1;\n+}\n+\n.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\nbackground: transparent;\ncolor:#333;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -57,31 +57,31 @@ limitations under the License.\n<body>\n+{% block header %}\n<header>\n+ <div class=\"col-md-12\">\n<a href=\"/\">\n<div id=\"logo\">\n<img src=\"/static/img/logo.png\">\n</div>\n</a>\n<div ts-butterbar id=\"butterbar\">Loading..</div>\n- <div class=\"pull-right\" style=\"margin-top:3px;margin-right:30px;\">\n+ <div class=\"pull-right\" style=\"margin-top:5px;\">\n{% block header_right %}{% endblock %}\n<span style=\"color:#fff;margin-right:20px;margin-left: 20px;\">{{ current_user.username }}</span>\n<a style=\"color:#fff;\" href=\"/logout/\">Logout</a>\n</div>\n+ </div>\n</header>\n+{% endblock %}\n{% block subheader %}\n<div id=\"subheader\">\n<div id=\"navigation\">\n- <div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\">\n<div class=\"col-md-12\">\n{% block navigation %}{% endblock %}\n</div>\n</div>\n- <div class=\"col-md-1\"></div>\n- </div>\n</div>\n{% endblock %}\n"
},
{
"change_type": "DELETE",
"old_path": "timesketch/ui/templates/sketch/base.html",
"new_path": null,
"diff": "-{% extends \"base.html\" %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block header_right %}\n<div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\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<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/ui/templates/sketch/timeline.html",
"new_path": "timesketch/ui/templates/sketch/timeline.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "-{% extends \"sketch/base.html\" %}\n+{% extends \"base.html\" %}\n{% block navigation %}\n<ul class=\"nav nav-tabs\">\n<div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n+ <h4>Views</h4>\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\" show-search-templates=\"true\" show-delete=\"true\"></ts-saved-view-list>\n</div>\n</div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Wide navigation |
263,093 | 13.02.2017 23:31:34 | -3,600 | 318c36e63b24fe88356a926a092846cc701adcd0 | Create site.css | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/site.css",
"diff": "+@import 'https://fonts.googleapis.com/css?family=Roboto:300,400,500';\n+\n+html {\n+ margin: 0;\n+ padding: 0;\n+}\n+\n+header {\n+ background-color: #34495e;\n+ background-position: center top;\n+ background-repeat: no-repeat;\n+ background-size: cover;\n+ line-height: 1.2;\n+ padding: 5vw 2em;\n+ text-align: center;\n+ max-width: none;\n+}\n+\n+header h1 {\n+ color: white;\n+ font-size: 2.5em;\n+ font-weight: 300;\n+}\n+\n+body {\n+ font-family: \"Roboto\", \"Helvetica\", \"Arial\", sans-serif;\n+ line-height: 1.5;\n+ color: #333;\n+ margin: 0;\n+ padding: 0;\n+}\n+\n+main {\n+ margin: 0 auto;\n+ max-width: 50em;\n+ padding: 1em 1em;\n+}\n+\n+h1,\n+h2,\n+strong {\n+ font-weight: 400;\n+}\n+\n+a {\n+ color: #34495e;\n+}\n+\n+.buttons .button {\n+ display: block;\n+ margin-bottom: 1em;\n+}\n+\n+html a.button {\n+ border: 1px solid #d8dee9;\n+ color: #b0bfc7;\n+ padding: 1em 1.5em;\n+ text-align: center;\n+ text-decoration: none;\n+ transition: none 200ms ease-out;\n+ transition-property: color, background;\n+}\n+\n+.button em {\n+ display: block;\n+ font-size: 0.6em;\n+ font-style: normal;\n+ letter-spacing: 0.2em;\n+ text-transform: uppercase;\n+}\n+\n+.button strong {\n+ transition: color 200ms ease-out;\n+}\n+\n+.button:hover strong {\n+ color: white !important;\n+}\n+\n+.button.github strong {\n+ color: #333;\n+}\n+\n+.button.github:hover {\n+ background: #333;\n+}\n+\n+.button.twitter strong {\n+ color: #55acee;\n+}\n+\n+.button.twitter:hover {\n+ background: #55acee;\n+}\n+\n+@media (min-width: 600px) {\n+ .buttons {\n+ align-items: center;\n+ display: flex;\n+ justify-content: space-between;\n+ padding: 1em 0;\n+ }\n+\n+ .buttons .button {\n+ flex-grow: 1;\n+ flex-shrink: 0;\n+ margin-bottom: 0;\n+ margin-right: 1em;\n+ }\n+\n+ .buttons .button:last-child {\n+ margin-right: 0;\n+ }\n+}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Create site.css |
263,093 | 14.02.2017 09:31:59 | -3,600 | c7b3d42f0e07983cf56b1e89adeb2fcca98195a0 | Left align main pages | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search.html",
"new_path": "timesketch/ui/static/components/explore/explore-search.html",
"diff": "</div>\n</div>\n-<div class=\"container\">\n- <div class=\"col-md-12\">\n-\n<div class=\"card card-top\" style=\"padding-bottom:0;\">\n<form class=\"form-inline\" ng-submit=\"ctrl.search(query, filter)\">\n<li role=\"presentation\" class=\"active\"><a href=\"#heatmap\" aria-controls=\"heatmap\" role=\"tab\" data-toggle=\"tab\"><span class=\"tab-filler\"></span><i class=\"fa fa-th\"></i> Heatmap</a></li>\n<li role=\"presentation\"><a href=\"#histogram-tab\" aria-controls=\"histogram-tab\" role=\"tab\" data-toggle=\"tab\"><span class=\"tab-filler\"></span><i class=\"fa fa-bar-chart\"></i> Histogram</a></li>\n</ul>\n- <div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"tab-content card\">\n</div>\n</div>\n</div>\n- </div>\n<div class=\"card\" ng-if=\"filter.context\">\n<ts-search-context-card ng-if=\"filter.context\" context=\"filter.context\"></ts-search-context-card>\n</div>\n<ts-event-list events=\"events\" meta=\"meta\" sketch-id=\"sketchId\" filter=\"filter\" query=\"query\" query-dsl=\"queryDsl\" view-id=\"viewId\" named-view=\"namedView\"></ts-event-list>\n- </div>\n-</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -63,7 +63,7 @@ header {\n}\n#main {\n- margin:20px 15px 15px 15px;\n+ margin:20px 30px 15px 30px;\n}\n#sketch-name {\n@@ -447,6 +447,11 @@ rect.bordered {\nmargin-top:-12px;\n}\n+.nav-tabs-light>li>a:hover {\n+ background: transparent;\n+ border-bottom: none;\n+}\n+\n.nav-tabs-light>li.active .tab-filler {\nwidth:100%;\nheight:3px;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "{% endblock %}\n{% block main %}\n+ <div class=\"container\">\n{% if sketch.timelines %}\n+ <div class=\"row\">\n+ <div class=\"col-md-12\">\n<ts-search sketch-id=\"{{ sketch.id }}\" view-id=\"{{ view.id }}\" named-view=\"{{ named_view }}\" searchtemplate-id=\"{{ searchtemplate_id }}\" autoload=\"true\" redirect=\"true\"></ts-search>\n+ </div>\n+ </div>\n{% else %}\n- <div class=\"col-md-1\"></div>\n+ <div class=\"row\">\n<div class=\"col-md-10\">\n-\n- <div class=\"col-md-12\">\n-\n<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</div>\n</div>\n</div>\n- </div>\n- <div class=\"col-md-1\"></div>\n{% endif %}\n+ </div>\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n</div>\n- <div class=\"col-md-1\"></div>\n+ <div class=\"container\">\n+ <div class=\"row\">\n<div class=\"col-md-10\">\n-\n- <div class=\"col-md-12\">\n<div class=\"card\" style=\"padding-left:30px; padding-bottom: 30px;\">\n<div class=\"pull-right\" style=\"margin-right:10px;margin-top:10px;\">\n<div class=\"btn-group\">\n{% endif %}\n</div>\n</div>\n-\n-\n+ </div>\n{% if not sketch.timelines %}\n-\n- <div class=\"col-md-12\">\n+ <div class=\"row\">\n+ <div class=\"col-md-10\">\n<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</div>\n</div>\n</div>\n+ </div>\n+ {% endif %}\n- {% else %}\n-\n+ {% if sketch.timelines %}\n<!-- Single metric info cards -->\n- <div class=\"col-md-6\">\n+ <div class=\"row\">\n+ <div class=\"col-md-5\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n<div class=\"text-center\">\n<h1>{{ sketch.timelines|length }}</h1>\n</div>\n</div>\n</div>\n-\n- <div class=\"col-md-6\">\n+ <div class=\"col-md-5\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n<div class=\"text-center\">\n<h1 ts-count-events sketch-id=\"{{ sketch.id }}\"></h1>\n</div>\n</div>\n</div>\n+ </div>\n- <div class=\"col-md-6\">\n+ <div class=\"row\">\n+ <div class=\"col-md-5\">\n<div class=\"card\" style=\"min-height:300px;\">\n<h4>Timelines</h4>\n{% endif %}\n</div>\n</div>\n-\n- <div class=\"col-md-6\">\n+ <div class=\"col-md-5\">\n<div class=\"card\" style=\"min-height: 300px;\">\n<h4>Views</h4>\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\"></ts-saved-view-list>\n</div>\n</div>\n-\n+ </div>\n{% endif %}\n-\n</div>\n- <div class=\"col-md-1\"></div>\n-\n-\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "{% block main %}\n- <div class=\"col-md-1\"></div>\n+ <div class=\"container\">\n+ <div class=\"row\">\n<div class=\"col-md-10\">\n{% if not sketch.timelines %}\n- <div class=\"col-md-12\">\n<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<a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n</div>\n</div>\n- </div>\n{% else %}\n- <div class=\"container\">\n- <div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n{% if story %}\n<ts-story sketch-id=\"{{ sketch.id }}\" story-id=\"{{ story.id }}\"></ts-story>\n<ts-story-list sketch-id=\"{{ sketch.id }}\" show-create-button=\"true\"></ts-story-list>\n{% endif %}\n</div>\n+ {% endif %}\n</div>\n</div>\n- {% endif %}\n</div>\n- <div class=\"col-md-10\">\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timeline.html",
"new_path": "timesketch/ui/templates/sketch/timeline.html",
"diff": "</div>\n</div>\n- <div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\">\n-\n<div class=\"container\">\n- <div class=\"col-md-12\">\n+ <div class=\"row\">\n+ <div class=\"col-md-10\">\n<div class=\"card card-top\">\n<div class=\"pull-left\" style=\"width:50px;height:50px;background:#{{ timeline.color }};cursor: pointer\" data-toggle=\"modal\" data-target=\"#edit-timeline-modal\"></div>\n{% if sketch.has_permission(user=current_user, permission='write') %}\n</div>\n</div>\n</div>\n- <div class=\"col-md-1\"></div>\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% block main %}\n- <div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\">\n-\n<div class=\"container\">\n- <div class=\"col-md-12\">\n{% if sketch.timelines %}\n+ <div class=\"row\">\n+ <div class=\"col-md-10\">\n<div class=\"card\" style=\"padding:30px;\">\n<table class=\"table table-hover\">\n<thead>\n</tbody>\n</table>\n</div>\n- {% endif %}\n</div>\n- <div class=\"col-md-12\">\n+ </div>\n+ {% endif %}\n+\n{% if sketch.has_permission(current_user, 'write') %}\n{% if timelines %}\n+ <div class=\"row\">\n+ <div class=\"col-md-10\">\n+\n<div class=\"card\">\n<h4 class=\"pull-left\">Add timeline</h4>\n<ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n</form>\n{% endif %}\n</div>\n- {% endif %}\n</div>\n</div>\n-\n+ {% endif %}\n</div>\n- <div class=\"col-md-10\">\n+\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "{% block main %}\n- <div class=\"col-md-1\"></div>\n+ <div class=\"container\">\n+ <div class=\"row\">\n<div class=\"col-md-10\">\n-\n{% if not sketch.timelines %}\n- <div class=\"col-md-12\">\n<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<a href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">or add an existing timeline</a>\n</div>\n</div>\n- </div>\n{% else %}\n- <div class=\"container\">\n- <div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n<h4>Views</h4>\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\" show-search-templates=\"true\" show-delete=\"true\"></ts-saved-view-list>\n</div>\n+ {% endif %}\n</div>\n</div>\n- {% endif %}\n-\n</div>\n- <div class=\"col-md-10\">\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Left align main pages |
263,093 | 16.02.2017 09:45:39 | -3,600 | ac30dd8a93c3c980baac2f2a11de1c79deb2308f | Add GA to timesketch.org site | [
{
"change_type": "MODIFY",
"old_path": "docs/themes/timesketch/layouts/partials/header.html",
"new_path": "docs/themes/timesketch/layouts/partials/header.html",
"diff": "<title>Timesketch</title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/timesketch.css\">\n+ <script>\n+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n+ ga('create', 'UA-50830188-4', 'auto');\n+ ga('send', 'pageview');\n+ </script>\n</head>\n<body>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add GA to timesketch.org site |
263,093 | 16.02.2017 09:48:51 | -3,600 | f3443bd2291e5a2aa3f3d22115348ce151b822ec | Generate new site | [
{
"change_type": "MODIFY",
"old_path": "docs/public/404.html",
"new_path": "docs/public/404.html",
"diff": "<title>Timesketch</title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/timesketch.css\">\n+ <script>\n+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n+ ga('create', 'UA-50830188-4', 'auto');\n+ ga('send', 'pageview');\n+ </script>\n</head>\n<body>\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/public/index.html",
"new_path": "docs/public/index.html",
"diff": "<title>Timesketch</title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/timesketch.css\">\n+ <script>\n+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n+ ga('create', 'UA-50830188-4', 'auto');\n+ ga('send', 'pageview');\n+ </script>\n</head>\n<body>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Generate new site |
263,093 | 19.02.2017 14:16:28 | -3,600 | ce20ce1a19f97bee5fa01ae129141469b292f7ea | Export 10k events by default | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/sketch.py",
"new_path": "timesketch/ui/views/sketch.py",
"diff": "@@ -255,6 +255,10 @@ def export(sketch_id):\nquery_dsl = json.loads(view.query_dsl)\nindices = query_filter.get(u'indices', [])\n+ # Export more than the 500 first results.\n+ max_events_to_fetch = 10000\n+ query_filter[u'limit'] = max_events_to_fetch\n+\ndatastore = ElasticsearchDataStore(\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n"
}
] | Python | Apache License 2.0 | google/timesketch | Export 10k events by default |
263,093 | 19.02.2017 14:23:39 | -3,600 | 55ab5d2919b8d7db3654c0d5331bc933c8ab8d4a | Disable export button when more than 10k events | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-event-list.html",
"new_path": "timesketch/ui/static/components/explore/explore-event-list.html",
"diff": "<div class=\"btn-group\" style=\"margin-left:10px;\">\n<button class=\"btn btn-default\" ng-click=\"filter.order = { 'asc': 'desc', 'desc': 'asc'}[filter.order];applyOrder()\"><i ng-class=\"{'asc': 'fa fa-sort-asc', 'desc': 'fa fa-sort-desc'}[filter.order]\"></i> Sort</button>\n- <a class=\"btn btn-default\" href=\"/sketch/{{ sketchId }}/explore/export/\" download=\"export.csv\"><i class=\"fa fa-cloud-download\"></i> Export</a>\n+ <a class=\"btn btn-default\" ng-disabled=\"meta.es_total_count > 10000\" href=\"/sketch/{{ sketchId }}/explore/export/\" download=\"export.csv\"><i class=\"fa fa-cloud-download\"></i> Export</a>\n<button class=\"btn btn-default\" ng-click=\"toggleAll()\"><i class=\"fa fa-check\"></i> Toggle all</button>\n<button class=\"btn btn-default\" data-toggle=\"modal\" ng-hide=\"!anySelected\" data-target=\"#save-event-view-modal\"><i class=\"fa fa-save\"></i> Save selection</button>\n<button class=\"btn btn-default\" ng-click=\"addStar()\" ng-hide=\"!anySelected\"><i class=\"fa fa-star icon-yellow\"></i> Add star</button>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Disable export button when more than 10k events |
263,093 | 19.02.2017 14:42:22 | -3,600 | 07e95540d66cc2c40b1d121c9b46050e07a59050 | Sort view dropdown alphabetically | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search-saved-view-picker.html",
"new_path": "timesketch/ui/static/components/explore/explore-search-saved-view-picker.html",
"diff": "-<select class=\"select select-view\" ng-model=\"selectedView.view\" ng-options=\"view.name for view in sketch.views\">\n+<select class=\"select select-view\" ng-model=\"selectedView.view\" ng-options=\"view.name for view in sketch.views | orderBy:'name'\">\n<option value=\"\">Saved views</option>\n</select>\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | google/timesketch | Sort view dropdown alphabetically |
263,093 | 19.02.2017 18:57:04 | -3,600 | ce0918e01f5b6ea9e340a9036a4b3b83e71e6c8a | Read only stories | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -1051,7 +1051,14 @@ class StoryResource(ResourceMixin, Resource):\nif story.sketch_id != sketch.id:\nabort(HTTP_STATUS_CODE_NOT_FOUND)\n- return self.to_json(story)\n+ # Only allow editing if the current user is the author.\n+ # This is needed until we have proper collaborative editing and\n+ # locking implemented.\n+ meta = dict(is_editable=False)\n+ if current_user == story.user:\n+ meta[u'is_editable'] = True\n+\n+ return self.to_json(story, meta=meta)\n@login_required\ndef post(self, sketch_id, story_id):\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-directive.js",
"new_path": "timesketch/ui/static/components/story/story-directive.js",
"diff": "timesketchApi.updateStory(scope.sketchId, scope.storyId, current_title, current_content);\n};\n+ // Get the story on first load\n+ timesketchApi.getStory(scope.sketchId, scope.storyId).success(function (data) {\n+ var story = data.objects[0];\n+ var meta = data.meta;\n+ story.updated_at = moment.utc(story.updated_at).format(\"YYYY-MM-DD HH:MM\");\n+ scope.story = story;\n+ scope.isEditable = meta['is_editable'];\n+\n// Setup the medium editors\nscope.titleEditor = new MediumEditor('.editable-title', {\nplaceholder: {\nhideOnClick: false\n},\ndisableReturn: true,\n- toolbar: false\n-\n+ toolbar: false,\n+ disableEditing: !scope.isEditable\n});\nscope.contentEditor = new MediumEditor('.editable', {\nplaceholder: {\ntext: 'Your story starts here...',\nhideOnClick: false\n- }\n+ },\n+ toolbar: scope.isEditable,\n+ disableEditing: !scope.isEditable\n});\n-\n- // Get the story on first load\n- timesketchApi.getStory(scope.sketchId, scope.storyId).success(function (data) {\n- var story = data.objects[0];\nset_content(story.title, story.content);\n- });\nvar editableEvents = ['editableKeyup', 'editableClick'];\nfor (var i = 0; i < editableEvents.length; i++) {\n}\n});\n}\n+ });\n// Save document every 3 seconds if any change is detected\n$interval(function() {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-dropdown.html",
"new_path": "timesketch/ui/static/components/story/story-dropdown.html",
"diff": "-<div ng-click=\"foobar = !foobar\" contenteditable=\"false\" style=\"cursor:pointer; position:absolute; margin-left:-60px;margin-top:-5px;background: #fff;border:1px solid #d1d1d1; width:40px;height:40px;text-align: center;border-radius: 100%;color:#666;\"><span style=\"font-size:1.7em;\">+</span></div>\n- <select ng-show=\"foobar\" class=\"select select-view\" ng-model=\"selectedView.view\" ng-options=\"view.name for view in sketch.views\">\n+<div ng-click=\"showDropdown = !showDropdown\" contenteditable=\"false\" style=\"cursor:pointer; position:absolute; margin-left:-60px;margin-top:-5px; padding-top:3px; padding-left:2px; background: #fff;border:1px solid #d1d1d1; width:40px;height:40px;text-align: center;border-radius: 100%;color:#666;\"><span style=\"font-size:1.7em;\">+</span></div>\n+ <select ng-show=\"showDropdown\" class=\"select select-view\" ng-model=\"selectedView.view\" ng-options=\"view.name for view in sketch.views\">\n<option value=\"\">Choose View</option>\n</select>\n</div>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story.html",
"new_path": "timesketch/ui/static/components/story/story.html",
"diff": "<div style=\"max-width: 960px; min-height: 500px; margin:auto;\">\n+ <div class=\"pull-right\" style=\"color:#666;\">\n+ <span class=\"pull-right\">Last updated {{ story.updated_at }}</span>\n<br>\n- <h1 class=\"editable-title\" contenteditable=\"true\" spellcheck=\"true\" data-medium-editor-element=\"true\" role=\"textbox\" medium-editor-index=\"0\" data-medium-focused=\"false\"></h1>\n+ <span class=\"pull-right\">Created by {{ story.user.username }}</span>\n<br>\n- <div class=\"editable\" contenteditable=\"true\" spellcheck=\"true\" data-medium-editor-element=\"true\" role=\"textbox\" medium-editor-index=\"1\" data-medium-focused=\"true\"></div>\n+ <span ng-show=\"!isEditable\" class=\"pull-right\" style=\"font-weight: bold;\">View only</span>\n+ </div>\n+ <br>\n+ <h1 class=\"editable-title\" spellcheck=\"true\" role=\"textbox\" medium-editor-index=\"0\" data-medium-focused=\"false\"></h1>\n+ <br>\n+ <div class=\"editable\" spellcheck=\"true\" role=\"textbox\" medium-editor-index=\"1\" data-medium-focused=\"true\"></div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -52,7 +52,7 @@ header {\n}\n#subheader {\n- height: 50px;\n+ height: 55px;\nbackground: #fff;\nmargin-top:55px;\nborder-bottom: 1px solid #f1f1f1;\n@@ -419,8 +419,7 @@ rect.bordered {\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\nbackground: transparent;\ncolor:#555;\n- #padding-bottom: 10px;\n- padding: 11px 5px 10px 5px;\n+ padding: 11px 5px 14px 5px;\nmargin-top:7px;\nborder: none;\nfont-weight: normal;\n@@ -430,7 +429,7 @@ rect.bordered {\n.nav-tabs>li>a:hover {\nbackground: transparent;\n- border-bottom:2px solid #f1f1f1;\n+ border-bottom:2px solid #d1d1d1;\n}\n.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<div class=\"card\" style=\"padding-left:30px; padding-bottom: 30px;\">\n<div class=\"pull-right\" style=\"margin-right:10px;margin-top:10px;\">\n<div class=\"btn-group\">\n{% if not sketch.timelines %}\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<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{% if sketch.timelines %}\n<!-- Single metric info cards -->\n<div class=\"row\">\n- <div class=\"col-md-5\">\n+ <div class=\"col-md-6\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n<div class=\"text-center\">\n<h1>{{ sketch.timelines|length }}</h1>\n</div>\n</div>\n</div>\n- <div class=\"col-md-5\">\n+ <div class=\"col-md-6\">\n<div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n<div class=\"text-center\">\n<h1 ts-count-events sketch-id=\"{{ sketch.id }}\"></h1>\n</div>\n<div class=\"row\">\n- <div class=\"col-md-5\">\n+ <div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height:300px;\">\n<h4>Timelines</h4>\n{% endif %}\n</div>\n</div>\n- <div class=\"col-md-5\">\n+ <div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height: 300px;\">\n<h4>Views</h4>\n<ts-saved-view-list sketch-id=\"{{ sketch.id }}\"></ts-saved-view-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n- <div class=\"col-md-10\">\n-\n+ <div class=\"col-md-12\">\n{% if not sketch.timelines %}\n<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timeline.html",
"new_path": "timesketch/ui/templates/sketch/timeline.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<div class=\"card card-top\">\n<div class=\"pull-left\" style=\"width:50px;height:50px;background:#{{ timeline.color }};cursor: pointer\" data-toggle=\"modal\" data-target=\"#edit-timeline-modal\"></div>\n{% if sketch.has_permission(user=current_user, permission='write') %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "<div class=\"container\">\n{% if sketch.timelines %}\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n<table class=\"table table-hover\">\n<thead>\n{% if sketch.has_permission(current_user, 'write') %}\n{% if timelines %}\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<div class=\"card\">\n<h4 class=\"pull-left\">Add timeline</h4>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n{% if not sketch.timelines %}\n<div class=\"card\">\n<div class=\"text-center\" style=\"padding:100px;\">\n"
}
] | Python | Apache License 2.0 | google/timesketch | Read only stories |
263,093 | 19.02.2017 19:14:43 | -3,600 | a889a0ff3902292b3446a0757ac7ffdaff72fee8 | Consistent card width | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "</div>\n{% else %}\n<div class=\"row\">\n- <div class=\"col-md-10\">\n+ <div class=\"col-md-12\">\n<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"
}
] | Python | Apache License 2.0 | google/timesketch | Consistent card width |
263,093 | 24.02.2017 15:17:05 | -3,600 | 244b37c530c3172b2d04ae8ec61c7a0df3f755f3 | Handle missing indices gracefully | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -62,6 +62,7 @@ from timesketch.lib.forms import EventAnnotationForm\nfrom timesketch.lib.forms import ExploreForm\nfrom timesketch.lib.forms import UploadFileForm\nfrom timesketch.lib.forms import StoryForm\n+from timesketch.lib.utils import get_validated_indices\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import Event\nfrom timesketch.models.sketch import SearchIndex\n@@ -604,9 +605,9 @@ class ExploreResource(ResourceMixin, Resource):\nif u'_all' in indices:\nindices = sketch_indices\n- # Make sure that the indices in the filter are part of the sketch\n- if set(indices) - set(sketch_indices):\n- abort(HTTP_STATUS_CODE_BAD_REQUEST)\n+ # Make sure that the indices in the filter are part of the sketch.\n+ # This will also remove any deleted timeline from the search result.\n+ indices = get_validated_indices(indices, sketch_indices)\n# Make sure we have a query string or star filter\nif not (form.query.data,\n@@ -704,9 +705,13 @@ class AggregationResource(ResourceMixin, Resource):\nt.searchindex.index_name for t in sketch.timelines]\nindices = query_filter.get(u'indices', sketch_indices)\n- # Make sure that the indices in the filter are part of the sketch\n- if set(indices) - set(sketch_indices):\n- abort(HTTP_STATUS_CODE_BAD_REQUEST)\n+ # If _all in indices then execute the query on all indices\n+ if u'_all' in indices:\n+ indices = sketch_indices\n+\n+ # Make sure that the indices in the filter are part of the sketch.\n+ # This will also remove any deleted timeline from the search result.\n+ indices = get_validated_indices(indices, sketch_indices)\n# Make sure we have a query string or star filter\nif not (form.query.data,\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -246,12 +246,14 @@ class ElasticsearchDataStore(datastore.DataStore):\n# Check if we have specific events to fetch and get indices.\nif query_filter.get(u'events', None):\n- indices = {event[u'index'] for event in query_filter[u'events']}\n+ indices = {\n+ event[u'index'] for event in query_filter[u'events']\n+ if event[u'index'] in indices\n+ }\nquery_dsl = self.build_query(\nsketch_id, query_string, query_filter, query_dsl, aggregations)\n-\n# Default search type for elasticsearch is query_then_fetch.\nsearch_type = u'query_then_fetch'\nif not return_results:\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "@@ -56,3 +56,19 @@ def read_and_validate_csv(path):\nfor row in reader:\nyield row\n+\n+\n+def get_validated_indices(indices, sketch_indices):\n+ \"\"\"Exclude any deleted search index references.\n+\n+ Args:\n+ indices: List of indices from the user\n+ sketch_indices: List of indices in the sketch\n+\n+ Returns:\n+ Set of indices with those removed that is not in the sketch\n+ \"\"\"\n+ exclude = set(indices) - set(sketch_indices)\n+ if exclude:\n+ indices = [index for index in indices if index not in exclude]\n+ return indices\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils_test.py",
"new_path": "timesketch/lib/utils_test.py",
"diff": "import re\nfrom timesketch.lib.testlib import BaseTest\n+from timesketch.lib.utils import get_validated_indices\nfrom timesketch.lib.utils import random_color\n@@ -25,3 +26,15 @@ class TestUtils(BaseTest):\n\"\"\"Test to generate a random color.\"\"\"\ncolor = random_color()\nself.assertTrue(re.match(u'^[0-9a-fA-F]{6}$', color))\n+\n+ def test_get_validated_indices(self):\n+ \"\"\"Test for validating indices.\"\"\"\n+ sketch = self.sketch1\n+ sketch_indices = [t.searchindex.index_name for t in sketch.timelines]\n+ valid_indices = [u'test']\n+ invalid_indices = [u'test', u'fail']\n+ self.assertListEqual(\n+ sketch_indices, get_validated_indices(\n+ valid_indices, sketch_indices))\n+ self.assertFalse(\n+ u'fail' in get_validated_indices(invalid_indices, sketch_indices))\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/home.py",
"new_path": "timesketch/ui/views/home.py",
"diff": "@@ -17,14 +17,12 @@ from flask import Blueprint\nfrom flask import current_app\nfrom flask import render_template\nfrom flask import redirect\n-from flask import request\nfrom flask import url_for\nfrom flask_login import current_user\nfrom flask_login import login_required\nfrom sqlalchemy import not_\nfrom timesketch.models.sketch import Sketch\n-from timesketch.models.sketch import View\nfrom timesketch.lib.forms import HiddenNameDescriptionForm\nfrom timesketch.models import db_session\n"
}
] | Python | Apache License 2.0 | google/timesketch | Handle missing indices gracefully |
263,093 | 25.02.2017 10:34:56 | -3,600 | 54fd9eb12386de6b28242cd2ef6c64edfa1ff8bc | Add timeline API | [
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -39,6 +39,8 @@ from timesketch.api.v1.resources import StoryListResource\nfrom timesketch.api.v1.resources import StoryResource\nfrom timesketch.api.v1.resources import QueryResource\nfrom timesketch.api.v1.resources import CountEventsResource\n+from timesketch.api.v1.resources import TimelineResource\n+from timesketch.api.v1.resources import TimelineListResource\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.models import configure_engine\nfrom timesketch.models import init_db\n@@ -129,6 +131,11 @@ def create_app(config=None):\nQueryResource, u'/sketches/<int:sketch_id>/explore/query/')\napi_v1.add_resource(\nCountEventsResource, u'/sketches/<int:sketch_id>/count/')\n+ api_v1.add_resource(\n+ TimelineListResource, u'/sketches/<int:sketch_id>/timelines/')\n+ api_v1.add_resource(\n+ TimelineResource,\n+ u'/sketches/<int:sketch_id>/timelines/<int:timeline_id>/')\n# Register error handlers\n# pylint: disable=unused-variable\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -1144,3 +1144,40 @@ class CountEventsResource(ResourceMixin, Resource):\nmeta = dict(count=count)\nschema = dict(meta=meta, objects=[])\nreturn jsonify(schema)\n+\n+\n+class TimelineListResource(ResourceMixin, Resource):\n+ \"\"\"Resource to get all timelines for sketch.\"\"\"\n+ @login_required\n+ def get(self, sketch_id):\n+ \"\"\"Handles GET request to the resource.\n+\n+ Returns:\n+ View in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+ return self.to_json(sketch.timelines)\n+\n+\n+class TimelineResource(ResourceMixin, Resource):\n+ @login_required\n+ def delete(self, sketch_id, timeline_id):\n+ \"\"\"Handles DELETE request to the resource.\n+\n+ Args:\n+ sketch_id: Integer primary key for a sketch database model\n+ timeline_id: Integer primary key for a timeline database model\n+ \"\"\"\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+ timeline = Timeline.query.get(timeline_id)\n+\n+ # Check that this timeline belongs to the sketch\n+ if timeline.sketch_id != sketch.id:\n+ abort(HTTP_STATUS_CODE_NOT_FOUND)\n+\n+ if not sketch.has_permission(user=current_user, permission=u'write'):\n+ abort(HTTP_STATUS_CODE_FORBIDDEN)\n+\n+ sketch.timelines.remove(timeline)\n+ db_session.commit()\n+ return HTTP_STATUS_CODE_OK\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/api/api-service.js",
"new_path": "timesketch/ui/static/components/api/api-service.js",
"diff": "@@ -32,6 +32,27 @@ limitations under the License.\nreturn $http.get(resource_url)\n};\n+ this.getTimelines = function(sketch_id) {\n+ /**\n+ * Get all timelines for sketch.\n+ * @param sketch_id - The id for the sketch.\n+ * @returns A $http promise with two methods, success and error.\n+ */\n+ var resource_url = SKETCH_BASE_URL + sketch_id + '/timelines/';\n+ return $http.get(resource_url)\n+ };\n+\n+ this.deleteTimeline = function(sketch_id, timeline_id) {\n+ /**\n+ * Delete a Timesketch view.\n+ * @param sketch_id - The id for the sketch.\n+ * @param timeline_id - The id of the timeline.\n+ * @returns A $http promise with two methods, success and error.\n+ */\n+ var resource_url = SKETCH_BASE_URL + sketch_id + '/timelines/' + timeline_id + '/';\n+ return $http.delete(resource_url)\n+ };\n+\nthis.getViews = function(sketch_id) {\n/**\n* Get all saved views for sketch.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/ui/static/components/sketch/sketch-timelines-directive.js",
"diff": "+/*\n+ Copyright 2015 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+\n+(function() {\n+ var module = angular.module('timesketch.sketch.timelines.directive', []);\n+\n+ module.directive('tsTimelinesList', ['timesketchApi', function (timesketchApi) {\n+ /**\n+ * Render the list of timelines.\n+ */\n+ return {\n+ restrict: 'E',\n+ templateUrl: '/static/components/sketch/sketch-timelines-list.html',\n+ scope: {\n+ sketchId: '=',\n+ showEdit: '=',\n+ showDelete: '='\n+ },\n+ controller: function ($scope) {\n+ timesketchApi.getTimelines($scope.sketchId).success(function (data) {\n+ $scope.timelines = [];\n+ var timelines = data.objects[0];\n+ if (timelines) {\n+ for (var i = 0; i < timelines.length; i++) {\n+ var timeline = timelines[i];\n+ timeline.updated_at = moment.utc(timeline.updated_at).format(\"YYYY-MM-DD\");\n+ $scope.timelines.push(timeline)\n+ }\n+ }\n+ });\n+\n+ $scope.deleteTimeline = function(timeline) {\n+ timesketchApi.deleteTimeline($scope.sketchId, timeline.id);\n+ var index = $scope.timelines.indexOf(timeline);\n+ if (index > -1) {\n+ $scope.timelines.splice(index, 1);\n+ }\n+ };\n+\n+ this.updateTimelines = function(timeline) {\n+ $scope.timelines.unshift(timeline)\n+\n+ }\n+ }\n+ }\n+ }]);\n+\n+})();\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/ui/static/components/sketch/sketch-timelines-list.html",
"diff": "+<ul class=\"content-list\" ng-hide=\"!timelines.length\">\n+ <li class=\"content-item\" ng-repeat=\"timeline in timelines\">\n+\n+ <div ng-if=\"showEdit\" class=\"pull-right\" style=\"margin-top:2px;\">\n+ <a style=\"cursor: pointer; margin-left:10px; color:#333;\" ng-show=\"showEdit\" href=\"/sketch/{{ sketchId }}/timelines/{{ timeline.id }}/\"><i class=\"fa fa-edit\"></i></a>\n+ </div>\n+\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+ <div class=\"pull-right\" ng-show=\"confirmDelete\">\n+ <span class=\"btn btn-sm btn-danger\" style=\"margin-top:-5px; margin-right:5px;margin-left:5px;\" ng-click=\"deleteTimeline(timeline)\">Delete</span>\n+ <i class=\"fa fa-close\" style=\"cursor:pointer;\" ng-click=\"confirmDelete =! confirmDelete\"></i>\n+ </div>\n+ </div>\n+\n+ <div class=\"pull-right\">\n+ <span>{{ timeline.updated_at }}</span>\n+ </div>\n+ <div class=\"pull-left\" style=\"margin-top:-5px\">\n+ <div class=\"color-box\" style=\"background:#{{ timeline.color }};\"></div>\n+ </div>\n+ <div class=\"title\">\n+ <a style=\"font-weight: bold;\" href=\"/sketch/{{ sketchId }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n+ </div>\n+ </li>\n+</ul>\n+\n+<div ng-if=\"!timelines.length\">\n+ There are no timelines added yet.\n+</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch.js",
"new_path": "timesketch/ui/static/components/sketch/sketch.js",
"diff": "@@ -16,6 +16,7 @@ limitations under the License.\n(function() {\nvar module = angular.module('timesketch.sketch', [\n+ 'timesketch.sketch.timelines.directive',\n'timesketch.sketch.views.directive',\n'timesketch.sketch.count.events.directive'\n]);\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -50,6 +50,7 @@ limitations under the License.\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/core/core-edit-sketch-directive.js\"></script>\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/sketch/sketch.js\"></script>\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/sketch/sketch-views-directive.js\"></script>\n+ <script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/sketch/sketch-timelines-directive.js\"></script>\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/sketch/sketch-count-events-directive.js\"></script>\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/story/story.js\"></script>\n<script type=\"text/javascript\" language=\"javascript\" src=\"/static/components/story/story-directive.js\"></script>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "<div class=\"col-md-6\">\n<div class=\"card\" style=\"min-height:300px;\">\n<h4>Timelines</h4>\n-\n- {% if not sketch.timelines %}\n- <br>\n- {% if sketch.has_permission(current_user, 'write') %}\n- <a class=\"btn btn-success\" href=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\"><i class=\"fa fa-plus\"></i> Add a timeline to get started</a>\n- {% endif %}\n- {% else %}\n-\n- <ul class=\"content-list\">\n- {% for timeline in sketch.timelines|sort(attribute='created_at', reverse = True) %}\n- <li class=\"content-item\">\n- <div class=\"pull-right\">\n- <span>{{ timeline.created_at.strftime('%Y-%m-%d') }}</span>\n- </div>\n- <div>\n- <div class=\"pull-left\" style=\"margin-top:-5px\">\n- {% if timeline.searchindex.get_status.status == 'processing' %}\n- <div style=\"margin-top:5px;\">\n- <i style=\"margin-left:10px;margin-right: 15px;\" class=\"fa fa-circle-o-notch fa-spin\"></i>\n- </div>\n- {% else %}\n- <div class=\"color-box\" style=\"background:#{{ timeline.color }};\"></div>\n- {% endif %}\n- </div>\n-\n- <div class=\"title\">\n- {% if timeline.searchindex.get_status.status == 'processing' %}\n- <div>{{ timeline.name }}</div>\n- {% else %}\n- <a style=\"font-weight: bold;\" href=\"/sketch/{{ sketch.id }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n- {% endif %}\n- </div>\n- </div>\n- </li>\n- {% endfor %}\n- </ul>\n-\n- {% endif %}\n+ <ts-timelines-list sketch-id=\"{{ sketch.id }}\" show-delete=\"false\"></ts-timelines-list>\n</div>\n</div>\n<div class=\"col-md-6\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% block main %}\n<div class=\"container\">\n- {% if sketch.timelines %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n- <table class=\"table table-hover\">\n- <thead>\n- <tr>\n- <th width=\"50px\"></th>\n- <th></th>\n- <th>Added by</th>\n- <th>Added</th>\n- <th></th>\n- </tr>\n- <tbody>\n- {% for timeline in sketch.timelines %}\n- <tr>\n- <td>\n- {% if timeline.searchindex.get_status.status == 'processing' %}\n- <i class=\"fa fa-spinner fa-spin\"></i>\n- {% else %}\n- <div class=\"color-box\" style=\"background:#{{ timeline.color }};\"></div>\n- {% endif %}\n- </td>\n- <td>\n- <div style=\"margin-top:5px;\">\n- {% if timeline.searchindex.get_status.status == 'processing' %}\n- {{ timeline.name }}\n- {% else %}\n- <a href=\"/sketch/{{ sketch.id }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n- {% endif %}\n+ <h4>Timelines</h4>\n+ <ts-timelines-list sketch-id=\"{{ sketch.id }}\" show-delete=\"true\" show-edit=\"true\"></ts-timelines-list>\n</div>\n- </td>\n- <td>{{ timeline.user.name }}</td>\n- <td>\n- <div style=\"margin-top:5px;\">{{ timeline.created_at.strftime('%Y-%m-%d %H:%M') }}</div>\n- </td>\n- <td>\n- {% if sketch.has_permission(user=current_user, permission='write') %}\n- <a href=\"{{ url_for('sketch_views.timeline', sketch_id=sketch.id, timeline_id=timeline.id) }}\" class=\"btn btn-default pull-right\" style=\"margin-left:10px;width:50px;\"><i class=\"fa fa-pencil\"></i></a>\n- {% endif %}\n- </td>\n- </tr>\n- {% endfor %}\n- </tbody>\n- </table>\n</div>\n</div>\n</div>\n- {% endif %}\n+ <div class=\"container\">\n{% if sketch.has_permission(current_user, 'write') %}\n{% if timelines %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n-\n<div class=\"card\">\n<h4 class=\"pull-left\">Add timeline</h4>\n<ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n-\n<form method=\"post\" action=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">\n<table class=\"table table-hover\">\n<thead>\n{{ form.csrf_token }}\n<button class=\"btn btn-success\" type=\"submit\"><i class=\"fa fa-plus\"></i> Add to sketch</button>\n</form>\n- {% endif %}\n</div>\n</div>\n</div>\n{% endif %}\n+ {% endif %}\n</div>\n-\n{% endblock %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add timeline API |
263,093 | 25.02.2017 12:47:14 | -3,600 | b3cf9d011bd10561a2b0302974447e84bcb1e1d4 | Make upload name optional, default to filename | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -897,9 +897,9 @@ class UploadFileResource(ResourceMixin, Resource):\nsketch_id = form.sketch_id.data\nfile_storage = form.file.data\n- timeline_name = form.name.data\n- _, _extension = os.path.splitext(file_storage.filename)\n+ _filename, _extension = os.path.splitext(file_storage.filename)\nfile_extension = _extension.lstrip(u'.')\n+ timeline_name = form.name.data or _filename.rstrip(u'.')\nsketch = None\nif sketch_id:\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/forms.py",
"new_path": "timesketch/lib/forms.py",
"diff": "@@ -194,7 +194,7 @@ class UploadFileForm(BaseForm):\nFileAllowed(\n[u'plaso', u'csv'],\nu'Allowed file extensions: .plaso or .csv')])\n- name = StringField(u'Timeline name', validators=[DataRequired()])\n+ name = StringField(u'Timeline name', validators=[Optional()])\nsketch_id = IntegerField(u'Sketch ID', validators=[Optional()])\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"new_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"diff": "$scope.sketchId = 0;\n}\n$scope.uploadFile = function() {\n- if ($scope.uploadForm.name) {\n+ if (!$scope.uploadForm.name) {\n+ $scope.uploadForm.name = \"\";\n+ }\ntimesketchApi.uploadFile($scope.uploadForm.file, $scope.uploadForm.name, $scope.sketchId).success(function () {\n$scope.uploadForm = {};\n$window.location.reload();\n});\n- }\n};\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload.html",
"new_path": "timesketch/ui/static/components/core/core-upload.html",
"diff": "<form name=\"uploadform\" class=\"form-inline\" ng-submit=\"uploadFile()\">\n<span class=\"form-group\">\n- <span class=\"btn btn-success btn-file\">\n+ <span class=\"btn btn-file\" ng-class=\"{'btn-default': uploadForm.file, 'btn-success': !uploadForm.file}\">\n<i class=\"fa fa-cloud-upload\" style=\"margin-right: 5px;\"></i>\n<span ng-hide=\"uploadForm.file\">Import timeline</span>\n<span ng-show=\"uploadForm.file\">{{ uploadForm.file.name }}</span>\n</span>\n</span>\n<span ng-show=\"uploadForm.file\" class=\"form-group\">\n- <input class=\"form-control\" placeholder=\"New timeline name\" ng-model=\"uploadForm.name\" required autofocus/>\n+ <input class=\"form-control\" placeholder=\"(Optional) Timeline name\" ng-model=\"uploadForm.name\"/>\n</span>\n- <input type=\"submit\" ng-show=\"uploadForm.file\" class=\"btn btn-default\" value=\"Upload\"/>\n- <input type=\"reset\" ng-show=\"uploadForm.file\" class=\"btn btn-danger\" value=\"Cancel\" ng-click=\"clearForm()\"/>\n+ <input type=\"submit\" ng-show=\"uploadForm.file\" class=\"btn btn-success\" value=\"Upload\"/>\n+ <input type=\"reset\" ng-show=\"uploadForm.file\" class=\"btn btn-default\" value=\"Cancel\" ng-click=\"clearForm()\"/>\n</form>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make upload name optional, default to filename |
263,093 | 25.02.2017 14:54:27 | -3,600 | abd3bf03f7e2f7623ba17d40ea6d2409892d6305 | Remove data_type filter picker | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -652,26 +652,11 @@ class ExploreResource(ResourceMixin, Resource):\ntl_colors[timeline.searchindex.index_name] = timeline.color\ntl_names[timeline.searchindex.index_name] = timeline.name\n- try:\n- buckets = result[\n- u'aggregations'][\n- u'field_aggregation'][\n- u'buckets']\n- except KeyError:\n- buckets = None\n-\n- es_total_count_unfiltered = 0\n- if buckets:\n- for bucket in buckets:\n- es_total_count_unfiltered += bucket[u'doc_count']\n-\nmeta = {\nu'es_time': result[u'took'],\nu'es_total_count': result[u'hits'][u'total'],\n- u'es_total_count_unfiltered': es_total_count_unfiltered,\nu'timeline_colors': tl_colors,\nu'timeline_names': tl_names,\n- u'histogram': buckets\n}\nschema = {\nu'meta': meta,\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources_test.py",
"new_path": "timesketch/api/v1/resources_test.py",
"diff": "@@ -165,8 +165,6 @@ class ExploreResourceTest(BaseTest):\nu'test': u'FFFFFF'\n},\nu'es_total_count': 1,\n- u'es_total_count_unfiltered': 0,\n- u'histogram': None,\nu'es_time': 5\n},\nu'objects': [\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -192,28 +192,9 @@ class ElasticsearchDataStore(datastore.DataStore):\ndel query_dsl[u'aggregations']\n# Add any pre defined aggregations\n- data_type_aggregation = self._build_field_aggregator(u'data_type')\nif aggregations:\nif isinstance(aggregations, dict):\n- if query_filter.get(u'exclude', None):\n- aggregations = {\n- u'exclude': {\n- u'filter': {\n- u'not': {\n- u'terms': {\n- u'field_aggregation':\n- query_filter[u'exclude']\n- }\n- }\n- },\n- u'aggregations': aggregations\n- },\n- u'data_type':\n- data_type_aggregation[u'field_aggregation']\n- }\nquery_dsl[u'aggregations'] = aggregations\n- else:\n- query_dsl[u'aggregations'] = data_type_aggregation\nreturn query_dsl\n"
},
{
"change_type": "DELETE",
"old_path": "timesketch/ui/static/components/explore/explore-data-type-picker-item.html",
"new_path": null,
"diff": "-<table class=\"table ts-table-condensed\">\n- <tbody>\n- <tr>\n- <td width=\"270px\">\n- <label><input type=\"checkbox\" ng-checked=\"checkboxModel.active\" ng-click=\"toggleCheckbox()\">\n- <span ng-style=\"datatype_picker_title\" style=\"margin-left:20px;font-weight: normal;\">{{ datatype.key }}</span></label>\n- </td>\n- <td>\n- <div class=\"progress ts-progress-bar\">\n- <div class=\"progress-bar\" ng-style=\"datatype_picker_color\" role=\"progressbar\" aria-valuenow=\"{{ datatype.doc_count/meta.es_total_count_unfiltered*100 }}\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: {{ datatype.doc_count/meta.es_total_count_unfiltered*100 }}%;\">\n- </div>\n- </div>\n- </td>\n- <td width=\"70px\" style=\"padding-left:10px;\">\n- <span style=\"font-weight: bold;color: #999;\">{{ datatype.doc_count/meta.es_total_count_unfiltered*100|number:1 }}%</span>\n- </td>\n- <td width=\"90px\" align=\"right\">\n- <span ng-style=\"datatype_picker_title\" style=\"font-weight: bold;\">{{ datatype.doc_count }}</span>\n- </td>\n- </tr>\n- </tbody>\n-</table>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -118,65 +118,4 @@ limitations under the License.\n}\n});\n- module.directive('tsDataTypePickerItem', function() {\n- /**\n- * Manage the data types items to filter on.\n- */\n- return {\n- restrict: 'E',\n- templateUrl: '/static/components/explore/explore-data-type-picker-item.html',\n- scope: {\n- datatype: '=',\n- query: '=',\n- queryDsl: '=',\n- meta: '=',\n- filter: '='\n- },\n- require: '^tsSearch',\n- link: function(scope, elem, attrs, ctrl) {\n- scope.checkboxModel = {};\n- scope.checkboxModel.active = true;\n-\n- if (!scope.filter.exclude) {\n- scope.filter.exclude = [];\n- } else {\n- var index = scope.filter.exclude.indexOf(scope.datatype.key);\n- if (index > -1) {\n- scope.checkboxModel.active = false;\n- }\n- }\n-\n- scope.toggleCheckbox = function () {\n- var index = scope.filter.exclude.indexOf(scope.datatype.key);\n- scope.checkboxModel.active = !scope.checkboxModel.active;\n-\n- if (scope.checkboxModel.active) {\n- if (index > -1) {\n- scope.filter.exclude.splice(index, 1);\n- scope.datatype_picker_title = {'color': '#333', 'text-decoration': 'none'};\n- scope.datatype_picker_color = {'color': '#333', 'background': '#428bca'};\n- }\n- } else {\n- if (index == -1) {\n- scope.filter.exclude.push(scope.datatype.key);\n- scope.datatype_picker_title = {'color': '#D1D1D1', 'text-decoration': 'line-through'};\n- scope.datatype_picker_color = {'color': '#D1D1D1', 'background': '#D1D1D1'};\n- }\n- }\n- ctrl.search(scope.query, scope.filter, scope.queryDsl);\n- };\n- scope.$watch(\"filter\", function(value) {\n- if (scope.filter.exclude.indexOf(scope.datatype.key) == -1) {\n- scope.datatype_picker_title = {'color': '#333', 'text-decoration': 'none'};\n- scope.datatype_picker_color = {'color': '#333', 'background': '#428bca'};\n- } else {\n- scope.datatype_picker_title = {'color': '#D1D1D1', 'text-decoration': 'line-through'};\n- scope.datatype_picker_color = {'color': '#D1D1D1', 'background': '#D1D1D1'};\n- }\n- }, true);\n- }\n- }\n- });\n-\n-\n})();\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter.html",
"new_path": "timesketch/ui/static/components/explore/explore-filter.html",
"diff": "<ts-timeline-picker-item timeline=\"timeline\" query=\"query\" filter=\"filter\" query-dsl=\"queryDsl\"></ts-timeline-picker-item>\n</div>\n</div>\n-\n-<div class=\"filter-card\" ng-show=\"meta.histogram\">\n- <h5>Choose which data types to query</h5>\n- <div ng-repeat=\"datatype in meta.histogram\">\n- <ts-data-type-picker-item datatype=\"datatype\" query=\"query\" filter=\"filter\" meta=\"meta\" query-dsl=\"queryDsl\"></ts-data-type-picker-item>\n- </div>\n-</div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Remove data_type filter picker |
263,093 | 28.02.2017 01:28:54 | -3,600 | 4ba11df12baae911916a7337f1c4c58384d4f7f8 | Choose which fields to return | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -219,7 +219,7 @@ class ElasticsearchDataStore(datastore.DataStore):\ndef search(\nself, sketch_id, query_string, query_filter, query_dsl, indices,\n- aggregations=None, return_results=True):\n+ aggregations=None, return_results=True, return_fields=None):\n\"\"\"Search ElasticSearch. This will take a query string from the UI\ntogether with a filter definition. Based on this it will execute the\nsearch request on ElasticSearch and get result back.\n@@ -232,6 +232,7 @@ class ElasticsearchDataStore(datastore.DataStore):\nindices: List of indices to query\naggregations: Dict of Elasticsearch aggregations\nreturn_results: Boolean indicating if results should be returned\n+ return_fields: List of fields to return\nReturns:\nSet of event documents in JSON format\n@@ -240,6 +241,11 @@ class ElasticsearchDataStore(datastore.DataStore):\nDEFAULT_LIMIT = 500 # Maximum events to return\nLIMIT_RESULTS = query_filter.get(u'limit', DEFAULT_LIMIT)\n+ default_fields = [\n+ u'datetime', u'timestamp', u'message', u'timestamp_desc',\n+ u'timesketch_label', u'tag'\n+ ]\n+\n# Exit early if we have no indices to query\nif not indices:\nreturn {u'hits': {u'hits': [], u'total': 0}, u'took': 0}\n@@ -251,20 +257,21 @@ class ElasticsearchDataStore(datastore.DataStore):\nquery_dsl = self.build_query(\nsketch_id, query_string, query_filter, query_dsl, aggregations)\n-\n# Default search type for elasticsearch is query_then_fetch.\nsearch_type = u'query_then_fetch'\nif not return_results:\nsearch_type = u'count'\n+ if not return_fields:\n+ return_fields = default_fields\n+\n# Suppress the lint error because elasticsearch-py adds parameters\n# to the function with a decorator and this makes pylint sad.\n# pylint: disable=unexpected-keyword-arg\nreturn self.client.search(\nbody=query_dsl, index=list(indices), size=LIMIT_RESULTS,\n- search_type=search_type, _source_include=[\n- u'datetime', u'timestamp', u'message', u'timestamp_desc',\n- u'timesketch_label', u'tag'])\n+ search_type=search_type, _source_include=return_fields,\n+ scroll=u'1m')\ndef get_event(self, searchindex_id, event_id):\n\"\"\"Get one event from the datastore.\n"
}
] | Python | Apache License 2.0 | google/timesketch | Choose which fields to return |
263,093 | 09.03.2017 09:28:14 | -3,600 | a1016800b21990f1144018cd2910ee123c74e1cf | Bug fixes in the UI | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"new_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"diff": "restrict: 'E',\ntemplateUrl: '/static/components/core/core-upload.html',\nscope: {\n- sketchId: '=?'\n+ sketchId: '=?',\n+ btnText: '='\n},\ncontroller: function($scope) {\n$scope.uploadForm = {};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload.html",
"new_path": "timesketch/ui/static/components/core/core-upload.html",
"diff": "<span class=\"form-group\">\n<span class=\"btn btn-file\" ng-class=\"{'btn-default': uploadForm.file, 'btn-success': !uploadForm.file}\">\n<i class=\"fa fa-cloud-upload\" style=\"margin-right: 5px;\"></i>\n- <span ng-hide=\"uploadForm.file\">Import timeline</span>\n+ <span ng-hide=\"uploadForm.file\">{{ btnText||'Import timeline' }}</span>\n<span ng-show=\"uploadForm.file\">{{ uploadForm.file.name }}</span>\n<input type=\"file\" class=\"form-control\" ts-core-file-model=\"uploadForm.file\" />\n</span>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-timelines-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-timelines-list.html",
"diff": "</ul>\n<div ng-if=\"!timelines.length\">\n- There are no timelines added yet.\n+ No timelines\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"diff": "</ul>\n<div ng-if=\"!savedViews.length\">\n- There are no views saved yet.\n+ No saved views\n</div>\n<div ng-if=\"showSearchTemplates\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "<br><br>\n<div ng-if=\"stories.length < 1\">\n- There are no stories written yet.\n+ No stories\n</div>\n<div ng-if=\"stories.length > 0\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -227,7 +227,7 @@ header {\nposition: absolute;\nleft:0;\nright:0;\n- top:0;\n+ top:-11px;\nmargin-left:auto;\nmargin-right:auto;\ntext-align: center;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "{% extends \"base.html\" %}\n-{% block header_right %}\n- <div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n- <button data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n- {% if sketch.is_public %}\n- <i class=\"fa fa-globe\"></i> Share</button>\n- {% else %}\n- <i class=\"fa fa-lock\"></i> Share</button>\n- {% endif %}\n- </div>\n-{% endblock %}\n-\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</div>\n+ <button style=\"margin-left:10px;\" data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n+ {% if sketch.is_public %}\n+ <i class=\"fa fa-globe\"></i> Share</button>\n+ {% else %}\n+ <i class=\"fa fa-lock\"></i> Share</button>\n+ {% endif %}\n+\n</div>\n<h3 style=\"margin-top:10px;\">{{ sketch.name }}</h3>\n<p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% block main %}\n<div class=\"container\">\n+ {% if sketch.timelines %}\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card\" style=\"padding:30px;\">\n</div>\n</div>\n</div>\n+ {% endif %}\n+ {% if not sketch.timelines and not timelines %}\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+ </div>\n+ </div>\n+ </div>\n+ {% endif %}\n</div>\n<div class=\"container\">\n<div class=\"col-md-12\">\n<div class=\"card\">\n<h4 class=\"pull-left\">Add timeline</h4>\n- <ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n<form method=\"post\" action=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">\n<table class=\"table table-hover\">\n<thead>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Bug fixes in the UI |
263,093 | 09.03.2017 10:10:09 | -3,600 | 887a05c98bfc6a65b65aa8a5bfedfc71475a23f4 | Progress spinner on event count | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-count-events-directive.js",
"new_path": "timesketch/ui/static/components/sketch/sketch-count-events-directive.js",
"diff": "* Render event count.\n*/\nreturn {\n- restrict: 'A',\n- template: '{{count}}',\n+ restrict: 'E',\n+ templateUrl: '/static/components/sketch/sketch-count-events.html',\nscope: {\nsketchId: '='\n},\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/ui/static/components/sketch/sketch-count-events.html",
"diff": "+<span ng-if=\"!count\">\n+ <h1><i class=\"fa fa-circle-o-notch fa-spin\" style=\"color:#d1d1d1;\"></i></h1>\n+ Events\n+</span>\n+\n+<span ng-if=\"count\">\n+ <h1>{{ count }}</h1>\n+ Events\n+</span>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n</div>\n<div class=\"col-md-6\">\n- <div class=\"card\" style=\"border-top: 2px solid #428bca;\">\n+ <div class=\"card\" style=\"border-top: 2px solid #428bca; min-height: 132px\">\n<div class=\"text-center\">\n- <h1 ts-count-events sketch-id=\"{{ sketch.id }}\"></h1>\n- Events\n+ <ts-count-events sketch-id=\"{{ sketch.id }}\"></ts-count-events>\n</div>\n</div>\n</div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Progress spinner on event count |
263,129 | 10.03.2017 19:05:04 | 28,800 | 11fbfafeb7ffd7c1e4596264252de63ce6fcd49c | Use datetimes to build timelines | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "import colorsys\nimport csv\nimport random\n+import time\n+from dateutil import parser\ndef random_color():\n\"\"\"Generates a random color.\n@@ -40,10 +42,11 @@ def read_and_validate_csv(path):\n\"\"\"\n# Columns that must be present in the CSV file\nmandatory_fields = [\n- u'message', u'timestamp', u'datetime', u'timestamp_desc']\n+ u'message', u'datetime', u'timestamp_desc']\nwith open(path, u'rb') as fh:\n- reader = csv.DictReader(fh)\n+\n+ reader = csv.DictReader((x.replace('\\x00', '') for x in fh))\ncsv_header = reader.fieldnames\nmissing_fields = []\n# Validate the CSV header\n@@ -53,11 +56,18 @@ def read_and_validate_csv(path):\nif missing_fields:\nraise RuntimeError(\nu'Missing fields in CSV header: {0:s}'.format(missing_fields))\n-\nfor row in reader:\n+ if u'timestamp' not in csv_header and u'datetime' in csv_header:\n+ try:\n+ row['timestamp'] = str(int(time.mktime(\n+ parser.parse(row[\"datetime\"]).timetuple())))\n+ except ValueError:\n+ continue\n+\nyield row\n+\ndef get_validated_indices(indices, sketch_indices):\n\"\"\"Exclude any deleted search index references.\n"
}
] | Python | Apache License 2.0 | google/timesketch | Use datetimes to build timelines |
263,093 | 23.03.2017 10:34:30 | -3,600 | fb771346944ab93d4f8b78fdba596534ffe6f2be | Consistent context buttons | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -106,7 +106,7 @@ limitations under the License.\nscope.$watch(\"filter.indices\", function(value) {\nif (scope.filter.indices.indexOf(index_name) == -1) {\nscope.colorbox = {'background-color': '#E9E9E9'};\n- scope.timeline_picker_title = {'color': '#D1D1D1', 'text-decoration': 'line-through'};\n+ scope.timeline_picker_title = {'color': '#D1D1D1'};\nscope.checkboxModel.active = false;\n} else {\nscope.colorbox = {'background-color': \"#\" + scope.timeline.color};\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter.html",
"new_path": "timesketch/ui/static/components/explore/explore-filter.html",
"diff": "-<div ng-show=\"showFilters\" class=\"filter-card\">\n+<div ng-show=\"showFilters\" class=\"card\">\n<h5>Time range</h5>\n<form class=\"form-inline\" role=\"form\">\n<div class=\"form-group\">\n<input style=\"margin-right:5px;margin-left: 5px;\" type=\"submit\" class=\"btn btn-primary\" value=\"Filter\" ng-click=\"applyFilter()\">\n<input type=\"reset\" class=\"btn btn-default\" value=\"Clear\" ng-click=\"clearFilter()\">\n</form>\n-</div>\n-<div class=\"timeline-picker-card\" style=\"background:#f9f9f9;border-top:1px solid #f5f5f5;border-bottom:1px solid #f5f5f5;margin-top:20px;margin-bottom:20px;margin-left:-20px;margin-right:-20px;padding-left: 20px;padding-bottom: 20px;padding-top:20px;\">\n- <h5>Timelines to query</h5>\n+ <br><br>\n+ <h5>Timelines</h5>\n<div class=\"btn-group\">\n<button class=\"btn btn-default\" ng-click=\"enableAllTimelines()\"><i class=\"fa fa-check\"></i> Enable all</button>\n<button class=\"btn btn-default\" ng-click=\"disableAllTimelines()\"><i class=\"fa fa-ban\"></i> Disable all</button>\n<div ng-repeat=\"timeline in sketch.timelines\" class=\"pull-left timeline-box\">\n<ts-timeline-picker-item timeline=\"timeline\" query=\"query\" filter=\"filter\" query-dsl=\"queryDsl\"></ts-timeline-picker-item>\n</div>\n+\n+ <br><br><br>\n+\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search.html",
"new_path": "timesketch/ui/static/components/explore/explore-search.html",
"diff": "<br><br>\n</div>\n-<div class=\"card\" ng-show=\"showFilters && !showAdvanced\">\n+<div ng-show=\"showFilters && !showAdvanced\">\n<ts-filter\nfilter=\"filter\"\nquery=\"query\"\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-directive.js",
"new_path": "timesketch/ui/static/components/story/story-directive.js",
"diff": "restrict: 'E',\ntemplateUrl: '/static/components/story/story-list.html',\nscope: {\n- sketchId: '=',\n- showCreateButton: '='\n+ sketchId: '='\n},\ncontroller: function($scope) {\ntimesketchApi.getStories($scope.sketchId).success(function(data) {\n$scope.stories.push(story)\n}\n});\n+ }\n+ }\n+ }]);\n+ module.directive('tsCreateStory', ['timesketchApi', function(timesketchApi) {\n+ /**\n+ * Create story.\n+ */\n+ return {\n+ restrict: 'E',\n+ template: '<button class=\"btn btn-success\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Write a story</button>',\n+ scope: {\n+ sketchId: '='\n+ },\n+ controller: function($scope) {\n$scope.createStory = function () {\ntimesketchApi.createStory($scope.sketchId).success(function(data) {\nvar storyId = data.objects[0].id;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "-<button class=\"btn btn-success pull-right\" style=\"margin-top:-5px;\" ng-click=\"createStory()\"><i class=\"fa fa-plus\"></i> Write a story</button>\n-<br><br>\n-\n<div ng-if=\"stories.length < 1\">\nNo stories\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -71,6 +71,11 @@ header {\nfont-size: 16px;\n}\n+.right-nav {\n+ padding:10px;\n+ margin-right:5px;\n+}\n+\n.card {\nmargin-bottom: 20px;\nbackground: #fff;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/base.html",
"new_path": "timesketch/ui/templates/base.html",
"diff": "@@ -80,8 +80,13 @@ limitations under the License.\n<div id=\"subheader\">\n<div id=\"navigation\">\n<div class=\"col-md-12\">\n+ <div class=\"pull-left\">\n{% block navigation %}{% endblock %}\n</div>\n+ <div class=\"right-nav pull-right\">\n+ {% block right_nav %}{% endblock %}\n+ </div>\n+ </div>\n</div>\n</div>\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/home/home.html",
"new_path": "timesketch/ui/templates/home/home.html",
"diff": "{% extends \"base.html\" %}\n-{% block header_right %}\n+{% block right_nav %}\n{% if sketches.all() %}\n- <div class=\"pull-left\" style=\"margin-right:0px;margin-top: -6px;\">\n<form action=\"{{ url_for('home_views.home') }}\" method=\"post\">\n{{ form.name }}\n{{ form.description }}\n<button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-plus\"></i> New sketch</button>\n{{ form.csrf_token }}\n</form>\n- </div>\n{% endif %}\n{% endblock %}\n-{% block subheader %}{% endblock %}\n-\n{% block main %}\n-\n- <div style=\"margin-top:80px;\">\n-\n{% if not sketches.all() %}\n<div style=\"text-align: center\">\n<br><br>\n</form>\n</div>\n{% else %}\n- <div class=\"col-md-1\"></div>\n- <div class=\"col-md-10\">\n- <div class=\"col-md-12\">\n<div class=\"card\">\n{% if sketches.all() %}\n<div>\n</div>\n{% endif %}\n</div>\n- </div>\n- </div>\n- <div class=\"col-md-1\"></div>\n{% endif %}\n- </div>\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</ul>\n{% endblock %}\n+{% block right_nav %}\n+ <div class=\"btn-group\">\n+ {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n+ <ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+ {% endif %}\n+ </div>\n+\n+ <button style=\"margin-left:10px;\" data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n+ {% if sketch.is_public %}\n+ <i class=\"fa fa-globe\"></i> Share</button>\n+ {% else %}\n+ <i class=\"fa fa-lock\"></i> Share</button>\n+ {% endif %}\n+ </div>\n+{% endblock %}\n+\n{% block main %}\n<div class=\"modal\" id=\"new-sketch-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n{% if sketch.has_permission(user=current_user, permission='delete') %}\n<button class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#trash-modal\"><i class=\"fa fa-trash\"></i></button>\n{% endif %}\n-\n- {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n- <ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- {% endif %}\n-\n</div>\n-\n- <button style=\"margin-left:10px;\" data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n- {% if sketch.is_public %}\n- <i class=\"fa fa-globe\"></i> Share</button>\n- {% else %}\n- <i class=\"fa fa-lock\"></i> Share</button>\n- {% endif %}\n-\n</div>\n<h3 style=\"margin-top:10px;\">{{ sketch.name }}</h3>\n+ {% if not sketch.description %}\n+ <a data-toggle=\"modal\" data-target=\"#edit-sketch-modal\">Add description</a>\n+ {% endif %}\n<p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n{% if sketch.collaborators or sketch.groups %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "</ul>\n{% endblock %}\n+{% block right_nav %}\n+ <ts-create-story sketch-id=\"{{ sketch.id }}\"></ts-create-story>\n+{% endblock %}\n+\n{% block main %}\n<div class=\"container\">\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<ts-story-list sketch-id=\"{{ sketch.id }}\" show-create-button=\"true\"></ts-story-list>\n{% endif %}\n</div>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Consistent context buttons |
263,127 | 28.03.2017 17:00:49 | -7,200 | 00af391c46c1ce76424a2883a1d17bcb2160085d | Add first mockup of dynamic datetime search to time_start filter form field | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -43,9 +43,48 @@ limitations under the License.\nrequire: '^tsSearch',\nlink: function(scope, elem, attrs, ctrl) {\nscope.applyFilter = function() {\n+ //TODO: Implement dynamic timefilter\n+ scope.parseDate(scope.filter.time_start)\nctrl.search(scope.query, scope.filter, scope.queryDsl)\n};\n+ scope.parseDate = function(datevalue){\n+ //Parse out 'T' date time seperator needed by ELK but not by moment.js\n+ datevalue=datevalue.replace(/T/g,' ');\n+ //console.log(datevalue);\n+\n+ //Parse offset given by user. Eg. +-10m\n+ var offsetRegexp = /(.*?)(-|\\+|\\+-|-\\+)(\\d+)(y|d|h|m|s)/g;\n+ var match = offsetRegexp.exec(datevalue);\n+\n+ //console.log(\"offset rexexp:\")\n+ //console.log(match[0]);\n+ //console.log(match[1]);\n+ //console.log(match[2]);\n+ //console.log(match[3]);\n+ //console.log(match[4]);\n+\n+ if (match != null) {\n+ //calculate filter start and end datetimes\n+ if (match[2] == '+') {\n+ scope.filter.time_start = moment.utc(match[1]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ scope.filter.time_end = moment.utc(match[1]).add(match[3],match[4]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ }\n+\n+ if (match[2] == '-') {\n+ scope.filter.time_start = moment.utc(match[1]).subtract(match[3],match[4]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ scope.filter.time_end = moment.utc(match[1]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ }\n+ if (match[2] == '-+' || match[2] == '+-') {\n+ scope.filter.time_start = moment.utc(match[1]).subtract(match[3],match[4]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ scope.filter.time_end = moment.utc(match[1]).add(match[3],match[4]).format(\"YYYY-MM-DDThh:mm:ss\");\n+ }\n+\n+ //console.log(scope.filter.time_start)\n+ //console.log(scope.filter.time_end)\n+ }\n+ }\n+\nscope.clearFilter = function() {\ndelete scope.filter.time_start;\ndelete scope.filter.time_end;\n@@ -69,6 +108,7 @@ limitations under the License.\n}\n}\n+\n}\n});\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add first mockup of dynamic datetime search to time_start filter form field |
263,093 | 29.03.2017 12:17:09 | -7,200 | 977f88ec000de3e82500951d9f9b4e1f6036e7d7 | Move buttons to centext bar | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "{% endblock %}\n{% block right_nav %}\n+ {% if sketch.timelines %}\n<ts-create-story sketch-id=\"{{ sketch.id }}\"></ts-create-story>\n+ {% endif %}\n{% endblock %}\n{% block main %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "</ul>\n{% endblock %}\n+{% block right_nav %}\n+ {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n+ <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+ {% endif %}\n+{% endblock %}\n+\n{% block main %}\n<div class=\"container\">\n"
}
] | Python | Apache License 2.0 | google/timesketch | Move buttons to centext bar |
263,093 | 29.03.2017 12:49:27 | -7,200 | 16543307ca0d18d55aeaa779ee40f116b0e2d14b | Center plus sign in story dropdown | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-dropdown.html",
"new_path": "timesketch/ui/static/components/story/story-dropdown.html",
"diff": "-<div ng-click=\"showDropdown = !showDropdown\" contenteditable=\"false\" style=\"cursor:pointer; position:absolute; margin-left:-60px;margin-top:-5px; padding-top:3px; padding-left:2px; background: #fff;border:1px solid #d1d1d1; width:40px;height:40px;text-align: center;border-radius: 100%;color:#666;\"><span style=\"font-size:1.7em;\">+</span></div>\n+<div ng-click=\"showDropdown = !showDropdown\" contenteditable=\"false\" style=\"cursor:pointer; position:absolute; margin-left:-60px;margin-top:-5px; padding-left:2px; background: #fff;border:1px solid #d1d1d1; width:40px;height:40px;text-align: center;border-radius: 100%;color:#666;\"><span style=\"font-size:1.7em;\">+</span></div>\n<select ng-show=\"showDropdown\" class=\"select select-view\" ng-model=\"selectedView.view\" ng-options=\"view.name for view in sketch.views\">\n<option value=\"\">Choose View</option>\n</select>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Center plus sign in story dropdown |
263,093 | 29.03.2017 13:36:17 | -7,200 | e800f1f2d80da713d0ad775537041423af85b6f0 | Make buttons rounded and trim some UI text | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-event-list.html",
"new_path": "timesketch/ui/static/components/explore/explore-event-list.html",
"diff": "<div class=\"card\" ng-if=\"view\">\n- <h4><span style=\"font-weight: normal\">View:</span> {{ view.name }}</h4>\n+ <h4>{{ view.name }}</h4>\nYou are exploring in the context of a saved view.\n<br>\nClick <a href=\"/sketch/{{ sketchId }}/explore\">here</a> to go back to explore view.\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search.html",
"new_path": "timesketch/ui/static/components/explore/explore-search.html",
"diff": "</div>\n<div class=\"card\" ng-show=\"searchTemplate\">\n- <h4><span style=\"font-weight: normal\">Search template:</span> {{ searchTemplate.name }}</h4>\n+ <h4>{{ searchTemplate.name }}</h4>\nYou are exploring in the context of a search template.\n<br>\nClick <a href=\"/sketch/{{ sketchId }}/explore\">here</a> to go back to explore view.\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-timelines-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-timelines-list.html",
"diff": "<div class=\"color-box\" style=\"background:#{{ timeline.color }};\"></div>\n</div>\n<div class=\"title\">\n- <a style=\"font-weight: bold;\" href=\"/sketch/{{ sketchId }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n+ <a style=\"text-decoration: none; font-weight: 500;font-size: 1.1em;\" href=\"/sketch/{{ sketchId }}/explore/?q=*&index={{ timeline.searchindex.index_name }}&limit=40\">{{ timeline.name }}</a>\n</div>\n</li>\n</ul>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"new_path": "timesketch/ui/static/components/sketch/sketch-views-list.html",
"diff": "<ul class=\"content-list\" ng-hide=\"!savedViews.length\">\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:1px;margin-left:10px;\"></i>\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<div class=\"pull-right\" ng-show=\"confirmDelete\">\n<span class=\"btn btn-sm btn-danger\" style=\"margin-top:-5px; margin-right:5px;margin-left:5px;\" ng-click=\"deleteView(view)\">Delete</span>\n<i class=\"fa fa-close\" style=\"cursor:pointer;\" ng-click=\"confirmDelete =! confirmDelete\"></i>\n<span>{{ view.updated_at }}</span>\n</div>\n<div class=\"title\">\n- <a style=\"font-weight: bold;\" href=\"/sketch/{{ sketchId }}/explore/view/{{ view.id }}/\">{{ view.name }}</a>\n+ <a style=\"text-decoration: none; font-weight: 500;font-size: 1.1em;\" href=\"/sketch/{{ sketchId }}/explore/view/{{ view.id }}/\">{{ view.name }}</a>\n</div>\n</li>\n</ul>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/story/story-list.html",
"new_path": "timesketch/ui/static/components/story/story-list.html",
"diff": "<span>{{ story.created_at }}</span>\n</div>\n<div class=\"title\">\n- <a style=\"text-decoration: none; font-weight: 500;font-size: 1.2em;\" href=\"/sketch/{{ sketchId }}/stories/{{ story.id }}/\"><b>{{ story.title||'Untitled story' }}</b></a>\n+ <a style=\"text-decoration: none; font-weight: 500;font-size: 1.1em;\" href=\"/sketch/{{ sketchId }}/stories/{{ story.id }}/\"><b>{{ story.title||'Untitled story' }}</b></a>\n<br>\nCreated by {{ story.user.username }}\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -497,7 +497,7 @@ rect.bordered {\n}\n.btn {\n- border-radius: 0;\n+ border-radius: 4px;\n}\n.label {\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make buttons rounded and trim some UI text |
263,093 | 30.03.2017 14:14:39 | -7,200 | d4314a1af3bb9756150de2d4fcf08f94201cc88f | Hide upload button when disabled | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "{% block right_nav %}\n<div class=\"btn-group\">\n- {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n+ {% if sketch.has_permission(current_user, 'write') and sketch.timelines and upload_enabled %}\n<ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n{% endif %}\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% endblock %}\n{% block right_nav %}\n- {% if sketch.has_permission(current_user, 'write') and sketch.timelines %}\n+ {% if sketch.has_permission(current_user, 'write') and sketch.timelines and upload_enabled %}\n<ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n{% endif %}\n{% endblock %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/sketch.py",
"new_path": "timesketch/ui/views/sketch.py",
"diff": "@@ -68,6 +68,7 @@ def overview(sketch_id):\npermission_form = TogglePublic()\nstatus_form = StatusForm()\ntrash_form = TrashForm()\n+ upload_enabled = current_app.config[u'UPLOAD_ENABLED']\n# Dynamically set the forms select options.\n# pylint: disable=singleton-comparison\n@@ -157,7 +158,7 @@ def overview(sketch_id):\nreturn render_template(\nu'sketch/overview.html', sketch=sketch, sketch_form=sketch_form,\npermission_form=permission_form, status_form=status_form,\n- trash_form=trash_form)\n+ trash_form=trash_form, upload_enabled=upload_enabled)\n@sketch_views.route(\n@@ -296,6 +297,7 @@ def timelines(sketch_id):\ncurrent_user).order_by(\ndesc(SearchIndex.created_at)).filter(\nnot_(SearchIndex.id.in_(searchindices_in_sketch)))\n+ upload_enabled = current_app.config[u'UPLOAD_ENABLED']\n# Setup the form\nform = AddTimelineForm()\n@@ -318,7 +320,7 @@ def timelines(sketch_id):\nreturn render_template(\nu'sketch/timelines.html', sketch=sketch, timelines=indices.all(),\n- form=form)\n+ form=form, upload_enabled=upload_enabled)\n@sketch_views.route(\n"
}
] | Python | Apache License 2.0 | google/timesketch | Hide upload button when disabled |
263,093 | 30.03.2017 14:27:14 | -7,200 | 1beb18ce99bc603aabd3613392b14b0bddbc0f2c | Remove UI element for adding description | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n</div>\n<h3 style=\"margin-top:10px;\">{{ sketch.name }}</h3>\n- {% if not sketch.description %}\n- <a data-toggle=\"modal\" data-target=\"#edit-sketch-modal\" style=\"cursor: pointer;\">+ Add description</a>\n- {% endif %}\n<p style=\"white-space: pre-wrap;word-wrap: break-word; max-width: 800px;\">{{ sketch.description }}</p>\n{% if sketch.collaborators or sketch.groups %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Remove UI element for adding description |
263,093 | 31.03.2017 13:16:05 | -7,200 | 5ffb9a3c72d4477dc2ad2db669ffdb6d2fae76cb | Make scroll API available | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -200,7 +200,8 @@ class ElasticsearchDataStore(datastore.DataStore):\ndef search(\nself, sketch_id, query_string, query_filter, query_dsl, indices,\n- aggregations=None, return_results=True, return_fields=None):\n+ aggregations=None, return_results=True, return_fields=None,\n+ scroll=None):\n\"\"\"Search ElasticSearch. This will take a query string from the UI\ntogether with a filter definition. Based on this it will execute the\nsearch request on ElasticSearch and get result back.\n@@ -214,6 +215,7 @@ class ElasticsearchDataStore(datastore.DataStore):\naggregations: Dict of Elasticsearch aggregations\nreturn_results: Boolean indicating if results should be returned\nreturn_fields: List of fields to return\n+ scroll: If Elasticsearch scroll API should be used\nReturns:\nSet of event documents in JSON format\n@@ -222,10 +224,18 @@ class ElasticsearchDataStore(datastore.DataStore):\nDEFAULT_LIMIT = 500 # Maximum events to return\nLIMIT_RESULTS = query_filter.get(u'limit', DEFAULT_LIMIT)\n+ # Default timeout for the scroll API\n+ default_scroll_timeout = u'1m' # 1 minute\n+ if scroll:\n+ scroll = default_scroll_timeout\n+\n+ # Use default fields if none is provided\ndefault_fields = [\nu'datetime', u'timestamp', u'message', u'timestamp_desc',\nu'timesketch_label', u'tag'\n]\n+ if not return_fields:\n+ return_fields = default_fields\n# Exit early if we have no indices to query\nif not indices:\n@@ -246,16 +256,13 @@ class ElasticsearchDataStore(datastore.DataStore):\nif not return_results:\nsearch_type = u'count'\n- if not return_fields:\n- return_fields = default_fields\n-\n# Suppress the lint error because elasticsearch-py adds parameters\n# to the function with a decorator and this makes pylint sad.\n# pylint: disable=unexpected-keyword-arg\nreturn self.client.search(\nbody=query_dsl, index=list(indices), size=LIMIT_RESULTS,\nsearch_type=search_type, _source_include=return_fields,\n- scroll=u'1m')\n+ scroll=scroll)\ndef get_event(self, searchindex_id, event_id):\n\"\"\"Get one event from the datastore.\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make scroll API available |
263,093 | 12.04.2017 08:59:26 | -7,200 | 2ab7bf73fd9c69ab2836f54f4bfce396804950fc | More intuitive scroll | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -201,7 +201,7 @@ class ElasticsearchDataStore(datastore.DataStore):\ndef search(\nself, sketch_id, query_string, query_filter, query_dsl, indices,\naggregations=None, return_results=True, return_fields=None,\n- scroll=None):\n+ enable_scroll=False):\n\"\"\"Search ElasticSearch. This will take a query string from the UI\ntogether with a filter definition. Based on this it will execute the\nsearch request on ElasticSearch and get result back.\n@@ -215,7 +215,7 @@ class ElasticsearchDataStore(datastore.DataStore):\naggregations: Dict of Elasticsearch aggregations\nreturn_results: Boolean indicating if results should be returned\nreturn_fields: List of fields to return\n- scroll: If Elasticsearch scroll API should be used\n+ enable_scroll: If Elasticsearch scroll API should be used\nReturns:\nSet of event documents in JSON format\n@@ -224,10 +224,9 @@ class ElasticsearchDataStore(datastore.DataStore):\nDEFAULT_LIMIT = 500 # Maximum events to return\nLIMIT_RESULTS = query_filter.get(u'limit', DEFAULT_LIMIT)\n- # Default timeout for the scroll API\n- default_scroll_timeout = u'1m' # 1 minute\n- if scroll:\n- scroll = default_scroll_timeout\n+ scroll_timeout = None\n+ if enable_scroll:\n+ scroll_timeout = u'1m' # Default to 1 minute scroll timeout\n# Use default fields if none is provided\ndefault_fields = [\n@@ -262,7 +261,7 @@ class ElasticsearchDataStore(datastore.DataStore):\nreturn self.client.search(\nbody=query_dsl, index=list(indices), size=LIMIT_RESULTS,\nsearch_type=search_type, _source_include=return_fields,\n- scroll=scroll)\n+ scroll=scroll_timeout)\ndef get_event(self, searchindex_id, event_id):\n\"\"\"Get one event from the datastore.\n"
}
] | Python | Apache License 2.0 | google/timesketch | More intuitive scroll |
263,129 | 12.04.2017 17:31:35 | -7,200 | f5fc3e6346b37fa2540ccee796daad287db53b33 | Rename variables and remove clearing of null bytes | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "@@ -46,7 +46,7 @@ def read_and_validate_csv(path):\nwith open(path, u'rb') as fh:\n- reader = csv.DictReader((x.replace('\\x00', '') for x in fh))\n+ reader = csv.DictReader(fh)\ncsv_header = reader.fieldnames\nmissing_fields = []\n# Validate the CSV header\n@@ -59,8 +59,8 @@ def read_and_validate_csv(path):\nfor row in reader:\nif u'timestamp' not in csv_header and u'datetime' in csv_header:\ntry:\n- parsed = parser.parse(row[u'datetime'])\n- row[u'timestamp'] = int(time.mktime(parsed.timetuple()))\n+ parsed_datetime = parser.parse(row[u'datetime'])\n+ row[u'timestamp'] = int(time.mktime(parsed_datetime.timetuple()))\nexcept ValueError:\ncontinue\n"
}
] | Python | Apache License 2.0 | google/timesketch | Rename variables and remove clearing of null bytes |
263,093 | 13.04.2017 12:21:16 | -7,200 | 0514114a9d0586f8f14c06a5c7ea72be15c24a60 | Initial graph backend and API resource | [
{
"change_type": "MODIFY",
"old_path": "setup.py",
"new_path": "setup.py",
"diff": "@@ -63,5 +63,6 @@ setup(\nu'redis',\nu'blinker',\nu'elasticsearch',\n+ u'neo4jrestclient'\n])\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch.conf",
"new_path": "timesketch.conf",
"diff": "@@ -83,3 +83,16 @@ 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+\n+#-------------------------------------------------------------------------------\n+\n+# Graph backend configuration.\n+#\n+GRAPH_BACKEND_ENABLED = False\n+\n+# Neo4j server configuration\n+NEO4J_HOST = u'127.0.0.1'\n+NEO4J_PORT = 7474\n+NEO4J_USERNAME = u''\n+NEO4J_PASSWORD = u''\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -27,6 +27,7 @@ from timesketch.api.v1.resources import AggregationResource\nfrom timesketch.api.v1.resources import ExploreResource\nfrom timesketch.api.v1.resources import EventResource\nfrom timesketch.api.v1.resources import EventAnnotationResource\n+from timesketch.api.v1.resources import GraphResource\nfrom timesketch.api.v1.resources import SketchResource\nfrom timesketch.api.v1.resources import SketchListResource\nfrom timesketch.api.v1.resources import ViewResource\n@@ -136,6 +137,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(\n+ GraphResource,\n+ u'/sketches/<int:sketch_id>/explore/graph/')\n# Register error handlers\n# pylint: disable=unused-variable\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -53,6 +53,7 @@ from 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\nfrom timesketch.lib.datastores.elastic import ElasticsearchDataStore\n+from timesketch.lib.datastores.neo4j import Neo4jDataStore\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.lib.forms import AddTimelineForm\nfrom timesketch.lib.forms import AggregationForm\n@@ -62,6 +63,7 @@ from timesketch.lib.forms import EventAnnotationForm\nfrom timesketch.lib.forms import ExploreForm\nfrom timesketch.lib.forms import UploadFileForm\nfrom timesketch.lib.forms import StoryForm\n+from timesketch.lib.forms import GraphExploreForm\nfrom timesketch.lib.utils import get_validated_indices\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import Event\n@@ -189,6 +191,20 @@ class ResourceMixin(object):\nhost=current_app.config[u'ELASTIC_HOST'],\nport=current_app.config[u'ELASTIC_PORT'])\n+ @property\n+ def graph_datastore(self):\n+ \"\"\"Property to get an instance of the graph database backend.\n+\n+ Returns:\n+ Instance of timesketch.lib.datastores.neo4j.Neo4jDatabase\n+ \"\"\"\n+ return Neo4jDataStore(\n+ host=current_app.config[u'NEO4J_HOST'],\n+ port=current_app.config[u'NEO4J_PORT'],\n+ username=current_app.config[u'NEO4J_USERNAME'],\n+ password=current_app.config[u'NEO4J_PASSWORD']\n+ )\n+\ndef to_json(\nself, model, model_fields=None, meta=None,\nstatus_code=HTTP_STATUS_CODE_OK):\n@@ -1145,6 +1161,7 @@ class TimelineListResource(ResourceMixin, Resource):\nclass TimelineResource(ResourceMixin, Resource):\n+ \"\"\"Resource for a timeline.\"\"\"\n@login_required\ndef delete(self, sketch_id, timeline_id):\n\"\"\"Handles DELETE request to the resource.\n@@ -1166,3 +1183,35 @@ class TimelineResource(ResourceMixin, Resource):\nsketch.timelines.remove(timeline)\ndb_session.commit()\nreturn HTTP_STATUS_CODE_OK\n+\n+\n+class GraphResource(ResourceMixin, Resource):\n+ \"\"\"Resource to get result from graph query.\"\"\"\n+ @login_required\n+ def post(self, sketch_id):\n+ \"\"\"Handles GET request to the resource.\n+\n+ Args:\n+ sketch_id: Integer primary key for a sketch database model\n+\n+ Returns:\n+ Graph in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ # Check access to the sketch\n+ Sketch.query.get_with_acl(sketch_id)\n+\n+ form = GraphExploreForm.build(request)\n+ if form.validate_on_submit():\n+ query = form.query.data\n+ output_format = form.output_format.data\n+ result = self.graph_datastore.search(\n+ query, output_format=output_format)\n+ schema = {\n+ u'meta': {},\n+ u'objects': [{\n+ u'graph': result[u'graph'],\n+ u'rows': result[u'rows'],\n+ u'stats': result[u'stats']\n+ }]\n+ }\n+ return jsonify(schema)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/lib/datastores/neo4j.py",
"diff": "+# Copyright 2015 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+\"\"\"Neo4j graph database.\"\"\"\n+\n+from neo4jrestclient.client import GraphDatabase\n+from neo4jrestclient.constants import DATA_GRAPH\n+\n+\n+class Neo4jDataStore(object):\n+ \"\"\"Implements the datastore.\"\"\"\n+ def __init__(self, username, password, host=u'127.0.0.1', port=7474):\n+ \"\"\"Create a neo4j client.\"\"\"\n+ super(Neo4jDataStore, self).__init__()\n+ self.client = GraphDatabase(\n+ u'http://{0:s}:{1:d}/db/data/'.format(host, port),\n+ username=username, password=password)\n+\n+ @staticmethod\n+ def _get_formatter(output_format):\n+ default_output_format = u'neo4j'\n+ formatter_registry = {\n+ u'neo4j': Neo4jOutputFormatter,\n+ u'cytoscape': CytoscapeOutputFormatter\n+ }\n+ formatter = formatter_registry.get(output_format, None)\n+ if not formatter:\n+ formatter = formatter_registry.get(default_output_format)\n+ return formatter()\n+\n+ def search(self, query, output_format=None, return_rows=False):\n+ data_content = DATA_GRAPH\n+ if return_rows:\n+ data_content = True\n+ query_result = self.client.query(query, data_contents=data_content)\n+ formatter = self._get_formatter(output_format)\n+ return formatter.format(query_result, return_rows)\n+\n+\n+class OutputFormatterBaseClass(object):\n+ def __init__(self):\n+ super(OutputFormatterBaseClass, self).__init__()\n+ self.schema = dict(stats=None, rows=None, graph=None)\n+\n+ def format(self, data, return_rows):\n+ self.schema[u'stats'] = data.stats\n+ self.schema[u'graph'] = self.format_graph(data.graph)\n+ if return_rows:\n+ self.schema[u'rows'] = data.rows\n+ return self.schema\n+\n+ def format_graph(self, graph):\n+ node_list = []\n+ edge_list = []\n+ for subgraph in graph:\n+ nodes = subgraph[u'nodes']\n+ edges = subgraph[u'relationships']\n+ for node in nodes:\n+ formatted_node = self.format_node(node)\n+ if formatted_node not in node_list:\n+ node_list.append(formatted_node)\n+ for edge in edges:\n+ formatted_edge = self.format_edge(edge)\n+ if formatted_edge not in edge_list:\n+ edge_list.append(formatted_edge)\n+ formatted_graph = {u'nodes': node_list, u'edges': edge_list}\n+ return formatted_graph\n+\n+ def format_node(self, node):\n+ return NotImplemented\n+\n+ def format_edge(self, edge):\n+ return NotImplemented\n+\n+\n+class Neo4jOutputFormatter(OutputFormatterBaseClass):\n+ def __init__(self):\n+ super(Neo4jOutputFormatter, self).__init__()\n+\n+ def format_graph(self, graph):\n+ return graph\n+\n+\n+class CytoscapeOutputFormatter(OutputFormatterBaseClass):\n+ def __init__(self):\n+ super(CytoscapeOutputFormatter, self).__init__()\n+\n+ def format_node(self, node):\n+ cytoscape_node = {\n+ u'data': {\n+ u'id': node[u'id'],\n+ u'label': node[u'properties'][u'name'],\n+ u'type': node[u'labels'][0]\n+ }\n+ }\n+ return cytoscape_node\n+\n+ def format_edge(self, edge):\n+ try:\n+ label = edge[u'properties'][u'human_readable']\n+ except KeyError:\n+ label = edge[u'type']\n+ cytoscape_edge = {\n+ u'data': {\n+ u'id': edge[u'id'],\n+ u'source': edge[u'startNode'],\n+ u'target': edge[u'endNode'],\n+ u'label': label\n+ }\n+ }\n+ return cytoscape_edge\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/forms.py",
"new_path": "timesketch/lib/forms.py",
"diff": "@@ -156,6 +156,12 @@ class ExploreForm(BaseForm):\ndsl = StringField(u'DSL')\n+class GraphExploreForm(BaseForm):\n+ \"\"\"Form used to search the graph datastore.\"\"\"\n+ query = StringField(u'Query')\n+ output_format = StringField(u'Output format')\n+\n+\nclass AggregationForm(ExploreForm):\n\"\"\"Form used to search the datastore.\"\"\"\naggtype = StringField(u'Aggregation type')\n"
}
] | Python | Apache License 2.0 | google/timesketch | Initial graph backend and API resource |
263,093 | 13.04.2017 13:50:45 | -7,200 | 70d7190141533efbac58525f21517cfba853e9cf | Add painless scripts | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "contrib/add_label.painless",
"diff": "+if( ! ctx._source.timesketch_label.contains (params.timesketch_label)) {\n+ ctx._source.timesketch_label.add(params.timesketch_label)\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "contrib/toggle_label.painless",
"diff": "+if(ctx._source.timesketch_label.contains(params.timesketch_label)) {\n+ for (int i = 0; i < ctx._source.timesketch_label.size(); i++) {\n+ if (ctx._source.timesketch_label[i] == params.timesketch_label) {\n+ ctx._source.timesketch_label.remove(i)\n+ }\n+ i++;\n+ }\n+} else {\n+ ctx._source.timesketch_label.add(params.timesketch_label)\n+}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add painless scripts |
263,093 | 13.04.2017 22:00:26 | -7,200 | 5fbe7e3403c6a8c2bb9870d6393a2bf2e80d7bbc | Add tests for graph backend | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastore.py",
"new_path": "timesketch/lib/datastore.py",
"diff": "@@ -24,16 +24,20 @@ class DataStore(object):\n@abc.abstractmethod\ndef search(\nself, sketch_id, query, query_filter, query_dsl, indices,\n- aggregations, return_results):\n+ aggregations, return_results, return_fields, enable_scroll):\n\"\"\"Return search results.\nArgs:\nsketch_id: Integer of sketch primary key\nquery: Query string\nquery_filter: Dictionary containing filters to apply\n+ query_dsl: Dictionary containing Elasticsearch DSL query\nindices: List of indices to query\naggregations: Dict of Elasticsearch aggregations\nreturn_results: Boolean indicating if results should be returned\n+ return_fields: List of fields to be returned\n+ enable_scroll: If Elasticsearch scroll API should be used\n+\n\"\"\"\n@abc.abstractmethod\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/neo4j.py",
"new_path": "timesketch/lib/datastores/neo4j.py",
"diff": "-# Copyright 2015 Google Inc. All rights reserved.\n+# 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# 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-\"\"\"Neo4j graph database.\"\"\"\n+\"\"\"Neo4j graph datastore.\"\"\"\nfrom neo4jrestclient.client import GraphDatabase\nfrom neo4jrestclient.constants import DATA_GRAPH\nclass Neo4jDataStore(object):\n- \"\"\"Implements the datastore.\"\"\"\n+ \"\"\"Implements the Neo4j datastore.\n+\n+ Attributes:\n+ client: Instance of Neo4j GraphDatabase\n+ \"\"\"\ndef __init__(self, username, password, host=u'127.0.0.1', port=7474):\n- \"\"\"Create a neo4j client.\"\"\"\n+ \"\"\"Create a neo4j client.\n+\n+ Args:\n+ username: Neo4j username\n+ password: Neo4j password\n+ host: Neo4j host\n+ port: Neo4j port\n+ \"\"\"\nsuper(Neo4jDataStore, self).__init__()\nself.client = GraphDatabase(\nu'http://{0:s}:{1:d}/db/data/'.format(host, port),\n@@ -28,6 +39,14 @@ class Neo4jDataStore(object):\n@staticmethod\ndef _get_formatter(output_format):\n+ \"\"\"Get format class instance from format name.\n+\n+ Args:\n+ output_format: Name as string of output format\n+\n+ Returns:\n+ Output formatter object\n+ \"\"\"\ndefault_output_format = u'neo4j'\nformatter_registry = {\nu'neo4j': Neo4jOutputFormatter,\n@@ -39,7 +58,18 @@ class Neo4jDataStore(object):\nreturn formatter()\ndef search(self, query, output_format=None, return_rows=False):\n+ \"\"\"Search the graph.\n+\n+ Args:\n+ query: A cypher query\n+ output_format: Name of the output format to use\n+ return_rows: Boolean indicating if rows should be returned\n+\n+ Returns:\n+ Dictionary 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@@ -48,11 +78,26 @@ class Neo4jDataStore(object):\nclass OutputFormatterBaseClass(object):\n+ \"\"\"Base class for output formatter.\n+\n+ Attributes:\n+ schema: Dictionary structure to return\n+ \"\"\"\ndef __init__(self):\n+ \"\"\"Initialize the output formatter object.\"\"\"\nsuper(OutputFormatterBaseClass, self).__init__()\nself.schema = dict(stats=None, rows=None, graph=None)\ndef format(self, data, return_rows):\n+ \"\"\"Format Neo4j query result.\n+\n+ Args:\n+ data: Neo4j query result dictionary\n+ return_rows: Boolean indicating if rows should be returned\n+\n+ Returns:\n+ Dictionary with formatted result\n+ \"\"\"\nself.schema[u'stats'] = data.stats\nself.schema[u'graph'] = self.format_graph(data.graph)\nif return_rows:\n@@ -60,6 +105,14 @@ class OutputFormatterBaseClass(object):\nreturn self.schema\ndef format_graph(self, graph):\n+ \"\"\"Format the Neo4j graph result.\n+\n+ Args:\n+ graph: Dictionary with Neo4j graph result\n+\n+ Returns:\n+ Dictionary with formatted graph\n+ \"\"\"\nnode_list = []\nedge_list = []\nfor subgraph in graph:\n@@ -76,26 +129,66 @@ class OutputFormatterBaseClass(object):\nformatted_graph = {u'nodes': node_list, u'edges': edge_list}\nreturn formatted_graph\n+ # pylint: disable=unused-argument\ndef format_node(self, node):\n+ \"\"\"Format a graph node.\n+\n+ Args:\n+ node: A dictionary with one node\n+ \"\"\"\nreturn NotImplemented\n+ # pylint: disable=unused-argument\ndef format_edge(self, edge):\n+ \"\"\"Format a graph edge.\n+\n+ Args:\n+ edge: A dictionary with one edge\n+ \"\"\"\nreturn NotImplemented\nclass Neo4jOutputFormatter(OutputFormatterBaseClass):\n+ \"\"\"Neo4j raw formatter.\n+\n+ This formatter will return the original Neo4j result\n+ without any formatting.\n+ \"\"\"\ndef __init__(self):\n+ \"\"\"Initialize the Neo4j output formatter object.\"\"\"\nsuper(Neo4jOutputFormatter, self).__init__()\ndef format_graph(self, graph):\n+ \"\"\"Format the Neo4j graph result.\n+\n+ Args:\n+ graph: Dictionary with Neo4j graph result\n+\n+ Returns:\n+ Dictionary with formatted graph\n+ \"\"\"\nreturn graph\nclass CytoscapeOutputFormatter(OutputFormatterBaseClass):\n+ \"\"\"Cytoscape formatter.\n+\n+ This formatter will return the graph compatible with the open source\n+ graph Javascript library Cytoscape (http://js.cytoscape.org/).\n+ \"\"\"\ndef __init__(self):\n+ \"\"\"Initialize the Cytoscape output formatter object.\"\"\"\nsuper(CytoscapeOutputFormatter, self).__init__()\ndef format_node(self, node):\n+ \"\"\"Format a Cytoscape graph node.\n+\n+ Args:\n+ node: A dictionary with one node\n+\n+ Returns:\n+ Dictionary with a Cytoscape formatted node\n+ \"\"\"\ncytoscape_node = {\nu'data': {\nu'id': node[u'id'],\n@@ -106,6 +199,14 @@ class CytoscapeOutputFormatter(OutputFormatterBaseClass):\nreturn cytoscape_node\ndef format_edge(self, edge):\n+ \"\"\"Format a Cytoscape graph egde.\n+\n+ Args:\n+ edge: A dictionary with one edge\n+\n+ Returns:\n+ Dictionary with a Cytoscape formatted edge\n+ \"\"\"\ntry:\nlabel = edge[u'properties'][u'human_readable']\nexcept KeyError:\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "timesketch/lib/datastores/neo4j_test.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+\"\"\"Tests for the Neo4j datastore.\"\"\"\n+\n+import mock\n+\n+from timesketch.lib.datastores.neo4j import Neo4jDataStore\n+from timesketch.lib.testlib import MockGraphDatabase\n+from timesketch.lib.testlib import BaseTest\n+\n+\n+@mock.patch(\n+ u'timesketch.lib.datastores.neo4j.GraphDatabase', MockGraphDatabase)\n+class Neo4jTest(BaseTest):\n+ \"\"\"Test Neo4j datastore.\"\"\"\n+ def test_neo4j_output(self):\n+ \"\"\"Test Neo4j output format.\"\"\"\n+ expected_output = {\n+ u'graph': [\n+ {\n+ u'relationships': [\n+ {\n+ u'endNode': u'2',\n+ u'startNode': u'1',\n+ u'type': u'TEST',\n+ u'id': u'3',\n+ u'properties': {\n+ u'human_readable': u'test',\n+ u'type': u'test'\n+\n+ }\n+ }\n+ ],\n+ u'nodes': [\n+ {\n+ u'labels': [\n+ u'Test'\n+ ],\n+ u'id': u'1',\n+ u'properties': {\n+ u'name': u'test',\n+ u'uid': u'123456'\n+ }\n+ },\n+ {\n+ u'labels': [\n+ u'Test'\n+ ],\n+ u'id': u'2',\n+ u'properties': {\n+ u'name': u'test'\n+ }\n+ }\n+ ]\n+ }\n+ ],\n+ u'rows': None,\n+ u'stats': {}\n+ }\n+ client = Neo4jDataStore(username=u'test', password=u'test')\n+ formatted_response = client.search(query=u'')\n+ self.assertIsInstance(formatted_response, dict)\n+ self.assertDictEqual(formatted_response, expected_output)\n+\n+ def test_cytoscape_output(self):\n+ \"\"\"Test Cytoscape output format.\"\"\"\n+ expected_output = {\n+ u'graph': {\n+ u'nodes': [\n+ {\n+ u'data': {\n+ u'type': u'Test',\n+ u'id': u'1',\n+ u'label': u'test'\n+ }\n+ },\n+ {\n+ u'data': {\n+ u'type': u'Test',\n+ u'id': u'2',\n+ u'label': u'test'\n+ }\n+ }\n+ ],\n+ u'edges': [\n+ {\n+ u'data': {\n+ u'source': u'1',\n+ u'label': u'test',\n+ u'id': u'3',\n+ u'target': u'2'\n+ }\n+ }\n+ ]\n+ },\n+ u'rows': None,\n+ u'stats': {}\n+ }\n+ client = Neo4jDataStore(username=u'test', password=u'test')\n+ formatted_response = client.search(\n+ query=u'', 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": "@@ -118,7 +118,8 @@ class MockDataStore(datastore.DataStore):\ndef search(\nself, unused_sketch_id, unused_query, unused_query_filter,\n- unused_query_dsl, unused_indices, aggregations, return_results):\n+ unused_query_dsl, unused_indices, aggregations, return_results,\n+ return_fields=None, enable_scroll=False):\n\"\"\"Mock a search query.\nReturns:\n@@ -141,6 +142,76 @@ class MockDataStore(datastore.DataStore):\nreturn\n+class MockGraphDatabase(object):\n+ \"\"\"A mock implementation of a Datastore.\"\"\"\n+ def __init__(self, host, username, password):\n+ \"\"\"Initialize the datastore.\n+\n+ Args:\n+ host: Neo4j host\n+ username: Neo4j username\n+ password: Neo4j password\n+ \"\"\"\n+ self.host = host\n+ self.username = username\n+ self.password = password\n+\n+ class MockQuerySequence(object):\n+ \"\"\"A mock implementation of a QuerySequence.\"\"\"\n+ MOCK_GRAPH = [{\n+ u'nodes': [\n+ {\n+ u'id': u'1',\n+ u'labels': [\n+ u'Test'\n+ ],\n+ u'properties': {\n+ u'name': u'test',\n+ u'uid': u'123456'\n+ }\n+ },\n+ {\n+ u'id': u'2',\n+ u'labels': [\n+ u'Test'\n+ ],\n+ u'properties': {\n+ u'name': u'test'\n+ }\n+ }\n+ ],\n+ u'relationships': [\n+ {\n+ u'endNode': u'2',\n+ u'id': u'3',\n+ u'properties': {\n+ u'human_readable': u'test',\n+ u'type': u'test'\n+ },\n+ u'startNode': u'1',\n+ u'type': u'TEST'\n+ }\n+ ]\n+ }]\n+ MOCK_ROWS = {}\n+ MOCK_STATS = {}\n+\n+ def __init__(self):\n+ self.graph = self.MOCK_GRAPH\n+ self.rows = self.MOCK_ROWS\n+ self.stats = self.MOCK_ROWS\n+\n+ # pylint: disable=unused-argument\n+ def query(self, *args, **kwargs):\n+ \"\"\"Mock a search query.\n+\n+ Returns:\n+ A MockQuerySequence instance.\n+ \"\"\"\n+\n+ return self.MockQuerySequence()\n+\n+\nclass BaseTest(TestCase):\n\"\"\"Base class for tests.\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/utils.py",
"new_path": "timesketch/lib/utils.py",
"diff": "@@ -20,6 +20,7 @@ import time\nfrom dateutil import parser\n+\ndef random_color():\n\"\"\"Generates a random color.\n@@ -44,7 +45,7 @@ def read_and_validate_csv(path):\nmandatory_fields = [\nu'message', u'datetime', u'timestamp_desc']\n- with open(path, u'rb') as fh:\n+ with open(path, 'rb') as fh:\nreader = csv.DictReader(fh)\ncsv_header = reader.fieldnames\n@@ -60,14 +61,14 @@ def read_and_validate_csv(path):\nif u'timestamp' not in csv_header and u'datetime' in csv_header:\ntry:\nparsed_datetime = parser.parse(row[u'datetime'])\n- row[u'timestamp'] = int(time.mktime(parsed_datetime.timetuple()))\n+ row[u'timestamp'] = int(\n+ time.mktime(parsed_datetime.timetuple()))\nexcept ValueError:\ncontinue\nyield row\n-\ndef get_validated_indices(indices, sketch_indices):\n\"\"\"Exclude any deleted search index references.\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,trailing-whitespace\n[REPORTS]\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add tests for graph backend |
263,093 | 18.04.2017 15:07:27 | -7,200 | bf901f560c38f183c291a42d29d0615cada2e22f | Delete timeline permanently | [
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "@@ -37,6 +37,7 @@ from timesketch.models import drop_all\nfrom timesketch.models.user import Group\nfrom timesketch.models.user import User\nfrom timesketch.models.sketch import SearchIndex\n+from timesketch.models.sketch import Timeline\nclass DropDataBaseTables(Command):\n@@ -364,6 +365,49 @@ class CreateTimelineFromCsv(CreateTimelineBase):\nself.create_searchindex(timeline_name, index_name)\n+class PurgeTimeline(Command):\n+ \"\"\"Delete timeline permanently from Timesketch and Elasticsearch.\"\"\"\n+ option_list = (\n+ Option(u'--index', u'-i', dest=u'index_name', required=True),\n+ )\n+\n+ def __init__(self):\n+ super(PurgeTimeline, self).__init__()\n+\n+ def run(self, index_name):\n+ \"\"\"Delete timeline in both Timesketch snd Elasticsearch.\n+\n+ Args:\n+ index_name: The name of the index in Elasticsearch\n+ \"\"\"\n+ index_name = unicode(index_name.decode(encoding=u'utf-8'))\n+ searchindex = SearchIndex.query.filter_by(index_name=index_name).first()\n+\n+ es = ElasticsearchDataStore(\n+ host=current_app.config[u'ELASTIC_HOST'],\n+ port=current_app.config[u'ELASTIC_PORT'])\n+\n+ if not searchindex:\n+ sys.stdout.write(u'No such index\\n')\n+ sys.exit()\n+\n+ timelines = [t for t in Timeline.query.filter_by(searchindex=searchindex).all()]\n+ sketches = [t.sketch for t in timelines if t.sketch]\n+ if sketches:\n+ sys.stdout.write(u'WARNING: This timeline is in use by the following sketches:\\n')\n+ for sketch in sketches:\n+ if not sketch.get_status.status == u'deleted':\n+ sys.stdout.write(u' * {0:s}\\n'.format(sketch.name))\n+ sys.stdout.flush()\n+ really_delete = prompt_bool(u'Are you sure you want to delete this timeline?')\n+ if really_delete:\n+ for timeline in timelines:\n+ db_session.delete(timeline)\n+ db_session.delete(searchindex)\n+ db_session.commit()\n+ es.client.indices.delete(index=index_name)\n+\n+\nif __name__ == '__main__':\n# Setup Flask-script command manager and register commands.\nshell_manager = Manager(create_app)\n@@ -375,6 +419,7 @@ if __name__ == '__main__':\nshell_manager.add_command(u'db', MigrateCommand)\nshell_manager.add_command(u'drop_db', DropDataBaseTables())\nshell_manager.add_command(u'json2ts', CreateTimelineFromJson())\n+ shell_manager.add_command(u'purge', PurgeTimeline())\nshell_manager.add_command(u'runserver', Server(\nhost=u'127.0.0.1', port=5000))\nshell_manager.add_option(\n"
}
] | Python | Apache License 2.0 | google/timesketch | Delete timeline permanently |
263,093 | 20.04.2017 10:26:00 | -7,200 | c9b2185e1525a86c0bfbe4d840dd33d8fc4d06fb | Don't include deleted skethes | [
{
"change_type": "MODIFY",
"old_path": "tsctl",
"new_path": "tsctl",
"diff": "@@ -383,23 +383,25 @@ class PurgeTimeline(Command):\nindex_name = unicode(index_name.decode(encoding=u'utf-8'))\nsearchindex = SearchIndex.query.filter_by(index_name=index_name).first()\n- es = ElasticsearchDataStore(\n- host=current_app.config[u'ELASTIC_HOST'],\n- port=current_app.config[u'ELASTIC_PORT'])\n-\nif not searchindex:\nsys.stdout.write(u'No such index\\n')\nsys.exit()\n- timelines = [t for t in Timeline.query.filter_by(searchindex=searchindex).all()]\n- sketches = [t.sketch for t in timelines if t.sketch]\n+ es = ElasticsearchDataStore(\n+ host=current_app.config[u'ELASTIC_HOST'],\n+ port=current_app.config[u'ELASTIC_PORT'])\n+\n+ timelines = Timeline.query.filter_by(searchindex=searchindex).all()\n+ sketches = [t.sketch for t in timelines if\n+ t.sketch and t.sketch.get_status.status != u'deleted']\nif sketches:\n- sys.stdout.write(u'WARNING: This timeline is in use by the following sketches:\\n')\n+ sys.stdout.write(u'WARNING: This timeline is in use by:\\n')\nfor sketch in sketches:\n- if not sketch.get_status.status == u'deleted':\nsys.stdout.write(u' * {0:s}\\n'.format(sketch.name))\nsys.stdout.flush()\n- really_delete = prompt_bool(u'Are you sure you want to delete this timeline?')\n+ really_delete = prompt_bool(\n+ u'Are you sure you want to delete this timeline?'\n+ )\nif really_delete:\nfor timeline in timelines:\ndb_session.delete(timeline)\n"
}
] | Python | Apache License 2.0 | google/timesketch | Don't include deleted skethes |
263,127 | 04.05.2017 16:15:50 | -7,200 | bd5d237abeadfa1ae2a116a3f8b2a1616ae6e44f | Add/Fix ws... | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -101,7 +101,6 @@ limitations under the License.\n}\n}\n-\n}\n});\n@@ -136,6 +135,7 @@ limitations under the License.\n}\nctrl.search(scope.query, scope.filter, scope.queryDsl);\n};\n+\nscope.$watch(\"filter.indices\", function(value) {\nif (scope.filter.indices.indexOf(index_name) == -1) {\nscope.colorbox = {'background-color': '#E9E9E9'};\n@@ -150,5 +150,4 @@ limitations under the License.\n}\n}\n});\n-\n})();\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add/Fix ws... |
263,127 | 26.05.2017 11:39:24 | -7,200 | e4f83e2ad677fb9a968cd5497df52d9a4903f6b6 | Place filter regexp matches in variables for readability | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "/*\n+\nCopyright 2015 Google Inc. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\");\n@@ -78,23 +79,27 @@ limitations under the License.\n//Parse offset given by user. Eg. +-10m\nvar offsetRegexp = /(.*?)(-|\\+|\\+-|-\\+)(\\d+)(y|d|h|m|s|M|Q|w|ms)/g;\nvar match = offsetRegexp.exec(datevalue);\n+\nif (match != null) {\n- match[1] = moment(match[1],\"YYYY-MM-DD HH:mm:ssZZ\");\n+ var filterbase = match[1]\n+ var filteroffset = match[2]\n+ var filteramount = match[3]\n+ var filtertype = match[4]\n+\n+ filterbase = moment(filterbase,\"YYYY-MM-DD HH:mm:ssZZ\");\n//calculate filter start and end datetimes\n- if (match[2] == '+') {\n- scope.filter.time_start = moment.utc(match[1]).format(datetimetemplate);\n- scope.filter.time_end = moment.utc(match[1]).add(match[3],match[4]).format(datetimetemplate);\n+ if (filteroffset == '+') {\n+ scope.filter.time_start = moment.utc(filterbase).format(datetimetemplate);\n+ scope.filter.time_end = moment.utc(filterbase).add(filteramount,filtertype).format(datetimetemplate);\n}\n- if (match[2] == '-') {\n- scope.filter.time_start = moment.utc(match[1]).subtract(match[3],match[4]).format(datetimetemplate);\n- scope.filter.time_end = moment.utc(match[1]).format(datetimetemplate);\n+ if (filteroffset == '-') {\n+ scope.filter.time_start = moment.utc(filterbase).subtract(filteramount,filtertype).format(datetimetemplate);\n+ scope.filter.time_end = moment.utc(filterbase).format(datetimetemplate);\n}\n- if (match[2] == '-+' || match[2] == '+-') {\n- scope.filter.time_start = moment.utc(match[1]).subtract(match[3],match[4]).format(datetimetemplate);\n- scope.filter.time_end = moment.utc(match[1]).add(match[3],match[4]).format(datetimetemplate);\n+ if (filteroffset == '-+' || filteroffset == '+-') {\n+ scope.filter.time_start = moment.utc(filterbase).subtract(filteramount,filtertype).format(datetimetemplate);\n+ scope.filter.time_end = moment.utc(filterbase).add(filteramount,filtertype).format(datetimetemplate);\n}\n- } else {\n- scope.filter.time_end = scope.filter.time_start;\n}\n}\n}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Place filter regexp matches in variables for readability |
263,127 | 30.05.2017 14:13:44 | -7,200 | c13881d8b0908b0f97d2074e9f63f46b8d735b94 | Make Filters visible when a datetime field is left-clicked | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-event-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-event-directive.js",
"diff": "@@ -247,8 +247,7 @@ limitations under the License.\n};\n$scope.addFilterStart= function() {\n- var tr_input = angular.element('[ng-model=\"filter.time_start\"]');\n- tr_input[0].value=$scope.event._source.datetime;\n+ $scope.$emit('datetime-clicked', {datetimeclicked: $scope.event._source.datetime});\n};\n$scope.getDetail = function() {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-search-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-search-directive.js",
"diff": "@@ -77,6 +77,11 @@ limitations under the License.\n}\n});\n+ $scope.$on('datetime-clicked', function (event, clickObj) {\n+ $scope.showFilters = true;\n+ $scope.filter.time_start= clickObj.datetimeclicked;\n+ });\n+\nif ($scope.searchtemplateId) {\ntimesketchApi.getSearchTemplate($scope.searchtemplateId).success(function(data) {\n$scope.searchTemplate = data.objects[0];\n"
}
] | Python | Apache License 2.0 | google/timesketch | Make Filters visible when a datetime field is left-clicked |
263,093 | 12.06.2017 17:58:24 | -7,200 | 8a78d71201f253d4e605e1d70298b938288f0fda | Move the upload form to the timelines pane | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"new_path": "timesketch/ui/static/components/core/core-upload-directive.js",
"diff": "templateUrl: '/static/components/core/core-upload.html',\nscope: {\nsketchId: '=?',\n+ visible: '=?',\nbtnText: '='\n},\ncontroller: function($scope) {\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/core/core-upload.html",
"new_path": "timesketch/ui/static/components/core/core-upload.html",
"diff": "<form name=\"uploadform\" class=\"form-inline\" ng-submit=\"uploadFile()\">\n+\n+ <div ng-show=\"visible\">\n+ <span class=\"form-group\">\n+ <span class=\"btn btn-file\" ng-class=\"{'btn-default': uploadForm.file, 'btn-success': !uploadForm.file}\">\n+ <i class=\"fa fa-cloud-upload\" style=\"margin-right: 5px;\"></i>\n+ <span>{{ btnText||'Import timeline' }}</span>\n+ <span>{{ uploadForm.file.name }}</span>\n+ <input type=\"file\" class=\"form-control\" ts-core-file-model=\"uploadForm.file\" />\n+ </span>\n+ </span>\n+ <span class=\"form-group\">\n+ <input class=\"form-control\" placeholder=\"(Optional) Timeline name\" ng-model=\"uploadForm.name\"/>\n+ </span>\n+ <input type=\"submit\" class=\"btn btn-success\" value=\"Upload\"/>\n+ <input type=\"reset\" class=\"btn btn-default\" value=\"Cancel\" ng-click=\"clearForm()\"/>\n+ </div>\n+\n+ <div ng-show=\"!visible\">\n<span class=\"form-group\">\n<span class=\"btn btn-file\" ng-class=\"{'btn-default': uploadForm.file, 'btn-success': !uploadForm.file}\">\n<i class=\"fa fa-cloud-upload\" style=\"margin-right: 5px;\"></i>\n</span>\n<input type=\"submit\" ng-show=\"uploadForm.file\" class=\"btn btn-success\" value=\"Upload\"/>\n<input type=\"reset\" ng-show=\"uploadForm.file\" class=\"btn btn-default\" value=\"Cancel\" ng-click=\"clearForm()\"/>\n+ </div>\n+\n</form>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/css/ts.css",
"new_path": "timesketch/ui/static/css/ts.css",
"diff": "@@ -52,7 +52,7 @@ header {\n}\n#subheader {\n- height: 55px;\n+ height: 60px;\nbackground: #fff;\nmargin-top:55px;\nborder-bottom: 1px solid #f1f1f1;\n@@ -74,6 +74,7 @@ header {\n.right-nav {\npadding:10px;\nmargin-right:5px;\n+ margin-top:2px;\n}\n.card {\n@@ -424,7 +425,7 @@ rect.bordered {\n.nav-tabs>li>a, .nav-tabs>li>a:hover {\nbackground: transparent;\ncolor:#555;\n- padding: 11px 5px 14px 5px;\n+ padding: 16px 5px 14px 5px;\nmargin-top:7px;\nborder: none;\nfont-weight: normal;\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "{% block right_nav %}\n<div class=\"btn-group\">\n{% if sketch.has_permission(current_user, 'write') and sketch.timelines and upload_enabled %}\n- <ts-core-upload class=\"pull-right\" sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n+ <a href=\"timelines/\" class=\"btn btn-success\"><i class=\"fa fa-cloud-upload\"></i>Import timeline</a>\n{% endif %}\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% endblock %}\n{% block right_nav %}\n- {% if sketch.has_permission(current_user, 'write') and sketch.timelines and upload_enabled %}\n- <ts-core-upload sketch-id=\"{{ sketch.id }}\"></ts-core-upload>\n- {% endif %}\n{% endblock %}\n{% block main %}\n+ {% if sketch.has_permission(current_user, 'write') and upload_enabled %}\n+ <div class=\"card\">\n+ <h4>Import timeline</h4>\n+ <p>You can upload either a Plaso storage file or a timeline as a CSV file.</p>\n+ <ts-core-upload sketch-id=\"{{ sketch.id }}\" visible=\"true\" btn-text=\"'Select file'\"></ts-core-upload>\n+ </div>\n+ {% endif %}\n+\n<div class=\"container\">\n{% if sketch.timelines %}\n<div class=\"row\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"card\">\n- <h4 class=\"pull-left\">Add timeline</h4>\n+ <h4 class=\"pull-left\">Available timelines</h4>\n+ <br><br>\n<form method=\"post\" action=\"{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}\">\n<table class=\"table table-hover\">\n<thead>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Move the upload form to the timelines pane |
263,093 | 22.06.2017 10:35:42 | 18,000 | 8d928ef057ecd77a45814aacf35c20bfa23014d6 | Show supported Plaso version if uopload is enabled | [
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -88,6 +88,15 @@ def create_app(config=None):\nu'$ openssl rand -base64 32\\n\\n')\nsys.exit()\n+ # Plaso version that we support\n+ if app.config[u'UPLOAD_ENABLED']:\n+ try:\n+ from plaso import __version__ as plaso_version\n+ except ImportError:\n+ sys.stderr.write(u'Upload is enabled, but Plaso is not installed.')\n+ sys.exit()\n+ app.config[u'PLASO_VERSION'] = plaso_version\n+\n# Setup the database.\nconfigure_engine(app.config[u'SQLALCHEMY_DATABASE_URI'])\ndb = init_db()\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "{% if sketch.has_permission(current_user, 'write') and upload_enabled %}\n<div class=\"card\">\n<h4>Import timeline</h4>\n- <p>You can upload either a Plaso storage file or a timeline as a CSV file.</p>\n+ <p>You can upload either a Plaso storage file or a CSV file.<br>\n+ <i>Supported Plaso version: {{ plaso_version }}</i>\n+ </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 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</div>\n{% endif %}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/views/sketch.py",
"new_path": "timesketch/ui/views/sketch.py",
"diff": "@@ -299,6 +299,11 @@ def timelines(sketch_id):\nnot_(SearchIndex.id.in_(searchindices_in_sketch)))\nupload_enabled = current_app.config[u'UPLOAD_ENABLED']\n+ try:\n+ plaso_version = current_app.config[u'PLASO_VERSION']\n+ except KeyError:\n+ plaso_version = u'Unknown'\n+\n# Setup the form\nform = AddTimelineForm()\nform.timelines.choices = set((i.id, i.name) for i in indices.all())\n@@ -320,7 +325,7 @@ def timelines(sketch_id):\nreturn render_template(\nu'sketch/timelines.html', sketch=sketch, timelines=indices.all(),\n- form=form, upload_enabled=upload_enabled)\n+ form=form, upload_enabled=upload_enabled, plaso_version=plaso_version)\n@sketch_views.route(\n"
}
] | Python | Apache License 2.0 | google/timesketch | Show supported Plaso version if uopload is enabled |
263,093 | 04.07.2017 13:35:21 | -7,200 | b917b69a8878b849352b26807ab60e1a11a7ffda | Get single timeline | [
{
"change_type": "MODIFY",
"old_path": "api_client/python/timesketch_api_client/client.py",
"new_path": "api_client/python/timesketch_api_client/client.py",
"diff": "@@ -79,7 +79,6 @@ class BaseSketchResource(object):\ndef lazyload_data(self):\nif not self.data:\n- print \"lazyload base\"\nself.data = self.sketch.api.fetch_resource_data(self.resource_url)\nreturn self.data\n@@ -108,17 +107,28 @@ class View(BaseSketchResource):\nclass Timeline(BaseSketchResource):\n- def __init__(self, timeline_id, timeline_name, timeline_index, sketch):\n+ def __init__(self, timeline_id, sketch, timeline_name=None,\n+ timeline_index=None):\nself.id = timeline_id\n- self.name = timeline_name\n- self.index = timeline_index\n- resource_uri = u'views/{0:d}/'.format(self.id)\n+ self.timeline_name = timeline_name\n+ self.timeline_index = timeline_index\n+ resource_uri = u'timelines/{0:d}/'.format(self.id)\nsuper(Timeline, self).__init__(sketch, resource_uri)\n@property\n- def query_string(self):\n- view = self.lazyload_data()\n- return view[u'objects'][0][u'query_string']\n+ def name(self):\n+ if not self.timeline_name:\n+ timeline = self.lazyload_data()\n+ self.timeline_name = timeline[u'objects'][0][u'name']\n+ return self.timeline_name\n+\n+ @property\n+ def index(self):\n+ if not self.timeline_name:\n+ timeline = self.lazyload_data()\n+ index = timeline[u'objects'][0][u'searchindex'][u'index_name']\n+ self.timeline_index = index\n+ return self.timeline_index\nclass Sketch(object):\n@@ -162,6 +172,18 @@ class Sketch(object):\nviews.append(view_obj)\nreturn views\n+ @property\n+ def timelines(self):\n+ sketch = self._lazyload_data()\n+ timelines = []\n+ for timeline in sketch[u'objects'][0][u'timelines']:\n+ index = timeline[u'searchindex'][u'index_name']\n+ timeline_obj = Timeline(\n+ timeline_id=timeline[u'id'], timeline_name=timeline[u'name'],\n+ timeline_index=index, sketch=self)\n+ timelines.append(timeline_obj)\n+ return timelines\n+\ndef upload(self, timeline_name, file_path):\nresource_url = u'{0:s}/upload/'.format(self.api.api_root)\nfiles = {u'file': open(file_path, 'rb')}\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -1148,6 +1148,27 @@ class TimelineListResource(ResourceMixin, Resource):\nclass TimelineResource(ResourceMixin, Resource):\n+ \"\"\"Resource to get timeline.\"\"\"\n+ @login_required\n+ def get(self, sketch_id, timeline_id):\n+ \"\"\"Handles GET request to the resource.\n+\n+ Args:\n+ sketch_id: Integer primary key for a sketch database model\n+ timeline_id: Integer primary key for a timeline database model\n+ \"\"\"\n+ sketch = Sketch.query.get_with_acl(sketch_id)\n+ timeline = Timeline.query.get(timeline_id)\n+\n+ # Check that this timeline belongs to the sketch\n+ if timeline.sketch_id != sketch.id:\n+ abort(HTTP_STATUS_CODE_NOT_FOUND)\n+\n+ if not sketch.has_permission(user=current_user, permission=u'read'):\n+ abort(HTTP_STATUS_CODE_FORBIDDEN)\n+\n+ return self.to_json(timeline)\n+\n@login_required\ndef delete(self, sketch_id, timeline_id):\n\"\"\"Handles DELETE request to the resource.\n"
}
] | Python | Apache License 2.0 | google/timesketch | Get single timeline |
263,093 | 05.07.2017 15:08:03 | -7,200 | 6594c08d0ac2f1fc1e3e59ce8766c8406f11d1f9 | API client tests | [
{
"change_type": "MODIFY",
"old_path": "api_client/python/timesketch_api_client/client.py",
"new_path": "api_client/python/timesketch_api_client/client.py",
"diff": "@@ -130,67 +130,6 @@ class TimesketchApi(object):\nreturn sketches\n-class BaseSketchResource(object):\n- def __init__(self, sketch, resource_uri):\n- self.sketch = sketch\n- self.data = None\n- self.resource_url = u'{0:s}/sketches/{1:d}/{2:s}'.format(\n- sketch.api.api_root, sketch.id, resource_uri)\n-\n- def lazyload_data(self):\n- if not self.data:\n- self.data = self.sketch.api.fetch_resource_data(self.resource_url)\n- return self.data\n-\n-\n-class View(BaseSketchResource):\n- def __init__(self, view_id, view_name, sketch):\n- self.id = view_id\n- self.name = view_name\n- resource_uri = u'views/{0:d}/'.format(self.id)\n- super(View, self).__init__(sketch, resource_uri)\n-\n- @property\n- def query_string(self):\n- view = self.lazyload_data()\n- return view[u'objects'][0][u'query_string']\n-\n- @property\n- def query_filter(self):\n- view = self.lazyload_data()\n- return view[u'objects'][0][u'query_filter']\n-\n- @property\n- def query_dsl(self):\n- view = self.lazyload_data()\n- return view[u'objects'][0][u'query_dsl']\n-\n-\n-class Timeline(BaseSketchResource):\n- def __init__(self, timeline_id, sketch, timeline_name=None,\n- timeline_index=None):\n- self.id = timeline_id\n- self.timeline_name = timeline_name\n- self.timeline_index = timeline_index\n- resource_uri = u'timelines/{0:d}/'.format(self.id)\n- super(Timeline, self).__init__(sketch, resource_uri)\n-\n- @property\n- def name(self):\n- if not self.timeline_name:\n- timeline = self.lazyload_data()\n- self.timeline_name = timeline[u'objects'][0][u'name']\n- return self.timeline_name\n-\n- @property\n- def index(self):\n- if not self.timeline_name:\n- timeline = self.lazyload_data()\n- index = timeline[u'objects'][0][u'searchindex'][u'index_name']\n- self.timeline_index = index\n- return self.timeline_index\n-\n-\nclass Sketch(object):\ndef __init__(self, sketch_id, api, sketch_name=None):\nself.id = sketch_id\n@@ -283,3 +222,64 @@ class Sketch(object):\n}\nresponse = self.api.session.post(resource_url, json=form_data)\nreturn response.json()\n+\n+\n+class BaseSketchResource(object):\n+ def __init__(self, sketch, resource_uri):\n+ self.sketch = sketch\n+ self.data = None\n+ self.resource_url = u'{0:s}/sketches/{1:d}/{2:s}'.format(\n+ sketch.api.api_root, sketch.id, resource_uri)\n+\n+ def lazyload_data(self):\n+ if not self.data:\n+ self.data = self.sketch.api.fetch_resource_data(self.resource_url)\n+ return self.data\n+\n+\n+class View(BaseSketchResource):\n+ def __init__(self, view_id, view_name, sketch):\n+ self.id = view_id\n+ self.name = view_name\n+ resource_uri = u'views/{0:d}/'.format(self.id)\n+ super(View, self).__init__(sketch, resource_uri)\n+\n+ @property\n+ def query_string(self):\n+ view = self.lazyload_data()\n+ return view[u'objects'][0][u'query_string']\n+\n+ @property\n+ def query_filter(self):\n+ view = self.lazyload_data()\n+ return view[u'objects'][0][u'query_filter']\n+\n+ @property\n+ def query_dsl(self):\n+ view = self.lazyload_data()\n+ return view[u'objects'][0][u'query_dsl']\n+\n+\n+class Timeline(BaseSketchResource):\n+ def __init__(self, timeline_id, sketch, timeline_name=None,\n+ timeline_index=None):\n+ self.id = timeline_id\n+ self.timeline_name = timeline_name\n+ self.timeline_index = timeline_index\n+ resource_uri = u'timelines/{0:d}/'.format(self.id)\n+ super(Timeline, self).__init__(sketch, resource_uri)\n+\n+ @property\n+ def name(self):\n+ if not self.timeline_name:\n+ timeline = self.lazyload_data()\n+ self.timeline_name = timeline[u'objects'][0][u'name']\n+ return self.timeline_name\n+\n+ @property\n+ def index(self):\n+ if not self.timeline_name:\n+ timeline = self.lazyload_data()\n+ index = timeline[u'objects'][0][u'searchindex'][u'index_name']\n+ self.timeline_index = index\n+ return self.timeline_index\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "api_client/python/timesketch_api_client/client_test.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+\"\"\"Tests for the Timesketch API client\"\"\"\n+\n+import mock\n+import unittest\n+\n+from . import client\n+\n+\n+def mock_session():\n+\n+ class MockHeaders:\n+ def update(self, *args, **kwargs):\n+ return\n+\n+ class MockSession:\n+ def __init__(self):\n+ self.verify = False\n+ self.headers = self.mock_headers()\n+\n+ def get(self, *args, **kwargs):\n+ return mock_response(*args, **kwargs)\n+\n+ def post(self, *args, **kwargs):\n+ return\n+\n+ def mock_headers(self):\n+ return MockHeaders()\n+\n+ return MockSession()\n+\n+\n+def mock_response(*args, **kwargs):\n+ class MockResponse:\n+ def __init__(self, json_data=None, text_data=None, status_code=200):\n+ self.json_data = json_data\n+ self.text = text_data\n+ self.status_code = status_code\n+\n+ def json(self):\n+ return self.json_data\n+\n+ auth_text_data = u'<input id=\"csrf_token\" name=\"csrf_token\" value=\"test\">'\n+ sketch_data = {\n+ u'meta': {\n+ u'views': [\n+ {\n+ u'id': 1,\n+ u'name': u'test'\n+ },\n+ {\n+ u'id': 2,\n+ u'name': u'test'\n+ }\n+ ]\n+ },\n+ u'objects': [\n+ {\n+ u'id': 1,\n+ u'name': u'test',\n+ u'description': u'test',\n+ u'timelines': [\n+ {\n+ u'id': 1,\n+ u'name': u'test'\n+ },\n+ {\n+ u'id': 2,\n+ u'name': u'test'\n+ }\n+ ]\n+ }\n+ ]}\n+\n+ url_router = {\n+ u'http://127.0.0.1': MockResponse(text_data=auth_text_data),\n+ u'http://127.0.0.1/api/v1/sketches/': MockResponse(json_data={}),\n+ u'http://127.0.0.1/api/v1/sketches/1': MockResponse(\n+ json_data=sketch_data),\n+\n+ }\n+\n+ print args[0]\n+\n+ try:\n+ req_obj = url_router.get(args[0])\n+ except KeyError:\n+ req_obj = MockResponse(None, 404)\n+\n+ return req_obj\n+\n+\n+class TimesketchApiTest(unittest.TestCase):\n+ \"\"\"Test TimesketchApi\"\"\"\n+\n+ @mock.patch(u'requests.Session', mock_session)\n+ def setUp(self):\n+ self.api_client = client.TimesketchApi(\n+ u'http://127.0.0.1', u'test', u'test')\n+\n+ def test_fetch_resource_data(self):\n+ response = self.api_client.fetch_resource_data(u'sketches/')\n+ self.assertIsInstance(response, dict)\n+\n+ def test_get_sketch(self):\n+ sketch = self.api_client.get_sketch(1)\n+ self.assertIsInstance(sketch, client.Sketch)\n+ self.assertEqual(sketch.id, 1)\n+ self.assertEqual(sketch.name, u'test')\n+ self.assertEqual(sketch.description, u'test')\n+\n+\n+class SketchTest(unittest.TestCase):\n+\n+ @mock.patch(u'requests.Session', mock_session)\n+ def setUp(self):\n+ self.api_client = client.TimesketchApi(\n+ u'http://127.0.0.1', u'test', u'test')\n+ self.sketch = self.api_client.get_sketch(1)\n+\n+ def test_get_views(self):\n+ views = self.sketch.get_views()\n+ self.assertIsInstance(views, list)\n+ self.assertEqual(len(views), 2)\n+ self.assertIsInstance(views[0], client.View)\n+\n"
}
] | Python | Apache License 2.0 | google/timesketch | API client tests |
263,093 | 06.07.2017 19:01:50 | -7,200 | 1a9aa80ea91f1daf0f3a10ac2e87cb997165a64f | Add setup.py for apu_client | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "api_client/python/setup.py",
"diff": "+#!/usr/bin/env python\n+# 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+\"\"\"This is the setup file for the project.\"\"\"\n+\n+from setuptools import find_packages\n+from setuptools import setup\n+\n+\n+setup(\n+ name=u'timesketch-api-client',\n+ version=u'20170606',\n+ description=u'Timesketch',\n+ license=u'Apache License, Version 2.0',\n+ url=u'http://www.timesketch.org/',\n+ maintainer=u'Timesketch development team',\n+ maintainer_email=u'timesketch-dev@googlegroups.com',\n+ classifiers=[\n+ u'Development Status :: 4 - Beta',\n+ u'Environment :: Web Environment',\n+ u'Operating System :: OS Independent',\n+ u'Programming Language :: Python',\n+ ],\n+ packages=find_packages(),\n+ include_package_data=True,\n+ zip_safe=False,\n+ install_requires=frozenset([\n+ u'requests',\n+ u'BeautifulSoup',\n+ ])\n+)\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add setup.py for apu_client |
263,093 | 06.07.2017 19:02:25 | -7,200 | 7912bd151e847ba99f34a7e402bffc62a1a60f5a | Return Timeline when uploading in sketch context | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -922,6 +922,7 @@ class UploadFileResource(ResourceMixin, Resource):\ndb_session.add(searchindex)\ndb_session.commit()\n+ timeline = None\nif sketch and sketch.has_permission(current_user, u'write'):\ntimeline = Timeline(\nname=searchindex.name,\n@@ -939,8 +940,14 @@ class UploadFileResource(ResourceMixin, Resource):\n(file_path, timeline_name, index_name, username),\ntask_id=index_name)\n+ # Return Timeline if it was created.\n+ if timeline:\n+ return self.to_json(\n+ timeline, status_code=HTTP_STATUS_CODE_CREATED)\n+ else:\nreturn self.to_json(\nsearchindex, status_code=HTTP_STATUS_CODE_CREATED)\n+\nelse:\nraise ApiHTTPError(\nmessage=form.errors[u'file'][0],\n"
}
] | Python | Apache License 2.0 | google/timesketch | Return Timeline when uploading in sketch context |
263,093 | 07.07.2017 10:35:10 | -7,200 | fad800b782f824a6b3fd7f25920b6ef51cca929c | Fix Travis tests Docker fails, disable for now | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "-sudo: required\n-services:\n- - docker\nlanguage: python\npython:\n- \"2.7\"\n-before_install:\n- - docker build -t timesketch .\n# command to install dependencies\ninstall:\n- \"pip install .\"\n- - \"pip install Flask-Testing nose mock pylint coverage\"\n+ - \"pip install Flask-Testing nose mock pylint coverage requests BeautifulSoup\"\n# command to run tests\nscript: nosetests\n"
}
] | Python | Apache License 2.0 | google/timesketch | Fix Travis tests Docker fails, disable for now |
263,093 | 07.07.2017 10:37:23 | -7,200 | b8d081344ef6fca1e01614d2db736a05d46fa7d5 | Fix Vagrant test environment | [
{
"change_type": "MODIFY",
"old_path": "utils/run_tests.sh",
"new_path": "utils/run_tests.sh",
"diff": "@@ -23,7 +23,7 @@ if test $? -ne 0; then\nfi\necho \"\"\necho \"* Run python unit tests\"\n-nosetests --with-coverage --cover-package=timesketch\n+nosetests --exe --with-coverage --cover-package=timesketch\nrm .coverage\nif test $? -ne 0; then\nexit 1\n"
}
] | Python | Apache License 2.0 | google/timesketch | Fix Vagrant test environment |
263,093 | 07.07.2017 10:38:58 | -7,200 | 908c931414f6e0f0ea25a18664777e78dcf0061a | Fix for method signature change | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -621,7 +621,8 @@ class ExploreResource(ResourceMixin, Resource):\nresult = self.datastore.search(\nsketch_id, form.query.data, query_filter, query_dsl, indices,\n- aggregations=None, return_results=True)\n+ aggregations=None, return_results=True, return_fields=None,\n+ enable_scroll=False)\n# Get labels for each event that matches the sketch.\n# Remove all other labels.\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/aggregators.py",
"new_path": "timesketch/lib/aggregators.py",
"diff": "@@ -41,7 +41,8 @@ def heatmap(\nsearch_result = es_client.search(\nsketch_id, query_string, query_filter, query_dsl, indices,\n- aggregations=aggregation, return_results=False)\n+ aggregations=aggregation, return_results=False, return_fields=None,\n+ enable_scroll=False)\ntry:\naggregation_result = search_result[u'aggregations']\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastore.py",
"new_path": "timesketch/lib/datastore.py",
"diff": "@@ -24,7 +24,7 @@ class DataStore(object):\n@abc.abstractmethod\ndef search(\nself, sketch_id, query, query_filter, query_dsl, indices,\n- aggregations, return_results):\n+ aggregations, return_results, return_fields, enable_scroll):\n\"\"\"Return search results.\nArgs:\n@@ -34,6 +34,8 @@ class DataStore(object):\nindices: List of indices to query\naggregations: Dict of Elasticsearch aggregations\nreturn_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@abc.abstractmethod\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/testlib.py",
"new_path": "timesketch/lib/testlib.py",
"diff": "@@ -118,7 +118,8 @@ class MockDataStore(datastore.DataStore):\ndef search(\nself, unused_sketch_id, unused_query, unused_query_filter,\n- unused_query_dsl, unused_indices, aggregations, return_results):\n+ unused_query_dsl, unused_indices, aggregations, return_results,\n+ return_fields, enable_scroll):\n\"\"\"Mock a search query.\nReturns:\n"
}
] | Python | Apache License 2.0 | google/timesketch | Fix for method signature change |
263,093 | 07.07.2017 10:42:23 | -7,200 | 96698aa1be3aa9e21d40c6972e664b1cf55b25a7 | Add api-client tests to test script | [
{
"change_type": "MODIFY",
"old_path": "utils/run_tests.sh",
"new_path": "utils/run_tests.sh",
"diff": "@@ -23,7 +23,7 @@ if test $? -ne 0; then\nfi\necho \"\"\necho \"* Run python unit tests\"\n-nosetests --exe --with-coverage --cover-package=timesketch\n+nosetests --exe --with-coverage --cover-package=timesketch_api_client,timesketch api_client/python/timesketch_api_client/ timesketch/\nrm .coverage\nif test $? -ne 0; then\nexit 1\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add api-client tests to test script |
263,093 | 07.07.2017 13:41:49 | -7,200 | 4de187c8390467014d021f647292ddd6a7d09044 | Add back linter check and fix code | [
{
"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,trailing-whitespace\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[REPORTS]\n"
}
] | Python | Apache License 2.0 | google/timesketch | Add back linter check and fix code |
263,127 | 10.07.2017 14:02:12 | -7,200 | 0b9398cb7a32d96222bb60f18b42724f34f83c09 | Copy value of start_time when end_time filter field is empty. | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -44,7 +44,7 @@ limitations under the License.\nrequire: '^tsSearch',\nlink: function(scope, elem, attrs, ctrl) {\nscope.applyFilter = function() {\n- scope.parseFilterDate(scope.filter.time_start)\n+ scope.parseFilterDate(scope.filter.time_start, scope.filter.time_end)\nctrl.search(scope.query, scope.filter, scope.queryDsl)\n};\n@@ -71,7 +71,7 @@ limitations under the License.\nscope.meta.noisy = false;\n}\n- scope.parseFilterDate = function(datevalue){\n+ scope.parseFilterDate = function(datevalue, datevalue_end){\nif (datevalue != null) {\nvar datetimetemplate=\"YYYY-MM-DDTHH:mm:ss\";\n//Parse out 'T' date time seperator needed by ELK but not by moment.js\n@@ -83,7 +83,7 @@ limitations under the License.\nif (match != null) {\nvar filterbase = match[1]\nvar filteroffset = match[2]\n- var filteramount = match[3]\n+ var filteramount = match[z3]\nvar filtertype = match[4]\nfilterbase = moment(filterbase,\"YYYY-MM-DD HH:mm:ssZZ\");\n@@ -100,6 +100,10 @@ limitations under the License.\nscope.filter.time_start = moment.utc(filterbase).subtract(filteramount,filtertype).format(datetimetemplate);\nscope.filter.time_end = moment.utc(filterbase).add(filteramount,filtertype).format(datetimetemplate);\n}\n+ } else {\n+ if (datevalue_end == null || datevalue_end == '') {\n+ scope.filter.time_end = scope.filter.time_start;\n+ }\n}\n}\n}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Copy value of start_time when end_time filter field is empty. |
263,127 | 10.07.2017 14:11:28 | -7,200 | 28dd574f29f7acdc702c9495b5c4151d63de4e91 | Fixed UTC timeoffset when creating filter without a time. | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"new_path": "timesketch/ui/static/components/explore/explore-filter-directive.js",
"diff": "@@ -83,10 +83,10 @@ limitations under the License.\nif (match != null) {\nvar filterbase = match[1]\nvar filteroffset = match[2]\n- var filteramount = match[z3]\n+ var filteramount = match[3]\nvar filtertype = match[4]\n- filterbase = moment(filterbase,\"YYYY-MM-DD HH:mm:ssZZ\");\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"
}
] | Python | Apache License 2.0 | google/timesketch | Fixed UTC timeoffset when creating filter without a time. |
263,127 | 10.07.2017 14:24:40 | -7,200 | 366475b68789e5298c18e90bb75f57a9ccfe031d | Added example filter formats using datetime modifier +- | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter.html",
"new_path": "timesketch/ui/static/components/explore/explore-filter.html",
"diff": "</div>\n<input style=\"margin-right:5px;margin-left: 5px;\" type=\"submit\" class=\"btn btn-primary\" value=\"Filter\" ng-click=\"applyFilter()\">\n<input type=\"reset\" class=\"btn btn-default\" value=\"Clear\" ng-click=\"clearFilter()\">\n+ <br>\n+ <div style=\"font-size: 11px; color: grey\">\n+ Examples: \"2017-01-20 +-1d\", \"2017-01-20 22:13 +5m\", \"2017-01-20 22:13:10 +-120s\"\n+ </div>\n</form>\n<br><br>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Added example filter formats using datetime modifier +- |
263,127 | 10.07.2017 14:29:32 | -7,200 | 8a89938d24f5c88b2dc7e29ecc7b718807d37cc2 | Changed cursor to "plus" sign to give visual feedback a date can be added to filter | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-event.html",
"new_path": "timesketch/ui/static/components/explore/explore-event.html",
"diff": "<table id=\"search-result-table\" width=\"100%\">\n<tr>\n- <td ng-click=\"addFilterStart()\" style=\"background: #{{::timeline_color}}\" width=\"210px\">\n+ <td ng-click=\"addFilterStart()\" style=\"cursor: copy; background: #{{::timeline_color}}\" width=\"210px\">\n{{::event._source.datetime}}\n</td>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Changed cursor to "plus" sign to give visual feedback a date can be added to filter |
263,127 | 10.07.2017 14:52:05 | -7,200 | 1d27953c0ddbb324d23e1852f246943a04e94a5f | Added some more top-margin to example text | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/static/components/explore/explore-filter.html",
"new_path": "timesketch/ui/static/components/explore/explore-filter.html",
"diff": "<input style=\"margin-right:5px;margin-left: 5px;\" type=\"submit\" class=\"btn btn-primary\" value=\"Filter\" ng-click=\"applyFilter()\">\n<input type=\"reset\" class=\"btn btn-default\" value=\"Clear\" ng-click=\"clearFilter()\">\n<br>\n- <div style=\"font-size: 11px; color: grey\">\n- Examples: \"2017-01-20 +-1d\", \"2017-01-20 22:13 +5m\", \"2017-01-20 22:13:10 +-120s\"\n+ <div style=\"font-size: 11px; color: grey; margin-top: 3px\">\n+ Supports manipulators, examples: \"2017-01-20 +-1d\" \"2017-01-20 22:13 +5m\"\n</div>\n</form>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Added some more top-margin to example text |
263,146 | 17.07.2017 00:21:23 | 25,200 | a380707b89093de728f49a1f07d15e02b21c3b9b | upgrade to docker-compose v3 and fix docker support | [
{
"change_type": "MODIFY",
"old_path": "docker/Dockerfile",
"new_path": "docker/Dockerfile",
"diff": "@@ -24,7 +24,8 @@ RUN cp /usr/local/share/timesketch/timesketch.conf /etc\nRUN chmod 600 /etc/timesketch.conf\n# Copy the entrypoint script into the container\n-COPY docker-entrypoint.sh /\n+COPY docker/docker-entrypoint.sh /\n+RUN chmod a+x /docker-entrypoint.sh\n# Expose the port used by Timesketch\nEXPOSE 5000\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/docker-compose.yml",
"new_path": "docker/docker-compose.yml",
"diff": "+version: '3'\n+services:\ntimesketch:\n- build: .\n+ build:\n+ context: ../\n+ dockerfile: ./docker/Dockerfile\nports:\n- \"5000:5000\"\nlinks:\n- elasticsearch\n- postgres\n+ - redis\nenvironment:\n- POSTGRES_USER=timesketch\n- POSTGRES_PASSWORD=password\n@@ -27,3 +32,5 @@ postgres:\n- POSTGRES_USER=timesketch\n- POSTGRES_PASSWORD=password\nrestart: always\n+ redis:\n+ image: redis:3\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/docker-entrypoint.sh",
"new_path": "docker/docker-entrypoint.sh",
"diff": "@@ -27,6 +27,10 @@ if [ \"$1\" = 'timesketch' ]; then\necho \"Please pass values for the ELASTIC_ADDRESS and ELASTIC_PORT environment variables\"\nfi\n+ # Replace Redis Hostname\n+ sed -i \"s#^CELERY_BROKER_URL=.*#CELERY_BROKER_URL='redis://redis:6379'#\" /etc/timesketch.conf\n+ sed -i \"s#^CELERY_RESULT_BACKEND=.*#CELERY_RESULT_BACKEND='redis://redis:6379'#\" /etc/timesketch.conf\n+\n# Set up web credentials\nif [ -z ${TIMESKETCH_USER+x} ]; then\nTIMESKETCH_USER=\"admin\"\n"
}
] | Python | Apache License 2.0 | google/timesketch | upgrade to docker-compose v3 and fix docker support |
263,093 | 19.07.2017 10:20:18 | -7,200 | 867034c7721d9bf81f8ccda15605ea72dd3b85ce | Enable upload in Vagrant | [
{
"change_type": "MODIFY",
"old_path": "vagrant/Vagrantfile",
"new_path": "vagrant/Vagrantfile",
"diff": "@@ -19,7 +19,6 @@ Vagrant.configure(2) do |config|\n# VirtualBox configuration\nconfig.vm.provider \"virtualbox\" do |vb|\n- vb.name = \"timesketch-dev\"\nvb.cpus = 2\nvb.memory = 4096\nend\n"
},
{
"change_type": "MODIFY",
"old_path": "vagrant/bootstrap.sh",
"new_path": "vagrant/bootstrap.sh",
"diff": "@@ -20,7 +20,7 @@ echo \"create database timesketch owner timesketch;\" | sudo -u postgres psql\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\n+apt-get install -y python-pip python-dev libffi-dev, redis-server\npip install --upgrade pip\npip install -e /usr/local/src/timesketch/\npip install gunicorn\n"
},
{
"change_type": "MODIFY",
"old_path": "vagrant/timesketch.conf",
"new_path": "vagrant/timesketch.conf",
"diff": "@@ -52,7 +52,7 @@ SSO_USER_ENV_VARIABLE = u'REMOTE_USER'\n# To enable this feature you need to configure an upload directory and\n# how to reach the Redis database used by the distributed task queue.\n-UPLOAD_ENABLED = False\n+UPLOAD_ENABLED = True\n# Folder for temporarily storage of Plaso dump files before being processed and\n# inserted into the datastore.\n@@ -60,8 +60,8 @@ 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://ip:port',\n-CELERY_RESULT_BACKEND='redis://ip:port'\n+CELERY_BROKER_URL='redis://127.0.0.1:6379'\n+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"
}
] | Python | Apache License 2.0 | google/timesketch | Enable upload in Vagrant |
263,093 | 19.07.2017 10:53:43 | -7,200 | e5fdb55f5baa756039f3d2b1aeaf61d1a956a790 | Celery in Vagrant | [
{
"change_type": "MODIFY",
"old_path": "vagrant/bootstrap.sh",
"new_path": "vagrant/bootstrap.sh",
"diff": "@@ -59,6 +59,15 @@ mkdir -p /var/lib/timesketch/\nchown ubuntu /var/lib/timesketch\ncp /vagrant/timesketch.conf /etc/\n+# Enable Celery task manager (for uploads)\n+mkdir -p /var/{lib,log,run}/celery\n+chown ubuntu /var/{lib,log,run}/celery\n+cp /vagrant/celery.service /etc/systemd/system/\n+cp /vagrant/celery.conf /etc/\n+/bin/systemctl daemon-reload\n+/bin/systemctl enable celery.service\n+/bin/systemctl start celery.service\n+\n# Set session key for Timesketch\nsed s/\"SECRET_KEY = u'this is just a dev environment'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\nmv /etc/timesketch.conf.new /etc/timesketch.conf\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "vagrant/celery.conf",
"diff": "+CELERYD_NODES=\"w1\"\n+CELERY_BIN=\"/usr/local/bin/celery\"\n+CELERY_APP=\"timesketch.lib.tasks\"\n+CELERYD_MULTI=\"multi\"\n+CELERYD_PID_FILE=\"/var/run/celery/%n.pid\"\n+CELERYD_LOG_FILE=\"/var/log/celery/%n%I.log\"\n+CELERYD_LOG_LEVEL=\"INFO\"\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "vagrant/celery.service",
"diff": "+[Unit]\n+Description=Celery Service\n+After=network.target\n+\n+[Service]\n+Type=forking\n+User=ubuntu\n+Group=ubuntu\n+EnvironmentFile=-/etc/celery.conf\n+WorkingDirectory=/var/lib/celery\n+ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \\\n+ -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \\\n+ --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'\n+ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \\\n+ --pidfile=${CELERYD_PID_FILE}'\n+ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \\\n+ -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \\\n+ --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'\n+\n+[Install]\n+WantedBy=multi-user.target\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | google/timesketch | Celery in Vagrant |
263,093 | 19.07.2017 11:28:07 | -7,200 | db612c97984bfcf3b52bf0b0c134eefb0ad3b029 | Start celery after Timesketch conf | [
{
"change_type": "MODIFY",
"old_path": "vagrant/bootstrap.sh",
"new_path": "vagrant/bootstrap.sh",
"diff": "@@ -20,7 +20,7 @@ echo \"create database timesketch owner timesketch;\" | sudo -u postgres psql\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+apt-get install -y python-pip python-dev libffi-dev redis-server\npip install --upgrade pip\npip install -e /usr/local/src/timesketch/\npip install gunicorn\n@@ -28,6 +28,19 @@ pip install gunicorn\n# Timesketch development dependencies\npip install pylint nose flask-testing coverage\n+# Initialize Timesketch\n+mkdir -p /var/lib/timesketch/\n+chown ubuntu /var/lib/timesketch\n+cp /vagrant/timesketch.conf /etc/\n+\n+# Set session key for Timesketch\n+sed s/\"SECRET_KEY = u'this is just a dev environment'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n+mv /etc/timesketch.conf.new /etc/timesketch.conf\n+\n+# Configure the DB password\n+sed s/\"timesketch:foobar@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n+mv /etc/timesketch.conf.new /etc/timesketch.conf\n+\n# Java is needed for Elasticsearch\napt-get install -y openjdk-8-jre-headless\n@@ -54,11 +67,6 @@ cp /usr/local/src/timesketch/contrib/*.groovy /etc/elasticsearch/scripts/\n# Install Plaso\napt-get install -y python-plaso\n-# Initialize Timesketch\n-mkdir -p /var/lib/timesketch/\n-chown ubuntu /var/lib/timesketch\n-cp /vagrant/timesketch.conf /etc/\n-\n# Enable Celery task manager (for uploads)\nmkdir -p /var/{lib,log,run}/celery\nchown ubuntu /var/{lib,log,run}/celery\n@@ -68,14 +76,6 @@ cp /vagrant/celery.conf /etc/\n/bin/systemctl enable celery.service\n/bin/systemctl start celery.service\n-# Set session key for Timesketch\n-sed s/\"SECRET_KEY = u'this is just a dev environment'\"/\"SECRET_KEY = u'${SECRET_KEY}'\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n-mv /etc/timesketch.conf.new /etc/timesketch.conf\n-\n-# Configure the DB password\n-sed s/\"timesketch:foobar@localhost\"/\"timesketch:${PSQL_PW}@localhost\"/ /etc/timesketch.conf > /etc/timesketch.conf.new\n-mv /etc/timesketch.conf.new /etc/timesketch.conf\n-\n# Create test user\nsudo -u ubuntu tsctl add_user --username spock --password spock\n"
}
] | Python | Apache License 2.0 | google/timesketch | Start celery after Timesketch conf |
263,093 | 19.07.2017 14:37:51 | -7,200 | a87dc336206d4036d40aa2c0cb21e35e4fe1b38d | Use Elastic 5.x in Vagrant | [
{
"change_type": "MODIFY",
"old_path": "vagrant/bootstrap.sh",
"new_path": "vagrant/bootstrap.sh",
"diff": "@@ -44,17 +44,12 @@ mv /etc/timesketch.conf.new /etc/timesketch.conf\n# Java is needed for Elasticsearch\napt-get install -y openjdk-8-jre-headless\n-# Install Elasticsearch 2.x\n-wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.4/elasticsearch-2.4.4.deb\n-echo \"27074f49a251bc87795822e803de3ddecb275125 *elasticsearch-2.4.4.deb\" | sha1sum -c -\n-dpkg -i ./elasticsearch-2.4.4.deb\n-\n# Install Elasticsearch 5.x\n-#apt-get install apt-transport-https\n-#wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -\n-#echo \"deb https://artifacts.elastic.co/packages/5.x/apt stable main\" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list\n-#apt-get update\n-#apt-get install elasticsearch\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# Copy groovy scripts\ncp /usr/local/src/timesketch/contrib/*.groovy /etc/elasticsearch/scripts/\n"
}
] | Python | Apache License 2.0 | google/timesketch | Use Elastic 5.x in Vagrant |
263,093 | 19.07.2017 15:02:20 | -7,200 | 0c8af30b612ca4a69adb7b744332266d21ab9224 | Neo4j support in Vagrant | [
{
"change_type": "MODIFY",
"old_path": "vagrant/bootstrap.sh",
"new_path": "vagrant/bootstrap.sh",
"diff": "@@ -71,6 +71,23 @@ 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\n+echo \"dbms.shell.enabled=true\" >> /etc/neo4j/neo4j.conf\n+\n+# Expose Neo4j to the host, for development purposes\n+echo \"dbms.connectors.default_listen_address=0.0.0.0\" >> /etc/neo4j/neo4j.conf\n+\n+# Start Neo4j automatically\n+/bin/systemctl daemon-reload\n+/bin/systemctl enable neo4j\n+/bin/systemctl start neo4j\n+\n# Create test user\nsudo -u ubuntu tsctl add_user --username spock --password spock\n"
}
] | Python | Apache License 2.0 | google/timesketch | Neo4j support in Vagrant |
263,093 | 19.07.2017 15:22:13 | -7,200 | 015b7ee4e686eb97bb5cfdec6d7adac7d16acb2d | Expose Neo4j to Vagrant host | [
{
"change_type": "MODIFY",
"old_path": "vagrant/Vagrantfile",
"new_path": "vagrant/Vagrantfile",
"diff": "@@ -8,11 +8,12 @@ Vagrant.configure(2) do |config|\nconfig.vm.box = \"ubuntu/xenial64\"\nconfig.vm.box_check_update = true\n- # Forward the default Timesketch webserver port\n+ # Access to Timesketch from the host\nconfig.vm.network :forwarded_port, guest: 5000, host: 5000\n- # Access to Elasticsearch\n- config.vm.network :forwarded_port, guest: 9200, host: 9200\n+ # Access to Neo4j from the host\n+ config.vm.network :forwarded_port, guest: 7474, host: 7474\n+ config.vm.network :forwarded_port, guest: 7687, host: 7687\n# Share folder to the guest VM\nconfig.vm.synced_folder \"../\", \"/usr/local/src/timesketch\"\n"
}
] | Python | Apache License 2.0 | google/timesketch | Expose Neo4j to Vagrant host |
263,093 | 21.07.2017 12:37:52 | -7,200 | 68820127c0dbdf13fd643dca5d78727facbec0f5 | Remove depricated search_type | [
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/datastores/elastic.py",
"new_path": "timesketch/lib/datastores/elastic.py",
"diff": "@@ -259,8 +259,10 @@ class ElasticsearchDataStore(datastore.DataStore):\n# Default search type for elasticsearch is query_then_fetch.\nsearch_type = u'query_then_fetch'\n+\n+ # Set limit to 0 to not return any results\nif not return_results:\n- search_type = u'count'\n+ LIMIT_RESULTS = 0\n# Suppress the lint error because elasticsearch-py adds parameters\n# to the function with a decorator and this makes pylint sad.\n"
}
] | Python | Apache License 2.0 | google/timesketch | Remove depricated search_type |
263,093 | 21.07.2017 12:45:31 | -7,200 | dd382f9e42cd284004abaeb068067150b9c05f48 | Only show share button if owner | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "{% endif %}\n</div>\n+ {% if current_user == sketch.user %}\n<button style=\"margin-left:10px;\" data-toggle=\"modal\" data-target=\"#share-modal\" class=\"btn btn-primary\">\n{% if sketch.is_public %}\n<i class=\"fa fa-globe\"></i> Share</button>\n<i class=\"fa fa-lock\"></i> Share</button>\n{% endif %}\n</div>\n+ {% endif %}\n{% endblock %}\n{% block main %}\n"
}
] | Python | Apache License 2.0 | google/timesketch | Only show share button if owner |
263,093 | 21.07.2017 13:27:15 | -7,200 | ae36cf4b80736236dfa714feda384067780d94fd | Only grant read permission if public | [
{
"change_type": "MODIFY",
"old_path": "timesketch/models/acl.py",
"new_path": "timesketch/models/acl.py",
"diff": "@@ -220,7 +220,7 @@ class AccessControlMixin(object):\npermission.\n\"\"\"\npublic_ace = self.is_public\n- if public_ace:\n+ if public_ace and permission == u'read':\nreturn public_ace\nreturn self._get_ace(permission=unicode(permission), user=user)\n"
}
] | Python | Apache License 2.0 | google/timesketch | Only grant read permission if public |
263,093 | 21.07.2017 13:35:17 | -7,200 | 8b49a9100e63a42c0a22f009849ecf07ef7427cc | Permission checks for uploads | [
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/explore.html",
"new_path": "timesketch/ui/templates/sketch/explore.html",
"diff": "{% block main %}\n<div class=\"container\">\n- {% if sketch.timelines %}\n- <div class=\"row\">\n- <div class=\"col-md-12\">\n- <ts-search sketch-id=\"{{ sketch.id }}\" view-id=\"{{ view.id }}\" named-view=\"{{ named_view }}\" searchtemplate-id=\"{{ searchtemplate_id }}\" autoload=\"true\" redirect=\"true\"></ts-search>\n- </div>\n- </div>\n- {% else %}\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 class=\"card\">\n</div>\n</div>\n</div>\n+ {% else %}\n+ <div class=\"row\">\n+ <div class=\"col-md-12\">\n+ <ts-search sketch-id=\"{{ sketch.id }}\" view-id=\"{{ view.id }}\" named-view=\"{{ named_view }}\" searchtemplate-id=\"{{ searchtemplate_id }}\" autoload=\"true\" redirect=\"true\"></ts-search>\n+ </div>\n+ </div>\n{% endif %}\n</div>\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/overview.html",
"new_path": "timesketch/ui/templates/sketch/overview.html",
"diff": "</div>\n</div>\n- {% if not sketch.timelines %}\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 class=\"card\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/stories.html",
"new_path": "timesketch/ui/templates/sketch/stories.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n- {% if not sketch.timelines %}\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<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/timelines.html",
"new_path": "timesketch/ui/templates/sketch/timelines.html",
"diff": "</div>\n</div>\n{% endif %}\n- {% if not sketch.timelines and not timelines %}\n+\n+ {% if sketch.has_permission(user=current_user, permission='write') and not sketch.timelines and not timelines%}\n<div class=\"row\">\n<div class=\"col-md-12\">\n<div class=\"text-center\" style=\"padding:100px;\">\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/ui/templates/sketch/views.html",
"new_path": "timesketch/ui/templates/sketch/views.html",
"diff": "<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12\">\n- {% if not sketch.timelines %}\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<h3 style=\"color:#777\"><i class=\"fa fa-meh-o\"></i> No data to analyze</h3>\n"
}
] | Python | Apache License 2.0 | google/timesketch | Permission checks for uploads |
263,093 | 21.07.2017 15:38:50 | -7,200 | 182fc88edc11e59234e41718593b046ebbadbb3e | New api-client release | [
{
"change_type": "MODIFY",
"old_path": "api_client/python/setup.py",
"new_path": "api_client/python/setup.py",
"diff": "@@ -20,7 +20,7 @@ from setuptools import setup\nsetup(\nname=u'timesketch-api-client',\n- version=u'20170606',\n+ version=u'20170721',\ndescription=u'Timesketch',\nlicense=u'Apache License, Version 2.0',\nurl=u'http://www.timesketch.org/',\n@@ -28,7 +28,7 @@ setup(\nmaintainer_email=u'timesketch-dev@googlegroups.com',\nclassifiers=[\nu'Development Status :: 4 - Beta',\n- u'Environment :: Web Environment',\n+ u'Environment :: Console',\nu'Operating System :: OS Independent',\nu'Programming Language :: Python',\n],\n"
}
] | Python | Apache License 2.0 | google/timesketch | New api-client release |
263,146 | 06.08.2017 22:52:24 | 25,200 | 66d41125c47eca3ad9022cf4e961dd16bd2c1f53 | Add and update docker README from the wiki | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docker/README.md",
"diff": "+# Docker\n+\n+Timesketch has support for Docker. This is a convenient way of getting up and running.\n+\n+### Install Docker\n+Follow the official instructions [here](https://www.docker.com/community-edition)\n+\n+### Clone Timesketch\n+\n+```shell\n+git clone https://github.com/google/timesketch.git\n+cd timesketch\n+```\n+\n+### Build and Start Containers\n+\n+```shell\n+cd docker\n+docker-compose up\n+```\n+\n+### Access Timesketch\n+* Retrieve the randomly generated password from startup logs: `TIMESKETCH_PASSWORD set randomly to: xxx`\n+* Go to: http://127.0.0.1:5000/\n+* Login with username: admin and the retrieved random password\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"
}
] | Python | Apache License 2.0 | google/timesketch | Add and update docker README from the wiki |
263,093 | 15.08.2017 14:30:08 | -7,200 | aa6403581988395ee391d629eaf45140fae0fe0c | API endpoint to list search indices | [
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -42,6 +42,7 @@ from timesketch.api.v1.resources import QueryResource\nfrom timesketch.api.v1.resources import CountEventsResource\nfrom timesketch.api.v1.resources import TimelineResource\nfrom timesketch.api.v1.resources import TimelineListResource\n+from timesketch.api.v1.resources import SearchIndexListResource\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.models import configure_engine\nfrom timesketch.models import init_db\n@@ -146,6 +147,8 @@ def create_app(config=None):\napi_v1.add_resource(\nTimelineResource,\nu'/sketches/<int:sketch_id>/timelines/<int:timeline_id>/')\n+ api_v1.add_resource(\n+ SearchIndexListResource, u'/timelines/')\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": "@@ -1246,3 +1246,16 @@ class GraphResource(ResourceMixin, Resource):\n}]\n}\nreturn jsonify(schema)\n+\n+\n+class SearchIndexListResource(ResourceMixin, Resource):\n+ \"\"\"Resource to get all search indices.\"\"\"\n+ @login_required\n+ def get(self):\n+ \"\"\"Handles GET request to the resource.\n+\n+ Returns:\n+ List of search indices in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ indices = SearchIndex.all_with_acl(current_user).all()\n+ return self.to_json(indices)\n"
}
] | Python | Apache License 2.0 | google/timesketch | API endpoint to list search indices |
263,093 | 15.08.2017 14:34:32 | -7,200 | fd47688bdd27b1c7558b7380532ffabca80ae539 | API endpoint to get a search index | [
{
"change_type": "MODIFY",
"old_path": "timesketch/__init__.py",
"new_path": "timesketch/__init__.py",
"diff": "@@ -43,6 +43,7 @@ from timesketch.api.v1.resources import CountEventsResource\nfrom timesketch.api.v1.resources import TimelineResource\nfrom timesketch.api.v1.resources import TimelineListResource\nfrom timesketch.api.v1.resources import SearchIndexListResource\n+from timesketch.api.v1.resources import SearchIndexResource\nfrom timesketch.lib.errors import ApiHTTPError\nfrom timesketch.models import configure_engine\nfrom timesketch.models import init_db\n@@ -149,6 +150,8 @@ def create_app(config=None):\nu'/sketches/<int:sketch_id>/timelines/<int:timeline_id>/')\napi_v1.add_resource(\nSearchIndexListResource, u'/timelines/')\n+ api_v1.add_resource(\n+ SearchIndexResource, u'/timelines/<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": "@@ -1259,3 +1259,16 @@ class SearchIndexListResource(ResourceMixin, Resource):\n\"\"\"\nindices = SearchIndex.all_with_acl(current_user).all()\nreturn self.to_json(indices)\n+\n+\n+class SearchIndexResource(ResourceMixin, Resource):\n+ \"\"\"Resource to get search index.\"\"\"\n+ @login_required\n+ def get(self, searchindex_id):\n+ \"\"\"Handles GET request to the resource.\n+\n+ Returns:\n+ Search index in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ searchindex = SearchIndex.query.get_with_acl(searchindex_id)\n+ return self.to_json(searchindex)\n"
}
] | Python | Apache License 2.0 | google/timesketch | API endpoint to get a search index |
263,093 | 15.08.2017 15:37:46 | -7,200 | edb0cfa802390a7749a77707fba7175d31fd1800 | API enpoint for creating a searchindex | [
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -64,6 +64,7 @@ from timesketch.lib.forms import ExploreForm\nfrom timesketch.lib.forms import UploadFileForm\nfrom timesketch.lib.forms import StoryForm\nfrom timesketch.lib.forms import GraphExploreForm\n+from timesketch.lib.forms import SearchIndexForm\nfrom timesketch.lib.utils import get_validated_indices\nfrom timesketch.models import db_session\nfrom timesketch.models.sketch import Event\n@@ -1260,6 +1261,46 @@ class SearchIndexListResource(ResourceMixin, Resource):\nindices = SearchIndex.all_with_acl(current_user).all()\nreturn self.to_json(indices)\n+ @login_required\n+ def post(self):\n+ \"\"\"Handles POST request to the resource.\n+\n+ Returns:\n+ A search index in JSON (instance of flask.wrappers.Response)\n+ \"\"\"\n+ form = SearchIndexForm.build(request)\n+ timeline_name = form.timeline_name.data\n+ index_name = form.index_name.data\n+ public = form.public.data\n+\n+ if form.validate_on_submit():\n+ searchindex = SearchIndex.query.filter_by(\n+ index_name=index_name).first()\n+\n+ print searchindex\n+\n+ if not searchindex:\n+ searchindex = SearchIndex.get_or_create(\n+ name=timeline_name, description=timeline_name,\n+ user=current_user, index_name=index_name)\n+ searchindex.grant_permission(\n+ permission=u'read', user=current_user)\n+\n+ if public:\n+ searchindex.grant_permission(permission=u'read', user=None)\n+\n+ # Create the index in Elasticsearch\n+ self.datastore.create_index(\n+ index_name=index_name, doc_type=u'generic_event')\n+\n+ db_session.add(searchindex)\n+ db_session.commit()\n+\n+ return self.to_json(\n+ searchindex, status_code=HTTP_STATUS_CODE_CREATED)\n+\n+ return abort(HTTP_STATUS_CODE_BAD_REQUEST)\n+\nclass SearchIndexResource(ResourceMixin, Resource):\n\"\"\"Resource to get search index.\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources_test.py",
"new_path": "timesketch/api/v1/resources_test.py",
"diff": "@@ -295,3 +295,20 @@ class EventAnnotationResourceTest(BaseTest):\nself.resource_url, data=json.dumps(data),\ncontent_type=u'application/json')\nself.assertEquals(response.status_code, HTTP_STATUS_CODE_BAD_REQUEST)\n+\n+\n+class SearchIndexResourceTest(BaseTest):\n+ \"\"\"Test SearchIndexResource.\"\"\"\n+ resource_url = u'/api/v1/timelines/'\n+\n+ @mock.patch(\n+ u'timesketch.api.v1.resources.ElasticsearchDataStore', MockDataStore)\n+ def test_post_create_searchindex(self):\n+ \"\"\"Authenticated request to create a searchindex.\"\"\"\n+ self.login()\n+ data = dict(timeline_name=u'test2', index_name=u'test2', public=False)\n+ response = self.client.post(\n+ self.resource_url, data=json.dumps(data),\n+ content_type=u'application/json')\n+ self.assertIsInstance(response.json, dict)\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": "@@ -209,3 +209,12 @@ class StoryForm(BaseForm):\ntitle = StringField(u'Title', validators=[])\ncontent = StringField(\nu'Content', validators=[], widget=widgets.TextArea())\n+\n+\n+class 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+ public = BooleanField(\n+ u'Public', false_values={False, u'false', u''},\n+ default=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/lib/testlib.py",
"new_path": "timesketch/lib/testlib.py",
"diff": "@@ -141,6 +141,11 @@ class MockDataStore(datastore.DataStore):\n\"\"\"Mock adding a label to an event.\"\"\"\nreturn\n+ # pylint: disable=unused-argument\n+ def create_index(self, *args, **kwargs):\n+ \"\"\"Mock creating an index.\"\"\"\n+ return\n+\nclass MockGraphDatabase(object):\n\"\"\"A mock implementation of a Datastore.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/timesketch | API enpoint for creating a searchindex |
263,093 | 15.08.2017 17:49:02 | -7,200 | 9488de94aa908f1bff4223d654f273ecec919fe9 | SearchIndex feature in 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": "@@ -17,6 +17,7 @@ import json\nimport BeautifulSoup\nimport requests\nfrom requests.exceptions import ConnectionError\n+from uuid import uuid4\nclass TimesketchApi(object):\n@@ -150,31 +151,72 @@ class TimesketchApi(object):\nsketches.append(sketch_obj)\nreturn sketches\n+ def get_timeline(self, searchindex_id):\n+ \"\"\"Get a timeline (searchindex).\n-class Sketch(object):\n- \"\"\"Timesketch sketch object.\n+ Args:\n+ searchindex_id: Primary key ID of the searchindex.\n- A sketch in Timesketch is a collection of one or more timelines. It has\n- access control and its own namespace for things like labels and comments.\n+ Returns:\n+ Instance of a SearchIndex object.\n+ \"\"\"\n+ return SearchIndex(searchindex_id, api=self)\n- Attributes:\n- id: The ID of the sketch.\n- api: An instance of TimesketchApi object.\n+ def list_timelines(self):\n+ \"\"\"Get list of all timelines that the user has access to.\n+\n+ Returns:\n+ List of SearchIndex object instances.\n\"\"\"\n- def __init__(self, sketch_id, api, sketch_name=None):\n- \"\"\"Initializes the Sketch object.\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+\n+ def create_timeline(self, timeline_name, index_name=None, public=False):\n+ \"\"\"Create a new timeline (searchindex).\n+\n+ Args:\n+ timeline_name: Name of the searchindex in Timesketch.\n+ index_name: Name of the index in Elasticsearch.\n+ public: Boolean indicating if the searchindex should be public.\n+\n+ Returns:\n+ Instance of a SearchIndex object.\n+ \"\"\"\n+ if not index_name:\n+ index_name = uuid4().hex\n+\n+ resource_url = u'{0:s}/timelines/'.format(self.api_root)\n+ form_data = {\n+ u'timeline_name': timeline_name,\n+ u'index_name': index_name,\n+ u'public': public\n+ }\n+ response = self.session.post(resource_url, json=form_data)\n+ response_dict = response.json()\n+ searchindex_id = response_dict[u'objects'][0][u'id']\n+ return self.get_timeline(searchindex_id)\n+\n+\n+class BaseResource(object):\n+ \"\"\"Base resource object.\"\"\"\n+ def __init__(self, api, resource_uri):\n+ \"\"\"Initialize object.\nArgs:\n- sketch_id: Primary key ID of the sketch.\napi: An instance of TimesketchApi object.\n- sketch_name: Name of the sketch (optional).\n\"\"\"\n- self.id = sketch_id\nself.api = api\n- self._sketch_name = sketch_name\n- self._data = None\n+ self.resource_uri = resource_uri\n+ self.resource_data = None\n- def _lazyload_data(self, refresh_cache=False):\n+ def lazyload_data(self, refresh_cache=False):\n\"\"\"Load resource data once and cache the result.\nArgs:\n@@ -183,19 +225,43 @@ class Sketch(object):\nReturns:\nDictionary with resource data.\n\"\"\"\n- if not self._data or refresh_cache:\n- resource_uri = u'sketches/{0:d}'.format(self.id)\n- self._data = self.api.fetch_resource_data(resource_uri)\n- return self._data\n+ if not self.resource_data or refresh_cache:\n+ self.resource_data = self.api.fetch_resource_data(self.resource_uri)\n+ return self.resource_data\n@property\ndef data(self):\n- \"\"\"Property to fetch sketch data.\n+ \"\"\"Property to fetch resource data.\nReturns:\nDictionary with resource data.\n\"\"\"\n- return self._lazyload_data()\n+ return self.lazyload_data()\n+\n+\n+class Sketch(BaseResource):\n+ \"\"\"Timesketch sketch object.\n+\n+ A sketch in Timesketch is a collection of one or more timelines. It has\n+ access control and its own namespace for things like labels and comments.\n+\n+ Attributes:\n+ id: The ID of the sketch.\n+ api: An instance of TimesketchApi object.\n+ \"\"\"\n+ def __init__(self, sketch_id, api, sketch_name=None):\n+ \"\"\"Initializes the Sketch object.\n+\n+ Args:\n+ sketch_id: Primary key ID of the sketch.\n+ api: An instance of TimesketchApi object.\n+ sketch_name: Name of the sketch (optional).\n+ \"\"\"\n+ self.id = sketch_id\n+ self.api = api\n+ self._sketch_name = sketch_name\n+ self._resource_uri = u'sketches/{0:d}'.format(self.id)\n+ super(Sketch, self).__init__(api=api, resource_uri=self._resource_uri)\n@property\ndef name(self):\n@@ -205,7 +271,7 @@ class Sketch(object):\nSketch name as string.\n\"\"\"\nif not self._sketch_name:\n- sketch = self._lazyload_data()\n+ sketch = self.lazyload_data()\nself._sketch_name = sketch[u'objects'][0][u'name']\nreturn self._sketch_name\n@@ -216,7 +282,7 @@ class Sketch(object):\nReturns:\nSketch description as string.\n\"\"\"\n- sketch = self._lazyload_data()\n+ sketch = self.lazyload_data()\nreturn sketch[u'objects'][0][u'description']\n@property\n@@ -226,7 +292,7 @@ class Sketch(object):\nReturns:\nSketch status as string.\n\"\"\"\n- sketch = self._lazyload_data()\n+ sketch = self.lazyload_data()\nreturn sketch[u'objects'][0][u'status'][0][u'status']\ndef list_views(self):\n@@ -235,11 +301,14 @@ class Sketch(object):\nReturns:\nList of views (instances of View objects)\n\"\"\"\n- sketch = self._lazyload_data()\n+ sketch = self.lazyload_data()\nviews = []\nfor view in sketch[u'meta'][u'views']:\nview_obj = View(\n- view_id=view[u'id'], view_name=view[u'name'], sketch=self)\n+ view_id=view[u'id'],\n+ view_name=view[u'name'],\n+ sketch_id=self.id,\n+ api=self.api)\nviews.append(view_obj)\nreturn views\n@@ -249,14 +318,15 @@ class Sketch(object):\nReturns:\nList of timelines (instances of Timeline objects)\n\"\"\"\n- sketch = self._lazyload_data()\n+ sketch = self.lazyload_data()\ntimelines = []\nfor timeline in sketch[u'objects'][0][u'timelines']:\ntimeline_obj = Timeline(\ntimeline_id=timeline[u'id'],\n+ sketch_id=self.id,\n+ api=self.api,\nname=timeline[u'name'],\n- searchindex=timeline[u'searchindex'][u'index_name'],\n- sketch=self\n+ searchindex=timeline[u'searchindex'][u'index_name']\n)\ntimelines.append(timeline_obj)\nreturn timelines\n@@ -279,9 +349,10 @@ class Sketch(object):\ntimeline = response_dict[u'objects'][0]\ntimeline_obj = Timeline(\ntimeline_id=timeline[u'id'],\n+ sketch_id=self.id,\n+ api=self.api,\nname=timeline[u'name'],\n- searchindex=timeline[u'searchindex'][u'index_name'],\n- sketch=self\n+ searchindex=timeline[u'searchindex'][u'index_name']\n)\nreturn timeline_obj\n@@ -329,63 +400,70 @@ class Sketch(object):\nreturn response.json()\n-class BaseSketchResource(object):\n- \"\"\"Base class for resource objects related to a sketch.\n+class SearchIndex(BaseResource):\n+ \"\"\"Timesketch searchindex object.\nAttributes:\n- sketch: Sketch object instance.\n- resource_url: URL to the sketch resource endpoint.\n+ id: The ID of the search index.\n+ api: An instance of TimesketchApi object.\n\"\"\"\n- def __init__(self, sketch, resource_uri):\n- \"\"\"Initializes the base Sketch resource object.\n+ def __init__(self, searchindex_id, api, searchindex_name=None):\n+ \"\"\"Initializes the SearchIndex object.\nArgs:\n- sketch: Sketch object instance.\n- resource_uri: URI to the resource endpoint.\n+ searchindex_id: Primary key ID of the searchindex.\n+ searchindex_name: Name of the searchindex (optional).\n\"\"\"\n- self.sketch = sketch\n- self.resource_url = u'sketches/{0:d}/{1:s}'.format(\n- sketch.id, resource_uri)\n- self._data = None\n+ self.id = searchindex_id\n+ self._searchindex_name = searchindex_name\n+ self._resource_uri = u'timelines/{0:d}'.format(self.id)\n+ super(\n+ SearchIndex, self).__init__(\n+ api=api, resource_uri=self._resource_uri)\n- def lazyload_data(self, refresh_cache=False):\n- \"\"\"Load resource data once and cache the result.\n-\n- Args:\n- refresh_cache: Boolean indicating if to update cache.\n+ @property\n+ def name(self):\n+ \"\"\"Property that returns searchindex name.\nReturns:\n- Dictionary with resource data.\n+ Searchindex name as string.\n\"\"\"\n- if not self._data or refresh_cache:\n- self._data = self.sketch.api.fetch_resource_data(self.resource_url)\n- return self._data\n+ if not self._searchindex_name:\n+ searchindex = self.lazyload_data()\n+ self._searchindex_name = searchindex[u'objects'][0][u'name']\n+ return self._searchindex_name\n@property\n- def data(self):\n- \"\"\"Property to fetch sketch data.\"\"\"\n- return self.lazyload_data()\n+ def index_name(self):\n+ \"\"\"Property that returns Elasticsearch index name.\n+\n+ Returns:\n+ Elasticsearch index name as string.\n+ \"\"\"\n+ searchindex = self.lazyload_data()\n+ return searchindex[u'objects'][0][u'index_name']\n-class View(BaseSketchResource):\n+class View(BaseResource):\n\"\"\"Saved view object.\nAttributes:\nid: Primary key of the view.\nname: Name of the view.\n\"\"\"\n- def __init__(self, view_id, view_name, sketch):\n+ def __init__(self, view_id, view_name, sketch_id, api):\n\"\"\"Initializes the View object.\nArgs:\nview_id: Primary key ID for the view.\nview_name: The name of the view.\n- sketch: Instance of a Sketch object.\n+ sketch_id: ID of a sketch.\n+ api: Instance of a TimesketchApi object.\n\"\"\"\nself.id = view_id\nself.name = view_name\n- resource_uri = u'views/{0:d}/'.format(self.id)\n- super(View, self).__init__(sketch, resource_uri)\n+ resource_uri = u'sketches/{0:d}/views/{1:d}/'.format(sketch_id, self.id)\n+ super(View, self).__init__(api, resource_uri)\n@property\ndef query_string(self):\n@@ -418,26 +496,29 @@ class View(BaseSketchResource):\nreturn view[u'objects'][0][u'query_dsl']\n-class Timeline(BaseSketchResource):\n+class Timeline(BaseResource):\n\"\"\"Timeline object.\nAttributes:\nid: Primary key of the view.\n\"\"\"\n- def __init__(self, timeline_id, sketch, name=None, searchindex=None):\n+ def __init__(self, timeline_id, sketch_id, api, name=None,\n+ searchindex=None):\n\"\"\"Initializes the Timeline object.\nArgs:\ntimeline_id: The primary key ID of the timeline.\n- sketch: Instance of a Sketch object.\n+ sketch_id: ID of a sketch.\n+ api: Instance of a TimesketchApi object.\nname: Name of the timeline (optional)\nsearchindex: The Elasticsearch index name (optional)\n\"\"\"\nself.id = timeline_id\nself._name = name\n- self._index = searchindex\n- resource_uri = u'timelines/{0:d}/'.format(self.id)\n- super(Timeline, self).__init__(sketch, resource_uri)\n+ self._searchindex = searchindex\n+ resource_uri = u'sketches/{0:d}/timelines/{1:d}/'.format(\n+ sketch_id, self.id)\n+ super(Timeline, self).__init__(api, resource_uri)\n@property\ndef name(self):\n@@ -458,8 +539,8 @@ class Timeline(BaseSketchResource):\nReturns:\nElasticsearch index name as string.\n\"\"\"\n- if not self._index:\n+ if not self._searchindex:\ntimeline = self.lazyload_data()\n- index = timeline[u'objects'][0][u'searchindex'][u'index_name']\n- self._index = index\n- return self._index\n+ index_name = timeline[u'objects'][0][u'searchindex'][u'index_name']\n+ self._searchindex = index_name\n+ return self._searchindex\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -1277,8 +1277,6 @@ class SearchIndexListResource(ResourceMixin, Resource):\nsearchindex = SearchIndex.query.filter_by(\nindex_name=index_name).first()\n- print searchindex\n-\nif not searchindex:\nsearchindex = SearchIndex.get_or_create(\nname=timeline_name, description=timeline_name,\n"
}
] | Python | Apache License 2.0 | google/timesketch | SearchIndex feature in the API client |
263,093 | 15.08.2017 17:49:55 | -7,200 | 2fd940a4c0eb047f2f5ac59fe04646e3e132e879 | Change version of API client | [
{
"change_type": "MODIFY",
"old_path": "api_client/python/setup.py",
"new_path": "api_client/python/setup.py",
"diff": "@@ -20,8 +20,8 @@ from setuptools import setup\nsetup(\nname=u'timesketch-api-client',\n- version=u'20170721',\n- description=u'Timesketch',\n+ version=u'20170815',\n+ description=u'Timesketch API client',\nlicense=u'Apache License, Version 2.0',\nurl=u'http://www.timesketch.org/',\nmaintainer=u'Timesketch development team',\n"
}
] | Python | Apache License 2.0 | google/timesketch | Change version of API client |
263,093 | 17.08.2017 15:10:04 | -7,200 | 6f31fbb8bca7cd53f7af58cc5f407a3281b4efa2 | Return HTTP 409 on conflict and raise error | [
{
"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+import uuid\nimport BeautifulSoup\nimport requests\n+\nfrom requests.exceptions import ConnectionError\n-from uuid import uuid4\n+\n+from .definitions import HTTP_STATUS_CODE_CREATED\n+from .definitions import HTTP_STATUS_CODE_CONFLICT\n+from .errors import TimelineExist\nclass TimesketchApi(object):\n@@ -190,7 +195,7 @@ class TimesketchApi(object):\nInstance of a SearchIndex object.\n\"\"\"\nif not index_name:\n- index_name = uuid4().hex\n+ index_name = uuid.uuid4().hex\nresource_url = u'{0:s}/timelines/'.format(self.api_root)\nform_data = {\n@@ -199,6 +204,12 @@ class TimesketchApi(object):\nu'public': public\n}\nresponse = self.session.post(resource_url, json=form_data)\n+\n+ if 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+\nresponse_dict = response.json()\nsearchindex_id = response_dict[u'objects'][0][u'id']\nreturn self.get_timeline(searchindex_id)\n@@ -417,8 +428,7 @@ class SearchIndex(BaseResource):\nself.id = searchindex_id\nself._searchindex_name = searchindex_name\nself._resource_uri = u'timelines/{0:d}'.format(self.id)\n- super(\n- SearchIndex, self).__init__(\n+ super(SearchIndex, self).__init__(\napi=api, resource_uri=self._resource_uri)\n@property\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "api_client/python/timesketch_api_client/definitions.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+\"\"\"Timesketch API client definitions.\"\"\"\n+\n+\n+# HTTP status codes\n+HTTP_STATUS_CODE_OK = 200\n+HTTP_STATUS_CODE_CREATED = 201\n+HTTP_STATUS_CODE_REDIRECT = 302\n+HTTP_STATUS_CODE_BAD_REQUEST = 400\n+HTTP_STATUS_CODE_UNAUTHORIZED = 401\n+HTTP_STATUS_CODE_FORBIDDEN = 403\n+HTTP_STATUS_CODE_NOT_FOUND = 404\n+HTTP_STATUS_CODE_CONFLICT = 409\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "api_client/python/timesketch_api_client/errors.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+\"\"\"Timesketch API client errors.\"\"\"\n+\n+\n+class TimelineExist(Exception):\n+ \"\"\"Raise exception if timeline already exists\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "timesketch/api/v1/resources.py",
"new_path": "timesketch/api/v1/resources.py",
"diff": "@@ -52,6 +52,7 @@ 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@@ -1277,7 +1278,9 @@ class SearchIndexListResource(ResourceMixin, Resource):\nsearchindex = SearchIndex.query.filter_by(\nindex_name=index_name).first()\n- if not searchindex:\n+ if searchindex:\n+ status_code = HTTP_STATUS_CODE_CONFLICT\n+ else:\nsearchindex = SearchIndex.get_or_create(\nname=timeline_name, description=timeline_name,\nuser=current_user, index_name=index_name)\n@@ -1294,8 +1297,10 @@ class SearchIndexListResource(ResourceMixin, Resource):\ndb_session.add(searchindex)\ndb_session.commit()\n+ status_code = HTTP_STATUS_CODE_CREATED\n+\nreturn self.to_json(\n- searchindex, status_code=HTTP_STATUS_CODE_CREATED)\n+ searchindex, status_code=status_code)\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,3 +21,4 @@ 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"
}
] | Python | Apache License 2.0 | google/timesketch | Return HTTP 409 on conflict and raise error |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.