Skip to content

Commit

Permalink
Merge pull request #11 from MislavReversingLabs/main
Browse files Browse the repository at this point in the history
Add tiscale to directory_scanning.ipynb
  • Loading branch information
MislavReversingLabs authored Apr 10, 2024
2 parents b396985 + dfe523b commit c36287a
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions Scenarios and Workflows/directory_scanning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,69 @@
"collapsed": false
},
"id": "6b6774a15517020b"
},
{
"cell_type": "markdown",
"source": [
"### 3. Scanning the files with TitaniumScale\n",
"To collect files from a local directory and send them for analysis on TitaniumScale, see the following code example."
],
"metadata": {
"collapsed": false
},
"id": "75a945aa9a600013"
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"import json\n",
"import os\n",
"from ReversingLabs.SDK.tiscale import TitaniumScale\n",
"\n",
"# Linux and Unix systems - Edit before use\n",
"FOLDER_PATH_LINUX = \"/full/path/to/folder\"\n",
"\n",
"# Windows systems - Edit before use\n",
"FOLDER_PATH_WINDOWS = \"C:\\\\full\\\\path\\\\to\\\\folder\"\n",
"\n",
"# Change this so the FOLDER_PATH variable fits your local system\n",
"FOLDER_PATH = FOLDER_PATH_LINUX\n",
"\n",
"CREDENTIALS = json.load(open(\"credentials.json\"))\n",
"HOST = CREDENTIALS.get(\"tiscale\").get(\"tiscale_url\")\n",
"TOKEN = CREDENTIALS.get(\"tiscale\").get(\"token\")\n",
"\n",
"# Set the verify parameter to False if your A1000 instance doesn't have a valid CA certificate\n",
"tiscale = TitaniumScale(\n",
" host=HOST,\n",
" token=TOKEN,\n",
" verify=True\n",
")\n",
"\n",
"# Files that should not be analyzed can be added to this list\n",
"skip_files = [\"file_name_1\", \"file_name_2\"]\n",
"\n",
"for file_name in os.listdir(FOLDER_PATH):\n",
" if file_name in skip_files:\n",
" continue\n",
" \n",
" file_path = os.path.join(FOLDER_PATH, file_name)\n",
" \n",
" try:\n",
" tiscale.upload_sample_from_path(file_path=file_path)\n",
" \n",
" except Exception as e:\n",
" if hasattr(e, \"response_object\"):\n",
" raise Exception(e.response_object.content)\n",
" \n",
" raise "
],
"metadata": {
"collapsed": false
},
"id": "7b6f4ed40dcfbd26"
}
],
"metadata": {
Expand Down

0 comments on commit c36287a

Please sign in to comment.