HakObserverpy 2.1.2__tar.gz → 2.2.0__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.
@@ -626,6 +626,86 @@ def get_System_events(DeviceID,server='localhost', log_type='System'):
626
626
 
627
627
  except Exception as e:
628
628
  print(f"Error fetching logs: {e}")
629
+
630
+ import subprocess
631
+
632
+ def get_iis_sites(HWDeviceID):
633
+ cmd = [
634
+ "powershell",
635
+ "-Command",
636
+ "Get-Website | Select-Object name, state, physicalPath, bindings | ConvertTo-Json -Depth 3"
637
+ ]
638
+ try:
639
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=10)
640
+ sites = json.loads(result.stdout)
641
+
642
+ # Ensure it's a list
643
+ if isinstance(sites, dict):
644
+ sites = [sites]
645
+
646
+ for site in sites:
647
+ try:
648
+ name = site.get("name", "N/A")
649
+ state = site.get("state", "N/A")
650
+ path = site.get("physicalPath", "N/A")
651
+ bindings = site.get("bindings", {}).get("Collection", [])
652
+
653
+ print(f"Site Name : {name}")
654
+ print(f"State : {state}")
655
+ print(f"Physical Path : {path}")
656
+ print("Bindings :")
657
+
658
+ #Insert_IIS(HWDeviceID,name, state,str(path).replace("\"","**"))
659
+ url = f"https://api.hakware.com/HakObserver/InsertIIS/{HWDeviceID}/{name}/{state}/{str(path).replace("\"","**")}"
660
+
661
+ session = HTMLSession()
662
+
663
+ response = session.get(url, verify=False)
664
+
665
+ if response.status_code == 200:
666
+ print("Device Data inserted successfully via API.")
667
+ else:
668
+ print(url)
669
+ print(f"Failed to insert data via API. Status code: {response.status_code}")
670
+
671
+
672
+ if isinstance(bindings, list):
673
+ for b in bindings:
674
+ protocol = b.get("protocol", "N/A")
675
+ binding_info = b.get("bindingInformation", "N/A")
676
+ ssl_flags = b.get("sslFlags", None)
677
+ cert_hash = b.get("certificateHash", "")
678
+ cert_store = b.get("certificateStoreName", "")
679
+
680
+ print(f" - Protocol : {protocol}")
681
+ print(f" Binding Info : {binding_info}")
682
+ if ssl_flags is not None:
683
+ print(f" SSL Flags : {ssl_flags}")
684
+ if cert_hash:
685
+ print(f" Cert Hash : {cert_hash}")
686
+ if cert_store:
687
+ print(f" Cert Store : {cert_store}")
688
+ print()
689
+ #Insert_IIS_Bindings(DeviceID,name,protocol, binding_info,ssl_flags,cert_hash,cert_store)
690
+ url = f"https://api.hakware.com/HakObserver/InsertIISBindings/{HWDeviceID}/{name}/{protocol}/{binding_info}/{ssl_flags}/{cert_hash}/{cert_store}"
691
+ session = HTMLSession()
692
+
693
+ response = session.get(url, verify=False)
694
+
695
+ if response.status_code == 200:
696
+ print("Device Data inserted successfully via API.")
697
+ else:
698
+ print(url)
699
+ print(f"Failed to insert data via API. Status code: {response.status_code}")
700
+ else:
701
+ print(" - No bindings found or unexpected format.")
702
+
703
+ print("-" * 60)
704
+ except:
705
+ pass
706
+
707
+ except Exception as e:
708
+ print(f"Error: {e}")
629
709
 
630
710
 
631
711
  ###############################################################################################################################################################################
@@ -714,7 +794,15 @@ def InitiateCollecection(HWDeviceID, ObserverVersion):
714
794
  except Exception as e:
715
795
  StatusLogginfo(HWDeviceID, 'Security Events', str(e),'Error')
716
796
  pass
717
-
797
+
798
+ #---------------------------------------
799
+ try:
800
+ get_iis_sites(HWDeviceID)
801
+ StatusLogginfo(HWDeviceID, 'IIS Sites', 'IIS Sites and Bindings','Completed')
802
+
803
+ except Exception as e:
804
+ StatusLogginfo(HWDeviceID, 'IIS Sites', str(e),'Error')
805
+ pass
718
806
 
719
807
 
720
808
 
@@ -2,7 +2,7 @@
2
2
  from .HakObserverpy import InitiateCollecection # Import the function from the correct module
3
3
 
4
4
  # Optional: Define a version number for the package
5
- __version__ = "2.1.2"
5
+ __version__ = "2.2.0"
6
6
 
7
7
  # Optional: Define the package's public interface
8
8
  __all__ = ["InitiateCollecection"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: HakObserverpy
3
- Version: 2.1.2
3
+ Version: 2.2.0
4
4
  Summary: A package connect endpoints to the Hakware Application
5
5
  Author: Jacob O'Brien
6
6
  Classifier: Programming Language :: Python :: 3
@@ -20,7 +20,7 @@ Hakware-py is a Python package that allows endpoints to connect to the Hakware s
20
20
 
21
21
  ## Installation
22
22
 
23
- To install Hakware-py, ensure you have Python installed (version 3.6 or higher), then use pip to install the package:
23
+ Will be installed automatically with HakObserver Installation
24
24
 
25
25
  ```bash
26
26
  pip install Hakware-py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: HakObserverpy
3
- Version: 2.1.2
3
+ Version: 2.2.0
4
4
  Summary: A package connect endpoints to the Hakware Application
5
5
  Author: Jacob O'Brien
6
6
  Classifier: Programming Language :: Python :: 3
@@ -20,7 +20,7 @@ Hakware-py is a Python package that allows endpoints to connect to the Hakware s
20
20
 
21
21
  ## Installation
22
22
 
23
- To install Hakware-py, ensure you have Python installed (version 3.6 or higher), then use pip to install the package:
23
+ Will be installed automatically with HakObserver Installation
24
24
 
25
25
  ```bash
26
26
  pip install Hakware-py
@@ -4,7 +4,7 @@ Hakware-py is a Python package that allows endpoints to connect to the Hakware s
4
4
 
5
5
  ## Installation
6
6
 
7
- To install Hakware-py, ensure you have Python installed (version 3.6 or higher), then use pip to install the package:
7
+ Will be installed automatically with HakObserver Installation
8
8
 
9
9
  ```bash
10
10
  pip install Hakware-py
@@ -0,0 +1,25 @@
1
+ import platform
2
+ from setuptools import setup, find_packages
3
+
4
+ setup(
5
+ name='HakObserverpy',
6
+ version='2.2.0',
7
+ description='A package connect endpoints to the Hakware Application',
8
+ long_description=open('README.md').read(),
9
+ long_description_content_type='text/markdown',
10
+ author='Jacob O\'Brien',
11
+ packages=find_packages(),
12
+ install_requires=[
13
+ 'requests',
14
+ 'psutil',
15
+ 'lxml[html_clean]',
16
+ 'requests_html' ,
17
+ 'pywin32'
18
+ ],
19
+ classifiers=[
20
+ 'Programming Language :: Python :: 3',
21
+ 'License :: OSI Approved :: MIT License',
22
+ 'Operating System :: OS Independent',
23
+ ],
24
+ python_requires='>=3.6',
25
+ )
@@ -1,27 +0,0 @@
1
- import platform
2
- from setuptools import setup, find_packages
3
-
4
- setup(
5
- name='HakObserverpy', # Your package name
6
- version='2.1.2', # Start with a version number
7
- description='A package connect endpoints to the Hakware Application', # Short description
8
- long_description=open('README.md').read(), # Long description from README
9
- long_description_content_type='text/markdown',
10
- author='Jacob O\'Brien', # Your name
11
- # author_email='your.email@example.com', # Your email
12
- # url='https://github.com/your-username/XGRCPy', # Your package's URL (if applicable)
13
- packages=find_packages(), # Find all sub-packages
14
- install_requires=[ # Add your package dependencies here
15
- 'requests',
16
- 'psutil',
17
- 'lxml[html_clean]',
18
- 'requests_html' ,
19
- 'pywin32'
20
- ],
21
- classifiers=[
22
- 'Programming Language :: Python :: 3',
23
- 'License :: OSI Approved :: MIT License', # Choose your license
24
- 'Operating System :: OS Independent',
25
- ],
26
- python_requires='>=3.6', # Specify Python version compatibility
27
- )
File without changes