Skip to content

Commit fcd6dc2

Browse files
committed
docs: use honeypot dataset in collections notebook
1 parent b3175d5 commit fcd6dc2

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

demos/more_examples/graphistry_features/collections.ipynb

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,13 @@
2222
"execution_count": null,
2323
"outputs": [],
2424
"source": [
25+
"from pathlib import Path\n",
2526
"import pandas as pd\n",
2627
"import graphistry\n",
2728
"from graphistry import collection_set, collection_intersection, n, e_forward, Chain\n",
2829
"\n",
29-
"edges = pd.DataFrame({\n",
30-
" 'src': ['acct1', 'acct2', 'acct3'],\n",
31-
" 'dst': ['user1', 'user2', 'user3'],\n",
32-
" 'rel': ['owns', 'owns', 'owns']\n",
33-
"})\n",
34-
"\n",
35-
"nodes = pd.DataFrame({\n",
36-
" 'id': ['acct1', 'acct2', 'acct3', 'user1', 'user2', 'user3'],\n",
37-
" 'type': ['account', 'account', 'account', 'user', 'user', 'user'],\n",
38-
" 'subscribed': [False, True, True, True, False, True],\n",
39-
" 'status': ['purchased', 'purchased', 'new', 'new', 'purchased', 'new']\n",
40-
"})\n",
41-
"\n",
42-
"g = graphistry.edges(edges, 'src', 'dst').nodes(nodes, 'id')\n"
30+
"edges = pd.read_csv(Path('demos/data/honeypot.csv'))\n",
31+
"g = graphistry.edges(edges, \"attackerIP\", \"victimIP\")\n"
4332
]
4433
},
4534
{
@@ -48,24 +37,27 @@
4837
"execution_count": null,
4938
"outputs": [],
5039
"source": [
40+
"# Use Chain to select subgraphs (nodes + edges) by edge attributes\n",
5141
"collections = [\n",
5242
" collection_set(\n",
53-
" expr=Chain([n({'status': 'purchased'}), e_forward(), n()]),\n",
54-
" id='purchasers',\n",
55-
" name='Purchasers + Connections',\n",
43+
" expr=Chain([n(), e_forward({\"vulnName\": \"MS08067 (NetAPI)\"}), n()]),\n",
44+
" id='netapi',\n",
45+
" name='MS08067 (NetAPI)',\n",
5646
" node_color='#00BFFF',\n",
5747
" edge_color='#00BFFF',\n",
5848
" ),\n",
5949
" collection_set(\n",
60-
" expr=n({'subscribed': True}),\n",
61-
" id='subscribers',\n",
62-
" name='Subscribers',\n",
50+
" expr=Chain([n(), e_forward({\"victimPort\": 445.0}), n()]),\n",
51+
" id='port445',\n",
52+
" name='Port 445',\n",
6353
" node_color='#32CD32',\n",
54+
" edge_color='#32CD32',\n",
6455
" ),\n",
6556
" collection_intersection(\n",
66-
" sets=['purchasers', 'subscribers'],\n",
67-
" name='High Value Subscribers',\n",
57+
" sets=['netapi', 'port445'],\n",
58+
" name='NetAPI + 445',\n",
6859
" node_color='#AABBCC',\n",
60+
" edge_color='#AABBCC',\n",
6961
" ),\n",
7062
"]\n",
7163
"\n",
@@ -142,16 +134,18 @@
142134
"```python\n",
143135
"collections_priority = [\n",
144136
" collection_set(\n",
145-
" expr=n({\"vip\": True}),\n",
146-
" id=\"vip\",\n",
147-
" name=\"VIP\",\n",
137+
" expr=Chain([n(), e_forward({\"vulnName\": \"MS08067 (NetAPI)\"}), n()]),\n",
138+
" id=\"netapi\",\n",
139+
" name=\"MS08067 (NetAPI)\",\n",
148140
" node_color=\"#FFAA00\",\n",
141+
" edge_color=\"#FFAA00\",\n",
149142
" ),\n",
150143
" collection_set(\n",
151-
" expr=n({\"recent\": True}),\n",
152-
" id=\"recent\",\n",
153-
" name=\"Recent\",\n",
144+
" expr=Chain([n(), e_forward({\"victimPort\": 445.0}), n()]),\n",
145+
" id=\"port445\",\n",
146+
" name=\"Port 445\",\n",
154147
" node_color=\"#00BFFF\",\n",
148+
" edge_color=\"#00BFFF\",\n",
155149
" ),\n",
156150
"]\n",
157151
"g.collections(collections=collections_priority)\n",

0 commit comments

Comments
 (0)