pyalienvaultcli 1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyalienvaultcli
3
+ Version: 1.1
4
+ Summary: A simple Python script to interact with Alienvault OTX APIs from CLI.
5
+ Author-email: tdebize@mail.com
6
+ License-Expression: LGPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/maaaaz/pyalienvaultcli
8
+ Keywords: alienvault,otx,cli,malware,phishing,threat,open,threat,exchange,ioc,api
9
+ Classifier: Topic :: Security
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: OTXv2
14
+ Requires-Dist: validators
15
+
16
+ pyalienvaultcli
17
+ =========
18
+
19
+ Description
20
+ -----------
21
+ A simple Python script to interact with Alienvault OTX APIs from CLI.
22
+
23
+
24
+ Usage
25
+ -----
26
+ ```
27
+ $ pip install pyalienvaultcli
28
+
29
+ $ pyalienvaultcli
30
+ usage: pyalienvaultcli.py [-h] [-k API_KEY] [-a {add}] -p PULSE_ID -i INPUT_FILE
31
+
32
+ version: 1.1
33
+
34
+ options:
35
+ -h, --help show this help message and exit
36
+ -k, --api-key API_KEY
37
+ API key (could either be provided in the "SECRET_ALIENVAULT_API_KEY" env var)
38
+ -a, --action {add} Action to perform (default 'add')
39
+ -p, --pulse_id PULSE_ID
40
+ Pulse ID to perform the requested action
41
+ -i, --input-file INPUT_FILE
42
+ Input file as a list of newline-separated IoC
43
+ ```
44
+
45
+
46
+ Changelog
47
+ ---------
48
+ * version 1.1 - 2025-09-14: Publication on pypi.org and few fixes
49
+
50
+
51
+ Copyright and license
52
+ ---------------------
53
+
54
+ pyalienvaultcli is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
55
+
56
+ pyalienvaultcli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
57
+
58
+ See the GNU Lesser General Public License for more details.
59
+
60
+ You should have received a copy of the GNU General Public License along with pyalienvaultcli.
61
+ If not, see http://www.gnu.org/licenses/.
62
+
63
+ Contact
64
+ -------
65
+ * Thomas Debize < tdebize at mail d0t com >
@@ -0,0 +1,50 @@
1
+ pyalienvaultcli
2
+ =========
3
+
4
+ Description
5
+ -----------
6
+ A simple Python script to interact with Alienvault OTX APIs from CLI.
7
+
8
+
9
+ Usage
10
+ -----
11
+ ```
12
+ $ pip install pyalienvaultcli
13
+
14
+ $ pyalienvaultcli
15
+ usage: pyalienvaultcli.py [-h] [-k API_KEY] [-a {add}] -p PULSE_ID -i INPUT_FILE
16
+
17
+ version: 1.1
18
+
19
+ options:
20
+ -h, --help show this help message and exit
21
+ -k, --api-key API_KEY
22
+ API key (could either be provided in the "SECRET_ALIENVAULT_API_KEY" env var)
23
+ -a, --action {add} Action to perform (default 'add')
24
+ -p, --pulse_id PULSE_ID
25
+ Pulse ID to perform the requested action
26
+ -i, --input-file INPUT_FILE
27
+ Input file as a list of newline-separated IoC
28
+ ```
29
+
30
+
31
+ Changelog
32
+ ---------
33
+ * version 1.1 - 2025-09-14: Publication on pypi.org and few fixes
34
+
35
+
36
+ Copyright and license
37
+ ---------------------
38
+
39
+ pyalienvaultcli is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
40
+
41
+ pyalienvaultcli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
42
+
43
+ See the GNU Lesser General Public License for more details.
44
+
45
+ You should have received a copy of the GNU General Public License along with pyalienvaultcli.
46
+ If not, see http://www.gnu.org/licenses/.
47
+
48
+ Contact
49
+ -------
50
+ * Thomas Debize < tdebize at mail d0t com >
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import pyalienvaultcli
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ import os
4
+ import argparse
5
+ import datetime
6
+ import pprint
7
+
8
+ import validators
9
+ from OTXv2 import OTXv2
10
+ from OTXv2 import IndicatorTypes
11
+
12
+ # Globals
13
+ VERSION = '1.1'
14
+ SECRET_ALIENVAULT_API_KEY = 'SECRET_ALIENVAULT_API_KEY'
15
+
16
+ # Options definition
17
+ parser = argparse.ArgumentParser(description="version: " + VERSION)
18
+ parser.add_argument('-k', '--api-key', help='API key (could either be provided in the "%s" env var)' % SECRET_ALIENVAULT_API_KEY, type = str)
19
+ parser.add_argument('-a', '--action', help="Action to perform (default 'add')", choices = ['add'], type = str.lower, default = 'add')
20
+ parser.add_argument('-p', '--pulse_id', help='Pulse ID to perform the requested action', type = str.lower, required = True)
21
+ parser.add_argument('-i', '--input-file', help='Input file as a list of newline-separated IoC', required = True)
22
+
23
+ def make_indicator(entry, type):
24
+ return { 'indicator': entry, 'type': type }
25
+
26
+ def make_indicators_from_file(fd_input):
27
+ res = []
28
+
29
+ for entry in fd_input:
30
+ entry = entry.strip()
31
+
32
+ if validators.domain(entry):
33
+ res.append(make_indicator(entry, IndicatorTypes.DOMAIN.name))
34
+
35
+ elif validators.ipv4(entry):
36
+ res.append(make_indicator(entry, IndicatorTypes.IPv4.name))
37
+
38
+ elif validators.ipv6(entry):
39
+ res.append(make_indicator(entry, IndicatorTypes.IPv6.name))
40
+
41
+ elif validators.email(entry):
42
+ res.append(make_indicator(entry, IndicatorTypes.EMAIL.name))
43
+
44
+ elif validators.url(entry):
45
+ res.append(make_indicator(entry, IndicatorTypes.URL.name))
46
+
47
+ #pprint.pprint(res)
48
+ return res
49
+
50
+
51
+ def main():
52
+ global parser
53
+ options = parser.parse_args()
54
+
55
+ api_key = options.api_key
56
+ if not(api_key):
57
+ if SECRET_ALIENVAULT_API_KEY in os.environ:
58
+ api_key = os.environ[SECRET_ALIENVAULT_API_KEY]
59
+ else:
60
+ parser.error('[!] No API key has been provided, exiting.')
61
+ options.api_key = api_key
62
+
63
+ otx = OTXv2(options.api_key)
64
+
65
+ with open(options.input_file, mode='r', encoding='utf-8') as fd_input:
66
+ new_indicators = make_indicators_from_file(fd_input)
67
+ response = otx.add_pulse_indicators(options.pulse_id, new_indicators)
68
+ print(str(response))
69
+
70
+ return
71
+
72
+ if __name__ == "__main__" :
73
+ main()
@@ -0,0 +1,2 @@
1
+ OTXv2
2
+ validators
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyalienvaultcli
3
+ Version: 1.1
4
+ Summary: A simple Python script to interact with Alienvault OTX APIs from CLI.
5
+ Author-email: tdebize@mail.com
6
+ License-Expression: LGPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/maaaaz/pyalienvaultcli
8
+ Keywords: alienvault,otx,cli,malware,phishing,threat,open,threat,exchange,ioc,api
9
+ Classifier: Topic :: Security
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: OTXv2
14
+ Requires-Dist: validators
15
+
16
+ pyalienvaultcli
17
+ =========
18
+
19
+ Description
20
+ -----------
21
+ A simple Python script to interact with Alienvault OTX APIs from CLI.
22
+
23
+
24
+ Usage
25
+ -----
26
+ ```
27
+ $ pip install pyalienvaultcli
28
+
29
+ $ pyalienvaultcli
30
+ usage: pyalienvaultcli.py [-h] [-k API_KEY] [-a {add}] -p PULSE_ID -i INPUT_FILE
31
+
32
+ version: 1.1
33
+
34
+ options:
35
+ -h, --help show this help message and exit
36
+ -k, --api-key API_KEY
37
+ API key (could either be provided in the "SECRET_ALIENVAULT_API_KEY" env var)
38
+ -a, --action {add} Action to perform (default 'add')
39
+ -p, --pulse_id PULSE_ID
40
+ Pulse ID to perform the requested action
41
+ -i, --input-file INPUT_FILE
42
+ Input file as a list of newline-separated IoC
43
+ ```
44
+
45
+
46
+ Changelog
47
+ ---------
48
+ * version 1.1 - 2025-09-14: Publication on pypi.org and few fixes
49
+
50
+
51
+ Copyright and license
52
+ ---------------------
53
+
54
+ pyalienvaultcli is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
55
+
56
+ pyalienvaultcli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
57
+
58
+ See the GNU Lesser General Public License for more details.
59
+
60
+ You should have received a copy of the GNU General Public License along with pyalienvaultcli.
61
+ If not, see http://www.gnu.org/licenses/.
62
+
63
+ Contact
64
+ -------
65
+ * Thomas Debize < tdebize at mail d0t com >
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ pyalienvaultcli/__init__.py
4
+ pyalienvaultcli/pyalienvaultcli.py
5
+ pyalienvaultcli/requirements.txt
6
+ pyalienvaultcli.egg-info/PKG-INFO
7
+ pyalienvaultcli.egg-info/SOURCES.txt
8
+ pyalienvaultcli.egg-info/dependency_links.txt
9
+ pyalienvaultcli.egg-info/entry_points.txt
10
+ pyalienvaultcli.egg-info/requires.txt
11
+ pyalienvaultcli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyalienvaultcli = pyalienvaultcli.pyalienvaultcli:main
@@ -0,0 +1,2 @@
1
+ OTXv2
2
+ validators
@@ -0,0 +1 @@
1
+ pyalienvaultcli
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyalienvaultcli"
7
+ authors = [{ email = "tdebize@mail.com" }]
8
+ description = "A simple Python script to interact with Alienvault OTX APIs from CLI."
9
+ readme = "README.md"
10
+ requires-python = ">=3"
11
+ keywords = ["alienvault", "otx", "cli", "malware", "phishing", "threat", "open", "threat", "exchange", "ioc", "api"]
12
+ license = "LGPL-3.0-or-later"
13
+ classifiers = [
14
+ 'Topic :: Security',
15
+ 'Programming Language :: Python :: 3'
16
+ ]
17
+ dynamic = ["version", "dependencies"]
18
+
19
+ [tool.setuptools.dynamic]
20
+ dependencies = {file = ["pyalienvaultcli/requirements.txt"]}
21
+ version = {attr = "pyalienvaultcli.pyalienvaultcli.VERSION"}
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/maaaaz/pyalienvaultcli"
25
+
26
+ [project.scripts]
27
+ pyalienvaultcli = "pyalienvaultcli.pyalienvaultcli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+