davidism / mcafee-epo Goto Github PK
View Code? Open in Web Editor NEWPython client for McAfee ePolicy Orchestrator
License: BSD 3-Clause "New" or "Revised" License
Python client for McAfee ePolicy Orchestrator
License: BSD 3-Clause "New" or "Revised" License
How do you disable certificate verification? Almost everyone is going to use a self-signed certificate for ePO.
Traceback (most recent call last):
File "E:/py_workstation/common/programe/office_scan/McAfee/mcafee_py/mcafee_epo_1.py", line 7, in <module>
systems = client('system.find', 'zhangsan')
File "C:\Python27\lib\site-packages\mcafee_epo.py", line 120, in __call__
return self._request(name, params=params, files=files)
File "C:\Python27\lib\site-packages\mcafee_epo.py", line 69, in _request
self._get_token(_skip=name == "core.getSecurityToken"),
File "C:\Python27\lib\site-packages\mcafee_epo.py", line 49, in _get_token
self._token = self._request("core.getSecurityToken")
File "C:\Python27\lib\site-packages\mcafee_epo.py", line 77, in _request
r = self._session.get(url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.25.160', port=8443): Max retries exceeded with url: /remote/core.getSecurityToken?%3Aoutput=json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
s = requests.Session()
s.verify = '/path/to/certfile'
c = Client(url, username, password, session=s)
Please,what‘s certfile and how to generate?
Great work! Please consider:
Change
import request.Session
to
import request
def __init__(self, url, username, password, verify=True, session=None):
"""Create a client for the given ePO server.
:param url: Location of ePO server.
:param username: Username to authenticate.
:param password: Password to authenticate.
:param session: Custom instance of :class:`requests.Session`,
useful for configuring server verification.
"""
self.url = url
self.username = username
self.password = password
if session is None:
session = requests.Session()
self._session = session
self._token = None
self._verify = verify
if not verify:
requests.packages.urllib3.disable_warnings()
and
if any(kwargs.get(key) for key in ("data", "json", "files")):
# Use post method if there is post data.
r = self._session.post(url, verify=self._verify, **kwargs)
else:
r = self._session.get(url, verify=self._verify, **kwargs)
This allows the client to bypass certification verification in development situations
I can't seem to import a task from a local xml file.
inst_ma_eval.xml is a task exported from the epo website
>>> c = Client(...)
>>> with open('inst_ma_eval.xml', 'r') as f:
... c('clienttask.importClientTask', files={'uploadFile': f})
APIError: Error 0 :
java.lang.reflect.InvocationTargetException
Do you have any clue as to what I am doing wrong? I have tried passing the file content as a string instead, or opening the file as bytes ('rb' instead of 'r') but I always get that damn java.lang.reflect.InvocationTargetException error. Any idea would be very much appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.