Closed TarkingtonStabber closed 4 years ago
Testing creating a new cat and value seemed to work:
>>> tio.tags.create('TestCat', 'TestVal', filters={'asset': {'and': [{'field': 'ipv4', 'operator': 'eq', 'value': '192.168.0.0/16'}]}})
category has value of TestCat. Does not match pattern ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
{'uuid': '0fcfc9b7-e02b-4f34-b02b-4158103fe246', 'created_at': '2020-05-26T21:23:59.726Z', 'created_by': 'steve@cugnet.net', 'updated_at': '2020-05-26T21:23:59.726Z', 'updated_by': 'steve@cugnet.net'
, 'category_uuid': '19fc2717-4188-4bc8-b749-b368f4afca1b', 'value': 'TestVal', 'type': 'dynamic', 'category_name': 'TestCat', 'filters': {'asset': '{"and":[{"field":"ipv4","operator":"eq","value":"19
2.168.0.0/16"}]}'}}
Testing with UUID yields simmilar successes:
>>> u = tio.tags.create_category('TestCat2')['uuid']
>>> tio.tags.create(u, 'TestVal', filters={'asset': {'and': [{'field': 'ipv4', 'operator': 'eq', 'value': '192.168.0.0/16'}]}})
{'uuid': '01a38242-db83-442d-975a-94efa68fc130', 'created_at': '2020-05-26T21:26:24.131Z', 'created_by': 'steve@cugnet.net', 'updated_at': '2020-05-26T21:26:24.131Z', 'updated_by': 'steve@cugnet.net'
, 'category_uuid': '8d1743d8-f474-405d-b6e7-26ace2ea6dc0', 'value': 'TestVal', 'type': 'dynamic', 'category_name': 'TestCat2', 'filters': {'asset': '{"and":[{"field":"ipv4","operator":"eq","value":"1
92.168.0.0/16"}]}'}}
Testing with descriptions also works:
>>> u = tio.tags.create_category('TestCat3')['uuid']
>>> tio.tags.create(u, 'TestVal3', description='this is a test', category_description='test cat', filters={'asset': {'and': [{'field': 'ipv4', 'operator': 'eq', 'value': '192.168.0.0/16'}]}})
{'uuid': '0c6dbe89-8d0c-4373-9c81-e3c23227065b', 'created_at': '2020-05-26T21:28:41.339Z', 'created_by': 'steve@cugnet.net', 'updated_at': '2020-05-26T21:28:41.339Z', 'updated_by': 'steve@cugnet.net'
, 'category_uuid': '7c6d57e5-964a-4840-a5d1-ed0690ed7bcb', 'value': 'TestVal3', 'description': 'this is a test', 'type': 'dynamic', 'category_name': 'TestCat3', 'filters': {'asset': '{"and":[{"field"
:"ipv4","operator":"eq","value":"192.168.0.0/16"}]}'}}
Further, testing using your exact code yields success:
>>> from tenable.io import TenableIO
>>> tio = TenableIO()
>>> ret = tio.tags.create_category('hello dolly')
>>> new_uuid = ret['uuid']
>>> filt = {"asset": {"and": [{"field": "ipv4", "value": "192.168.0.0/16,10.0.0.0/8,172.0.0.0/8", "operator": "eq"}]}}
>>>
>>> try:
... tio.tags.create(category=new_uuid, value='Test tag', description="terst taggeroo",
... category_description="category desc", filters=filt)
... except Exception as e:
... print("What is wrong baby? Is the API being mean to you....boo-hoo {}".format(e))
...
{'uuid': 'e051aa14-e1b8-4b19-969d-3208be8a5187', 'created_at': '2020-05-26T21:48:08.518Z', 'created_by': 'steve@cugnet.net', 'updated_at': '2020-05-26T21:48:08.518Z', 'updated_by': 'steve@cugnet.net'
, 'category_uuid': 'db4c8014-6c22-423f-b17a-2ff848143d03', 'value': 'Test tag', 'description': 'terst taggeroo', 'type': 'dynamic', 'category_name': 'hello dolly', 'filters': {'asset': '{"and":[{"fie
ld":"ipv4","operator":"eq","value":"192.168.0.0/16,10.0.0.0/8,172.0.0.0/8"}]}'}}
>>>
ah, sorry wasting your time....I wasn't on most recent pytenable...
John
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, May 26, 2020 5:30 PM, Steven McGrath notifications@github.com wrote:
Testing creating a new cat and value seemed to work:
tio
.
tags
.
create
(
'TestCat'
,
'TestVal'
,
filters
=
{
'asset'
: {
'and'
: [{
'field'
:
'ipv4'
,
'operator'
:
'eq'
,
'value'
:
'192.168.0.0/16'
}]}})
category
has
value
of
TestCat
.
Does
not
match
pattern
^
[
a
-
fA
-
F0
-
9
]{
8
}
-
[
a
-
fA
-
F0
-
9
]{
4
}
-
[
a
-
fA
-
F0
-
9
]{
4
}
-
[
a
-
fA
-
F0
-
9
]{
4
}
-
[
a
-
fA
-
F0
-
9
]{
12
}$ {
'uuid'
:
'0fcfc9b7-e02b-4f34-b02b-4158103fe246'
,
'created_at'
:
'2020-05-26T21:23:59.726Z'
,
'created_by'
:
'steve@cugnet.net'
,
'updated_at'
:
'2020-05-26T21:23:59.726Z'
,
'updated_by'
:
'steve@cugnet.net'
,
'category_uuid'
:
'19fc2717-4188-4bc8-b749-b368f4afca1b'
,
'value'
:
'TestVal'
,
'type'
:
'dynamic'
,
'category_name'
:
'TestCat'
,
'filters'
: {
'asset'
:
'
{
"and"
:[{
"field"
:"ipv4","operator":"eq","value":"19
2.168.0.0/16"
}
]}'
}}
Testing with UUID yields simmilar successes:
u
=
tio
.
tags
.
create_category
(
'TestCat2'
)[
'uuid'
]
tio
.
tags
.
create
(
u
,
'TestVal'
,
filters
=
{
'asset'
: {
'and'
: [{
'field'
:
'ipv4'
,
'operator'
:
'eq'
,
'value'
:
'192.168.0.0/16'
}]}}) {
'uuid'
:
'01a38242-db83-442d-975a-94efa68fc130'
,
'created_at'
:
'2020-05-26T21:26:24.131Z'
,
'created_by'
:
'steve@cugnet.net'
,
'updated_at'
:
'2020-05-26T21:26:24.131Z'
,
'updated_by'
:
'steve@cugnet.net'
,
'category_uuid'
:
'8d1743d8-f474-405d-b6e7-26ace2ea6dc0'
,
'value'
:
'TestVal'
,
'type'
:
'dynamic'
,
'category_name'
:
'TestCat2'
,
'filters'
: {
'asset'
:
'
{
"and"
:[{
"field"
:"ipv4","operator":"eq","value":"1
92.168.0.0/16"
}
]}'
}}
Testing with descriptions also works:
u
=
tio
.
tags
.
create_category
(
'TestCat3'
)[
'uuid'
]
tio
.
tags
.
create
(
u
,
'TestVal3'
,
description
=
'this is a test'
,
category_description
=
'test cat'
,
filters
=
{
'asset'
: {
'and'
: [{
'field'
:
'ipv4'
,
'operator'
:
'eq'
,
'value'
:
'192.168.0.0/16'
}]}}) {
'uuid'
:
'0c6dbe89-8d0c-4373-9c81-e3c23227065b'
,
'created_at'
:
'2020-05-26T21:28:41.339Z'
,
'created_by'
:
'steve@cugnet.net'
,
'updated_at'
:
'2020-05-26T21:28:41.339Z'
,
'updated_by'
:
'steve@cugnet.net'
,
'category_uuid'
:
'7c6d57e5-964a-4840-a5d1-ed0690ed7bcb'
,
'value'
:
'TestVal3'
,
'description'
:
'this is a test'
,
'type'
:
'dynamic'
,
'category_name'
:
'TestCat3'
,
'filters'
: {
'asset'
:
'
{
"and"
:[{
"field"
:"ipv4","operator":"eq","value":"192.168.0.0/16"
}
]}'
}}
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
No worries, appreciate that you fired off the issue. ;)
Describe the bug tags.create fails when a filter is provided
To Reproduce Steps to reproduce the behavior: def main(): tio = TenableIO(accesskey, secretkey)
Expected behavior category and tag created
Screenshots Connected to Tenable.io
What is wrong baby? Is the API being mean to you....boo-hoo create() got an unexpected keyword argument 'filters'
System Information (please complete the following information):
Additional context Add any other context about the problem here.