Skip to content

Commit 466d184

Browse files
Update to v1.1.0
Add more scenarios
1 parent 4da42d6 commit 466d184

21 files changed

+3377
-1439
lines changed

A1000/dynamic_analysis.ipynb

Lines changed: 72 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,65 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"id": "9d7f1f15771d055c",
6+
"metadata": {
7+
"collapsed": false
8+
},
59
"source": [
610
"# A1000 dynamic analysis API\n",
711
"This notebook explains how to fetch the dynamic analysis results from your instance of A1000. This API only fetches the analysis results. To submit a file for dynamic analysis on A1000, do so while uploading the file or while reanalyzing it. \n",
812
"**NOTE:** If pasted into a Python file in the displayed order, all code cells can also work as a Python script."
9-
],
10-
"metadata": {
11-
"collapsed": false
12-
},
13-
"id": "9d7f1f15771d055c"
13+
]
1414
},
1515
{
1616
"cell_type": "markdown",
17+
"id": "fa10448d71096650",
18+
"metadata": {
19+
"collapsed": false
20+
},
1721
"source": [
1822
"### Credentials\n",
1923
"Credentials are loaded from a local file instead of being written here in plain text.\n",
2024
"To learn how to creat the credentials file, see the **Storing and using the credentials** section in the [README file](./README.md) "
21-
],
22-
"metadata": {
23-
"collapsed": false
24-
},
25-
"id": "fa10448d71096650"
25+
]
2626
},
2727
{
2828
"cell_type": "markdown",
29-
"source": [
30-
"### 1. Import the A1000 class"
31-
],
29+
"id": "cf14d328ce34f928",
3230
"metadata": {
3331
"collapsed": false
3432
},
35-
"id": "cf14d328ce34f928"
33+
"source": [
34+
"### 1. Import the A1000 class"
35+
]
3636
},
3737
{
3838
"cell_type": "code",
3939
"execution_count": null,
40+
"id": "13ba76c5b7e61c6e",
41+
"metadata": {},
4042
"outputs": [],
4143
"source": [
4244
"from ReversingLabs.SDK.a1000 import A1000"
43-
],
44-
"metadata": {
45-
"collapsed": false
46-
},
47-
"id": "13ba76c5b7e61c6e"
45+
]
4846
},
4947
{
5048
"cell_type": "markdown",
49+
"id": "ef3b6b1a2b1a61b1",
50+
"metadata": {
51+
"collapsed": false
52+
},
5153
"source": [
5254
"### 2. Loading the credentials\n",
5355
"Next, we will load our A1000 credentials and host URL from the local `a1000_credentials.json` file.\n",
5456
"**NOTE: Instead of doing this step, you can paste your credentials while creating the Python object in the following step.**"
55-
],
56-
"metadata": {
57-
"collapsed": false
58-
},
59-
"id": "ef3b6b1a2b1a61b1"
57+
]
6058
},
6159
{
6260
"cell_type": "code",
6361
"execution_count": null,
62+
"id": "d2992f910f3e1562",
63+
"metadata": {},
6464
"outputs": [],
6565
"source": [
6666
"import json\n",
@@ -69,28 +69,26 @@
6969
"CREDENTIALS = json.load(open(\"a1000_credentials.json\"))\n",
7070
"HOST = CREDENTIALS.get(\"host\")\n",
7171
"TOKEN = CREDENTIALS.get(\"token\")\n",
72-
"USER_AGENT = \"ReversingLabs SDK Cookbook v1.0.2\""
73-
],
74-
"metadata": {
75-
"collapsed": false
76-
},
77-
"id": "d2992f910f3e1562"
72+
"USER_AGENT = json.load(open('../user_agent.json'))[\"user_agent\"]"
73+
]
7874
},
7975
{
8076
"cell_type": "markdown",
77+
"id": "ab56f879c48f8bd1",
78+
"metadata": {
79+
"collapsed": false
80+
},
8181
"source": [
8282
"#### 3. Creating an A1000 object\n",
8383
"First let us create an object out of the A1000 class. Unlike the `ticloud` module, the `a1000` module has only one class for all its methods (API-s).\n",
8484
"Having that in mind, we will create our A1000 object:"
85-
],
86-
"metadata": {
87-
"collapsed": false
88-
},
89-
"id": "ab56f879c48f8bd1"
85+
]
9086
},
9187
{
9288
"cell_type": "code",
9389
"execution_count": null,
90+
"id": "5e1223dba726bae7",
91+
"metadata": {},
9492
"outputs": [],
9593
"source": [
9694
"a1000 = A1000(\n",
@@ -99,50 +97,48 @@
9997
" verify=False,\n",
10098
" user_agent=USER_AGENT\n",
10199
")"
102-
],
103-
"metadata": {
104-
"collapsed": false
105-
},
106-
"id": "5e1223dba726bae7"
100+
]
107101
},
108102
{
109103
"cell_type": "markdown",
110-
"source": [
111-
"**NOTE:** Set the `verify` parameter to `True` or `False` depending on whether you want your server certificates to be validated or ignored."
112-
],
104+
"id": "d18c338fedb2fd8a",
113105
"metadata": {
114106
"collapsed": false
115107
},
116-
"id": "d18c338fedb2fd8a"
108+
"source": [
109+
"**NOTE:** Set the `verify` parameter to `True` or `False` depending on whether you want your server certificates to be validated or ignored."
110+
]
117111
},
118112
{
119113
"cell_type": "markdown",
114+
"id": "30bf83a9c10f8058",
115+
"metadata": {
116+
"collapsed": false
117+
},
120118
"source": [
121119
"### 4. Getting the dynamic analysis results\n",
122120
"To get the dynamic analysis results for a file from A1000, we have three steps:\n",
123121
"- Requesting a report and its format (PDF or HTML)\n",
124122
"- Checking the report creation status\n",
125123
"- Downloading the report"
126-
],
127-
"metadata": {
128-
"collapsed": false
129-
},
130-
"id": "30bf83a9c10f8058"
124+
]
131125
},
132126
{
133127
"cell_type": "markdown",
134-
"source": [
135-
"#### Requesting a report\n",
136-
"First we need to request a report creation task and define the report format that we want."
137-
],
128+
"id": "7f40c39da72ad6de",
138129
"metadata": {
139130
"collapsed": false
140131
},
141-
"id": "7f40c39da72ad6de"
132+
"source": [
133+
"#### Requesting a report\n",
134+
"First we need to request a report creation task and define the report format that we want."
135+
]
142136
},
143137
{
144138
"cell_type": "code",
145139
"execution_count": null,
140+
"id": "de98440b912ff8e1",
141+
"metadata": {},
146142
"outputs": [],
147143
"source": [
148144
"response = a1000.create_dynamic_analysis_report(\n",
@@ -151,29 +147,27 @@
151147
")\n",
152148
"\n",
153149
"print(response.text)"
154-
],
155-
"metadata": {
156-
"collapsed": false
157-
},
158-
"id": "de98440b912ff8e1"
150+
]
159151
},
160152
{
161153
"cell_type": "markdown",
154+
"id": "fc224ffe106193bd",
155+
"metadata": {
156+
"collapsed": false
157+
},
162158
"source": [
163159
"In our example, we requested a PDF report.\n",
164160
"\n",
165161
"\n",
166162
"#### Checking the report creation status\n",
167163
"Next, we can check the status of our report creation task. This step is not mandatory but is useful for knowing if our report is ready or not."
168-
],
169-
"metadata": {
170-
"collapsed": false
171-
},
172-
"id": "fc224ffe106193bd"
164+
]
173165
},
174166
{
175167
"cell_type": "code",
176168
"execution_count": null,
169+
"id": "78cf3e1a71f9a7e8",
170+
"metadata": {},
177171
"outputs": [],
178172
"source": [
179173
"response = a1000.check_dynamic_analysis_report_status(\n",
@@ -182,29 +176,27 @@
182176
")\n",
183177
"\n",
184178
"print(response.text)"
185-
],
186-
"metadata": {
187-
"collapsed": false
188-
},
189-
"id": "78cf3e1a71f9a7e8"
179+
]
190180
},
191181
{
192182
"cell_type": "markdown",
183+
"id": "7ce55b15cbf69400",
184+
"metadata": {
185+
"collapsed": false
186+
},
193187
"source": [
194188
"By printing out the response message, we can see the status of our report creation task. \n",
195189
"\n",
196190
"\n",
197191
"#### Downloading the report\n",
198192
"If the report is ready, we can proceed to downloading it."
199-
],
200-
"metadata": {
201-
"collapsed": false
202-
},
203-
"id": "7ce55b15cbf69400"
193+
]
204194
},
205195
{
206196
"cell_type": "code",
207197
"execution_count": null,
198+
"id": "1505a364a3325af8",
199+
"metadata": {},
208200
"outputs": [],
209201
"source": [
210202
"response = a1000.download_dynamic_analysis_report(\n",
@@ -214,40 +206,22 @@
214206
"\n",
215207
"with open(\"report.pdf\", \"wb\") as file_handle:\n",
216208
" file_handle.write(response.content)"
217-
],
218-
"metadata": {
219-
"collapsed": false
220-
},
221-
"id": "1505a364a3325af8"
209+
]
222210
},
223211
{
224212
"cell_type": "markdown",
225-
"source": [
226-
"Here we had to open a new empty PDF file and write the report's binary contents into it."
227-
],
213+
"id": "bbdc335c300acfec",
228214
"metadata": {
229215
"collapsed": false
230216
},
231-
"id": "bbdc335c300acfec"
217+
"source": [
218+
"Here we had to open a new empty PDF file and write the report's binary contents into it."
219+
]
232220
}
233221
],
234222
"metadata": {
235-
"kernelspec": {
236-
"display_name": "Python 3",
237-
"language": "python",
238-
"name": "python3"
239-
},
240223
"language_info": {
241-
"codemirror_mode": {
242-
"name": "ipython",
243-
"version": 2
244-
},
245-
"file_extension": ".py",
246-
"mimetype": "text/x-python",
247-
"name": "python",
248-
"nbconvert_exporter": "python",
249-
"pygments_lexer": "ipython2",
250-
"version": "2.7.6"
224+
"name": "python"
251225
}
252226
},
253227
"nbformat": 4,

0 commit comments

Comments
 (0)