sdague / amt

Python tools for interacting with Intel's AMT hardware control interfaces
Apache License 2.0
63 stars 30 forks source link

enumerate functionality - possible contribution #30

Open smanross opened 2 years ago

smanross commented 2 years ago

Howdy,

I wanted to learn a bit more about the SOAP protocol, and possibly contribute to the project.

I've been working with Intel vPro PCs (AMT V12), not the NUCs.

I've been able to get an "enumerate request" working, and just wanted to know if it's worth putting in the pull request to the project or not.

Similar to runnung this winrm code on a windows command line:

winrm enumerate http://intel.com/wbem/wscim/1/amt-schema/1/AMT_RedirectionService -remote:https://mypc:16993/wsman -u:admin -p:password -a:Digest -encoding:utf-8 -skipCNCheck -skipRevocationCheck -skipCACheck

I've been hacking a lot of the code in this project:

Lastly, I wondered if we want to keep the code Python 2 compatible or not (hopefully not considering its not really supported anymore).

A lot of the changes I've made likely aren't Python 2 compatible, but I wonder if Python2 compatability should really be a thing anymore or not.... However, I don't even have a test system with Python 2 anymore.

P.S. Thanks for showing me the auth and get methods, as that got me started on the "Enumeration"s.

Here's an example of the code reduced to a simple python script:

import getpass
import amt.client
import amt.wsman

if 'mypass' not in locals().keys() or not mypass:
    # I rerun this a lot and likely have set my password in a previous running
    mypass = getpass.getpass()

client = amt.client.Client('somepc.somedomain.local', mypass, vncpasswd=mypass, protocol="https", verify_ssl=False, disable_ssl_warnings=True)

class_name = 'CIM_ComputerSystem'
rows = client.enumerate(class_name)

output:

[{'CreationClassName': 'CIM_ComputerSystem',
  'Dedicated': '32',
  'ElementName': 'Managed System',
  'EnabledDefault': '5',
  'EnabledState': '2',
  'HealthState': '5',
  'IdentifyingDescriptions': 'CIM:GUID',
  'Name': 'ManagedSystem',
  'NameFormat': 'Other',
  'OperationalStatus': '0',
  'OtherIdentifyingInfo': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'RequestedState': '12'},
 {'CreationClassName': 'CIM_ComputerSystem',
  'Dedicated': '14',
  'ElementName': 'Intel(r) AMT Subsystem',
  'EnabledDefault': '5',
  'EnabledState': '5',
  'HealthState': '5',
  'Name': 'Intel(r) AMT',
  'NameFormat': 'Other',
  'OperationalStatus': '0',
  'RequestedState': '12'}]

Please and Thank You, Steven

rgl commented 2 years ago

@smanross, just to let you known there's a more-up-to-date fork of this project at https://github.com/nomis/intel-amt (but at this point I'm afraid that both are more-or-less inactive).

smanross commented 2 years ago

Thanks @rgl,

I'll likely post my changes to yet another project so I dont break either project with my updates, and people can see what I've changed.

I'll also check out what changes have been made in the new project in case there's stuff I want to incorporate there too.

Steven