techprotrade commited on
Commit
10347e3
·
verified ·
1 Parent(s): 69b5490

Add loan-advisor-agent

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +6 -0
  2. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/__init__.py +113 -0
  3. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/adsi.pyd +3 -0
  4. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/adsicon.py +340 -0
  5. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/objectPicker.py +68 -0
  6. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/scp.py +565 -0
  7. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/search.py +151 -0
  8. loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/test.py +274 -0
  9. loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/__init__.py +6 -0
  10. loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/authorization.pyd +0 -0
  11. loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/demos/EditSecurity.py +229 -0
  12. loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/demos/EditServiceSecurity.py +219 -0
  13. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axcontrol/__init__.py +4 -0
  14. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axcontrol/axcontrol.pyd +3 -0
  15. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/__init__.py +4 -0
  16. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/adb.py +467 -0
  17. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/codecontainer.py +279 -0
  18. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/contexts.py +58 -0
  19. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/debugger.py +238 -0
  20. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/documents.py +135 -0
  21. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/dump.py +57 -0
  22. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/expressions.py +212 -0
  23. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/gateways.py +583 -0
  24. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/stackframe.py +178 -0
  25. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/util.py +98 -0
  26. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/CreateObject.asp +18 -0
  27. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/caps.asp +52 -0
  28. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test.asp +4 -0
  29. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test.html +10 -0
  30. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test1.asp +6 -0
  31. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test1.html +10 -0
  32. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/tut1.asp +10 -0
  33. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/CHARTPY.HTM +179 -0
  34. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/FOO.HTM +46 -0
  35. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/MarqueeText1.htm +24 -0
  36. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/calc.htm +115 -0
  37. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/dbgtest.htm +16 -0
  38. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo.htm +25 -0
  39. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_check.htm +39 -0
  40. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_intro.htm +37 -0
  41. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_menu.htm +14 -0
  42. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/docwrite.htm +25 -0
  43. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/foo2.htm +105 -0
  44. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/form.htm +25 -0
  45. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/marqueeDemo.htm +59 -0
  46. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/mousetrack.htm +82 -0
  47. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/pycom_blowing.gif +0 -0
  48. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/blank.pys +0 -0
  49. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/excel.pys +31 -0
  50. loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/registry.pys +44 -0
.gitattributes CHANGED
@@ -719,3 +719,9 @@ loan-advisor-agent/.venv/Lib/site-packages/win32/win32file.pyd filter=lfs diff=l
719
  loan-advisor-agent/.venv/Lib/site-packages/win32/win32gui.pyd filter=lfs diff=lfs merge=lfs -text
720
  loan-advisor-agent/.venv/Lib/site-packages/win32/win32security.pyd filter=lfs diff=lfs merge=lfs -text
721
  loan-advisor-agent/.venv/Lib/site-packages/win32com/libs/pythoncom.lib filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
719
  loan-advisor-agent/.venv/Lib/site-packages/win32/win32gui.pyd filter=lfs diff=lfs merge=lfs -text
720
  loan-advisor-agent/.venv/Lib/site-packages/win32/win32security.pyd filter=lfs diff=lfs merge=lfs -text
721
  loan-advisor-agent/.venv/Lib/site-packages/win32com/libs/pythoncom.lib filter=lfs diff=lfs merge=lfs -text
722
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/adsi.pyd filter=lfs diff=lfs merge=lfs -text
723
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/axcontrol/axcontrol.pyd filter=lfs diff=lfs merge=lfs -text
724
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/mapi/exchange.pyd filter=lfs diff=lfs merge=lfs -text
725
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/mapi/mapi.pyd filter=lfs diff=lfs merge=lfs -text
726
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/propsys/propsys.pyd filter=lfs diff=lfs merge=lfs -text
727
+ loan-advisor-agent/.venv/Lib/site-packages/win32comext/shell/shell.pyd filter=lfs diff=lfs merge=lfs -text
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/__init__.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import win32com
2
+ import win32com.client
3
+
4
+ if isinstance(__path__, str):
5
+ # For freeze to work!
6
+ import sys
7
+
8
+ try:
9
+ import adsi
10
+
11
+ sys.modules["win32com.adsi.adsi"] = adsi
12
+ except ImportError:
13
+ pass
14
+ else:
15
+ # See if we have a special directory for the binaries (for developers)
16
+ win32com.__PackageSupportBuildPath__(__path__)
17
+
18
+
19
+ # Some helpers
20
+ # We want to _look_ like the ADSI module, but provide some additional
21
+ # helpers.
22
+
23
+ # Of specific note - most of the interfaces supported by ADSI
24
+ # derive from IDispatch - thus, you get the custom methods from the
25
+ # interface, as well as via IDispatch.
26
+ import pythoncom
27
+
28
+ from .adsi import * # nopycln: import # Re-export everything from win32comext/adsi/adsi.pyd
29
+
30
+ LCID = 0
31
+
32
+ IDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch]
33
+ IADsContainerType = pythoncom.TypeIIDs[adsi.IID_IADsContainer]
34
+
35
+
36
+ def _get_good_ret(
37
+ ob,
38
+ # Named arguments used internally
39
+ resultCLSID=None,
40
+ ):
41
+ assert resultCLSID is None, "Now have type info for ADSI objects - fix me!"
42
+ # See if the object supports IDispatch
43
+ if hasattr(ob, "Invoke"):
44
+ import win32com.client.dynamic
45
+
46
+ name = "Dispatch wrapper around %r" % ob
47
+ return win32com.client.dynamic.Dispatch(ob, name, ADSIDispatch)
48
+ return ob
49
+
50
+
51
+ class ADSIEnumerator:
52
+ def __init__(self, ob):
53
+ # Query the object for the container interface.
54
+ self._cont_ = ob.QueryInterface(adsi.IID_IADsContainer)
55
+ self._oleobj_ = adsi.ADsBuildEnumerator(self._cont_) # a PyIADsEnumVARIANT
56
+ self.index = -1
57
+
58
+ def __getitem__(self, index):
59
+ return self.__GetIndex(index)
60
+
61
+ def __call__(self, index):
62
+ return self.__GetIndex(index)
63
+
64
+ def __GetIndex(self, index):
65
+ if not isinstance(index, int):
66
+ raise TypeError("Only integer indexes are supported for enumerators")
67
+ if index != self.index + 1:
68
+ # Index requested out of sequence.
69
+ raise ValueError("You must index this object sequentially")
70
+ self.index = index
71
+ result = adsi.ADsEnumerateNext(self._oleobj_, 1)
72
+ if len(result):
73
+ return _get_good_ret(result[0])
74
+ # Failed - reset for next time around.
75
+ self.index = -1
76
+ self._oleobj_ = adsi.ADsBuildEnumerator(self._cont_) # a PyIADsEnumVARIANT
77
+ raise IndexError("list index out of range")
78
+
79
+
80
+ class ADSIDispatch(win32com.client.CDispatch):
81
+ def _wrap_dispatch_(self, ob, userName=None, returnCLSID=None):
82
+ if not userName:
83
+ userName = "ADSI-object"
84
+ olerepr = win32com.client.dynamic.MakeOleRepr(ob, None, None)
85
+ return ADSIDispatch(ob, olerepr, userName)
86
+
87
+ def _NewEnum(self):
88
+ try:
89
+ return ADSIEnumerator(self)
90
+ except pythoncom.com_error:
91
+ # doesn't support it - let our base try!
92
+ return win32com.client.CDispatch._NewEnum(self)
93
+
94
+ def __getattr__(self, attr):
95
+ try:
96
+ return getattr(self._oleobj_, attr)
97
+ except AttributeError:
98
+ return win32com.client.CDispatch.__getattr__(self, attr)
99
+
100
+ def QueryInterface(self, iid):
101
+ ret = self._oleobj_.QueryInterface(iid)
102
+ return _get_good_ret(ret)
103
+
104
+
105
+ # We override the adsi.pyd methods to do the right thing.
106
+ def ADsGetObject(path, iid=pythoncom.IID_IDispatch):
107
+ ret = adsi.ADsGetObject(path, iid)
108
+ return _get_good_ret(ret)
109
+
110
+
111
+ def ADsOpenObject(path, username, password, reserved=0, iid=pythoncom.IID_IDispatch):
112
+ ret = adsi.ADsOpenObject(path, username, password, reserved, iid)
113
+ return _get_good_ret(ret)
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/adsi.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db8929973ba569145a4ab8ef58fe4b6e7fa2b45092c0e0dbd847cc056c01b289
3
+ size 101888
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/adsicon.py ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ADS_ATTR_CLEAR = 1
2
+ ADS_ATTR_UPDATE = 2
3
+ ADS_ATTR_APPEND = 3
4
+ ADS_ATTR_DELETE = 4
5
+ ADS_EXT_MINEXTDISPID = 1
6
+ ADS_EXT_MAXEXTDISPID = 16777215
7
+ ADS_EXT_INITCREDENTIALS = 1
8
+ ADS_EXT_INITIALIZE_COMPLETE = 2
9
+
10
+ ADS_SEARCHPREF_ASYNCHRONOUS = 0
11
+ ADS_SEARCHPREF_DEREF_ALIASES = 1
12
+ ADS_SEARCHPREF_SIZE_LIMIT = 2
13
+ ADS_SEARCHPREF_TIME_LIMIT = 3
14
+ ADS_SEARCHPREF_ATTRIBTYPES_ONLY = 4
15
+ ADS_SEARCHPREF_SEARCH_SCOPE = 5
16
+ ADS_SEARCHPREF_TIMEOUT = 6
17
+ ADS_SEARCHPREF_PAGESIZE = 7
18
+ ADS_SEARCHPREF_PAGED_TIME_LIMIT = 8
19
+ ADS_SEARCHPREF_CHASE_REFERRALS = 9
20
+ ADS_SEARCHPREF_SORT_ON = 10
21
+ ADS_SEARCHPREF_CACHE_RESULTS = 11
22
+ ADS_SEARCHPREF_DIRSYNC = 12
23
+ ADS_SEARCHPREF_TOMBSTONE = 13
24
+
25
+ ADS_SCOPE_BASE = 0
26
+ ADS_SCOPE_ONELEVEL = 1
27
+ ADS_SCOPE_SUBTREE = 2
28
+
29
+ ADS_SECURE_AUTHENTICATION = 0x1
30
+ ADS_USE_ENCRYPTION = 0x2
31
+ ADS_USE_SSL = 0x2
32
+ ADS_READONLY_SERVER = 0x4
33
+ ADS_PROMPT_CREDENTIALS = 0x8
34
+ ADS_NO_AUTHENTICATION = 0x10
35
+ ADS_FAST_BIND = 0x20
36
+ ADS_USE_SIGNING = 0x40
37
+ ADS_USE_SEALING = 0x80
38
+ ADS_USE_DELEGATION = 0x100
39
+ ADS_SERVER_BIND = 0x200
40
+
41
+ ADSTYPE_INVALID = 0
42
+ ADSTYPE_DN_STRING = ADSTYPE_INVALID + 1
43
+ ADSTYPE_CASE_EXACT_STRING = ADSTYPE_DN_STRING + 1
44
+ ADSTYPE_CASE_IGNORE_STRING = ADSTYPE_CASE_EXACT_STRING + 1
45
+ ADSTYPE_PRINTABLE_STRING = ADSTYPE_CASE_IGNORE_STRING + 1
46
+ ADSTYPE_NUMERIC_STRING = ADSTYPE_PRINTABLE_STRING + 1
47
+ ADSTYPE_BOOLEAN = ADSTYPE_NUMERIC_STRING + 1
48
+ ADSTYPE_INTEGER = ADSTYPE_BOOLEAN + 1
49
+ ADSTYPE_OCTET_STRING = ADSTYPE_INTEGER + 1
50
+ ADSTYPE_UTC_TIME = ADSTYPE_OCTET_STRING + 1
51
+ ADSTYPE_LARGE_INTEGER = ADSTYPE_UTC_TIME + 1
52
+ ADSTYPE_PROV_SPECIFIC = ADSTYPE_LARGE_INTEGER + 1
53
+ ADSTYPE_OBJECT_CLASS = ADSTYPE_PROV_SPECIFIC + 1
54
+ ADSTYPE_CASEIGNORE_LIST = ADSTYPE_OBJECT_CLASS + 1
55
+ ADSTYPE_OCTET_LIST = ADSTYPE_CASEIGNORE_LIST + 1
56
+ ADSTYPE_PATH = ADSTYPE_OCTET_LIST + 1
57
+ ADSTYPE_POSTALADDRESS = ADSTYPE_PATH + 1
58
+ ADSTYPE_TIMESTAMP = ADSTYPE_POSTALADDRESS + 1
59
+ ADSTYPE_BACKLINK = ADSTYPE_TIMESTAMP + 1
60
+ ADSTYPE_TYPEDNAME = ADSTYPE_BACKLINK + 1
61
+ ADSTYPE_HOLD = ADSTYPE_TYPEDNAME + 1
62
+ ADSTYPE_NETADDRESS = ADSTYPE_HOLD + 1
63
+ ADSTYPE_REPLICAPOINTER = ADSTYPE_NETADDRESS + 1
64
+ ADSTYPE_FAXNUMBER = ADSTYPE_REPLICAPOINTER + 1
65
+ ADSTYPE_EMAIL = ADSTYPE_FAXNUMBER + 1
66
+ ADSTYPE_NT_SECURITY_DESCRIPTOR = ADSTYPE_EMAIL + 1
67
+ ADSTYPE_UNKNOWN = ADSTYPE_NT_SECURITY_DESCRIPTOR + 1
68
+ ADSTYPE_DN_WITH_BINARY = ADSTYPE_UNKNOWN + 1
69
+ ADSTYPE_DN_WITH_STRING = ADSTYPE_DN_WITH_BINARY + 1
70
+
71
+ ADS_PROPERTY_CLEAR = 1
72
+ ADS_PROPERTY_UPDATE = 2
73
+ ADS_PROPERTY_APPEND = 3
74
+ ADS_PROPERTY_DELETE = 4
75
+ ADS_SYSTEMFLAG_DISALLOW_DELETE = -2147483648
76
+ ADS_SYSTEMFLAG_CONFIG_ALLOW_RENAME = 0x40000000
77
+ ADS_SYSTEMFLAG_CONFIG_ALLOW_MOVE = 0x20000000
78
+ ADS_SYSTEMFLAG_CONFIG_ALLOW_LIMITED_MOVE = 0x10000000
79
+ ADS_SYSTEMFLAG_DOMAIN_DISALLOW_RENAME = -2147483648
80
+ ADS_SYSTEMFLAG_DOMAIN_DISALLOW_MOVE = 0x4000000
81
+ ADS_SYSTEMFLAG_CR_NTDS_NC = 0x1
82
+ ADS_SYSTEMFLAG_CR_NTDS_DOMAIN = 0x2
83
+ ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED = 0x1
84
+ ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED = 0x4
85
+ ADS_GROUP_TYPE_GLOBAL_GROUP = 0x2
86
+ ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x4
87
+ ADS_GROUP_TYPE_LOCAL_GROUP = 0x4
88
+ ADS_GROUP_TYPE_UNIVERSAL_GROUP = 0x8
89
+ ADS_GROUP_TYPE_SECURITY_ENABLED = -2147483648
90
+ ADS_UF_SCRIPT = 0x1
91
+ ADS_UF_ACCOUNTDISABLE = 0x2
92
+ ADS_UF_HOMEDIR_REQUIRED = 0x8
93
+ ADS_UF_LOCKOUT = 0x10
94
+ ADS_UF_PASSWD_NOTREQD = 0x20
95
+ ADS_UF_PASSWD_CANT_CHANGE = 0x40
96
+ ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED = 0x80
97
+ ADS_UF_TEMP_DUPLICATE_ACCOUNT = 0x100
98
+ ADS_UF_NORMAL_ACCOUNT = 0x200
99
+ ADS_UF_INTERDOMAIN_TRUST_ACCOUNT = 0x800
100
+ ADS_UF_WORKSTATION_TRUST_ACCOUNT = 0x1000
101
+ ADS_UF_SERVER_TRUST_ACCOUNT = 0x2000
102
+ ADS_UF_DONT_EXPIRE_PASSWD = 0x10000
103
+ ADS_UF_MNS_LOGON_ACCOUNT = 0x20000
104
+ ADS_UF_SMARTCARD_REQUIRED = 0x40000
105
+ ADS_UF_TRUSTED_FOR_DELEGATION = 0x80000
106
+ ADS_UF_NOT_DELEGATED = 0x100000
107
+ ADS_UF_USE_DES_KEY_ONLY = 0x200000
108
+ ADS_UF_DONT_REQUIRE_PREAUTH = 0x400000
109
+ ADS_UF_PASSWORD_EXPIRED = 0x800000
110
+ ADS_UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x1000000
111
+ ADS_RIGHT_DELETE = 0x10000
112
+ ADS_RIGHT_READ_CONTROL = 0x20000
113
+ ADS_RIGHT_WRITE_DAC = 0x40000
114
+ ADS_RIGHT_WRITE_OWNER = 0x80000
115
+ ADS_RIGHT_SYNCHRONIZE = 0x100000
116
+ ADS_RIGHT_ACCESS_SYSTEM_SECURITY = 0x1000000
117
+ ADS_RIGHT_GENERIC_READ = -2147483648
118
+ ADS_RIGHT_GENERIC_WRITE = 0x40000000
119
+ ADS_RIGHT_GENERIC_EXECUTE = 0x20000000
120
+ ADS_RIGHT_GENERIC_ALL = 0x10000000
121
+ ADS_RIGHT_DS_CREATE_CHILD = 0x1
122
+ ADS_RIGHT_DS_DELETE_CHILD = 0x2
123
+ ADS_RIGHT_ACTRL_DS_LIST = 0x4
124
+ ADS_RIGHT_DS_SELF = 0x8
125
+ ADS_RIGHT_DS_READ_PROP = 0x10
126
+ ADS_RIGHT_DS_WRITE_PROP = 0x20
127
+ ADS_RIGHT_DS_DELETE_TREE = 0x40
128
+ ADS_RIGHT_DS_LIST_OBJECT = 0x80
129
+ ADS_RIGHT_DS_CONTROL_ACCESS = 0x100
130
+ ADS_ACETYPE_ACCESS_ALLOWED = 0
131
+ ADS_ACETYPE_ACCESS_DENIED = 0x1
132
+ ADS_ACETYPE_SYSTEM_AUDIT = 0x2
133
+ ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = 0x5
134
+ ADS_ACETYPE_ACCESS_DENIED_OBJECT = 0x6
135
+ ADS_ACETYPE_SYSTEM_AUDIT_OBJECT = 0x7
136
+ ADS_ACETYPE_SYSTEM_ALARM_OBJECT = 0x8
137
+ ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK = 0x9
138
+ ADS_ACETYPE_ACCESS_DENIED_CALLBACK = 0xA
139
+ ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK_OBJECT = 0xB
140
+ ADS_ACETYPE_ACCESS_DENIED_CALLBACK_OBJECT = 0xC
141
+ ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK = 0xD
142
+ ADS_ACETYPE_SYSTEM_ALARM_CALLBACK = 0xE
143
+ ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK_OBJECT = 0xF
144
+ ADS_ACETYPE_SYSTEM_ALARM_CALLBACK_OBJECT = 0x10
145
+ ADS_ACEFLAG_INHERIT_ACE = 0x2
146
+ ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE = 0x4
147
+ ADS_ACEFLAG_INHERIT_ONLY_ACE = 0x8
148
+ ADS_ACEFLAG_INHERITED_ACE = 0x10
149
+ ADS_ACEFLAG_VALID_INHERIT_FLAGS = 0x1F
150
+ ADS_ACEFLAG_SUCCESSFUL_ACCESS = 0x40
151
+ ADS_ACEFLAG_FAILED_ACCESS = 0x80
152
+ ADS_FLAG_OBJECT_TYPE_PRESENT = 0x1
153
+ ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT = 0x2
154
+ ADS_SD_CONTROL_SE_OWNER_DEFAULTED = 0x1
155
+ ADS_SD_CONTROL_SE_GROUP_DEFAULTED = 0x2
156
+ ADS_SD_CONTROL_SE_DACL_PRESENT = 0x4
157
+ ADS_SD_CONTROL_SE_DACL_DEFAULTED = 0x8
158
+ ADS_SD_CONTROL_SE_SACL_PRESENT = 0x10
159
+ ADS_SD_CONTROL_SE_SACL_DEFAULTED = 0x20
160
+ ADS_SD_CONTROL_SE_DACL_AUTO_INHERIT_REQ = 0x100
161
+ ADS_SD_CONTROL_SE_SACL_AUTO_INHERIT_REQ = 0x200
162
+ ADS_SD_CONTROL_SE_DACL_AUTO_INHERITED = 0x400
163
+ ADS_SD_CONTROL_SE_SACL_AUTO_INHERITED = 0x800
164
+ ADS_SD_CONTROL_SE_DACL_PROTECTED = 0x1000
165
+ ADS_SD_CONTROL_SE_SACL_PROTECTED = 0x2000
166
+ ADS_SD_CONTROL_SE_SELF_RELATIVE = 0x8000
167
+ ADS_SD_REVISION_DS = 4
168
+ ADS_NAME_TYPE_1779 = 1
169
+ ADS_NAME_TYPE_CANONICAL = 2
170
+ ADS_NAME_TYPE_NT4 = 3
171
+ ADS_NAME_TYPE_DISPLAY = 4
172
+ ADS_NAME_TYPE_DOMAIN_SIMPLE = 5
173
+ ADS_NAME_TYPE_ENTERPRISE_SIMPLE = 6
174
+ ADS_NAME_TYPE_GUID = 7
175
+ ADS_NAME_TYPE_UNKNOWN = 8
176
+ ADS_NAME_TYPE_USER_PRINCIPAL_NAME = 9
177
+ ADS_NAME_TYPE_CANONICAL_EX = 10
178
+ ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME = 11
179
+ ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME = 12
180
+ ADS_NAME_INITTYPE_DOMAIN = 1
181
+ ADS_NAME_INITTYPE_SERVER = 2
182
+ ADS_NAME_INITTYPE_GC = 3
183
+ ADS_OPTION_SERVERNAME = 0
184
+ ADS_OPTION_REFERRALS = ADS_OPTION_SERVERNAME + 1
185
+ ADS_OPTION_PAGE_SIZE = ADS_OPTION_REFERRALS + 1
186
+ ADS_OPTION_SECURITY_MASK = ADS_OPTION_PAGE_SIZE + 1
187
+ ADS_OPTION_MUTUAL_AUTH_STATUS = ADS_OPTION_SECURITY_MASK + 1
188
+ ADS_OPTION_QUOTA = ADS_OPTION_MUTUAL_AUTH_STATUS + 1
189
+ ADS_OPTION_PASSWORD_PORTNUMBER = ADS_OPTION_QUOTA + 1
190
+ ADS_OPTION_PASSWORD_METHOD = ADS_OPTION_PASSWORD_PORTNUMBER + 1
191
+ ADS_SECURITY_INFO_OWNER = 0x1
192
+ ADS_SECURITY_INFO_GROUP = 0x2
193
+ ADS_SECURITY_INFO_DACL = 0x4
194
+ ADS_SECURITY_INFO_SACL = 0x8
195
+ ADS_SETTYPE_FULL = 1
196
+ ADS_SETTYPE_PROVIDER = 2
197
+ ADS_SETTYPE_SERVER = 3
198
+ ADS_SETTYPE_DN = 4
199
+ ADS_FORMAT_WINDOWS = 1
200
+ ADS_FORMAT_WINDOWS_NO_SERVER = 2
201
+ ADS_FORMAT_WINDOWS_DN = 3
202
+ ADS_FORMAT_WINDOWS_PARENT = 4
203
+ ADS_FORMAT_X500 = 5
204
+ ADS_FORMAT_X500_NO_SERVER = 6
205
+ ADS_FORMAT_X500_DN = 7
206
+ ADS_FORMAT_X500_PARENT = 8
207
+ ADS_FORMAT_SERVER = 9
208
+ ADS_FORMAT_PROVIDER = 10
209
+ ADS_FORMAT_LEAF = 11
210
+ ADS_DISPLAY_FULL = 1
211
+ ADS_DISPLAY_VALUE_ONLY = 2
212
+ ADS_ESCAPEDMODE_DEFAULT = 1
213
+ ADS_ESCAPEDMODE_ON = 2
214
+ ADS_ESCAPEDMODE_OFF = 3
215
+ ADS_ESCAPEDMODE_OFF_EX = 4
216
+ ADS_PATH_FILE = 1
217
+ ADS_PATH_FILESHARE = 2
218
+ ADS_PATH_REGISTRY = 3
219
+ ADS_SD_FORMAT_IID = 1
220
+ ADS_SD_FORMAT_RAW = 2
221
+ ADS_SD_FORMAT_HEXSTRING = 3
222
+
223
+
224
+ # Generated by h2py from AdsErr.h
225
+ def _HRESULT_TYPEDEF_(_sc):
226
+ return _sc
227
+
228
+
229
+ E_ADS_BAD_PATHNAME = _HRESULT_TYPEDEF_(-2147463168)
230
+ E_ADS_INVALID_DOMAIN_OBJECT = _HRESULT_TYPEDEF_(-2147463167)
231
+ E_ADS_INVALID_USER_OBJECT = _HRESULT_TYPEDEF_(-2147463166)
232
+ E_ADS_INVALID_COMPUTER_OBJECT = _HRESULT_TYPEDEF_(-2147463165)
233
+ E_ADS_UNKNOWN_OBJECT = _HRESULT_TYPEDEF_(-2147463164)
234
+ E_ADS_PROPERTY_NOT_SET = _HRESULT_TYPEDEF_(-2147463163)
235
+ E_ADS_PROPERTY_NOT_SUPPORTED = _HRESULT_TYPEDEF_(-2147463162)
236
+ E_ADS_PROPERTY_INVALID = _HRESULT_TYPEDEF_(-2147463161)
237
+ E_ADS_BAD_PARAMETER = _HRESULT_TYPEDEF_(-2147463160)
238
+ E_ADS_OBJECT_UNBOUND = _HRESULT_TYPEDEF_(-2147463159)
239
+ E_ADS_PROPERTY_NOT_MODIFIED = _HRESULT_TYPEDEF_(-2147463158)
240
+ E_ADS_PROPERTY_MODIFIED = _HRESULT_TYPEDEF_(-2147463157)
241
+ E_ADS_CANT_CONVERT_DATATYPE = _HRESULT_TYPEDEF_(-2147463156)
242
+ E_ADS_PROPERTY_NOT_FOUND = _HRESULT_TYPEDEF_(-2147463155)
243
+ E_ADS_OBJECT_EXISTS = _HRESULT_TYPEDEF_(-2147463154)
244
+ E_ADS_SCHEMA_VIOLATION = _HRESULT_TYPEDEF_(-2147463153)
245
+ E_ADS_COLUMN_NOT_SET = _HRESULT_TYPEDEF_(-2147463152)
246
+ S_ADS_ERRORSOCCURRED = _HRESULT_TYPEDEF_(0x00005011)
247
+ S_ADS_NOMORE_ROWS = _HRESULT_TYPEDEF_(0x00005012)
248
+ S_ADS_NOMORE_COLUMNS = _HRESULT_TYPEDEF_(0x00005013)
249
+ E_ADS_INVALID_FILTER = _HRESULT_TYPEDEF_(-2147463148)
250
+
251
+ # ADS_DEREFENUM enum
252
+ ADS_DEREF_NEVER = 0
253
+ ADS_DEREF_SEARCHING = 1
254
+ ADS_DEREF_FINDING = 2
255
+ ADS_DEREF_ALWAYS = 3
256
+
257
+ # ADS_PREFERENCES_ENUM
258
+ ADSIPROP_ASYNCHRONOUS = 0
259
+ ADSIPROP_DEREF_ALIASES = 0x1
260
+ ADSIPROP_SIZE_LIMIT = 0x2
261
+ ADSIPROP_TIME_LIMIT = 0x3
262
+ ADSIPROP_ATTRIBTYPES_ONLY = 0x4
263
+ ADSIPROP_SEARCH_SCOPE = 0x5
264
+ ADSIPROP_TIMEOUT = 0x6
265
+ ADSIPROP_PAGESIZE = 0x7
266
+ ADSIPROP_PAGED_TIME_LIMIT = 0x8
267
+ ADSIPROP_CHASE_REFERRALS = 0x9
268
+ ADSIPROP_SORT_ON = 0xA
269
+ ADSIPROP_CACHE_RESULTS = 0xB
270
+ ADSIPROP_ADSIFLAG = 0xC
271
+
272
+ # ADSI_DIALECT_ENUM
273
+ ADSI_DIALECT_LDAP = 0
274
+ ADSI_DIALECT_SQL = 0x1
275
+
276
+ # ADS_CHASE_REFERRALS_ENUM
277
+ ADS_CHASE_REFERRALS_NEVER = 0
278
+ ADS_CHASE_REFERRALS_SUBORDINATE = 0x20
279
+ ADS_CHASE_REFERRALS_EXTERNAL = 0x40
280
+ ADS_CHASE_REFERRALS_ALWAYS = (
281
+ ADS_CHASE_REFERRALS_SUBORDINATE | ADS_CHASE_REFERRALS_EXTERNAL
282
+ )
283
+
284
+ # Generated by h2py from ObjSel.h
285
+ DSOP_SCOPE_TYPE_TARGET_COMPUTER = 0x00000001
286
+ DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN = 0x00000002
287
+ DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN = 0x00000004
288
+ DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN = 0x00000008
289
+ DSOP_SCOPE_TYPE_GLOBAL_CATALOG = 0x00000010
290
+ DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN = 0x00000020
291
+ DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN = 0x00000040
292
+ DSOP_SCOPE_TYPE_WORKGROUP = 0x00000080
293
+ DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE = 0x00000100
294
+ DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE = 0x00000200
295
+ DSOP_SCOPE_FLAG_STARTING_SCOPE = 0x00000001
296
+ DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT = 0x00000002
297
+ DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP = 0x00000004
298
+ DSOP_SCOPE_FLAG_WANT_PROVIDER_GC = 0x00000008
299
+ DSOP_SCOPE_FLAG_WANT_SID_PATH = 0x00000010
300
+ DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH = 0x00000020
301
+ DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS = 0x00000040
302
+ DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS = 0x00000080
303
+ DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS = 0x00000100
304
+ DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS = 0x00000200
305
+ DSOP_FILTER_INCLUDE_ADVANCED_VIEW = 0x00000001
306
+ DSOP_FILTER_USERS = 0x00000002
307
+ DSOP_FILTER_BUILTIN_GROUPS = 0x00000004
308
+ DSOP_FILTER_WELL_KNOWN_PRINCIPALS = 0x00000008
309
+ DSOP_FILTER_UNIVERSAL_GROUPS_DL = 0x00000010
310
+ DSOP_FILTER_UNIVERSAL_GROUPS_SE = 0x00000020
311
+ DSOP_FILTER_GLOBAL_GROUPS_DL = 0x00000040
312
+ DSOP_FILTER_GLOBAL_GROUPS_SE = 0x00000080
313
+ DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL = 0x00000100
314
+ DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE = 0x00000200
315
+ DSOP_FILTER_CONTACTS = 0x00000400
316
+ DSOP_FILTER_COMPUTERS = 0x00000800
317
+ DSOP_DOWNLEVEL_FILTER_USERS = -2147483647
318
+ DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS = -2147483646
319
+ DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS = -2147483644
320
+ DSOP_DOWNLEVEL_FILTER_COMPUTERS = -2147483640
321
+ DSOP_DOWNLEVEL_FILTER_WORLD = -2147483632
322
+ DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER = -2147483616
323
+ DSOP_DOWNLEVEL_FILTER_ANONYMOUS = -2147483584
324
+ DSOP_DOWNLEVEL_FILTER_BATCH = -2147483520
325
+ DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER = -2147483392
326
+ DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP = -2147483136
327
+ DSOP_DOWNLEVEL_FILTER_DIALUP = -2147482624
328
+ DSOP_DOWNLEVEL_FILTER_INTERACTIVE = -2147481600
329
+ DSOP_DOWNLEVEL_FILTER_NETWORK = -2147479552
330
+ DSOP_DOWNLEVEL_FILTER_SERVICE = -2147475456
331
+ DSOP_DOWNLEVEL_FILTER_SYSTEM = -2147467264
332
+ DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS = -2147450880
333
+ DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER = -2147418112
334
+ DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS = -2147352576
335
+ DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE = -2147221504
336
+ DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE = -2146959360
337
+ DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON = -2146435072
338
+ DSOP_FLAG_MULTISELECT = 0x00000001
339
+ DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK = 0x00000002
340
+ CFSTR_DSOP_DS_SELECTION_LIST = "CFSTR_DSOP_DS_SELECTION_LIST"
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/objectPicker.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A demo for the IDsObjectPicker interface.
2
+ import pythoncom
3
+ import win32clipboard
4
+ from win32com.adsi import adsi
5
+ from win32com.adsi.adsicon import *
6
+
7
+ cf_objectpicker = win32clipboard.RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST)
8
+
9
+
10
+ def main():
11
+ hwnd = 0
12
+
13
+ # Create an instance of the object picker.
14
+ picker = pythoncom.CoCreateInstance(
15
+ adsi.CLSID_DsObjectPicker,
16
+ None,
17
+ pythoncom.CLSCTX_INPROC_SERVER,
18
+ adsi.IID_IDsObjectPicker,
19
+ )
20
+
21
+ # Create our scope init info.
22
+ siis = adsi.DSOP_SCOPE_INIT_INFOs(1)
23
+ sii = siis[0]
24
+
25
+ # Combine multiple scope types in a single array entry.
26
+
27
+ sii.type = (
28
+ DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN | DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
29
+ )
30
+
31
+ # Set uplevel and downlevel filters to include only computer objects.
32
+ # Uplevel filters apply to both mixed and native modes.
33
+ # Notice that the uplevel and downlevel flags are different.
34
+
35
+ sii.filterFlags.uplevel.bothModes = DSOP_FILTER_COMPUTERS
36
+ sii.filterFlags.downlevel = DSOP_DOWNLEVEL_FILTER_COMPUTERS
37
+
38
+ # Initialize the interface.
39
+ picker.Initialize(
40
+ None, # Target is the local computer.
41
+ siis, # scope infos
42
+ DSOP_FLAG_MULTISELECT, # options
43
+ ("objectGUID", "displayName"),
44
+ ) # attributes to fetch
45
+
46
+ do = picker.InvokeDialog(hwnd)
47
+ # Extract the data from the IDataObject.
48
+ format_etc = (
49
+ cf_objectpicker,
50
+ None,
51
+ pythoncom.DVASPECT_CONTENT,
52
+ -1,
53
+ pythoncom.TYMED_HGLOBAL,
54
+ )
55
+ medium = do.GetData(format_etc)
56
+ data = adsi.StringAsDS_SELECTION_LIST(medium.data)
57
+ for item in data:
58
+ name, klass, adspath, upn, attrs, flags = item
59
+ print("Item", name)
60
+ print(" Class:", klass)
61
+ print(" AdsPath:", adspath)
62
+ print(" UPN:", upn)
63
+ print(" Attrs:", attrs)
64
+ print(" Flags:", flags)
65
+
66
+
67
+ if __name__ == "__main__":
68
+ main()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/scp.py ADDED
@@ -0,0 +1,565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A re-implementation of the MS DirectoryService samples related to services.
2
+
3
+ * Adds and removes an ActiveDirectory "Service Connection Point",
4
+ including managing the security on the object.
5
+ * Creates and registers Service Principal Names.
6
+ * Changes the username for a domain user.
7
+
8
+ Some of these functions are likely to become move to a module - but there
9
+ is also a little command-line-interface to try these functions out.
10
+
11
+ For example:
12
+
13
+ scp.py --account-name=domain\\user --service-class=PythonScpTest \\
14
+ --keyword=foo --keyword=bar --binding-string=bind_info \\
15
+ ScpCreate SpnCreate SpnRegister
16
+
17
+ would:
18
+ * Attempt to delete a Service Connection Point for the service class
19
+ 'PythonScpTest'
20
+ * Attempt to create a Service Connection Point for that class, with 2
21
+ keywords and a binding string of 'bind_info'
22
+ * Create a Service Principal Name for the service and register it
23
+
24
+ to undo those changes, you could execute:
25
+
26
+ scp.py --account-name=domain\\user --service-class=PythonScpTest \\
27
+ SpnCreate SpnUnregister ScpDelete
28
+
29
+ which will:
30
+ * Create a SPN
31
+ * Unregister that SPN from the Active Directory.
32
+ * Delete the Service Connection Point
33
+
34
+ Executing with --test will create and remove one of everything.
35
+ """
36
+
37
+ import optparse
38
+ import textwrap
39
+ import traceback
40
+
41
+ import ntsecuritycon as dscon
42
+ import win32api
43
+ import win32con
44
+ import win32security
45
+ import winerror
46
+ from win32com.adsi import adsi
47
+ from win32com.adsi.adsicon import *
48
+ from win32com.client import Dispatch
49
+
50
+ verbose = 1
51
+ g_createdSCP = None
52
+ g_createdSPNs = []
53
+ g_createdSPNLast = None
54
+
55
+ import logging
56
+
57
+ logger = logging # use logging module global methods for now.
58
+
59
+ # still a bit confused about log(n, ...) vs logger.info/debug()
60
+
61
+
62
+ # Returns distinguished name of SCP.
63
+ def ScpCreate(
64
+ service_binding_info,
65
+ service_class_name, # Service class string to store in SCP.
66
+ account_name=None, # Logon account that needs access to SCP.
67
+ container_name=None,
68
+ keywords=None,
69
+ object_class="serviceConnectionPoint",
70
+ dns_name_type="A",
71
+ dn=None,
72
+ dns_name=None,
73
+ ):
74
+ container_name = container_name or service_class_name
75
+ if not dns_name:
76
+ # Get the DNS name of the local computer
77
+ dns_name = win32api.GetComputerNameEx(win32con.ComputerNameDnsFullyQualified)
78
+ # Get the distinguished name of the computer object for the local computer
79
+ if dn is None:
80
+ dn = win32api.GetComputerObjectName(win32con.NameFullyQualifiedDN)
81
+
82
+ # Compose the ADSpath and bind to the computer object for the local computer
83
+ comp = adsi.ADsGetObject("LDAP://" + dn, adsi.IID_IDirectoryObject)
84
+
85
+ # Publish the SCP as a child of the computer object
86
+ keywords = keywords or []
87
+ # Fill in the attribute values to be stored in the SCP.
88
+ attrs = [
89
+ ("cn", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING, (container_name,)),
90
+ ("objectClass", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING, (object_class,)),
91
+ ("keywords", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING, keywords),
92
+ ("serviceDnsName", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING, (dns_name,)),
93
+ (
94
+ "serviceDnsNameType",
95
+ ADS_ATTR_UPDATE,
96
+ ADSTYPE_CASE_IGNORE_STRING,
97
+ (dns_name_type,),
98
+ ),
99
+ (
100
+ "serviceClassName",
101
+ ADS_ATTR_UPDATE,
102
+ ADSTYPE_CASE_IGNORE_STRING,
103
+ (service_class_name,),
104
+ ),
105
+ (
106
+ "serviceBindingInformation",
107
+ ADS_ATTR_UPDATE,
108
+ ADSTYPE_CASE_IGNORE_STRING,
109
+ (service_binding_info,),
110
+ ),
111
+ ]
112
+ new = comp.CreateDSObject("cn=" + container_name, attrs)
113
+ logger.info("New connection point is at %s", container_name)
114
+ # Wrap in a usable IDispatch object.
115
+ new = Dispatch(new)
116
+ # And allow access to the SCP for the specified account name
117
+ AllowAccessToScpProperties(account_name, new)
118
+ return new
119
+
120
+
121
+ def ScpDelete(container_name, dn=None):
122
+ if dn is None:
123
+ dn = win32api.GetComputerObjectName(win32con.NameFullyQualifiedDN)
124
+ logger.debug("Removing connection point '%s' from %s", container_name, dn)
125
+
126
+ # Compose the ADSpath and bind to the computer object for the local computer
127
+ comp = adsi.ADsGetObject("LDAP://" + dn, adsi.IID_IDirectoryObject)
128
+ comp.DeleteDSObject("cn=" + container_name)
129
+ logger.info("Deleted service connection point '%s'", container_name)
130
+
131
+
132
+ # This function is described in detail in the MSDN article titled
133
+ # "Enabling Service Account to Access SCP Properties"
134
+ # From that article:
135
+ # The following sample code sets a pair of ACEs on a service connection point
136
+ # (SCP) object. The ACEs grant read/write access to the user or computer account
137
+ # under which the service instance will be running. Your service installation
138
+ # program calls this code to ensure that the service will be allowed to update
139
+ # its properties at run time. If you don't set ACEs like these, your service
140
+ # will get access-denied errors if it tries to modify the SCP's properties.
141
+ #
142
+ # The code uses the IADsSecurityDescriptor, IADsAccessControlList, and
143
+ # IADsAccessControlEntry interfaces to do the following:
144
+ # * Get the SCP object's security descriptor.
145
+ # * Set ACEs in the DACL of the security descriptor.
146
+ # * Set the security descriptor back on the SCP object.
147
+
148
+
149
+ def AllowAccessToScpProperties(
150
+ accountSAM, # Service account to allow access.
151
+ scpObject, # The IADs SCP object.
152
+ schemaIDGUIDs=( # Attributes to allow write-access to.
153
+ "{28630eb8-41d5-11d1-a9c1-0000f80367c1}", # serviceDNSName
154
+ "{b7b1311c-b82e-11d0-afee-0000f80367c1}", # serviceBindingInformation
155
+ ),
156
+ ):
157
+ # If no service account is specified, service runs under LocalSystem.
158
+ # So allow access to the computer account of the service's host.
159
+ if accountSAM:
160
+ trustee = accountSAM
161
+ else:
162
+ # Get the SAM account name of the computer object for the server.
163
+ trustee = win32api.GetComputerObjectName(win32con.NameSamCompatible)
164
+
165
+ # Get the nTSecurityDescriptor attribute
166
+ attribute = "nTSecurityDescriptor"
167
+ sd = getattr(scpObject, attribute)
168
+ acl = sd.DiscretionaryAcl
169
+
170
+ for sguid in schemaIDGUIDs:
171
+ ace = Dispatch(adsi.CLSID_AccessControlEntry)
172
+
173
+ # Set the properties of the ACE.
174
+ # Allow read and write access to the property.
175
+ ace.AccessMask = ADS_RIGHT_DS_READ_PROP | ADS_RIGHT_DS_WRITE_PROP
176
+
177
+ # Set the trustee, which is either the service account or the
178
+ # host computer account.
179
+ ace.Trustee = trustee
180
+
181
+ # Set the ACE type.
182
+ ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED_OBJECT
183
+
184
+ # Set AceFlags to zero because ACE is not inheritable.
185
+ ace.AceFlags = 0
186
+
187
+ # Set Flags to indicate an ACE that protects a specified object.
188
+ ace.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT
189
+
190
+ # Set ObjectType to the schemaIDGUID of the attribute.
191
+ ace.ObjectType = sguid
192
+
193
+ # Add the ACEs to the DACL.
194
+ acl.AddAce(ace)
195
+
196
+ # Write the modified DACL back to the security descriptor.
197
+ sd.DiscretionaryAcl = acl
198
+ # Write the ntSecurityDescriptor property to the property cache.
199
+ setattr(scpObject, attribute, sd)
200
+ # SetInfo updates the SCP object in the directory.
201
+ scpObject.SetInfo()
202
+ logger.info("Set security on object for account %r", trustee)
203
+
204
+
205
+ # Service Principal Names functions from the same sample.
206
+ # The example calls the DsWriteAccountSpn function, which stores the SPNs in
207
+ # Microsoft Active Directory under the servicePrincipalName attribute of the
208
+ # account object specified by the serviceAcctDN parameter. The account object
209
+ # corresponds to the logon account specified in the CreateService call for this
210
+ # service instance. If the logon account is a domain user account,
211
+ # serviceAcctDN must be the distinguished name of the account object in
212
+ # Active Directory for that user account. If the service's logon account is the
213
+ # LocalSystem account, serviceAcctDN must be the distinguished name of the
214
+ # computer account object for the host computer on which the service is
215
+ # installed. win32api.TranslateNames and win32security.DsCrackNames can
216
+ # be used to convert a domain\account format name to a distinguished name.
217
+ def SpnRegister(
218
+ serviceAcctDN, # DN of the service's logon account
219
+ spns, # List of SPNs to register
220
+ operation, # Add, replace, or delete SPNs
221
+ ):
222
+ assert not isinstance(spns, str) and hasattr(spns, "__iter__"), (
223
+ "spns must be a sequence of strings (got %r)" % spns
224
+ )
225
+ # Bind to a domain controller.
226
+ # Get the domain for the current user.
227
+ samName = win32api.GetUserNameEx(win32api.NameSamCompatible)
228
+ samName = samName.split("\\", 1)[0]
229
+
230
+ if not serviceAcctDN:
231
+ # Get the SAM account name of the computer object for the server.
232
+ serviceAcctDN = win32api.GetComputerObjectName(win32con.NameFullyQualifiedDN)
233
+ logger.debug("SpnRegister using DN '%s'", serviceAcctDN)
234
+
235
+ # Get the name of a domain controller in that domain.
236
+ info = win32security.DsGetDcName(
237
+ domainName=samName,
238
+ flags=dscon.DS_IS_FLAT_NAME
239
+ | dscon.DS_RETURN_DNS_NAME
240
+ | dscon.DS_DIRECTORY_SERVICE_REQUIRED,
241
+ )
242
+ # Bind to the domain controller.
243
+ handle = win32security.DsBind(info["DomainControllerName"])
244
+
245
+ # Write the SPNs to the service account or computer account.
246
+ logger.debug("DsWriteAccountSpn with spns %s")
247
+ win32security.DsWriteAccountSpn(
248
+ handle, # handle to the directory
249
+ operation, # Add or remove SPN from account's existing SPNs
250
+ serviceAcctDN, # DN of service account or computer account
251
+ spns,
252
+ ) # names
253
+
254
+ # Unbind the DS in any case (but Python would do it anyway)
255
+ handle.Close()
256
+
257
+
258
+ def UserChangePassword(username_dn, new_password):
259
+ # set the password on the account.
260
+ # Use the distinguished name to bind to the account object.
261
+ accountPath = "LDAP://" + username_dn
262
+ user = adsi.ADsGetObject(accountPath, adsi.IID_IADsUser)
263
+
264
+ # Set the password on the account.
265
+ user.SetPassword(new_password)
266
+
267
+
268
+ # functions related to the command-line interface
269
+ def log(level, msg, *args):
270
+ if verbose >= level:
271
+ print(msg % args)
272
+
273
+
274
+ class _NoDefault:
275
+ pass
276
+
277
+
278
+ def _get_option(po, opt_name, default=_NoDefault):
279
+ parser, options = po
280
+ ret = getattr(options, opt_name, default)
281
+ if not ret and default is _NoDefault:
282
+ parser.error("The '%s' option must be specified for this operation" % opt_name)
283
+ if not ret:
284
+ ret = default
285
+ return ret
286
+
287
+
288
+ def _option_error(po, why):
289
+ parser = po[0]
290
+ parser.error(why)
291
+
292
+
293
+ def do_ScpCreate(po):
294
+ """Create a Service Connection Point"""
295
+ global g_createdSCP
296
+ scp = ScpCreate(
297
+ _get_option(po, "binding_string"),
298
+ _get_option(po, "service_class"),
299
+ _get_option(po, "account_name_sam", None),
300
+ keywords=_get_option(po, "keywords", None),
301
+ )
302
+ g_createdSCP = scp
303
+ return scp.distinguishedName
304
+
305
+
306
+ def do_ScpDelete(po):
307
+ """Delete a Service Connection Point"""
308
+ sc = _get_option(po, "service_class")
309
+ try:
310
+ ScpDelete(sc)
311
+ except adsi.error as details:
312
+ if details[0] != winerror.ERROR_DS_OBJ_NOT_FOUND:
313
+ raise
314
+ log(2, "ScpDelete ignoring ERROR_DS_OBJ_NOT_FOUND for service-class '%s'", sc)
315
+ return sc
316
+
317
+
318
+ def do_SpnCreate(po):
319
+ """Create a Service Principal Name"""
320
+ # The 'service name' is the dn of our scp.
321
+ if g_createdSCP is None:
322
+ # Could accept an arg to avoid this?
323
+ _option_error(po, "ScpCreate must have been specified before SpnCreate")
324
+ # Create a Service Principal Name"
325
+ spns = win32security.DsGetSpn(
326
+ dscon.DS_SPN_SERVICE,
327
+ _get_option(po, "service_class"),
328
+ g_createdSCP.distinguishedName,
329
+ _get_option(po, "port", 0),
330
+ None,
331
+ None,
332
+ )
333
+ spn = spns[0]
334
+ log(2, "Created SPN: %s", spn)
335
+ global g_createdSPNLast
336
+ g_createdSPNLast = spn
337
+ g_createdSPNs.append(spn)
338
+ return spn
339
+
340
+
341
+ def do_SpnRegister(po):
342
+ """Register a previously created Service Principal Name"""
343
+ if not g_createdSPNLast:
344
+ _option_error(po, "SpnCreate must appear before SpnRegister")
345
+
346
+ SpnRegister(
347
+ _get_option(po, "account_name_dn", None),
348
+ (g_createdSPNLast,),
349
+ dscon.DS_SPN_ADD_SPN_OP,
350
+ )
351
+ return g_createdSPNLast
352
+
353
+
354
+ def do_SpnUnregister(po):
355
+ """Unregister a previously created Service Principal Name"""
356
+ if not g_createdSPNLast:
357
+ _option_error(po, "SpnCreate must appear before SpnUnregister")
358
+ SpnRegister(
359
+ _get_option(po, "account_name_dn", None),
360
+ (g_createdSPNLast,),
361
+ dscon.DS_SPN_DELETE_SPN_OP,
362
+ )
363
+ return g_createdSPNLast
364
+
365
+
366
+ def do_UserChangePassword(po):
367
+ """Change the password for a specified user"""
368
+ UserChangePassword(_get_option(po, "account_name_dn"), _get_option(po, "password"))
369
+ return "Password changed OK"
370
+
371
+
372
+ handlers = (
373
+ ("ScpCreate", do_ScpCreate),
374
+ ("ScpDelete", do_ScpDelete),
375
+ ("SpnCreate", do_SpnCreate),
376
+ ("SpnRegister", do_SpnRegister),
377
+ ("SpnUnregister", do_SpnUnregister),
378
+ ("UserChangePassword", do_UserChangePassword),
379
+ )
380
+
381
+
382
+ class HelpFormatter(optparse.IndentedHelpFormatter):
383
+ def format_description(self, description):
384
+ return description
385
+
386
+
387
+ def main():
388
+ global verbose
389
+ _handlers_dict = {}
390
+
391
+ arg_descs = []
392
+ for arg, func in handlers:
393
+ this_desc = "\n".join(textwrap.wrap(func.__doc__, subsequent_indent=" " * 8))
394
+ arg_descs.append(f" {arg}: {this_desc}")
395
+ _handlers_dict[arg.lower()] = func
396
+
397
+ description = __doc__ + "\ncommands:\n" + "\n".join(arg_descs) + "\n"
398
+
399
+ parser = optparse.OptionParser(
400
+ usage="%prog [options] command ...",
401
+ description=description,
402
+ formatter=HelpFormatter(),
403
+ )
404
+
405
+ parser.add_option(
406
+ "-v",
407
+ action="count",
408
+ dest="verbose",
409
+ default=1,
410
+ help="increase the verbosity of status messages",
411
+ )
412
+
413
+ parser.add_option(
414
+ "-q", "--quiet", action="store_true", help="Don't print any status messages"
415
+ )
416
+
417
+ parser.add_option(
418
+ "-t",
419
+ "--test",
420
+ action="store_true",
421
+ help="Execute a mini-test suite, providing defaults for most options and args",
422
+ )
423
+
424
+ parser.add_option(
425
+ "",
426
+ "--show-tracebacks",
427
+ action="store_true",
428
+ help="Show the tracebacks for any exceptions",
429
+ )
430
+
431
+ parser.add_option("", "--service-class", help="The service class name to use")
432
+
433
+ parser.add_option(
434
+ "", "--port", default=0, help="The port number to associate with the SPN"
435
+ )
436
+
437
+ parser.add_option(
438
+ "", "--binding-string", help="The binding string to use for SCP creation"
439
+ )
440
+
441
+ parser.add_option(
442
+ "", "--account-name", help="The account name to use (default is LocalSystem)"
443
+ )
444
+
445
+ parser.add_option("", "--password", help="The password to set.")
446
+
447
+ parser.add_option(
448
+ "",
449
+ "--keyword",
450
+ action="append",
451
+ dest="keywords",
452
+ help="""A keyword to add to the SCP. May be specified
453
+ multiple times""",
454
+ )
455
+
456
+ parser.add_option(
457
+ "",
458
+ "--log-level",
459
+ help="""The log-level to use - may be a number or a logging
460
+ module constant""",
461
+ default=str(logging.WARNING),
462
+ )
463
+
464
+ options, args = parser.parse_args()
465
+ po = (parser, options)
466
+ # fixup misc
467
+ try:
468
+ options.port = int(options.port)
469
+ except (TypeError, ValueError):
470
+ parser.error("--port must be numeric")
471
+ # fixup log-level
472
+ try:
473
+ log_level = int(options.log_level)
474
+ except (TypeError, ValueError):
475
+ try:
476
+ log_level = int(getattr(logging, options.log_level.upper()))
477
+ except (ValueError, TypeError, AttributeError):
478
+ parser.error("Invalid --log-level value")
479
+ try:
480
+ sl = logger.setLevel
481
+ # logger is a real logger
482
+ except AttributeError:
483
+ # logger is logging module
484
+ sl = logging.getLogger().setLevel
485
+ sl(log_level)
486
+ # Check -q/-v
487
+ if options.quiet and options.verbose:
488
+ parser.error("Can't specify --quiet and --verbose")
489
+ if options.quiet:
490
+ options.verbose -= 1
491
+ verbose = options.verbose
492
+ # --test
493
+ if options.test:
494
+ if args:
495
+ parser.error("Can't specify args with --test")
496
+
497
+ args = "ScpDelete ScpCreate SpnCreate SpnRegister SpnUnregister ScpDelete"
498
+ log(1, "--test - pretending args are:\n %s", args)
499
+ args = args.split()
500
+ if not options.service_class:
501
+ options.service_class = "PythonScpTest"
502
+ log(2, "--test: --service-class=%s", options.service_class)
503
+ if not options.keywords:
504
+ options.keywords = "Python Powered".split()
505
+ log(2, "--test: --keyword=%s", options.keywords)
506
+ if not options.binding_string:
507
+ options.binding_string = "test binding string"
508
+ log(2, "--test: --binding-string=%s", options.binding_string)
509
+
510
+ # check args
511
+ if not args:
512
+ parser.error("No command specified (use --help for valid commands)")
513
+ for arg in args:
514
+ if arg.lower() not in _handlers_dict:
515
+ parser.error("Invalid command '%s' (use --help for valid commands)" % arg)
516
+
517
+ # Patch up account-name.
518
+ if options.account_name:
519
+ log(2, "Translating account name '%s'", options.account_name)
520
+ options.account_name_sam = win32security.TranslateName(
521
+ options.account_name, win32api.NameUnknown, win32api.NameSamCompatible
522
+ )
523
+ log(2, "NameSamCompatible is '%s'", options.account_name_sam)
524
+ options.account_name_dn = win32security.TranslateName(
525
+ options.account_name, win32api.NameUnknown, win32api.NameFullyQualifiedDN
526
+ )
527
+ log(2, "NameFullyQualifiedDNis '%s'", options.account_name_dn)
528
+
529
+ # do it.
530
+ for arg in args:
531
+ handler = _handlers_dict[arg.lower()] # already been validated
532
+ if handler is None:
533
+ parser.error("Invalid command '%s'" % arg)
534
+ err_msg = None
535
+ try:
536
+ try:
537
+ log(2, "Executing '%s'...", arg)
538
+ result = handler(po)
539
+ log(1, "%s: %s", arg, result)
540
+ except:
541
+ if options.show_tracebacks:
542
+ print("--show-tracebacks specified - dumping exception")
543
+ traceback.print_exc()
544
+ raise
545
+ except adsi.error as xxx_todo_changeme:
546
+ (hr, desc, exc, argerr) = xxx_todo_changeme.args
547
+ if exc:
548
+ extra_desc = exc[2]
549
+ else:
550
+ extra_desc = ""
551
+ err_msg = desc
552
+ if extra_desc:
553
+ err_msg += "\n\t" + extra_desc
554
+ except win32api.error as xxx_todo_changeme1:
555
+ (hr, func, msg) = xxx_todo_changeme1.args
556
+ err_msg = msg
557
+ if err_msg:
558
+ log(1, "Command '%s' failed: %s", arg, err_msg)
559
+
560
+
561
+ if __name__ == "__main__":
562
+ try:
563
+ main()
564
+ except KeyboardInterrupt:
565
+ print("*** Interrupted")
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/search.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pythoncom
2
+ import pywintypes
3
+ from win32com.adsi import adsi, adsicon
4
+ from win32com.adsi.adsicon import *
5
+
6
+ options = None # set to optparse options object
7
+
8
+ ADsTypeNameMap = {}
9
+
10
+
11
+ def getADsTypeName(type_val):
12
+ # convert integer type to the 'typename' as known in the headerfiles.
13
+ if not ADsTypeNameMap:
14
+ for n, v in adsicon.__dict__.items():
15
+ if n.startswith("ADSTYPE_"):
16
+ ADsTypeNameMap[v] = n
17
+ return ADsTypeNameMap.get(type_val, hex(type_val))
18
+
19
+
20
+ def _guid_from_buffer(b):
21
+ return pywintypes.IID(b, True)
22
+
23
+
24
+ def _sid_from_buffer(b):
25
+ return str(pywintypes.SID(b))
26
+
27
+
28
+ _null_converter = lambda x: x
29
+
30
+ converters = {
31
+ "objectGUID": _guid_from_buffer,
32
+ "objectSid": _sid_from_buffer,
33
+ "instanceType": getADsTypeName,
34
+ }
35
+
36
+
37
+ def log(level, msg, *args):
38
+ if options.verbose >= level:
39
+ print("log:", msg % args)
40
+
41
+
42
+ def getGC():
43
+ cont = adsi.ADsOpenObject(
44
+ "GC:", options.user, options.password, 0, adsi.IID_IADsContainer
45
+ )
46
+ enum = adsi.ADsBuildEnumerator(cont)
47
+ # Only 1 child of the global catalog.
48
+ for e in enum:
49
+ gc = e.QueryInterface(adsi.IID_IDirectorySearch)
50
+ return gc
51
+ return None
52
+
53
+
54
+ def print_attribute(col_data):
55
+ prop_name, prop_type, values = col_data
56
+ if values is not None:
57
+ log(2, "property '%s' has type '%s'", prop_name, getADsTypeName(prop_type))
58
+ value = [converters.get(prop_name, _null_converter)(v[0]) for v in values]
59
+ if len(value) == 1:
60
+ value = value[0]
61
+ print(f" {prop_name}={value!r}")
62
+ else:
63
+ print(f" {prop_name} is None")
64
+
65
+
66
+ def search():
67
+ gc = getGC()
68
+ if gc is None:
69
+ log(0, "Can't find the global catalog")
70
+ return
71
+
72
+ prefs = [(ADS_SEARCHPREF_SEARCH_SCOPE, (ADS_SCOPE_SUBTREE,))]
73
+ hr, statuses = gc.SetSearchPreference(prefs)
74
+ log(3, "SetSearchPreference returned %d/%r", hr, statuses)
75
+
76
+ if options.attributes:
77
+ attributes = options.attributes.split(",")
78
+ else:
79
+ attributes = None
80
+
81
+ h = gc.ExecuteSearch(options.filter, attributes)
82
+ hr = gc.GetNextRow(h)
83
+ while hr != S_ADS_NOMORE_ROWS:
84
+ print("-- new row --")
85
+ if attributes is None:
86
+ # Loop over all columns returned
87
+ while 1:
88
+ col_name = gc.GetNextColumnName(h)
89
+ if col_name is None:
90
+ break
91
+ data = gc.GetColumn(h, col_name)
92
+ print_attribute(data)
93
+ else:
94
+ # loop over attributes specified.
95
+ for a in attributes:
96
+ try:
97
+ data = gc.GetColumn(h, a)
98
+ print_attribute(data)
99
+ except adsi.error as details:
100
+ if details[0] != E_ADS_COLUMN_NOT_SET:
101
+ raise
102
+ print_attribute((a, None, None))
103
+ hr = gc.GetNextRow(h)
104
+ gc.CloseSearchHandle(h)
105
+
106
+
107
+ def main():
108
+ global options
109
+ from optparse import OptionParser
110
+
111
+ parser = OptionParser()
112
+ parser.add_option(
113
+ "-f", "--file", dest="filename", help="write report to FILE", metavar="FILE"
114
+ )
115
+ parser.add_option(
116
+ "-v",
117
+ "--verbose",
118
+ action="count",
119
+ default=1,
120
+ help="increase verbosity of output",
121
+ )
122
+ parser.add_option(
123
+ "-q", "--quiet", action="store_true", help="suppress output messages"
124
+ )
125
+
126
+ parser.add_option("-U", "--user", help="specify the username used to connect")
127
+ parser.add_option("-P", "--password", help="specify the password used to connect")
128
+ parser.add_option(
129
+ "",
130
+ "--filter",
131
+ default="(&(objectCategory=person)(objectClass=User))",
132
+ help="specify the search filter",
133
+ )
134
+ parser.add_option(
135
+ "", "--attributes", help="comma sep'd list of attribute names to print"
136
+ )
137
+
138
+ options, args = parser.parse_args()
139
+ if options.quiet:
140
+ if options.verbose != 1:
141
+ parser.error("Can not use '--verbose' and '--quiet'")
142
+ options.verbose = 0
143
+
144
+ if args:
145
+ parser.error("You need not specify args")
146
+
147
+ search()
148
+
149
+
150
+ if __name__ == "__main__":
151
+ main()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/adsi/demos/test.py ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from collections.abc import Callable
3
+
4
+ import pythoncom
5
+ import win32api
6
+ from win32com.adsi import *
7
+
8
+ verbose_level = 0
9
+
10
+ server = "" # Must have trailing /
11
+ local_name = win32api.GetComputerName()
12
+
13
+
14
+ def DumpRoot():
15
+ "Dumps the root DSE"
16
+ path = "LDAP://%srootDSE" % server
17
+ rootdse = ADsGetObject(path)
18
+
19
+ for item in rootdse.Get("SupportedLDAPVersion"):
20
+ print(f"{path} supports ldap version {item}")
21
+
22
+ attributes = ["CurrentTime", "defaultNamingContext"]
23
+ for attr in attributes:
24
+ val = rootdse.Get(attr)
25
+ print(f" {attr}={val}")
26
+
27
+
28
+ ###############################################
29
+ #
30
+ # Code taken from article titled:
31
+ # Reading attributeSchema and classSchema Objects
32
+ def _DumpClass(child):
33
+ attrs = "Abstract lDAPDisplayName schemaIDGUID schemaNamingContext attributeSyntax oMSyntax"
34
+ _DumpTheseAttributes(child, attrs.split())
35
+
36
+
37
+ def _DumpAttribute(child):
38
+ attrs = "lDAPDisplayName schemaIDGUID adminDescription adminDisplayName rDNAttID defaultHidingValue defaultObjectCategory systemOnly defaultSecurityDescriptor"
39
+ _DumpTheseAttributes(child, attrs.split())
40
+
41
+
42
+ def _DumpTheseAttributes(child, attrs):
43
+ for attr in attrs:
44
+ try:
45
+ val = child.Get(attr)
46
+ except pythoncom.com_error as details:
47
+ continue
48
+ # ###
49
+ (hr, msg, exc, arg) = details
50
+ if exc and exc[2]:
51
+ msg = exc[2]
52
+ val = f"<Error: {msg}>"
53
+ if verbose_level >= 2:
54
+ print(f" {child.Class}: {attr}={val}")
55
+
56
+
57
+ def DumpSchema():
58
+ "Dumps the default DSE schema"
59
+ # Bind to rootDSE to get the schemaNamingContext property.
60
+ path = "LDAP://%srootDSE" % server
61
+ rootdse = ADsGetObject(path)
62
+ name = rootdse.Get("schemaNamingContext")
63
+
64
+ # Bind to the actual schema container.
65
+ path = "LDAP://" + server + name
66
+ print("Binding to", path)
67
+ ob = ADsGetObject(path)
68
+ nclasses = nattr = nsub = nunk = 0
69
+
70
+ # Enumerate the attribute and class objects in the schema container.
71
+ for child in ob:
72
+ # Find out if this is a class, attribute, or subSchema object.
73
+ class_name = child.Class
74
+ if class_name == "classSchema":
75
+ _DumpClass(child)
76
+ nclasses += 1
77
+ elif class_name == "attributeSchema":
78
+ _DumpAttribute(child)
79
+ nattr += 1
80
+ elif class_name == "subSchema":
81
+ nsub += 1
82
+ else:
83
+ print("Unknown class:", class_name)
84
+ nunk += 1
85
+ if verbose_level:
86
+ print("Processed", nclasses, "classes")
87
+ print("Processed", nattr, "attributes")
88
+ print("Processed", nsub, "sub-schema's")
89
+ print("Processed", nunk, "unknown types")
90
+
91
+
92
+ def _DumpObject(ob, level=0):
93
+ prefix = " " * level
94
+ print(f"{prefix}{ob.Class} object: {ob.Name}")
95
+ # Do the directory object thing
96
+ try:
97
+ dir_ob = ADsGetObject(ob.ADsPath, IID_IDirectoryObject)
98
+ except pythoncom.com_error:
99
+ dir_ob = None
100
+ if dir_ob is not None:
101
+ info = dir_ob.GetObjectInformation()
102
+ print(f"{prefix} RDN='{info.RDN}', ObjectDN='{info.ObjectDN}'")
103
+ # Create a list of names to fetch
104
+ names = ["distinguishedName"]
105
+ attrs = dir_ob.GetObjectAttributes(names)
106
+ for attr in attrs:
107
+ for val, typ in attr.Values:
108
+ print(f"{prefix} Attribute '{attr.AttrName}' = {val}")
109
+
110
+ for child in ob:
111
+ _DumpObject(child, level + 1)
112
+
113
+
114
+ def DumpAllObjects():
115
+ "Recursively dump the entire directory!"
116
+ path = "LDAP://%srootDSE" % server
117
+ rootdse = ADsGetObject(path)
118
+ name = rootdse.Get("defaultNamingContext")
119
+
120
+ # Bind to the actual schema container.
121
+ path = "LDAP://" + server + name
122
+ print("Binding to", path)
123
+ ob = ADsGetObject(path)
124
+
125
+ # Enumerate the attribute and class objects in the schema container.
126
+ _DumpObject(ob)
127
+
128
+
129
+ ##########################################################
130
+ #
131
+ # Code taken from article:
132
+ # Example Code for Enumerating Schema Classes, Attributes, and Syntaxes
133
+
134
+ # Fill a map with VT_ datatypes, to give us better names:
135
+ vt_map = {}
136
+ for name, val in pythoncom.__dict__.items():
137
+ if name[:3] == "VT_":
138
+ vt_map[val] = name
139
+
140
+
141
+ def DumpSchema2():
142
+ "Dumps the schema using an alternative technique"
143
+ path = f"LDAP://{server}schema"
144
+ schema = ADsGetObject(path, IID_IADsContainer)
145
+ nclass = nprop = nsyntax = 0
146
+ for item in schema:
147
+ item_class = item.Class.lower()
148
+ if item_class == "class":
149
+ items = []
150
+ if item.Abstract:
151
+ items.append("Abstract")
152
+ if item.Auxiliary:
153
+ items.append("Auxiliary")
154
+ # if item.Structural: items.append("Structural")
155
+ desc = ", ".join(items)
156
+ import win32com.util
157
+
158
+ iid_name = win32com.util.IIDToInterfaceName(item.PrimaryInterface)
159
+ if verbose_level >= 2:
160
+ print(
161
+ "Class: Name={}, Flags={}, Primary Interface={}".format(
162
+ item.Name, desc, iid_name
163
+ )
164
+ )
165
+ nclass += 1
166
+ elif item_class == "property":
167
+ if item.MultiValued:
168
+ val_type = "Multi-Valued"
169
+ else:
170
+ val_type = "Single-Valued"
171
+ if verbose_level >= 2:
172
+ print(f"Property: Name={item.Name}, {val_type}")
173
+ nprop += 1
174
+ elif item_class == "syntax":
175
+ data_type = vt_map.get(item.OleAutoDataType, "<unknown type>")
176
+ if verbose_level >= 2:
177
+ print(f"Syntax: Name={item.Name}, Datatype = {data_type}")
178
+ nsyntax += 1
179
+ if verbose_level >= 1:
180
+ print("Processed", nclass, "classes")
181
+ print("Processed", nprop, "properties")
182
+ print("Processed", nsyntax, "syntax items")
183
+
184
+
185
+ def DumpGC():
186
+ "Dumps the GC: object (whatever that is!)"
187
+ ob = ADsGetObject("GC:", IID_IADsContainer)
188
+ for sub_ob in ob:
189
+ print(f"GC ob: {sub_ob.Name} ({sub_ob.ADsPath})")
190
+
191
+
192
+ def DumpLocalUsers():
193
+ "Dumps the local machine users"
194
+ path = f"WinNT://{local_name},computer"
195
+ ob = ADsGetObject(path, IID_IADsContainer)
196
+ ob.put_Filter(["User", "Group"])
197
+ for sub_ob in ob:
198
+ print(f"User/Group: {sub_ob.Name} ({sub_ob.ADsPath})")
199
+
200
+
201
+ def DumpLocalGroups():
202
+ "Dumps the local machine groups"
203
+ path = f"WinNT://{local_name},computer"
204
+ ob = ADsGetObject(path, IID_IADsContainer)
205
+
206
+ ob.put_Filter(["Group"])
207
+ for sub_ob in ob:
208
+ print(f"Group: {sub_ob.Name} ({sub_ob.ADsPath})")
209
+ # get the members
210
+ members = sub_ob.Members()
211
+ for member in members:
212
+ print(f" Group member: {member.Name} ({member.ADsPath})")
213
+
214
+
215
+ def usage(tests):
216
+ import os
217
+
218
+ print("Usage: %s [-s server ] [-v] [Test ...]" % os.path.basename(sys.argv[0]))
219
+ print(" -v : Verbose - print more information")
220
+ print(" -s : server - execute the tests against the named server")
221
+ print("where Test is one of:")
222
+ for t in tests:
223
+ print(t.__name__, ":", t.__doc__)
224
+ print()
225
+ print("If not tests are specified, all tests are run")
226
+ sys.exit(1)
227
+
228
+
229
+ def main():
230
+ import getopt
231
+ import traceback
232
+
233
+ tests = []
234
+ for ob in globals().values():
235
+ if isinstance(ob, Callable) and ob.__doc__:
236
+ tests.append(ob)
237
+ opts, args = getopt.getopt(sys.argv[1:], "s:hv")
238
+ for opt, val in opts:
239
+ if opt == "-s":
240
+ if val[-1] not in "\\/":
241
+ val += "/"
242
+ global server
243
+ server = val
244
+ if opt == "-h":
245
+ usage(tests)
246
+ if opt == "-v":
247
+ global verbose_level
248
+ verbose_level += 1
249
+
250
+ if len(args) == 0:
251
+ print("Running all tests - use '-h' to see command-line options...")
252
+ dotests = tests
253
+ else:
254
+ dotests = []
255
+ for arg in args:
256
+ for t in tests:
257
+ if t.__name__ == arg:
258
+ dotests.append(t)
259
+ break
260
+ else:
261
+ print("Test '%s' unknown - skipping" % arg)
262
+ if not len(dotests):
263
+ print("Nothing to do!")
264
+ usage(tests)
265
+ for test in dotests:
266
+ try:
267
+ test()
268
+ except:
269
+ print("Test %s failed" % test.__name__)
270
+ traceback.print_exc()
271
+
272
+
273
+ if __name__ == "__main__":
274
+ main()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # This is a python package
2
+ # __PackageSupportBuildPath__ not needed for distutil based builds,
3
+ # but not everyone is there yet.
4
+ import win32com
5
+
6
+ win32com.__PackageSupportBuildPath__(__path__)
loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/authorization.pyd ADDED
Binary file (29.2 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/demos/EditSecurity.py ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import pythoncom
4
+ import win32api
5
+ import win32com.server.policy
6
+ import win32con
7
+ import win32security
8
+ from ntsecuritycon import (
9
+ FILE_ALL_ACCESS,
10
+ FILE_APPEND_DATA,
11
+ FILE_GENERIC_EXECUTE,
12
+ FILE_GENERIC_READ,
13
+ FILE_GENERIC_WRITE,
14
+ FILE_WRITE_DATA,
15
+ READ_CONTROL,
16
+ SI_ACCESS_GENERAL,
17
+ SI_ACCESS_SPECIFIC,
18
+ SI_ADVANCED,
19
+ SI_CONTAINER,
20
+ SI_EDIT_ALL,
21
+ SI_PAGE_TITLE,
22
+ SI_RESET,
23
+ WRITE_DAC,
24
+ WRITE_OWNER,
25
+ )
26
+ from pythoncom import IID_NULL
27
+ from win32com.authorization import authorization
28
+ from win32security import CONTAINER_INHERIT_ACE, OBJECT_INHERIT_ACE
29
+
30
+
31
+ class SecurityInformation(win32com.server.policy.DesignatedWrapPolicy):
32
+ _com_interfaces_ = [authorization.IID_ISecurityInformation]
33
+ _public_methods_ = [
34
+ "GetObjectInformation",
35
+ "GetSecurity",
36
+ "SetSecurity",
37
+ "GetAccessRights",
38
+ "GetInheritTypes",
39
+ "MapGeneric",
40
+ "PropertySheetPageCallback",
41
+ ]
42
+
43
+ def __init__(self, FileName):
44
+ self.FileName = FileName
45
+ self._wrap_(self)
46
+
47
+ def GetObjectInformation(self):
48
+ """Identifies object whose security will be modified, and determines options available
49
+ to the end user"""
50
+ flags = SI_ADVANCED | SI_EDIT_ALL | SI_PAGE_TITLE | SI_RESET
51
+ if os.path.isdir(self.FileName):
52
+ flags |= SI_CONTAINER
53
+ hinstance = 0 ## handle to module containing string resources
54
+ servername = "" ## name of authenticating server if not local machine
55
+ objectname = os.path.split(self.FileName)[1]
56
+ pagetitle = "Python ACL Editor"
57
+ if os.path.isdir(self.FileName):
58
+ pagetitle += " (dir)"
59
+ else:
60
+ pagetitle += " (file)"
61
+ objecttype = IID_NULL
62
+ return flags, hinstance, servername, objectname, pagetitle, objecttype
63
+
64
+ def GetSecurity(self, requestedinfo, bdefault):
65
+ """Requests the existing permissions for object"""
66
+ if bdefault:
67
+ ## This is invoked if the 'Default' button is pressed (only present if SI_RESET is passed
68
+ ## with the flags in GetObjectInfo). Passing an empty SD with a NULL Dacl
69
+ ## should cause inherited ACL from parent dir or default dacl from user's token to be used
70
+ return win32security.SECURITY_DESCRIPTOR()
71
+ else:
72
+ ## GetFileSecurity sometimes fails to return flags indicating that an ACE is inherited
73
+ return win32security.GetNamedSecurityInfo(
74
+ self.FileName, win32security.SE_FILE_OBJECT, requestedinfo
75
+ )
76
+
77
+ def SetSecurity(self, requestedinfo, sd):
78
+ """Applies permissions to the object"""
79
+ owner = sd.GetSecurityDescriptorOwner()
80
+ group = sd.GetSecurityDescriptorGroup()
81
+ dacl = sd.GetSecurityDescriptorDacl()
82
+ sacl = sd.GetSecurityDescriptorSacl()
83
+ win32security.SetNamedSecurityInfo(
84
+ self.FileName,
85
+ win32security.SE_FILE_OBJECT,
86
+ requestedinfo,
87
+ owner,
88
+ group,
89
+ dacl,
90
+ sacl,
91
+ )
92
+ ## should also handle recursive operations here
93
+
94
+ def GetAccessRights(self, objecttype, flags):
95
+ """Returns a tuple of (AccessRights, DefaultAccess), where AccessRights is a sequence of tuples representing
96
+ SI_ACCESS structs, containing (guid, access mask, Name, flags). DefaultAccess indicates which of the
97
+ AccessRights will be used initially when a new ACE is added (zero based).
98
+ Flags can contain SI_ACCESS_SPECIFIC,SI_ACCESS_GENERAL,SI_ACCESS_CONTAINER,SI_ACCESS_PROPERTY,
99
+ CONTAINER_INHERIT_ACE,INHERIT_ONLY_ACE,OBJECT_INHERIT_ACE
100
+ """
101
+ ## input flags: SI_ADVANCED,SI_EDIT_AUDITS,SI_EDIT_PROPERTIES indicating which property sheet is requesting the rights
102
+ if (objecttype is not None) and (objecttype != IID_NULL):
103
+ ## Should not be true for file objects. Usually only used with DS objects that support security for
104
+ ## their properties
105
+ raise NotImplementedError("Object type is not supported")
106
+
107
+ if os.path.isdir(self.FileName):
108
+ file_append_data_desc = "Create subfolders"
109
+ file_write_data_desc = "Create Files"
110
+ else:
111
+ file_append_data_desc = "Append data"
112
+ file_write_data_desc = "Write data"
113
+
114
+ accessrights = [
115
+ (
116
+ IID_NULL,
117
+ FILE_GENERIC_READ,
118
+ "Generic read",
119
+ SI_ACCESS_GENERAL
120
+ | SI_ACCESS_SPECIFIC
121
+ | OBJECT_INHERIT_ACE
122
+ | CONTAINER_INHERIT_ACE,
123
+ ),
124
+ (
125
+ IID_NULL,
126
+ FILE_GENERIC_WRITE,
127
+ "Generic write",
128
+ SI_ACCESS_GENERAL
129
+ | SI_ACCESS_SPECIFIC
130
+ | OBJECT_INHERIT_ACE
131
+ | CONTAINER_INHERIT_ACE,
132
+ ),
133
+ (
134
+ IID_NULL,
135
+ win32con.DELETE,
136
+ "Delete",
137
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
138
+ ),
139
+ (
140
+ IID_NULL,
141
+ WRITE_OWNER,
142
+ "Change owner",
143
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
144
+ ),
145
+ (
146
+ IID_NULL,
147
+ READ_CONTROL,
148
+ "Read Permissions",
149
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
150
+ ),
151
+ (
152
+ IID_NULL,
153
+ WRITE_DAC,
154
+ "Change permissions",
155
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
156
+ ),
157
+ (
158
+ IID_NULL,
159
+ FILE_APPEND_DATA,
160
+ file_append_data_desc,
161
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
162
+ ),
163
+ (
164
+ IID_NULL,
165
+ FILE_WRITE_DATA,
166
+ file_write_data_desc,
167
+ SI_ACCESS_SPECIFIC | OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
168
+ ),
169
+ ]
170
+ return (accessrights, 0)
171
+
172
+ def MapGeneric(self, guid, aceflags, mask):
173
+ """Converts generic access rights to specific rights. This implementation uses standard file system rights,
174
+ but you can map them any way that suits your application.
175
+ """
176
+ return win32security.MapGenericMask(
177
+ mask,
178
+ (
179
+ FILE_GENERIC_READ,
180
+ FILE_GENERIC_WRITE,
181
+ FILE_GENERIC_EXECUTE,
182
+ FILE_ALL_ACCESS,
183
+ ),
184
+ )
185
+
186
+ def GetInheritTypes(self):
187
+ """Specifies which types of ACE inheritance are supported.
188
+ Returns a sequence of tuples representing SI_INHERIT_TYPE structs, containing
189
+ (object type guid, inheritance flags, display name). Guid is usually only used with
190
+ Directory Service objects.
191
+ """
192
+ return (
193
+ (IID_NULL, 0, "Only current object"),
194
+ (IID_NULL, OBJECT_INHERIT_ACE, "Files inherit permissions"),
195
+ (IID_NULL, CONTAINER_INHERIT_ACE, "Sub Folders inherit permissions"),
196
+ (
197
+ IID_NULL,
198
+ CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE,
199
+ "Files and subfolders",
200
+ ),
201
+ )
202
+
203
+ def PropertySheetPageCallback(self, hwnd, msg, pagetype):
204
+ """Invoked each time a property sheet page is created or destroyed."""
205
+ ## page types from SI_PAGE_TYPE enum: SI_PAGE_PERM SI_PAGE_ADVPERM SI_PAGE_AUDIT SI_PAGE_OWNER
206
+ ## msg: PSPCB_CREATE, PSPCB_RELEASE, PSPCB_SI_INITDIALOG
207
+ return None
208
+
209
+ def EditSecurity(self, owner_hwnd=0):
210
+ """Creates an ACL editor dialog based on parameters returned by interface methods"""
211
+ isi = pythoncom.WrapObject(
212
+ self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown
213
+ )
214
+ authorization.EditSecurity(owner_hwnd, isi)
215
+
216
+
217
+ ## folder permissions
218
+ temp_dir = win32api.GetTempPath()
219
+ dir_name = win32api.GetTempFileName(temp_dir, "isi")[0]
220
+ print(dir_name)
221
+ os.remove(dir_name)
222
+ os.mkdir(dir_name)
223
+ si = SecurityInformation(dir_name)
224
+ si.EditSecurity()
225
+
226
+ ## file permissions
227
+ fname = win32api.GetTempFileName(dir_name, "isi")[0]
228
+ si = SecurityInformation(fname)
229
+ si.EditSecurity()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/authorization/demos/EditServiceSecurity.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ r"""
2
+ Implements a permissions editor for services.
3
+ Service can be specified as plain name for local machine,
4
+ or as a remote service of the form \\machinename\service
5
+ """
6
+
7
+ import os
8
+
9
+ import pythoncom
10
+ import win32com.server.policy
11
+ import win32con
12
+ import win32security
13
+ import win32service
14
+ from win32com.authorization import authorization
15
+
16
+ SERVICE_GENERIC_EXECUTE = (
17
+ win32service.SERVICE_START
18
+ | win32service.SERVICE_STOP
19
+ | win32service.SERVICE_PAUSE_CONTINUE
20
+ | win32service.SERVICE_USER_DEFINED_CONTROL
21
+ )
22
+ SERVICE_GENERIC_READ = (
23
+ win32service.SERVICE_QUERY_CONFIG
24
+ | win32service.SERVICE_QUERY_STATUS
25
+ | win32service.SERVICE_INTERROGATE
26
+ | win32service.SERVICE_ENUMERATE_DEPENDENTS
27
+ )
28
+ SERVICE_GENERIC_WRITE = win32service.SERVICE_CHANGE_CONFIG
29
+
30
+ from ntsecuritycon import (
31
+ READ_CONTROL,
32
+ SI_ACCESS_GENERAL,
33
+ SI_ACCESS_SPECIFIC,
34
+ SI_ADVANCED,
35
+ SI_EDIT_ALL,
36
+ SI_PAGE_TITLE,
37
+ SI_RESET,
38
+ WRITE_DAC,
39
+ WRITE_OWNER,
40
+ )
41
+ from pythoncom import IID_NULL
42
+
43
+
44
+ class ServiceSecurity(win32com.server.policy.DesignatedWrapPolicy):
45
+ _com_interfaces_ = [authorization.IID_ISecurityInformation]
46
+ _public_methods_ = [
47
+ "GetObjectInformation",
48
+ "GetSecurity",
49
+ "SetSecurity",
50
+ "GetAccessRights",
51
+ "GetInheritTypes",
52
+ "MapGeneric",
53
+ "PropertySheetPageCallback",
54
+ ]
55
+
56
+ def __init__(self, ServiceName):
57
+ self.ServiceName = ServiceName
58
+ self._wrap_(self)
59
+
60
+ def GetObjectInformation(self):
61
+ """Identifies object whose security will be modified, and determines options available
62
+ to the end user"""
63
+ flags = SI_ADVANCED | SI_EDIT_ALL | SI_PAGE_TITLE | SI_RESET
64
+ hinstance = 0 ## handle to module containing string resources
65
+ servername = "" ## name of authenticating server if not local machine
66
+
67
+ ## service name can contain remote machine name of the form \\Server\ServiceName
68
+ objectname = os.path.split(self.ServiceName)[1]
69
+ pagetitle = "Service Permissions for " + self.ServiceName
70
+ objecttype = IID_NULL
71
+ return flags, hinstance, servername, objectname, pagetitle, objecttype
72
+
73
+ def GetSecurity(self, requestedinfo, bdefault):
74
+ """Requests the existing permissions for object"""
75
+ if bdefault:
76
+ return win32security.SECURITY_DESCRIPTOR()
77
+ else:
78
+ return win32security.GetNamedSecurityInfo(
79
+ self.ServiceName, win32security.SE_SERVICE, requestedinfo
80
+ )
81
+
82
+ def SetSecurity(self, requestedinfo, sd):
83
+ """Applies permissions to the object"""
84
+ owner = sd.GetSecurityDescriptorOwner()
85
+ group = sd.GetSecurityDescriptorGroup()
86
+ dacl = sd.GetSecurityDescriptorDacl()
87
+ sacl = sd.GetSecurityDescriptorSacl()
88
+ win32security.SetNamedSecurityInfo(
89
+ self.ServiceName,
90
+ win32security.SE_SERVICE,
91
+ requestedinfo,
92
+ owner,
93
+ group,
94
+ dacl,
95
+ sacl,
96
+ )
97
+
98
+ def GetAccessRights(self, objecttype, flags):
99
+ """Returns a tuple of (AccessRights, DefaultAccess), where AccessRights is a sequence of tuples representing
100
+ SI_ACCESS structs, containing (guid, access mask, Name, flags). DefaultAccess indicates which of the
101
+ AccessRights will be used initially when a new ACE is added (zero based).
102
+ Flags can contain SI_ACCESS_SPECIFIC,SI_ACCESS_GENERAL,SI_ACCESS_CONTAINER,SI_ACCESS_PROPERTY,
103
+ CONTAINER_INHERIT_ACE,INHERIT_ONLY_ACE,OBJECT_INHERIT_ACE
104
+ """
105
+ ## input flags: SI_ADVANCED,SI_EDIT_AUDITS,SI_EDIT_PROPERTIES indicating which property sheet is requesting the rights
106
+ if (objecttype is not None) and (objecttype != IID_NULL):
107
+ ## Not relevent for services
108
+ raise NotImplementedError("Object type is not supported")
109
+
110
+ ## ???? for some reason, the DACL for a service will not retain ACCESS_SYSTEM_SECURITY in an ACE ????
111
+ ## (IID_NULL, win32con.ACCESS_SYSTEM_SECURITY, 'View/change audit settings', SI_ACCESS_SPECIFIC),
112
+
113
+ accessrights = [
114
+ (
115
+ IID_NULL,
116
+ win32service.SERVICE_ALL_ACCESS,
117
+ "Full control",
118
+ SI_ACCESS_GENERAL,
119
+ ),
120
+ (IID_NULL, SERVICE_GENERIC_READ, "Generic read", SI_ACCESS_GENERAL),
121
+ (IID_NULL, SERVICE_GENERIC_WRITE, "Generic write", SI_ACCESS_GENERAL),
122
+ (
123
+ IID_NULL,
124
+ SERVICE_GENERIC_EXECUTE,
125
+ "Start/Stop/Pause service",
126
+ SI_ACCESS_GENERAL,
127
+ ),
128
+ (IID_NULL, READ_CONTROL, "Read Permissions", SI_ACCESS_GENERAL),
129
+ (IID_NULL, WRITE_DAC, "Change permissions", SI_ACCESS_GENERAL),
130
+ (IID_NULL, WRITE_OWNER, "Change owner", SI_ACCESS_GENERAL),
131
+ (IID_NULL, win32con.DELETE, "Delete service", SI_ACCESS_GENERAL),
132
+ (IID_NULL, win32service.SERVICE_START, "Start service", SI_ACCESS_SPECIFIC),
133
+ (IID_NULL, win32service.SERVICE_STOP, "Stop service", SI_ACCESS_SPECIFIC),
134
+ (
135
+ IID_NULL,
136
+ win32service.SERVICE_PAUSE_CONTINUE,
137
+ "Pause/unpause service",
138
+ SI_ACCESS_SPECIFIC,
139
+ ),
140
+ (
141
+ IID_NULL,
142
+ win32service.SERVICE_USER_DEFINED_CONTROL,
143
+ "Execute user defined operations",
144
+ SI_ACCESS_SPECIFIC,
145
+ ),
146
+ (
147
+ IID_NULL,
148
+ win32service.SERVICE_QUERY_CONFIG,
149
+ "Read configuration",
150
+ SI_ACCESS_SPECIFIC,
151
+ ),
152
+ (
153
+ IID_NULL,
154
+ win32service.SERVICE_CHANGE_CONFIG,
155
+ "Change configuration",
156
+ SI_ACCESS_SPECIFIC,
157
+ ),
158
+ (
159
+ IID_NULL,
160
+ win32service.SERVICE_ENUMERATE_DEPENDENTS,
161
+ "List dependent services",
162
+ SI_ACCESS_SPECIFIC,
163
+ ),
164
+ (
165
+ IID_NULL,
166
+ win32service.SERVICE_QUERY_STATUS,
167
+ "Query status",
168
+ SI_ACCESS_SPECIFIC,
169
+ ),
170
+ (
171
+ IID_NULL,
172
+ win32service.SERVICE_INTERROGATE,
173
+ "Query status (immediate)",
174
+ SI_ACCESS_SPECIFIC,
175
+ ),
176
+ ]
177
+ return (accessrights, 0)
178
+
179
+ def MapGeneric(self, guid, aceflags, mask):
180
+ """Converts generic access rights to specific rights."""
181
+ return win32security.MapGenericMask(
182
+ mask,
183
+ (
184
+ SERVICE_GENERIC_READ,
185
+ SERVICE_GENERIC_WRITE,
186
+ SERVICE_GENERIC_EXECUTE,
187
+ win32service.SERVICE_ALL_ACCESS,
188
+ ),
189
+ )
190
+
191
+ def GetInheritTypes(self):
192
+ """Specifies which types of ACE inheritance are supported.
193
+ Services don't use any inheritance
194
+ """
195
+ return ((IID_NULL, 0, "Only current object"),)
196
+
197
+ def PropertySheetPageCallback(self, hwnd, msg, pagetype):
198
+ """Invoked each time a property sheet page is created or destroyed."""
199
+ ## page types from SI_PAGE_TYPE enum: SI_PAGE_PERM SI_PAGE_ADVPERM SI_PAGE_AUDIT SI_PAGE_OWNER
200
+ ## msg: PSPCB_CREATE, PSPCB_RELEASE, PSPCB_SI_INITDIALOG
201
+ return None
202
+
203
+ def EditSecurity(self, owner_hwnd=0):
204
+ """Creates an ACL editor dialog based on parameters returned by interface methods"""
205
+ isi = pythoncom.WrapObject(
206
+ self, authorization.IID_ISecurityInformation, pythoncom.IID_IUnknown
207
+ )
208
+ authorization.EditSecurity(owner_hwnd, isi)
209
+
210
+
211
+ if __name__ == "__main__":
212
+ # Find the first service on local machine and edit its permissions
213
+ scm = win32service.OpenSCManager(
214
+ None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE
215
+ )
216
+ svcs = win32service.EnumServicesStatus(scm)
217
+ win32service.CloseServiceHandle(scm)
218
+ si = ServiceSecurity(svcs[0][0])
219
+ si.EditSecurity()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axcontrol/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # See if we have a special directory for the binaries (for developers)
2
+ import win32com
3
+
4
+ win32com.__PackageSupportBuildPath__(__path__)
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axcontrol/axcontrol.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5db99a332600936247afd1bf44c57aa6665378c236d884f3326a0517255f1d6d
3
+ size 147456
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # See if we have a special directory for the binaries (for developers)
2
+ import win32com
3
+
4
+ win32com.__PackageSupportBuildPath__(__path__)
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/adb.py ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The glue between the Python debugger interface and the Active Debugger interface"""
2
+
3
+ import _thread
4
+ import bdb
5
+ import os
6
+ import sys
7
+ import traceback
8
+
9
+ import pythoncom
10
+ import win32api
11
+ import win32com.client.connect
12
+ from win32com.axdebug.util import _wrap, trace
13
+
14
+ from . import axdebug, gateways, stackframe
15
+
16
+
17
+ def fnull(*args):
18
+ pass
19
+
20
+
21
+ debugging = "DEBUG_AXDEBUG" in os.environ
22
+ traceenter = fnull # trace enter of functions
23
+ tracev = fnull # verbose trace
24
+
25
+ if debugging:
26
+ traceenter = trace # trace enter of functions
27
+ tracev = trace # verbose trace
28
+
29
+
30
+ class OutputReflector:
31
+ def __init__(self, file, writefunc):
32
+ self.writefunc = writefunc
33
+ self.file = file
34
+
35
+ def __getattr__(self, name):
36
+ return getattr(self.file, name)
37
+
38
+ def write(self, message):
39
+ self.writefunc(message)
40
+ self.file.write(message)
41
+
42
+
43
+ def _dumpf(frame):
44
+ if frame is None:
45
+ return "<None>"
46
+ else:
47
+ addn = "(with trace!)"
48
+ if frame.f_trace is None:
49
+ addn = " **No Trace Set **"
50
+ return f"Frame at {id(frame)}, file {frame.f_code.co_filename}, line: {frame.f_lineno}{addn}"
51
+
52
+
53
+ g_adb = None
54
+
55
+
56
+ def OnSetBreakPoint(codeContext, breakPointState, lineNo):
57
+ try:
58
+ fileName = codeContext.codeContainer.GetFileName()
59
+ # inject the code into linecache.
60
+ import linecache
61
+
62
+ linecache.cache[fileName] = 0, 0, codeContext.codeContainer.GetText(), fileName
63
+ g_adb._OnSetBreakPoint(fileName, codeContext, breakPointState, lineNo + 1)
64
+ except:
65
+ traceback.print_exc()
66
+
67
+
68
+ class Adb(bdb.Bdb, gateways.RemoteDebugApplicationEvents):
69
+ def __init__(self):
70
+ self.debugApplication = None
71
+ self.debuggingThread = None
72
+ self.debuggingThreadStateHandle = None
73
+ self.stackSnifferCookie = self.stackSniffer = None
74
+ self.codeContainerProvider = None
75
+ self.debuggingThread = None
76
+ self.breakFlags = None
77
+ self.breakReason = None
78
+ self.appDebugger = None
79
+ self.appEventConnection = None
80
+ self.logicalbotframe = None # Anything at this level or below does not exist!
81
+ self.currentframe = None # The frame we are currently in.
82
+ self.recursiveData = [] # Data saved for each reentery on this thread.
83
+ bdb.Bdb.__init__(self)
84
+ self._threadprotectlock = _thread.allocate_lock()
85
+ self.reset()
86
+
87
+ def canonic(self, fname):
88
+ if fname[0] == "<":
89
+ return fname
90
+ return bdb.Bdb.canonic(self, fname)
91
+
92
+ def reset(self):
93
+ traceenter("adb.reset")
94
+ bdb.Bdb.reset(self)
95
+
96
+ def __xxxxx__set_break(self, filename, lineno, cond=None):
97
+ # As per standard one, except no linecache checking!
98
+ if filename not in self.breaks:
99
+ self.breaks[filename] = []
100
+ list = self.breaks[filename]
101
+ if lineno in list:
102
+ return "There is already a breakpoint there!"
103
+ list.append(lineno)
104
+ if cond is not None:
105
+ self.cbreaks[filename, lineno] = cond
106
+
107
+ def stop_here(self, frame):
108
+ traceenter("stop_here", _dumpf(frame), _dumpf(self.stopframe))
109
+ # As per bdb.stop_here, except for logicalbotframe
110
+ # if self.stopframe is None:
111
+ # return 1
112
+ if frame is self.stopframe:
113
+ return 1
114
+
115
+ tracev("stop_here said 'No'!")
116
+ return 0
117
+
118
+ def break_here(self, frame):
119
+ traceenter("break_here", self.breakFlags, _dumpf(frame))
120
+ self.breakReason = None
121
+ if self.breakFlags == axdebug.APPBREAKFLAG_DEBUGGER_HALT:
122
+ self.breakReason = axdebug.BREAKREASON_DEBUGGER_HALT
123
+ elif self.breakFlags == axdebug.APPBREAKFLAG_DEBUGGER_BLOCK:
124
+ self.breakReason = axdebug.BREAKREASON_DEBUGGER_BLOCK
125
+ elif self.breakFlags == axdebug.APPBREAKFLAG_STEP:
126
+ self.breakReason = axdebug.BREAKREASON_STEP
127
+ else:
128
+ print("Calling base 'break_here' with", self.breaks)
129
+ if bdb.Bdb.break_here(self, frame):
130
+ self.breakReason = axdebug.BREAKREASON_BREAKPOINT
131
+ return self.breakReason is not None
132
+
133
+ def break_anywhere(self, frame):
134
+ traceenter("break_anywhere", _dumpf(frame))
135
+ if self.breakFlags == axdebug.APPBREAKFLAG_DEBUGGER_HALT:
136
+ self.breakReason = axdebug.BREAKREASON_DEBUGGER_HALT
137
+ return 1
138
+ rc = bdb.Bdb.break_anywhere(self, frame)
139
+ tracev("break_anywhere", _dumpf(frame), "returning", rc)
140
+ return rc
141
+
142
+ def dispatch_return(self, frame, arg):
143
+ traceenter("dispatch_return", _dumpf(frame), arg)
144
+ if self.logicalbotframe is frame:
145
+ # We don't want to debug parent frames.
146
+ tracev("dispatch_return resetting sys.trace")
147
+ sys.settrace(None)
148
+ return
149
+ # self.bSetTrace = 0
150
+ self.currentframe = frame.f_back
151
+ return bdb.Bdb.dispatch_return(self, frame, arg)
152
+
153
+ def dispatch_line(self, frame):
154
+ traceenter("dispatch_line", _dumpf(frame), _dumpf(self.botframe))
155
+ # trace("logbotframe is", _dumpf(self.logicalbotframe), "botframe is", self.botframe)
156
+ if frame is self.logicalbotframe:
157
+ trace("dispatch_line", _dumpf(frame), "for bottom frame returing tracer")
158
+ # The next code executed in the frame above may be a builtin (eg, apply())
159
+ # in which sys.trace needs to be set.
160
+ sys.settrace(self.trace_dispatch)
161
+ # And return the tracer incase we are about to execute Python code,
162
+ # in which case sys tracer is ignored!
163
+ return self.trace_dispatch
164
+
165
+ if self.codeContainerProvider.FromFileName(frame.f_code.co_filename) is None:
166
+ trace(
167
+ "dispatch_line has no document for", _dumpf(frame), "- skipping trace!"
168
+ )
169
+ return None
170
+ self.currentframe = (
171
+ frame # So the stack sniffer knows our most recent, debuggable code.
172
+ )
173
+ return bdb.Bdb.dispatch_line(self, frame)
174
+
175
+ def dispatch_call(self, frame, arg):
176
+ traceenter("dispatch_call", _dumpf(frame))
177
+ frame.f_locals["__axstack_address__"] = axdebug.GetStackAddress()
178
+ if frame is self.botframe:
179
+ trace("dispatch_call is self.botframe - returning tracer")
180
+ return self.trace_dispatch
181
+ # Not our bottom frame. If we have a document for it,
182
+ # then trace it, otherwise run at full speed.
183
+ if self.codeContainerProvider.FromFileName(frame.f_code.co_filename) is None:
184
+ trace(
185
+ "dispatch_call has no document for", _dumpf(frame), "- skipping trace!"
186
+ )
187
+ # sys.settrace(None)
188
+ return None
189
+ return self.trace_dispatch
190
+
191
+ # rc = bdb.Bdb.dispatch_call(self, frame, arg)
192
+ # trace("dispatch_call", _dumpf(frame),"returned",rc)
193
+ # return rc
194
+
195
+ def trace_dispatch(self, frame, event, arg):
196
+ traceenter("trace_dispatch", _dumpf(frame), event, arg)
197
+ if self.debugApplication is None:
198
+ trace("trace_dispatch has no application!")
199
+ return # None
200
+ return bdb.Bdb.trace_dispatch(self, frame, event, arg)
201
+
202
+ #
203
+ # The user functions do bugger all!
204
+ #
205
+ # def user_call(self, frame, argument_list):
206
+ # traceenter("user_call",_dumpf(frame))
207
+
208
+ def user_line(self, frame):
209
+ traceenter("user_line", _dumpf(frame))
210
+ # Traces at line zero
211
+ if frame.f_lineno != 0:
212
+ breakReason = self.breakReason
213
+ if breakReason is None:
214
+ breakReason = axdebug.BREAKREASON_STEP
215
+ self._HandleBreakPoint(frame, None, breakReason)
216
+
217
+ def user_return(self, frame, return_value):
218
+ # traceenter("user_return",_dumpf(frame),return_value)
219
+ bdb.Bdb.user_return(self, frame, return_value)
220
+
221
+ def user_exception(self, frame, exc_info):
222
+ # traceenter("user_exception")
223
+ bdb.Bdb.user_exception(self, frame, exc_info)
224
+
225
+ def _HandleBreakPoint(self, frame, tb, reason):
226
+ traceenter(
227
+ "Calling HandleBreakPoint with reason", reason, "at frame", _dumpf(frame)
228
+ )
229
+ traceenter(" Current frame is", _dumpf(self.currentframe))
230
+ try:
231
+ resumeAction = self.debugApplication.HandleBreakPoint(reason)
232
+ tracev("HandleBreakPoint returned with ", resumeAction)
233
+ except pythoncom.com_error as details:
234
+ # Eeek - the debugger is dead, or something serious is happening.
235
+ # Assume we should continue
236
+ resumeAction = axdebug.BREAKRESUMEACTION_CONTINUE
237
+ trace("HandleBreakPoint FAILED with", details)
238
+
239
+ self.stack = []
240
+ self.curindex = 0
241
+ if resumeAction == axdebug.BREAKRESUMEACTION_ABORT:
242
+ self.set_quit()
243
+ elif resumeAction == axdebug.BREAKRESUMEACTION_CONTINUE:
244
+ tracev("resume action is continue")
245
+ self.set_continue()
246
+ elif resumeAction == axdebug.BREAKRESUMEACTION_STEP_INTO:
247
+ tracev("resume action is step")
248
+ self.set_step()
249
+ elif resumeAction == axdebug.BREAKRESUMEACTION_STEP_OVER:
250
+ tracev("resume action is next")
251
+ self.set_next(frame)
252
+ elif resumeAction == axdebug.BREAKRESUMEACTION_STEP_OUT:
253
+ tracev("resume action is stop out")
254
+ self.set_return(frame)
255
+ else:
256
+ raise ValueError("unknown resume action flags")
257
+ self.breakReason = None
258
+
259
+ def set_trace(self):
260
+ self.breakReason = axdebug.BREAKREASON_LANGUAGE_INITIATED
261
+ bdb.Bdb.set_trace(self)
262
+
263
+ def CloseApp(self):
264
+ traceenter("ClosingApp")
265
+ self.reset()
266
+ self.logicalbotframe = None
267
+ if self.stackSnifferCookie is not None:
268
+ try:
269
+ self.debugApplication.RemoveStackFrameSniffer(self.stackSnifferCookie)
270
+
271
+ except pythoncom.com_error:
272
+ trace(
273
+ f"*** Could not RemoveStackFrameSniffer {self.stackSnifferCookie}"
274
+ )
275
+ self.stackSnifferCookie = self.stackSniffer = None
276
+
277
+ if self.appEventConnection is not None:
278
+ self.appEventConnection.Disconnect()
279
+ self.appEventConnection = None
280
+ self.debugApplication = None
281
+ self.appDebugger = None
282
+ if self.codeContainerProvider is not None:
283
+ self.codeContainerProvider.Close()
284
+ self.codeContainerProvider = None
285
+
286
+ def AttachApp(self, debugApplication, codeContainerProvider):
287
+ # traceenter("AttachApp", debugApplication, codeContainerProvider)
288
+ self.codeContainerProvider = codeContainerProvider
289
+ self.debugApplication = debugApplication
290
+ self.stackSniffer = _wrap(
291
+ stackframe.DebugStackFrameSniffer(self), axdebug.IID_IDebugStackFrameSniffer
292
+ )
293
+ self.stackSnifferCookie = debugApplication.AddStackFrameSniffer(
294
+ self.stackSniffer
295
+ )
296
+ # trace(f"StackFrameSniffer added ({self.stackSnifferCookie})")
297
+
298
+ # Connect to the application events.
299
+ self.appEventConnection = win32com.client.connect.SimpleConnection(
300
+ self.debugApplication, self, axdebug.IID_IRemoteDebugApplicationEvents
301
+ )
302
+
303
+ def ResetAXDebugging(self):
304
+ traceenter("ResetAXDebugging", self, "with refcount", len(self.recursiveData))
305
+ if win32api.GetCurrentThreadId() != self.debuggingThread:
306
+ trace("ResetAXDebugging called on other thread")
307
+ return
308
+
309
+ if len(self.recursiveData) == 0:
310
+ # print("ResetAXDebugging called for final time.")
311
+ self.logicalbotframe = None
312
+ self.debuggingThread = None
313
+ self.currentframe = None
314
+ self.debuggingThreadStateHandle = None
315
+ return
316
+
317
+ (
318
+ self.logbotframe,
319
+ self.stopframe,
320
+ self.currentframe,
321
+ self.debuggingThreadStateHandle,
322
+ ) = self.recursiveData[0]
323
+ self.recursiveData = self.recursiveData[1:]
324
+
325
+ def SetupAXDebugging(self, baseFrame=None, userFrame=None):
326
+ """Get ready for potential debugging. Must be called on the thread
327
+ that is being debugged.
328
+ """
329
+ # userFrame is for non AXScript debugging. This is the first frame of the
330
+ # users code.
331
+ if userFrame is None:
332
+ userFrame = baseFrame
333
+ else:
334
+ # We have missed the "dispatch_call" function, so set this up now!
335
+ userFrame.f_locals["__axstack_address__"] = axdebug.GetStackAddress()
336
+
337
+ traceenter("SetupAXDebugging", self)
338
+ self._threadprotectlock.acquire()
339
+ try:
340
+ thisThread = win32api.GetCurrentThreadId()
341
+ if self.debuggingThread is None:
342
+ self.debuggingThread = thisThread
343
+ else:
344
+ if self.debuggingThread != thisThread:
345
+ trace("SetupAXDebugging called on other thread - ignored!")
346
+ return
347
+ # push our context.
348
+ self.recursiveData.insert(
349
+ 0,
350
+ (
351
+ self.logicalbotframe,
352
+ self.stopframe,
353
+ self.currentframe,
354
+ self.debuggingThreadStateHandle,
355
+ ),
356
+ )
357
+ finally:
358
+ self._threadprotectlock.release()
359
+
360
+ trace("SetupAXDebugging has base frame as", _dumpf(baseFrame))
361
+ self.botframe = baseFrame
362
+ self.stopframe = userFrame
363
+ self.logicalbotframe = baseFrame
364
+ self.currentframe = None
365
+ self.debuggingThreadStateHandle = axdebug.GetThreadStateHandle()
366
+
367
+ self._BreakFlagsChanged()
368
+
369
+ # RemoteDebugApplicationEvents
370
+ def OnConnectDebugger(self, appDebugger):
371
+ traceenter("OnConnectDebugger", appDebugger)
372
+ self.appDebugger = appDebugger
373
+ # Reflect output to appDebugger
374
+ writefunc = lambda s: appDebugger.onDebugOutput(s)
375
+ sys.stdout = OutputReflector(sys.stdout, writefunc)
376
+ sys.stderr = OutputReflector(sys.stderr, writefunc)
377
+
378
+ def OnDisconnectDebugger(self):
379
+ traceenter("OnDisconnectDebugger")
380
+ # Stop reflecting output
381
+ if isinstance(sys.stdout, OutputReflector):
382
+ sys.stdout = sys.stdout.file
383
+ if isinstance(sys.stderr, OutputReflector):
384
+ sys.stderr = sys.stderr.file
385
+ self.appDebugger = None
386
+ self.set_quit()
387
+
388
+ def OnSetName(self, name):
389
+ traceenter("OnSetName", name)
390
+
391
+ def OnDebugOutput(self, string):
392
+ traceenter("OnDebugOutput", string)
393
+
394
+ def OnClose(self):
395
+ traceenter("OnClose")
396
+
397
+ def OnEnterBreakPoint(self, rdat):
398
+ traceenter("OnEnterBreakPoint", rdat)
399
+
400
+ def OnLeaveBreakPoint(self, rdat):
401
+ traceenter("OnLeaveBreakPoint", rdat)
402
+
403
+ def OnCreateThread(self, rdat):
404
+ traceenter("OnCreateThread", rdat)
405
+
406
+ def OnDestroyThread(self, rdat):
407
+ traceenter("OnDestroyThread", rdat)
408
+
409
+ def OnBreakFlagChange(self, abf, rdat):
410
+ traceenter("Debugger OnBreakFlagChange", abf, rdat)
411
+ self.breakFlags = abf
412
+ self._BreakFlagsChanged()
413
+
414
+ def _BreakFlagsChanged(self):
415
+ traceenter(
416
+ f"_BreakFlagsChanged to {self.breakFlags} "
417
+ + f"with our thread = {self.debuggingThread}, "
418
+ + f"and debugging thread = {win32api.GetCurrentThreadId()}"
419
+ )
420
+ trace("_BreakFlagsChanged has breaks", self.breaks)
421
+ # If a request comes on our debugging thread, then do it now!
422
+ # if self.debuggingThread!=win32api.GetCurrentThreadId():
423
+ # return
424
+
425
+ if len(self.breaks) or self.breakFlags:
426
+ if self.logicalbotframe:
427
+ trace("BreakFlagsChange with bot frame", _dumpf(self.logicalbotframe))
428
+ # We have frames not to be debugged (eg, Scripting engine frames
429
+ # (sys.settrace will be set when out logicalbotframe is hit -
430
+ # this may not be the right thing to do, as it may not cause the
431
+ # immediate break we desire.)
432
+ self.logicalbotframe.f_trace = self.trace_dispatch
433
+ else:
434
+ trace("BreakFlagsChanged, but no bottom frame")
435
+ if self.stopframe is not None:
436
+ self.stopframe.f_trace = self.trace_dispatch
437
+ # If we have the thread-state for the thread being debugged, then
438
+ # we dynamically set its trace function - it is possible that the thread
439
+ # being debugged is in a blocked call (eg, a message box) and we
440
+ # want to hit the debugger the instant we return
441
+ if (
442
+ self.debuggingThreadStateHandle is not None
443
+ and self.breakFlags
444
+ and self.debuggingThread != win32api.GetCurrentThreadId()
445
+ ):
446
+ axdebug.SetThreadStateTrace(
447
+ self.debuggingThreadStateHandle, self.trace_dispatch
448
+ )
449
+
450
+ def _OnSetBreakPoint(self, key, codeContext, bps, lineNo):
451
+ traceenter("_OnSetBreakPoint", self, key, codeContext, bps, lineNo)
452
+ if bps == axdebug.BREAKPOINT_ENABLED:
453
+ problem = self.set_break(key, lineNo)
454
+ if problem:
455
+ print("*** set_break failed -", problem)
456
+ trace("_OnSetBreakPoint just set BP and has breaks", self.breaks)
457
+ else:
458
+ self.clear_break(key, lineNo)
459
+ self._BreakFlagsChanged()
460
+ trace("_OnSetBreakPoint leaving with breaks", self.breaks)
461
+
462
+
463
+ def Debugger():
464
+ global g_adb
465
+ if g_adb is None:
466
+ g_adb = Adb()
467
+ return g_adb
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/codecontainer.py ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A utility class for a code container.
2
+
3
+ A code container is a class which holds source code for a debugger. It knows how
4
+ to color the text, and also how to translate lines into offsets, and back.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import os
10
+ import sys
11
+ import tokenize
12
+ from keyword import kwlist
13
+ from typing import Any
14
+
15
+ import win32api
16
+ import winerror
17
+ from win32com.axdebug import axdebug, contexts
18
+ from win32com.axdebug.util import _wrap
19
+ from win32com.server.exception import COMException
20
+
21
+ _keywords = {
22
+ _keyword
23
+ for _keyword in kwlist
24
+ # Avoids including True/False/None
25
+ if _keyword.islower()
26
+ }
27
+ """set of Python keywords"""
28
+
29
+
30
+ class SourceCodeContainer:
31
+ def __init__(
32
+ self,
33
+ text: str | None,
34
+ fileName="<Remove Me!>",
35
+ sourceContext=0,
36
+ startLineNumber=0,
37
+ site=None,
38
+ debugDocument=None,
39
+ ):
40
+ self.sourceContext = sourceContext # The source context added by a smart host.
41
+ self.text: str | None = text
42
+ if text:
43
+ self._buildlines()
44
+ self.nextLineNo = 0
45
+ self.fileName = fileName
46
+ # Any: PyIDispatch type is not statically exposed
47
+ self.codeContexts: dict[int, Any] = {}
48
+ self.site = site
49
+ self.startLineNumber = startLineNumber
50
+ self.debugDocument = debugDocument
51
+
52
+ def _Close(self):
53
+ self.text = self.lines = self.lineOffsets = None
54
+ self.codeContexts = None
55
+ self.debugDocument = None
56
+ self.site = None
57
+ self.sourceContext = None
58
+
59
+ def GetText(self):
60
+ return self.text
61
+
62
+ def GetName(self, dnt):
63
+ raise NotImplementedError("You must subclass this")
64
+
65
+ def GetFileName(self):
66
+ return self.fileName
67
+
68
+ def GetPositionOfLine(self, cLineNumber):
69
+ self.GetText() # Prime us.
70
+ try:
71
+ return self.lineOffsets[cLineNumber]
72
+ except IndexError:
73
+ raise COMException(scode=winerror.S_FALSE)
74
+
75
+ def GetLineOfPosition(self, charPos):
76
+ self.GetText() # Prime us.
77
+ lastOffset = 0
78
+ lineNo = 0
79
+ for lineOffset in self.lineOffsets[1:]:
80
+ if lineOffset > charPos:
81
+ break
82
+ lastOffset = lineOffset
83
+ lineNo += 1
84
+ else: # for not broken.
85
+ # print("Can't find", charPos, "in", self.lineOffsets)
86
+ raise COMException(scode=winerror.S_FALSE)
87
+ # print("GLOP ret=", lineNo, (charPos - lastOffset))
88
+ return lineNo, (charPos - lastOffset)
89
+
90
+ def GetNextLine(self):
91
+ if self.nextLineNo >= len(self.lines):
92
+ self.nextLineNo = 0 # auto-reset.
93
+ return ""
94
+ rc = self.lines[self.nextLineNo]
95
+ self.nextLineNo += 1
96
+ return rc
97
+
98
+ def GetLine(self, num):
99
+ self.GetText() # Prime us.
100
+ return self.lines[num]
101
+
102
+ def GetNumChars(self):
103
+ return len(self.GetText())
104
+
105
+ def GetNumLines(self):
106
+ self.GetText() # Prime us.
107
+ return len(self.lines)
108
+
109
+ def _buildline(self, pos):
110
+ i = self.text.find("\n", pos)
111
+ if i < 0:
112
+ newpos = len(self.text)
113
+ else:
114
+ newpos = i + 1
115
+ r = self.text[pos:newpos]
116
+ return r, newpos
117
+
118
+ def _buildlines(self):
119
+ self.lines = []
120
+ self.lineOffsets = [0]
121
+ line, pos = self._buildline(0)
122
+ while line:
123
+ self.lines.append(line)
124
+ self.lineOffsets.append(pos)
125
+ line, pos = self._buildline(pos)
126
+
127
+ def _ProcessToken(self, type, token, spos, epos, line):
128
+ srow, scol = spos
129
+ erow, ecol = epos
130
+ self.GetText() # Prime us.
131
+ linenum = srow - 1 # Lines zero based for us too.
132
+ realCharPos = self.lineOffsets[linenum] + scol
133
+ numskipped = realCharPos - self.lastPos
134
+ if numskipped == 0:
135
+ pass
136
+ elif numskipped == 1:
137
+ self.attrs.append(axdebug.SOURCETEXT_ATTR_COMMENT)
138
+ else:
139
+ self.attrs.append((axdebug.SOURCETEXT_ATTR_COMMENT, numskipped))
140
+ kwSize = len(token)
141
+ self.lastPos = realCharPos + kwSize
142
+ attr = 0
143
+
144
+ if type == tokenize.NAME:
145
+ if token in _keywords:
146
+ attr = axdebug.SOURCETEXT_ATTR_KEYWORD
147
+ elif type == tokenize.STRING:
148
+ attr = axdebug.SOURCETEXT_ATTR_STRING
149
+ elif type == tokenize.NUMBER:
150
+ attr = axdebug.SOURCETEXT_ATTR_NUMBER
151
+ elif type == tokenize.OP:
152
+ attr = axdebug.SOURCETEXT_ATTR_OPERATOR
153
+ elif type == tokenize.COMMENT:
154
+ attr = axdebug.SOURCETEXT_ATTR_COMMENT
155
+ # else attr remains zero...
156
+ if kwSize == 0:
157
+ pass
158
+ elif kwSize == 1:
159
+ self.attrs.append(attr)
160
+ else:
161
+ self.attrs.append((attr, kwSize))
162
+
163
+ def GetSyntaxColorAttributes(self):
164
+ self.lastPos = 0
165
+ self.attrs = []
166
+ try:
167
+ for tokens in tokenize.tokenize(self.GetNextLine):
168
+ self._ProcessToken(*tokens)
169
+ except tokenize.TokenError:
170
+ pass # Ignore - will cause all subsequent text to be commented.
171
+ numAtEnd = len(self.GetText()) - self.lastPos
172
+ if numAtEnd:
173
+ self.attrs.append((axdebug.SOURCETEXT_ATTR_COMMENT, numAtEnd))
174
+ return self.attrs
175
+
176
+ # We also provide and manage DebugDocumentContext objects
177
+ def _MakeDebugCodeContext(self, lineNo, charPos, len):
178
+ return _wrap(
179
+ contexts.DebugCodeContext(lineNo, charPos, len, self, self.site),
180
+ axdebug.IID_IDebugCodeContext,
181
+ )
182
+
183
+ # Make a context at the given position. It should take up the entire context.
184
+ def _MakeContextAtPosition(self, charPos):
185
+ lineNo, offset = self.GetLineOfPosition(charPos)
186
+ try:
187
+ endPos = self.GetPositionOfLine(lineNo + 1)
188
+ except:
189
+ endPos = charPos
190
+ codecontext = self._MakeDebugCodeContext(lineNo, charPos, endPos - charPos)
191
+ return codecontext
192
+
193
+ # Returns a DebugCodeContext. debugDocument can be None for smart hosts.
194
+ def GetCodeContextAtPosition(self, charPos):
195
+ # trace("GetContextOfPos", charPos, maxChars)
196
+ # Convert to line number.
197
+ lineNo, offset = self.GetLineOfPosition(charPos)
198
+ charPos = self.GetPositionOfLine(lineNo)
199
+ try:
200
+ cc = self.codeContexts[charPos]
201
+ except KeyError:
202
+ cc = self._MakeContextAtPosition(charPos)
203
+ self.codeContexts[charPos] = cc
204
+ return cc
205
+
206
+
207
+ class SourceModuleContainer(SourceCodeContainer):
208
+ def __init__(self, module):
209
+ self.module = module
210
+ if hasattr(module, "__file__"):
211
+ fname = self.module.__file__
212
+ # Check for .pyc or .pyo or even .pys!
213
+ if fname[-1] in ["O", "o", "C", "c", "S", "s"]:
214
+ fname = fname[:-1]
215
+ try:
216
+ fname = win32api.GetFullPathName(fname)
217
+ except win32api.error:
218
+ pass
219
+ else:
220
+ if module.__name__ == "__main__" and len(sys.argv) > 0:
221
+ fname = sys.argv[0]
222
+ else:
223
+ fname = "<Unknown!>"
224
+ SourceCodeContainer.__init__(self, None, fname)
225
+
226
+ def GetText(self):
227
+ if self.text is None:
228
+ fname = self.GetFileName()
229
+ if fname:
230
+ try:
231
+ self.text = open(fname, "r").read()
232
+ except OSError as details:
233
+ self.text = f"# COMException opening file\n# {details!r}"
234
+ else:
235
+ self.text = f"# No file available for module '{self.module}'"
236
+ self._buildlines()
237
+ return self.text
238
+
239
+ def GetName(self, dnt):
240
+ name = self.module.__name__
241
+ try:
242
+ fname = win32api.GetFullPathName(self.module.__file__)
243
+ except win32api.error:
244
+ fname = self.module.__file__
245
+ except AttributeError:
246
+ fname = name
247
+ if dnt == axdebug.DOCUMENTNAMETYPE_APPNODE:
248
+ return name.split(".")[-1]
249
+ elif dnt == axdebug.DOCUMENTNAMETYPE_TITLE:
250
+ return fname
251
+ elif dnt == axdebug.DOCUMENTNAMETYPE_FILE_TAIL:
252
+ return os.path.split(fname)[1]
253
+ elif dnt == axdebug.DOCUMENTNAMETYPE_URL:
254
+ return f"file:{fname}"
255
+ else:
256
+ raise COMException(scode=winerror.E_UNEXPECTED)
257
+
258
+
259
+ if __name__ == "__main__":
260
+ from Test import ttest
261
+
262
+ sc = SourceModuleContainer(ttest)
263
+ # sc = SourceCodeContainer(open(sys.argv[1], "rb").read(), sys.argv[1])
264
+ attrs = sc.GetSyntaxColorAttributes()
265
+ attrlen = 0
266
+ for attr in attrs:
267
+ if isinstance(attr, tuple):
268
+ attrlen += attr[1]
269
+ else:
270
+ attrlen += 1
271
+ text = sc.GetText()
272
+ if attrlen != len(text):
273
+ print(f"Lengths don't match!!! ({attrlen}/{len(text)})")
274
+
275
+ # print("Attributes:")
276
+ # print(attrs)
277
+ print("GetLineOfPos=", sc.GetLineOfPosition(0))
278
+ print("GetLineOfPos=", sc.GetLineOfPosition(4))
279
+ print("GetLineOfPos=", sc.GetLineOfPosition(10))
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/contexts.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module for managing the AXDebug I*Contexts"""
2
+
3
+ from . import adb, axdebug, gateways
4
+
5
+ # Utility function for wrapping object created by this module.
6
+ from .util import _wrap
7
+
8
+
9
+ class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDocumentContext):
10
+ # NOTE: We also implement the IDebugDocumentContext interface for Simple Hosts.
11
+ # Thus, debugDocument may be NULL when we have smart hosts - but in that case, we
12
+ # won't be called upon to provide it.
13
+ _public_methods_ = (
14
+ gateways.DebugCodeContext._public_methods_
15
+ + gateways.DebugDocumentContext._public_methods_
16
+ )
17
+ _com_interfaces_ = (
18
+ gateways.DebugCodeContext._com_interfaces_
19
+ + gateways.DebugDocumentContext._com_interfaces_
20
+ )
21
+
22
+ def __init__(self, lineNo, charPos, len, codeContainer, debugSite):
23
+ self.debugSite = debugSite
24
+ self.offset = charPos
25
+ self.length = len
26
+ self.breakPointState = 0
27
+ self.lineno = lineNo
28
+ gateways.DebugCodeContext.__init__(self)
29
+ self.codeContainer = codeContainer
30
+
31
+ def _Close(self):
32
+ self.debugSite = None
33
+
34
+ def GetDocumentContext(self):
35
+ if self.debugSite is not None:
36
+ # We have a smart host - let him give it to us.
37
+ return self.debugSite.GetDocumentContextFromPosition(
38
+ self.codeContainer.sourceContext, self.offset, self.length
39
+ )
40
+ else:
41
+ # Simple host - Fine - I'll do it myself!
42
+ return _wrap(self, axdebug.IID_IDebugDocumentContext)
43
+
44
+ def SetBreakPoint(self, bps):
45
+ self.breakPointState = bps
46
+ adb.OnSetBreakPoint(self, bps, self.lineno)
47
+
48
+ # The DebugDocumentContext methods for simple hosts.
49
+ def GetDocument(self):
50
+ return self.codeContainer.debugDocument
51
+
52
+ def EnumCodeContexts(self):
53
+ return _wrap(EnumDebugCodeContexts([self]), axdebug.IID_IEnumDebugCodeContexts)
54
+
55
+
56
+ class EnumDebugCodeContexts(gateways.EnumDebugCodeContexts):
57
+ def _wrap(self, obj):
58
+ return _wrap(obj, axdebug.IID_IDebugCodeContext)
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/debugger.py ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ import pythoncom
5
+ from win32com.axdebug import adb, axdebug, codecontainer, documents, expressions
6
+ from win32com.axdebug.util import _wrap
7
+
8
+ currentDebugger = None
9
+
10
+
11
+ class ModuleTreeNode:
12
+ """Helper class for building a module tree"""
13
+
14
+ def __init__(self, module):
15
+ modName = module.__name__
16
+ self.moduleName = modName
17
+ self.module = module
18
+ self.realNode = None
19
+ self.cont = codecontainer.SourceModuleContainer(module)
20
+
21
+ def __repr__(self):
22
+ return f"<ModuleTreeNode wrapping {self.module}>"
23
+
24
+ def Attach(self, parentRealNode):
25
+ self.realNode.Attach(parentRealNode)
26
+
27
+ def Close(self):
28
+ self.module = None
29
+ self.cont = None
30
+ self.realNode = None
31
+
32
+
33
+ def BuildModule(module, built_nodes, rootNode, create_node_fn, create_node_args):
34
+ if module:
35
+ keep = module.__name__
36
+ keep = keep and (built_nodes.get(module) is None)
37
+ if keep and hasattr(module, "__file__"):
38
+ keep = os.path.splitext(module.__file__)[1].lower() not in [
39
+ ".pyd",
40
+ ".dll",
41
+ ]
42
+ # keep = keep and module.__name__=='__main__'
43
+ if module and keep:
44
+ # print("keeping", module.__name__)
45
+ node = ModuleTreeNode(module)
46
+ built_nodes[module] = node
47
+ realNode = create_node_fn(*(node,) + create_node_args)
48
+ node.realNode = realNode
49
+
50
+ # Split into parent nodes.
51
+ parts = module.__name__.split(".")
52
+ if parts[-1][:8] == "__init__":
53
+ parts = parts[:-1]
54
+ parent = ".".join(parts[:-1])
55
+ parentNode = rootNode
56
+ if parent:
57
+ parentModule = sys.modules[parent]
58
+ BuildModule(
59
+ parentModule, built_nodes, rootNode, create_node_fn, create_node_args
60
+ )
61
+ if parentModule in built_nodes:
62
+ parentNode = built_nodes[parentModule].realNode
63
+ node.Attach(parentNode)
64
+
65
+
66
+ def RefreshAllModules(builtItems, rootNode, create_node, create_node_args):
67
+ for module in sys.modules.values():
68
+ BuildModule(module, builtItems, rootNode, create_node, create_node_args)
69
+
70
+
71
+ # realNode = pdm.CreateDebugDocumentHelper(None) # DebugDocumentHelper node?
72
+ # app.CreateApplicationNode() # doc provider node.
73
+
74
+
75
+ class CodeContainerProvider(documents.CodeContainerProvider):
76
+ def __init__(self, axdebugger):
77
+ self.axdebugger = axdebugger
78
+ documents.CodeContainerProvider.__init__(self)
79
+ self.currentNumModules = len(sys.modules)
80
+ self.nodes = {}
81
+ self.axdebugger.RefreshAllModules(self.nodes, self)
82
+
83
+ def FromFileName(self, fname):
84
+ # It appears we can't add modules during a debug session!
85
+ # if self.currentNumModules != len(sys.modules):
86
+ # self.axdebugger.RefreshAllModules(self.nodes, self)
87
+ # self.currentNumModules = len(sys.modules)
88
+ # for key in self.ccsAndNodes:
89
+ # print("File:", key)
90
+ return documents.CodeContainerProvider.FromFileName(self, fname)
91
+
92
+ def Close(self):
93
+ documents.CodeContainerProvider.Close(self)
94
+ self.axdebugger = None
95
+ print(f"Closing {len(self.nodes)} nodes")
96
+ for node in self.nodes.values():
97
+ node.Close()
98
+ self.nodes = {}
99
+
100
+
101
+ class OriginalInterfaceMaker:
102
+ def MakeInterfaces(self, pdm):
103
+ app = self.pdm.CreateApplication()
104
+ self.cookie = pdm.AddApplication(app)
105
+ root = app.GetRootNode()
106
+ return app, root
107
+
108
+ def CloseInterfaces(self, pdm):
109
+ pdm.RemoveApplication(self.cookie)
110
+
111
+
112
+ class SimpleHostStyleInterfaceMaker:
113
+ def MakeInterfaces(self, pdm):
114
+ app = pdm.GetDefaultApplication()
115
+ root = app.GetRootNode()
116
+ return app, root
117
+
118
+ def CloseInterfaces(self, pdm):
119
+ pass
120
+
121
+
122
+ class AXDebugger:
123
+ def __init__(self, interfaceMaker=None, processName=None):
124
+ if processName is None:
125
+ processName = "Python Process"
126
+ if interfaceMaker is None:
127
+ interfaceMaker = SimpleHostStyleInterfaceMaker()
128
+
129
+ self.pydebugger = adb.Debugger()
130
+
131
+ self.pdm = pythoncom.CoCreateInstance(
132
+ axdebug.CLSID_ProcessDebugManager,
133
+ None,
134
+ pythoncom.CLSCTX_ALL,
135
+ axdebug.IID_IProcessDebugManager,
136
+ )
137
+
138
+ self.app, self.root = interfaceMaker.MakeInterfaces(self.pdm)
139
+ self.app.SetName(processName)
140
+ self.interfaceMaker = interfaceMaker
141
+
142
+ expressionProvider = _wrap(
143
+ expressions.ProvideExpressionContexts(),
144
+ axdebug.IID_IProvideExpressionContexts,
145
+ )
146
+ self.expressionCookie = self.app.AddGlobalExpressionContextProvider(
147
+ expressionProvider
148
+ )
149
+
150
+ contProvider = CodeContainerProvider(self)
151
+ self.pydebugger.AttachApp(self.app, contProvider)
152
+
153
+ def Break(self):
154
+ # Get the frame we start debugging from - this is the frame 1 level up
155
+ try:
156
+ 1 + ""
157
+ except:
158
+ frame = sys.exc_info()[2].tb_frame.f_back
159
+
160
+ # Get/create the debugger, and tell it to break.
161
+ self.app.StartDebugSession()
162
+ # self.app.CauseBreak()
163
+
164
+ self.pydebugger.SetupAXDebugging(None, frame)
165
+ self.pydebugger.set_trace()
166
+
167
+ def Close(self):
168
+ self.pydebugger.ResetAXDebugging()
169
+ self.interfaceMaker.CloseInterfaces(self.pdm)
170
+ self.pydebugger.CloseApp()
171
+ self.app.RemoveGlobalExpressionContextProvider(self.expressionCookie)
172
+ self.expressionCookie = None
173
+
174
+ self.pdm = None
175
+ self.app = None
176
+ self.pydebugger = None
177
+ self.root = None
178
+
179
+ def RefreshAllModules(self, nodes, containerProvider):
180
+ RefreshAllModules(
181
+ nodes, self.root, self.CreateApplicationNode, (containerProvider,)
182
+ )
183
+
184
+ def CreateApplicationNode(self, node, containerProvider):
185
+ realNode = self.app.CreateApplicationNode()
186
+
187
+ document = documents.DebugDocumentText(node.cont)
188
+ document = _wrap(document, axdebug.IID_IDebugDocument)
189
+
190
+ node.cont.debugDocument = document
191
+
192
+ provider = documents.DebugDocumentProvider(document)
193
+ provider = _wrap(provider, axdebug.IID_IDebugDocumentProvider)
194
+ realNode.SetDocumentProvider(provider)
195
+
196
+ containerProvider.AddCodeContainer(node.cont, realNode)
197
+ return realNode
198
+
199
+
200
+ def _GetCurrentDebugger():
201
+ global currentDebugger
202
+ if currentDebugger is None:
203
+ currentDebugger = AXDebugger()
204
+ return currentDebugger
205
+
206
+
207
+ def Break():
208
+ _GetCurrentDebugger().Break()
209
+
210
+
211
+ brk = Break
212
+ set_trace = Break
213
+
214
+
215
+ def dosomethingelse():
216
+ a = 2
217
+ b = "Hi there"
218
+
219
+
220
+ def dosomething():
221
+ a = 1
222
+ b = 2
223
+ dosomethingelse()
224
+
225
+
226
+ def test():
227
+ Break()
228
+ input("Waiting...")
229
+ dosomething()
230
+ print("Done")
231
+
232
+
233
+ if __name__ == "__main__":
234
+ print("About to test the debugging interfaces!")
235
+ test()
236
+ print(
237
+ f" {pythoncom._GetInterfaceCount()}/{pythoncom._GetGatewayCount()} com objects still alive"
238
+ )
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/documents.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Management of documents for AXDebugging."""
2
+
3
+ import pythoncom
4
+ import win32api
5
+ from win32com.server.util import unwrap
6
+
7
+ from . import axdebug, gateways
8
+ from .util import _wrap, trace
9
+
10
+ # def trace(*args):
11
+ # pass
12
+
13
+
14
+ def GetGoodFileName(fname):
15
+ if fname[0] != "<":
16
+ return win32api.GetFullPathName(fname)
17
+ return fname
18
+
19
+
20
+ class DebugDocumentProvider(gateways.DebugDocumentProvider):
21
+ def __init__(self, doc):
22
+ self.doc = doc
23
+
24
+ def GetName(self, dnt):
25
+ return self.doc.GetName(dnt)
26
+
27
+ def GetDocumentClassId(self):
28
+ return self.doc.GetDocumentClassId()
29
+
30
+ def GetDocument(self):
31
+ return self.doc
32
+
33
+
34
+ class DebugDocumentText(gateways.DebugDocumentText):
35
+ _com_interfaces_ = (
36
+ gateways.DebugDocumentInfo._com_interfaces_
37
+ + gateways.DebugDocumentText._com_interfaces_
38
+ + gateways.DebugDocument._com_interfaces_
39
+ )
40
+ _public_methods_ = (
41
+ gateways.DebugDocumentInfo._public_methods_
42
+ + gateways.DebugDocumentText._public_methods_
43
+ + gateways.DebugDocument._public_methods_
44
+ )
45
+
46
+ # A class which implements a DebugDocumentText, using the functionality
47
+ # provided by a codeContainer
48
+ def __init__(self, codeContainer):
49
+ gateways.DebugDocumentText.__init__(self)
50
+ gateways.DebugDocumentInfo.__init__(self)
51
+ gateways.DebugDocument.__init__(self)
52
+ self.codeContainer = codeContainer
53
+
54
+ def _Close(self):
55
+ self.docContexts = None
56
+ # self.codeContainer._Close()
57
+ self.codeContainer = None
58
+
59
+ # IDebugDocumentInfo
60
+ def GetName(self, dnt):
61
+ return self.codeContainer.GetName(dnt)
62
+
63
+ def GetDocumentClassId(self):
64
+ return "{DF630910-1C1D-11d0-AE36-8C0F5E000000}"
65
+
66
+ # IDebugDocument has no methods!
67
+ #
68
+
69
+ # IDebugDocumentText methods.
70
+ # def GetDocumentAttributes
71
+ def GetSize(self):
72
+ # trace("GetSize")
73
+ return self.codeContainer.GetNumLines(), self.codeContainer.GetNumChars()
74
+
75
+ def GetPositionOfLine(self, cLineNumber):
76
+ return self.codeContainer.GetPositionOfLine(cLineNumber)
77
+
78
+ def GetLineOfPosition(self, charPos):
79
+ return self.codeContainer.GetLineOfPosition(charPos)
80
+
81
+ def GetText(self, charPos, maxChars, wantAttr):
82
+ # Get all the attributes, else the tokenizer will get upset.
83
+ # XXX - not yet!
84
+ # trace("GetText", charPos, maxChars, wantAttr)
85
+ cont = self.codeContainer
86
+ attr = cont.GetSyntaxColorAttributes()
87
+ return cont.GetText(), attr
88
+
89
+ def GetPositionOfContext(self, context):
90
+ trace("GetPositionOfContext", context)
91
+ context = unwrap(context)
92
+ return context.offset, context.length
93
+
94
+ # Return a DebugDocumentContext.
95
+ def GetContextOfPosition(self, charPos, maxChars):
96
+ # Make one
97
+ doc = _wrap(self, axdebug.IID_IDebugDocument)
98
+ rc = self.codeContainer.GetCodeContextAtPosition(charPos)
99
+ return rc.QueryInterface(axdebug.IID_IDebugDocumentContext)
100
+
101
+
102
+ class CodeContainerProvider:
103
+ """An abstract Python class which provides code containers!
104
+
105
+ Given a Python file name (as the debugger knows it by) this will
106
+ return a CodeContainer interface suitable for use.
107
+
108
+ This provides a simple base implementation that simply supports
109
+ a dictionary of nodes and providers.
110
+ """
111
+
112
+ def __init__(self):
113
+ self.ccsAndNodes = {}
114
+
115
+ def AddCodeContainer(self, cc, node=None):
116
+ fname = GetGoodFileName(cc.fileName)
117
+ self.ccsAndNodes[fname] = cc, node
118
+
119
+ def FromFileName(self, fname):
120
+ cc, node = self.ccsAndNodes.get(GetGoodFileName(fname), (None, None))
121
+ # if cc is None:
122
+ # print(f"FromFileName for {fname} returning None")
123
+ return cc
124
+
125
+ def Close(self):
126
+ for cc, node in self.ccsAndNodes.values():
127
+ try:
128
+ # Must close the node before closing the provider
129
+ # as node may make calls on provider (eg Reset breakpoints etc)
130
+ if node is not None:
131
+ node.Close()
132
+ cc._Close()
133
+ except pythoncom.com_error:
134
+ pass
135
+ self.ccsAndNodes = {}
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/dump.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import traceback
2
+
3
+ import pythoncom
4
+ from win32com.axdebug import axdebug
5
+ from win32com.client.util import Enumerator
6
+
7
+
8
+ def DumpDebugApplicationNode(node, level=0):
9
+ # Recursive dump of a DebugApplicationNode
10
+ spacer = " " * level
11
+ for desc, attr in [
12
+ ("Node Name", axdebug.DOCUMENTNAMETYPE_APPNODE),
13
+ ("Title", axdebug.DOCUMENTNAMETYPE_TITLE),
14
+ ("Filename", axdebug.DOCUMENTNAMETYPE_FILE_TAIL),
15
+ ("URL", axdebug.DOCUMENTNAMETYPE_URL),
16
+ ]:
17
+ try:
18
+ info = node.GetName(attr)
19
+ except pythoncom.com_error:
20
+ info = "<N/A>"
21
+ print(f"{spacer}{desc}: {info}")
22
+ try:
23
+ doc = node.GetDocument()
24
+ except pythoncom.com_error:
25
+ doc = None
26
+ if doc:
27
+ doctext = doc.QueryInterface(axdebug.IID_IDebugDocumentText)
28
+ numLines, numChars = doctext.GetSize()
29
+ # text, attr = doctext.GetText(0, 20, 1)
30
+ text, attr = doctext.GetText(0, numChars, 1)
31
+ print(f"{spacer}Text is '{text[:40] + '...'}', {len(text)} bytes long")
32
+ else:
33
+ print(f"{spacer * 2}<No document available>")
34
+
35
+ for child in Enumerator(node.EnumChildren()):
36
+ DumpDebugApplicationNode(child, level + 1)
37
+
38
+
39
+ def dumpall():
40
+ dm = pythoncom.CoCreateInstance(
41
+ axdebug.CLSID_MachineDebugManager,
42
+ None,
43
+ pythoncom.CLSCTX_ALL,
44
+ axdebug.IID_IMachineDebugManager,
45
+ )
46
+ e = Enumerator(dm.EnumApplications())
47
+ for app in e:
48
+ print(f"Application: {app.GetName()}")
49
+ node = app.GetRootNode() # of type PyIDebugApplicationNode->PyIDebugDocumentProvider->PyIDebugDocumentInfo
50
+ DumpDebugApplicationNode(node)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ try:
55
+ dumpall()
56
+ except:
57
+ traceback.print_exc()
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/expressions.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import io
2
+ import sys
3
+ import traceback
4
+ from pprint import pprint
5
+
6
+ import winerror
7
+
8
+ from . import axdebug, gateways
9
+ from .util import RaiseNotImpl, _wrap
10
+
11
+
12
+ # Given an object, return a nice string
13
+ def MakeNiceString(ob):
14
+ stream = io.StringIO()
15
+ pprint(ob, stream)
16
+ return stream.getvalue().strip()
17
+
18
+
19
+ class ProvideExpressionContexts(gateways.ProvideExpressionContexts):
20
+ pass
21
+
22
+
23
+ class ExpressionContext(gateways.DebugExpressionContext):
24
+ def __init__(self, frame):
25
+ self.frame = frame
26
+
27
+ def ParseLanguageText(self, code, radix, delim, flags):
28
+ return _wrap(
29
+ Expression(self.frame, code, radix, delim, flags),
30
+ axdebug.IID_IDebugExpression,
31
+ )
32
+
33
+ def GetLanguageInfo(self):
34
+ # print("GetLanguageInfo")
35
+ return "Python", "{DF630910-1C1D-11d0-AE36-8C0F5E000000}"
36
+
37
+
38
+ class Expression(gateways.DebugExpression):
39
+ def __init__(self, frame, code, radix, delim, flags):
40
+ self.callback = None
41
+ self.frame = frame
42
+ self.code = code
43
+ self.radix = radix
44
+ self.delim = delim
45
+ self.flags = flags
46
+ self.isComplete = 0
47
+ self.result = None
48
+ self.hresult = winerror.E_UNEXPECTED
49
+
50
+ def Start(self, callback):
51
+ try:
52
+ try:
53
+ try:
54
+ self.result = eval(
55
+ self.code, self.frame.f_globals, self.frame.f_locals
56
+ )
57
+ except SyntaxError:
58
+ exec(self.code, self.frame.f_globals, self.frame.f_locals)
59
+ self.result = ""
60
+ self.hresult = 0
61
+ except:
62
+ l = traceback.format_exception_only(
63
+ sys.exc_info()[0], sys.exc_info()[1]
64
+ )
65
+ # l is a list of strings with trailing "\n"
66
+ self.result = "\n".join(s[:-1] for s in l)
67
+ self.hresult = winerror.E_FAIL
68
+ finally:
69
+ self.isComplete = 1
70
+ callback.onComplete()
71
+
72
+ def Abort(self):
73
+ print("** ABORT **")
74
+
75
+ def QueryIsComplete(self):
76
+ return self.isComplete
77
+
78
+ def GetResultAsString(self):
79
+ # print("GetStrAsResult returning", self.result)
80
+ return self.hresult, MakeNiceString(self.result)
81
+
82
+ def GetResultAsDebugProperty(self):
83
+ result = _wrap(
84
+ DebugProperty(self.code, self.result, None, self.hresult),
85
+ axdebug.IID_IDebugProperty,
86
+ )
87
+ return self.hresult, result
88
+
89
+
90
+ def MakeEnumDebugProperty(object, dwFieldSpec, nRadix, iid, stackFrame=None):
91
+ name_vals = []
92
+ if hasattr(object, "items") and hasattr(object, "keys"): # If it is a dict.
93
+ name_vals = object.items()
94
+ dictionary = object
95
+ elif hasattr(object, "__dict__"): # object with dictionary, module
96
+ name_vals = object.__dict__.items()
97
+ dictionary = object.__dict__
98
+ infos = []
99
+ for name, val in name_vals:
100
+ infos.append(
101
+ GetPropertyInfo(name, val, dwFieldSpec, nRadix, 0, dictionary, stackFrame)
102
+ )
103
+ return _wrap(EnumDebugPropertyInfo(infos), axdebug.IID_IEnumDebugPropertyInfo)
104
+
105
+
106
+ def GetPropertyInfo(
107
+ obname, obvalue, dwFieldSpec, nRadix, hresult=0, dictionary=None, stackFrame=None
108
+ ):
109
+ # returns a tuple
110
+ name = typ = value = fullname = attrib = dbgprop = None
111
+ if dwFieldSpec & axdebug.DBGPROP_INFO_VALUE:
112
+ value = MakeNiceString(obvalue)
113
+ if dwFieldSpec & axdebug.DBGPROP_INFO_NAME:
114
+ name = obname
115
+ if dwFieldSpec & axdebug.DBGPROP_INFO_TYPE:
116
+ if hresult:
117
+ typ = "Error"
118
+ else:
119
+ try:
120
+ typ = type(obvalue).__name__
121
+ except AttributeError:
122
+ typ = str(type(obvalue))
123
+ if dwFieldSpec & axdebug.DBGPROP_INFO_FULLNAME:
124
+ fullname = obname
125
+ if dwFieldSpec & axdebug.DBGPROP_INFO_ATTRIBUTES:
126
+ if hasattr(obvalue, "has_key") or hasattr(
127
+ obvalue, "__dict__"
128
+ ): # If it is a dict or object
129
+ attrib = axdebug.DBGPROP_ATTRIB_VALUE_IS_EXPANDABLE
130
+ else:
131
+ attrib = 0
132
+ if dwFieldSpec & axdebug.DBGPROP_INFO_DEBUGPROP:
133
+ dbgprop = _wrap(
134
+ DebugProperty(name, obvalue, None, hresult, dictionary, stackFrame),
135
+ axdebug.IID_IDebugProperty,
136
+ )
137
+ return name, typ, value, fullname, attrib, dbgprop
138
+
139
+
140
+ from win32com.server.util import ListEnumeratorGateway
141
+
142
+
143
+ class EnumDebugPropertyInfo(ListEnumeratorGateway):
144
+ """A class to expose a Python sequence as an EnumDebugCodeContexts
145
+
146
+ Create an instance of this class passing a sequence (list, tuple, or
147
+ any sequence protocol supporting object) and it will automatically
148
+ support the EnumDebugCodeContexts interface for the object.
149
+
150
+ """
151
+
152
+ _public_methods_ = ListEnumeratorGateway._public_methods_ + ["GetCount"]
153
+ _com_interfaces_ = [axdebug.IID_IEnumDebugPropertyInfo]
154
+
155
+ def GetCount(self):
156
+ return len(self._list_)
157
+
158
+ def _wrap(self, ob):
159
+ return ob
160
+
161
+
162
+ class DebugProperty:
163
+ _com_interfaces_ = [axdebug.IID_IDebugProperty]
164
+ _public_methods_ = [
165
+ "GetPropertyInfo",
166
+ "GetExtendedInfo",
167
+ "SetValueAsString",
168
+ "EnumMembers",
169
+ "GetParent",
170
+ ]
171
+
172
+ def __init__(
173
+ self, name, value, parent=None, hresult=0, dictionary=None, stackFrame=None
174
+ ):
175
+ self.name = name
176
+ self.value = value
177
+ self.parent = parent
178
+ self.hresult = hresult
179
+ self.dictionary = dictionary
180
+ self.stackFrame = stackFrame
181
+
182
+ def GetPropertyInfo(self, dwFieldSpec, nRadix):
183
+ return GetPropertyInfo(
184
+ self.name,
185
+ self.value,
186
+ dwFieldSpec,
187
+ nRadix,
188
+ self.hresult,
189
+ self.dictionary,
190
+ self.stackFrame,
191
+ )
192
+
193
+ def GetExtendedInfo(self): ### Note - not in the framework.
194
+ RaiseNotImpl("DebugProperty::GetExtendedInfo")
195
+
196
+ def SetValueAsString(self, value, radix):
197
+ if self.stackFrame and self.dictionary:
198
+ self.dictionary[self.name] = eval(
199
+ value, self.stackFrame.f_globals, self.stackFrame.f_locals
200
+ )
201
+ else:
202
+ RaiseNotImpl("DebugProperty::SetValueAsString")
203
+
204
+ def EnumMembers(self, dwFieldSpec, nRadix, iid):
205
+ # Returns IEnumDebugPropertyInfo
206
+ return MakeEnumDebugProperty(
207
+ self.value, dwFieldSpec, nRadix, iid, self.stackFrame
208
+ )
209
+
210
+ def GetParent(self):
211
+ # return IDebugProperty
212
+ RaiseNotImpl("DebugProperty::GetParent")
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/gateways.py ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Classes which describe interfaces.
2
+
3
+ import pythoncom
4
+ import win32com.server.connect
5
+ import winerror
6
+ from win32com.axdebug import axdebug
7
+ from win32com.axdebug.util import RaiseNotImpl, _wrap
8
+ from win32com.server.exception import COMException
9
+ from win32com.server.util import ListEnumeratorGateway
10
+
11
+
12
+ class EnumDebugCodeContexts(ListEnumeratorGateway):
13
+ """A class to expose a Python sequence as an EnumDebugCodeContexts
14
+
15
+ Create an instance of this class passing a sequence (list, tuple, or
16
+ any sequence protocol supporting object) and it will automatically
17
+ support the EnumDebugCodeContexts interface for the object.
18
+
19
+ """
20
+
21
+ _com_interfaces_ = [axdebug.IID_IEnumDebugCodeContexts]
22
+
23
+
24
+ class EnumDebugStackFrames(ListEnumeratorGateway):
25
+ """A class to expose a Python sequence as an EnumDebugStackFrames
26
+
27
+ Create an instance of this class passing a sequence (list, tuple, or
28
+ any sequence protocol supporting object) and it will automatically
29
+ support the EnumDebugStackFrames interface for the object.
30
+
31
+ """
32
+
33
+ _com_interfaces_ = [axdebug.IID_IEnumDebugStackFrames]
34
+
35
+
36
+ class EnumDebugApplicationNodes(ListEnumeratorGateway):
37
+ """A class to expose a Python sequence as an EnumDebugStackFrames
38
+
39
+ Create an instance of this class passing a sequence (list, tuple, or
40
+ any sequence protocol supporting object) and it will automatically
41
+ support the EnumDebugApplicationNodes interface for the object.
42
+
43
+ """
44
+
45
+ _com_interfaces_ = [axdebug.IID_IEnumDebugApplicationNodes]
46
+
47
+
48
+ class EnumRemoteDebugApplications(ListEnumeratorGateway):
49
+ _com_interfaces_ = [axdebug.IID_IEnumRemoteDebugApplications]
50
+
51
+
52
+ class EnumRemoteDebugApplicationThreads(ListEnumeratorGateway):
53
+ _com_interfaces_ = [axdebug.IID_IEnumRemoteDebugApplicationThreads]
54
+
55
+
56
+ class DebugDocumentInfo:
57
+ _public_methods_ = ["GetName", "GetDocumentClassId"]
58
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentInfo]
59
+
60
+ def __init__(self):
61
+ pass
62
+
63
+ def GetName(self, dnt):
64
+ """Get the one of the name of the document
65
+ dnt -- int DOCUMENTNAMETYPE
66
+ """
67
+ RaiseNotImpl("GetName")
68
+
69
+ def GetDocumentClassId(self):
70
+ """
71
+ Result must be an IID object (or string representing one).
72
+ """
73
+ RaiseNotImpl("GetDocumentClassId")
74
+
75
+
76
+ class DebugDocumentProvider(DebugDocumentInfo):
77
+ _public_methods_ = DebugDocumentInfo._public_methods_ + ["GetDocument"]
78
+ _com_interfaces_ = DebugDocumentInfo._com_interfaces_ + [
79
+ axdebug.IID_IDebugDocumentProvider
80
+ ]
81
+
82
+ def GetDocument(self):
83
+ RaiseNotImpl("GetDocument")
84
+
85
+
86
+ class DebugApplicationNode(DebugDocumentProvider):
87
+ """Provides the functionality of IDebugDocumentProvider, plus a context within a project tree."""
88
+
89
+ _public_methods_ = (
90
+ """EnumChildren GetParent SetDocumentProvider
91
+ Close Attach Detach""".split()
92
+ + DebugDocumentProvider._public_methods_
93
+ )
94
+ _com_interfaces_ = [
95
+ axdebug.IID_IDebugDocumentProvider
96
+ ] + DebugDocumentProvider._com_interfaces_
97
+
98
+ def __init__(self):
99
+ DebugDocumentProvider.__init__(self)
100
+
101
+ def EnumChildren(self):
102
+ # Result is type PyIEnumDebugApplicationNodes
103
+ RaiseNotImpl("EnumChildren")
104
+
105
+ def GetParent(self):
106
+ # result is type PyIDebugApplicationNode
107
+ RaiseNotImpl("GetParent")
108
+
109
+ def SetDocumentProvider(self, pddp): # PyIDebugDocumentProvider pddp
110
+ # void result.
111
+ RaiseNotImpl("SetDocumentProvider")
112
+
113
+ def Close(self):
114
+ # void result.
115
+ RaiseNotImpl("Close")
116
+
117
+ def Attach(self, parent): # PyIDebugApplicationNode
118
+ # void result.
119
+ RaiseNotImpl("Attach")
120
+
121
+ def Detach(self):
122
+ # void result.
123
+ RaiseNotImpl("Detach")
124
+
125
+
126
+ class DebugApplicationNodeEvents:
127
+ """Event interface for DebugApplicationNode object."""
128
+
129
+ _public_methods_ = "onAddChild onRemoveChild onDetach".split()
130
+ _com_interfaces_ = [axdebug.IID_IDebugApplicationNodeEvents]
131
+
132
+ def __init__(self):
133
+ pass
134
+
135
+ def onAddChild(self, child): # PyIDebugApplicationNode
136
+ # void result.
137
+ RaiseNotImpl("onAddChild")
138
+
139
+ def onRemoveChild(self, child): # PyIDebugApplicationNode
140
+ # void result.
141
+ RaiseNotImpl("onRemoveChild")
142
+
143
+ def onDetach(self):
144
+ # void result.
145
+ RaiseNotImpl("onDetach")
146
+
147
+ def onAttach(self, parent): # PyIDebugApplicationNode
148
+ # void result.
149
+ RaiseNotImpl("onAttach")
150
+
151
+
152
+ class DebugDocument(DebugDocumentInfo):
153
+ """The base interface to all debug documents."""
154
+
155
+ _public_methods_ = DebugDocumentInfo._public_methods_
156
+ _com_interfaces_ = [axdebug.IID_IDebugDocument] + DebugDocumentInfo._com_interfaces_
157
+
158
+
159
+ class DebugDocumentText(DebugDocument):
160
+ """The interface to a text only debug document."""
161
+
162
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentText] + DebugDocument._com_interfaces_
163
+ _public_methods_ = [
164
+ "GetDocumentAttributes",
165
+ "GetSize",
166
+ "GetPositionOfLine",
167
+ "GetLineOfPosition",
168
+ "GetText",
169
+ "GetPositionOfContext",
170
+ "GetContextOfPosition",
171
+ ] + DebugDocument._public_methods_
172
+
173
+ def __init__(self):
174
+ pass
175
+
176
+ # IDebugDocumentText
177
+ def GetDocumentAttributes(self):
178
+ # Result is int (TEXT_DOC_ATTR)
179
+ RaiseNotImpl("GetDocumentAttributes")
180
+
181
+ def GetSize(self):
182
+ # Result is (numLines, numChars)
183
+ RaiseNotImpl("GetSize")
184
+
185
+ def GetPositionOfLine(self, cLineNumber):
186
+ # Result is int char position
187
+ RaiseNotImpl("GetPositionOfLine")
188
+
189
+ def GetLineOfPosition(self, charPos):
190
+ # Result is int, int (lineNo, offset)
191
+ RaiseNotImpl("GetLineOfPosition")
192
+
193
+ def GetText(self, charPos, maxChars, wantAttr):
194
+ """Params
195
+ charPos -- integer
196
+ maxChars -- integer
197
+ wantAttr -- Should the function compute attributes.
198
+
199
+ Return value must be (string, attribtues). attributes may be
200
+ None if(not wantAttr)
201
+ """
202
+ RaiseNotImpl("GetText")
203
+
204
+ def GetPositionOfContext(self, debugDocumentContext):
205
+ """Params
206
+ debugDocumentContext -- a PyIDebugDocumentContext object.
207
+
208
+ Return value must be (charPos, numChars)
209
+ """
210
+ RaiseNotImpl("GetPositionOfContext")
211
+
212
+ def GetContextOfPosition(self, charPos, maxChars):
213
+ """Params are integers.
214
+ Return value must be PyIDebugDocumentContext object
215
+ """
216
+ print(self)
217
+ RaiseNotImpl("GetContextOfPosition")
218
+
219
+
220
+ class DebugDocumentTextExternalAuthor:
221
+ """Allow external editors to edit file-based debugger documents, and to notify the document when the source file has been changed."""
222
+
223
+ _public_methods_ = ["GetPathName", "GetFileName", "NotifyChanged"]
224
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentTextExternalAuthor]
225
+
226
+ def __init__(self):
227
+ pass
228
+
229
+ def GetPathName(self):
230
+ """Return the full path (including file name) to the document's source file.
231
+
232
+ Result must be (filename, fIsOriginal), where
233
+ - if fIsOriginalPath is TRUE if the path refers to the original file for the document.
234
+ - if fIsOriginalPath is FALSE if the path refers to a newly created temporary file.
235
+
236
+ raise COMException(winerror.E_FAIL) if no source file can be created/determined.
237
+ """
238
+ RaiseNotImpl("GetPathName")
239
+
240
+ def GetFileName(self):
241
+ """Return just the name of the document, with no path information. (Used for "Save As...")
242
+
243
+ Result is a string
244
+ """
245
+ RaiseNotImpl("GetFileName")
246
+
247
+ def NotifyChanged(self):
248
+ """Notify the host that the document's source file has been saved and
249
+ that its contents should be refreshed.
250
+ """
251
+ RaiseNotImpl("NotifyChanged")
252
+
253
+
254
+ class DebugDocumentTextEvents:
255
+ _public_methods_ = """onDestroy onInsertText onRemoveText
256
+ onReplaceText onUpdateTextAttributes
257
+ onUpdateDocumentAttributes""".split()
258
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentTextEvents]
259
+
260
+ def __init__(self):
261
+ pass
262
+
263
+ def onDestroy(self):
264
+ # Result is void.
265
+ RaiseNotImpl("onDestroy")
266
+
267
+ def onInsertText(self, cCharacterPosition, cNumToInsert):
268
+ # Result is void.
269
+ RaiseNotImpl("onInsertText")
270
+
271
+ def onRemoveText(self, cCharacterPosition, cNumToRemove):
272
+ # Result is void.
273
+ RaiseNotImpl("onRemoveText")
274
+
275
+ def onReplaceText(self, cCharacterPosition, cNumToReplace):
276
+ # Result is void.
277
+ RaiseNotImpl("onReplaceText")
278
+
279
+ def onUpdateTextAttributes(self, cCharacterPosition, cNumToUpdate):
280
+ # Result is void.
281
+ RaiseNotImpl("onUpdateTextAttributes")
282
+
283
+ def onUpdateDocumentAttributes(self, textdocattr): # TEXT_DOC_ATTR
284
+ # Result is void.
285
+ RaiseNotImpl("onUpdateDocumentAttributes")
286
+
287
+
288
+ class DebugDocumentContext:
289
+ _public_methods_ = ["GetDocument", "EnumCodeContexts"]
290
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentContext]
291
+
292
+ def __init__(self):
293
+ pass
294
+
295
+ def GetDocument(self):
296
+ """Return value must be a PyIDebugDocument object"""
297
+ RaiseNotImpl("GetDocument")
298
+
299
+ def EnumCodeContexts(self):
300
+ """Return value must be a PyIEnumDebugCodeContexts object"""
301
+ RaiseNotImpl("EnumCodeContexts")
302
+
303
+
304
+ class DebugCodeContext:
305
+ _public_methods_ = ["GetDocumentContext", "SetBreakPoint"]
306
+ _com_interfaces_ = [axdebug.IID_IDebugCodeContext]
307
+
308
+ def __init__(self):
309
+ pass
310
+
311
+ def GetDocumentContext(self):
312
+ """Return value must be a PyIDebugDocumentContext object"""
313
+ RaiseNotImpl("GetDocumentContext")
314
+
315
+ def SetBreakPoint(self, bps):
316
+ """bps -- an integer with flags."""
317
+ RaiseNotImpl("SetBreakPoint")
318
+
319
+
320
+ class DebugStackFrame:
321
+ """Abstraction representing a logical stack frame on the stack of a thread."""
322
+
323
+ _public_methods_ = [
324
+ "GetCodeContext",
325
+ "GetDescriptionString",
326
+ "GetLanguageString",
327
+ "GetThread",
328
+ "GetDebugProperty",
329
+ ]
330
+ _com_interfaces_ = [axdebug.IID_IDebugStackFrame]
331
+
332
+ def __init__(self):
333
+ pass
334
+
335
+ def GetCodeContext(self):
336
+ """Returns the current code context associated with the stack frame.
337
+
338
+ Return value must be a IDebugCodeContext object
339
+ """
340
+ RaiseNotImpl("GetCodeContext")
341
+
342
+ def GetDescriptionString(self, fLong):
343
+ """Returns a textual description of the stack frame.
344
+
345
+ fLong -- A flag indicating if the long name is requested.
346
+ """
347
+ RaiseNotImpl("GetDescriptionString")
348
+
349
+ def GetLanguageString(self):
350
+ """Returns a short or long textual description of the language.
351
+
352
+ fLong -- A flag indicating if the long name is requested.
353
+ """
354
+ RaiseNotImpl("GetLanguageString")
355
+
356
+ def GetThread(self):
357
+ """Returns the thread associated with this stack frame.
358
+
359
+ Result must be a IDebugApplicationThread
360
+ """
361
+ RaiseNotImpl("GetThread")
362
+
363
+ def GetDebugProperty(self):
364
+ RaiseNotImpl("GetDebugProperty")
365
+
366
+
367
+ class DebugDocumentHost:
368
+ """The interface from the IDebugDocumentHelper back to
369
+ the smart host or language engine. This interface
370
+ exposes host specific functionality such as syntax coloring.
371
+ """
372
+
373
+ _public_methods_ = [
374
+ "GetDeferredText",
375
+ "GetScriptTextAttributes",
376
+ "OnCreateDocumentContext",
377
+ "GetPathName",
378
+ "GetFileName",
379
+ "NotifyChanged",
380
+ ]
381
+ _com_interfaces_ = [axdebug.IID_IDebugDocumentHost]
382
+
383
+ def __init__(self):
384
+ pass
385
+
386
+ def GetDeferredText(self, dwTextStartCookie, maxChars, bWantAttr):
387
+ RaiseNotImpl("GetDeferredText")
388
+
389
+ def GetScriptTextAttributes(self, codeText, delimterText, flags):
390
+ # Result must be an attribute sequence of same "length" as the code.
391
+ RaiseNotImpl("GetScriptTextAttributes")
392
+
393
+ def OnCreateDocumentContext(self):
394
+ # Result must be a PyIUnknown
395
+ RaiseNotImpl("OnCreateDocumentContext")
396
+
397
+ def GetPathName(self):
398
+ # Result must be (string, int) where the int is a BOOL
399
+ # - TRUE if the path refers to the original file for the document.
400
+ # - FALSE if the path refers to a newly created temporary file.
401
+ # - raise COMException(scode=E_FAIL) if no source file can be created/determined.
402
+ RaiseNotImpl("GetPathName")
403
+
404
+ def GetFileName(self):
405
+ # Result is a string with just the name of the document, no path information.
406
+ RaiseNotImpl("GetFileName")
407
+
408
+ def NotifyChanged(self):
409
+ RaiseNotImpl("NotifyChanged")
410
+
411
+
412
+ # Additional gateway related functions.
413
+
414
+
415
+ class DebugDocumentTextConnectServer:
416
+ _public_methods_ = (
417
+ win32com.server.connect.IConnectionPointContainer_methods
418
+ + win32com.server.connect.IConnectionPoint_methods
419
+ )
420
+ _com_interfaces_ = [
421
+ pythoncom.IID_IConnectionPoint,
422
+ pythoncom.IID_IConnectionPointContainer,
423
+ ]
424
+
425
+ # IConnectionPoint interfaces
426
+ def __init__(self):
427
+ self.cookieNo = -1
428
+ self.connections = {}
429
+
430
+ def EnumConnections(self):
431
+ RaiseNotImpl("EnumConnections")
432
+
433
+ def GetConnectionInterface(self):
434
+ RaiseNotImpl("GetConnectionInterface")
435
+
436
+ def GetConnectionPointContainer(self):
437
+ return _wrap(self)
438
+
439
+ def Advise(self, pUnk):
440
+ # Creates a connection to the client. Simply allocate a new cookie,
441
+ # find the clients interface, and store it in a dictionary.
442
+ interface = pUnk.QueryInterface(axdebug.IID_IDebugDocumentTextEvents, 1)
443
+ self.cookieNo += 1
444
+ self.connections[self.cookieNo] = interface
445
+ return self.cookieNo
446
+
447
+ def Unadvise(self, cookie):
448
+ # Destroy a connection - simply delete interface from the map.
449
+ try:
450
+ del self.connections[cookie]
451
+ except KeyError:
452
+ return COMException(scode=winerror.E_UNEXPECTED)
453
+
454
+ # IConnectionPointContainer interfaces
455
+ def EnumConnectionPoints(self):
456
+ RaiseNotImpl("EnumConnectionPoints")
457
+
458
+ def FindConnectionPoint(self, iid):
459
+ # Find a connection we support. Only support the single event interface.
460
+ if iid == axdebug.IID_IDebugDocumentTextEvents:
461
+ return _wrap(self)
462
+ raise COMException(scode=winerror.E_NOINTERFACE) # ??
463
+
464
+
465
+ class RemoteDebugApplicationEvents:
466
+ _public_methods_ = [
467
+ "OnConnectDebugger",
468
+ "OnDisconnectDebugger",
469
+ "OnSetName",
470
+ "OnDebugOutput",
471
+ "OnClose",
472
+ "OnEnterBreakPoint",
473
+ "OnLeaveBreakPoint",
474
+ "OnCreateThread",
475
+ "OnDestroyThread",
476
+ "OnBreakFlagChange",
477
+ ]
478
+ _com_interfaces_ = [axdebug.IID_IRemoteDebugApplicationEvents]
479
+
480
+ def OnConnectDebugger(self, appDebugger):
481
+ """appDebugger -- a PyIApplicationDebugger"""
482
+ RaiseNotImpl("OnConnectDebugger")
483
+
484
+ def OnDisconnectDebugger(self):
485
+ RaiseNotImpl("OnDisconnectDebugger")
486
+
487
+ def OnSetName(self, name):
488
+ RaiseNotImpl("OnSetName")
489
+
490
+ def OnDebugOutput(self, string):
491
+ RaiseNotImpl("OnDebugOutput")
492
+
493
+ def OnClose(self):
494
+ RaiseNotImpl("OnClose")
495
+
496
+ def OnEnterBreakPoint(self, rdat):
497
+ """rdat -- PyIRemoteDebugApplicationThread"""
498
+ RaiseNotImpl("OnEnterBreakPoint")
499
+
500
+ def OnLeaveBreakPoint(self, rdat):
501
+ """rdat -- PyIRemoteDebugApplicationThread"""
502
+ RaiseNotImpl("OnLeaveBreakPoint")
503
+
504
+ def OnCreateThread(self, rdat):
505
+ """rdat -- PyIRemoteDebugApplicationThread"""
506
+ RaiseNotImpl("OnCreateThread")
507
+
508
+ def OnDestroyThread(self, rdat):
509
+ """rdat -- PyIRemoteDebugApplicationThread"""
510
+ RaiseNotImpl("OnDestroyThread")
511
+
512
+ def OnBreakFlagChange(self, abf, rdat):
513
+ """abf -- int - one of the axdebug.APPBREAKFLAGS constants
514
+ rdat -- PyIRemoteDebugApplicationThread
515
+ RaiseNotImpl("OnBreakFlagChange")
516
+ """
517
+
518
+
519
+ class DebugExpressionContext:
520
+ _public_methods_ = ["ParseLanguageText", "GetLanguageInfo"]
521
+ _com_interfaces_ = [axdebug.IID_IDebugExpressionContext]
522
+
523
+ def __init__(self):
524
+ pass
525
+
526
+ def ParseLanguageText(self, code, radix, delim, flags):
527
+ """
528
+ result is IDebugExpression
529
+ """
530
+ RaiseNotImpl("ParseLanguageText")
531
+
532
+ def GetLanguageInfo(self):
533
+ """
534
+ result is (string langName, iid langId)
535
+ """
536
+ RaiseNotImpl("GetLanguageInfo")
537
+
538
+
539
+ class DebugExpression:
540
+ _public_methods_ = [
541
+ "Start",
542
+ "Abort",
543
+ "QueryIsComplete",
544
+ "GetResultAsString",
545
+ "GetResultAsDebugProperty",
546
+ ]
547
+ _com_interfaces_ = [axdebug.IID_IDebugExpression]
548
+
549
+ def Start(self, callback):
550
+ """
551
+ callback -- an IDebugExpressionCallback
552
+
553
+ result - void
554
+ """
555
+ RaiseNotImpl("Start")
556
+
557
+ def Abort(self):
558
+ """
559
+ no params
560
+ result -- void
561
+ """
562
+ RaiseNotImpl("Abort")
563
+
564
+ def QueryIsComplete(self):
565
+ """
566
+ no params
567
+ result -- void
568
+ """
569
+ RaiseNotImpl("QueryIsComplete")
570
+
571
+ def GetResultAsString(self):
572
+ RaiseNotImpl("GetResultAsString")
573
+
574
+ def GetResultAsDebugProperty(self):
575
+ RaiseNotImpl("GetResultAsDebugProperty")
576
+
577
+
578
+ class ProvideExpressionContexts:
579
+ _public_methods_ = ["EnumExpressionContexts"]
580
+ _com_interfaces_ = [axdebug.IID_IProvideExpressionContexts]
581
+
582
+ def EnumExpressionContexts(self):
583
+ RaiseNotImpl("EnumExpressionContexts")
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/stackframe.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Support for stack-frames.
2
+
3
+ Provides Implements a nearly complete wrapper for a stack frame.
4
+ """
5
+
6
+ import pythoncom
7
+
8
+ from . import axdebug, expressions, gateways
9
+ from .util import RaiseNotImpl, _wrap, trace
10
+
11
+ # def trace(*args):
12
+ # pass
13
+
14
+
15
+ class EnumDebugStackFrames(gateways.EnumDebugStackFrames):
16
+ """A class that given a debugger object, can return an enumerator
17
+ of DebugStackFrame objects.
18
+ """
19
+
20
+ def __init__(self, debugger):
21
+ infos = []
22
+ frame = debugger.currentframe
23
+ # print("Stack check")
24
+ while frame:
25
+ # print(" Checking frame", frame.f_code.co_filename, frame.f_lineno-1, frame.f_trace)
26
+ # Get a DebugCodeContext for the stack frame. If we fail, then it
27
+ # is not debuggable, and therefore not worth displaying.
28
+ cc = debugger.codeContainerProvider.FromFileName(frame.f_code.co_filename)
29
+ if cc is not None:
30
+ try:
31
+ address = frame.f_locals["__axstack_address__"]
32
+ except KeyError:
33
+ # print("Couldn't find stack address for",frame.f_code.co_filename, frame.f_lineno-1)
34
+ # Use this one, even tho it is wrong :-(
35
+ address = axdebug.GetStackAddress()
36
+ frameInfo = (
37
+ DebugStackFrame(frame, frame.f_lineno - 1, cc),
38
+ address,
39
+ address + 1,
40
+ 0,
41
+ None,
42
+ )
43
+ infos.append(frameInfo)
44
+ # print("- Kept!")
45
+ # else:
46
+ # print("- rejected")
47
+ frame = frame.f_back
48
+
49
+ gateways.EnumDebugStackFrames.__init__(self, infos, 0)
50
+
51
+ # def __del__(self):
52
+ # print("EnumDebugStackFrames dieing")
53
+
54
+ def Next(self, count):
55
+ return gateways.EnumDebugStackFrames.Next(self, count)
56
+
57
+ # def _query_interface_(self, iid):
58
+ # from win32com.util import IIDToInterfaceName
59
+ # print(f"EnumDebugStackFrames QI with {IIDToInterfaceName(iid)} ({iid})")
60
+ # return 0
61
+ def _wrap(self, obj):
62
+ # This enum returns a tuple, with 2 com objects in it.
63
+ obFrame, min, lim, fFinal, obFinal = obj
64
+ obFrame = _wrap(obFrame, axdebug.IID_IDebugStackFrame)
65
+ if obFinal:
66
+ obFinal = _wrap(obFinal, pythoncom.IID_IUnknown)
67
+ return obFrame, min, lim, fFinal, obFinal
68
+
69
+
70
+ class DebugStackFrame(gateways.DebugStackFrame):
71
+ def __init__(self, frame, lineno, codeContainer):
72
+ self.frame = frame
73
+ self.lineno = lineno
74
+ self.codeContainer = codeContainer
75
+ self.expressionContext = None
76
+
77
+ # def __del__(self):
78
+ # print("DSF dieing")
79
+ def _query_interface_(self, iid):
80
+ if iid == axdebug.IID_IDebugExpressionContext:
81
+ if self.expressionContext is None:
82
+ self.expressionContext = _wrap(
83
+ expressions.ExpressionContext(self.frame),
84
+ axdebug.IID_IDebugExpressionContext,
85
+ )
86
+ return self.expressionContext
87
+ # from win32com.util import IIDToInterfaceName
88
+ # print(f"DebugStackFrame QI with {IIDToInterfaceName(iid)} ({iid})")
89
+ return 0
90
+
91
+ #
92
+ # The following need implementation
93
+ def GetThread(self):
94
+ """Returns the thread associated with this stack frame.
95
+
96
+ Result must be a IDebugApplicationThread
97
+ """
98
+ RaiseNotImpl("GetThread")
99
+
100
+ def GetCodeContext(self):
101
+ offset = self.codeContainer.GetPositionOfLine(self.lineno)
102
+ return self.codeContainer.GetCodeContextAtPosition(offset)
103
+
104
+ #
105
+ # The following are usefully implemented
106
+ def GetDescriptionString(self, fLong):
107
+ filename = self.frame.f_code.co_filename
108
+ s = ""
109
+ if 0: # fLong:
110
+ s += filename
111
+ if self.frame.f_code.co_name:
112
+ s += self.frame.f_code.co_name
113
+ else:
114
+ s += "<lambda>"
115
+ return s
116
+
117
+ def GetLanguageString(self, fLong):
118
+ if fLong:
119
+ return "Python ActiveX Scripting Engine"
120
+ else:
121
+ return "Python"
122
+
123
+ def GetDebugProperty(self):
124
+ return _wrap(StackFrameDebugProperty(self.frame), axdebug.IID_IDebugProperty)
125
+
126
+
127
+ class DebugStackFrameSniffer:
128
+ _public_methods_ = ["EnumStackFrames"]
129
+ _com_interfaces_ = [axdebug.IID_IDebugStackFrameSniffer]
130
+
131
+ def __init__(self, debugger):
132
+ self.debugger = debugger
133
+ trace("DebugStackFrameSniffer instantiated")
134
+
135
+ # def __del__(self):
136
+ # print("DSFS dieing")
137
+ def EnumStackFrames(self):
138
+ trace("DebugStackFrameSniffer.EnumStackFrames called")
139
+ return _wrap(
140
+ EnumDebugStackFrames(self.debugger), axdebug.IID_IEnumDebugStackFrames
141
+ )
142
+
143
+
144
+ # A DebugProperty for a stack frame.
145
+ class StackFrameDebugProperty:
146
+ _com_interfaces_ = [axdebug.IID_IDebugProperty]
147
+ _public_methods_ = [
148
+ "GetPropertyInfo",
149
+ "GetExtendedInfo",
150
+ "SetValueAsString",
151
+ "EnumMembers",
152
+ "GetParent",
153
+ ]
154
+
155
+ def __init__(self, frame):
156
+ self.frame = frame
157
+
158
+ def GetPropertyInfo(self, dwFieldSpec, nRadix):
159
+ RaiseNotImpl("StackFrameDebugProperty::GetPropertyInfo")
160
+
161
+ def GetExtendedInfo(self): ### Note - not in the framework.
162
+ RaiseNotImpl("StackFrameDebugProperty::GetExtendedInfo")
163
+
164
+ def SetValueAsString(self, value, radix):
165
+ #
166
+ RaiseNotImpl("DebugProperty::SetValueAsString")
167
+
168
+ def EnumMembers(self, dwFieldSpec, nRadix, iid):
169
+ print("EnumMembers", dwFieldSpec, nRadix, iid)
170
+ from . import expressions
171
+
172
+ return expressions.MakeEnumDebugProperty(
173
+ self.frame.f_locals, dwFieldSpec, nRadix, iid, self.frame
174
+ )
175
+
176
+ def GetParent(self):
177
+ # return IDebugProperty
178
+ RaiseNotImpl("DebugProperty::GetParent")
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axdebug/util.py ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Utility function for wrapping objects. Centralising allows me to turn
2
+ # debugging on and off for the entire package in a single spot.
3
+
4
+ import os
5
+ import sys
6
+ import traceback
7
+
8
+ import win32api
9
+ import win32com.server.dispatcher
10
+ import win32com.server.policy
11
+ import win32com.server.util
12
+ import winerror
13
+ from win32com.server.exception import COMException
14
+
15
+ debugging = "DEBUG_AXDEBUG" in os.environ
16
+
17
+
18
+ def trace(*args):
19
+ if not debugging:
20
+ return
21
+ print(str(win32api.GetCurrentThreadId()) + ":", end=" ")
22
+ for arg in args:
23
+ print(arg, end=" ")
24
+ print()
25
+
26
+
27
+ # The AXDebugging implementation assumes that the returned COM pointers are in
28
+ # some cases identical. Eg, from a C++ perspective:
29
+ # p->GetSomeInterface( &p1 );
30
+ # p->GetSomeInterface( &p2 );
31
+ # p1==p2
32
+ # By default, this is _not_ true for Python.
33
+ # (Now this is only true for Document objects, and Python
34
+ # now does ensure this.
35
+
36
+
37
+ def _wrap(object, iid):
38
+ useDispatcher = win32com.server.policy.DispatcherWin32trace if debugging else None
39
+ return win32com.server.util.wrap(object, iid, useDispatcher=useDispatcher)
40
+
41
+
42
+ def RaiseNotImpl(who=None):
43
+ if who is not None:
44
+ print(f"********* Function {who} Raising E_NOTIMPL ************")
45
+
46
+ # Print a sort-of "traceback", dumping all the frames leading to here.
47
+ for frame, i in traceback.walk_stack(sys._getframe()):
48
+ print(f"File: {frame.f_code.co_filename}, Line: {frame.f_lineno}")
49
+
50
+ # and raise the exception for COM
51
+ raise COMException(scode=winerror.E_NOTIMPL)
52
+
53
+
54
+ class Dispatcher(win32com.server.dispatcher.DispatcherWin32trace):
55
+ def __init__(self, policyClass, object):
56
+ win32com.server.dispatcher.DispatcherTrace.__init__(self, policyClass, object)
57
+ import win32traceutil # Sets up everything.
58
+
59
+ # print(f"Object with win32trace dispatcher created ({object})")
60
+
61
+ def _QueryInterface_(self, iid):
62
+ rc = win32com.server.policy.DispatcherBase._QueryInterface_(self, iid)
63
+ # if not rc:
64
+ # self._trace_(f"in _QueryInterface_ with unsupported IID {IIDToInterfaceName(iid)} ({iid})\n")
65
+ return rc
66
+
67
+ def _Invoke_(self, dispid, lcid, wFlags, args):
68
+ print(
69
+ "In Invoke with",
70
+ dispid,
71
+ lcid,
72
+ wFlags,
73
+ args,
74
+ "with object",
75
+ self.policy._obj_,
76
+ )
77
+ try:
78
+ rc = win32com.server.policy.DispatcherBase._Invoke_(
79
+ self, dispid, lcid, wFlags, args
80
+ )
81
+ # print("Invoke of", dispid, "returning", rc)
82
+ return rc
83
+ except COMException:
84
+ t, v, tb = sys.exc_info()
85
+ tb = None # A cycle
86
+ scode = v.scode
87
+ try:
88
+ desc = f" ({v.description})"
89
+ except AttributeError:
90
+ desc = ""
91
+ print(f"*** Invoke of {dispid} raised COM exception 0x{scode:x}{desc}")
92
+ except:
93
+ print(f"*** Invoke of {dispid} failed:")
94
+ typ, val, tb = sys.exc_info()
95
+ import traceback
96
+
97
+ traceback.print_exception(typ, val, tb)
98
+ raise
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/CreateObject.asp ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+
3
+ <SCRIPT Language="Python" RUNAT=Server>
4
+
5
+ # Just for the sake of the demo, our Python script engine
6
+ # will create a Python.Interpreter COM object, and call that.
7
+
8
+ # This is completely useless, as the Python Script Engine is
9
+ # completely normal Python, and ASP does not impose retrictions, so
10
+ # there is nothing the COM object can do that we can not do natively.
11
+
12
+ o = Server.CreateObject("Python.Interpreter")
13
+
14
+ Response.Write("Python says 1+1=" + str(o.Eval("1+1")))
15
+
16
+ </SCRIPT>
17
+
18
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/caps.asp ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <%@ Language=Python %>
2
+ <HTML>
3
+
4
+ <HEAD>
5
+
6
+ <BODY BACKGROUND="/samples/images/backgrnd.gif">
7
+
8
+ <TITLE>Python test</TITLE>
9
+
10
+ </HEAD>
11
+
12
+ <BODY BGCOLOR="FFFFFF">
13
+
14
+ <SCRIPT Language="Python" RUNAT=Server>
15
+ # NOTE that the <% tags below execute _before_ these tags!
16
+ Response.Write("Hello from Python<P>")
17
+ Response.Write("Browser is "+bc.browser)
18
+ import win32api # Should be no problem using win32api in ASP pages.
19
+ Response.Write("<p>Win32 username is "+win32api.GetUserName())
20
+ </SCRIPT>
21
+
22
+ <BODY BGCOLOR="FFFFFF">
23
+
24
+ <%
25
+ import sys
26
+ print(sys.path)
27
+ from win32com.axscript.asputil import *
28
+ print("Hello")
29
+ print("There")
30
+ print("How are you")
31
+ %>
32
+
33
+ <%bc = Server.CreateObject("MSWC.BrowserType")%>
34
+ <BODY BGCOLOR="FFFFFF">
35
+ <table border=1>
36
+ <tr><td>Browser</td><td> <%=bc.browser %>
37
+ <tr><td>Version</td><td> <%=bc.version %> </td></TR>
38
+ <tr><td>Frames</td><td>
39
+ <%Response.Write( iif(bc.frames, "TRUE", "FALSE")) %></td></TR>
40
+ <tr><td>Tables</td><td>
41
+ <%Response.Write( iif (bc.tables, "TRUE", "FALSE")) %></td></TR>
42
+ <tr><td>BackgroundSounds</td><td>
43
+ <%Response.Write( iif(bc.BackgroundSounds, "TRUE", "FALSE"))%></td></TR>
44
+ <tr><td>VBScript</td><td>
45
+ <%Response.Write( iif(bc.vbscript, "TRUE", "FALSE"))%></td></TR>
46
+ <tr><td>JavaScript</td><td>
47
+ <%Response.Write( iif(bc.javascript, "TRUE", "FALSE"))%></td></TR>
48
+
49
+ </table>
50
+
51
+ </body>
52
+ </html>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test.asp ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <%@ language=python%>
2
+ <html>
3
+ <%Response.Redirect("test1.html")%>
4
+ </html>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test.html ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <body>
4
+ GOT There
5
+ <script language=javascript>
6
+ location.href ="http://192.168.0.1/Python/interrupt/test.asp"
7
+ </script>
8
+ </body>
9
+ </head>
10
+ </html>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test1.asp ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <%@ language =Python%>
2
+ <html>
3
+ <head>
4
+ <%Response.Redirect("test.html")%>
5
+ </head>
6
+ </html>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/interrupt/test1.html ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <body>
4
+ GOT HERE
5
+ <script language=javascript>
6
+ location.href ="http://192.168.0.1/Python/interrupt/test1.asp"
7
+ </script>
8
+ </body>
9
+ </head>
10
+ </html>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/asp/tut1.asp ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+
3
+ <SCRIPT Language="Python" RUNAT=Server>
4
+
5
+ for i in range(3,8):
6
+ Response.Write("<FONT SIZE=%d>Hello World!!<BR>" % i)
7
+
8
+ </SCRIPT>
9
+
10
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/CHARTPY.HTM ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ original Author: Bill Rollins
3
+ adapted for python by aaron watters
4
+ Purpose: This HTML example shows how to use Microsoft's ActiveX Chart control.
5
+ Properties of the control are changed using sub procedures called
6
+ by radio buttons and check boxes. The AboutBox method is called from
7
+ a command button.
8
+ Created: 3/16/96
9
+ Edited: 3/19/96 - VBScript code edited so there is only one procedure for each property.
10
+ 3/23/96 - Font sizes changed in title. Added text to the Notes section.
11
+ 6/01/96 - Change OBJECT tag to match E3 Beta requirements
12
+ -->
13
+
14
+
15
+ <HTML>
16
+ <HEAD>
17
+ <TITLE>ActiveX / VBScript Chart Example</TITLE>
18
+ </HEAD>
19
+
20
+ <BODY BGCOLOR=#FFFFCC TEXT=#000000>
21
+
22
+ <B><FONT SIZE=6>Chart Example</FONT></B><BR>
23
+ <FONT SIZE=2>You must be running Microsoft Internet Explorer 3.0 and have the Microsoft ActiveX Chart Control installed to view this page.</FONT><BR>
24
+ <P>
25
+ The chart control enables you to draw charts. The chart's types and styles are properties of the control. The chart has one method, AboutBox. The chart generates no events.
26
+
27
+ <HR>
28
+
29
+ <OBJECT
30
+ classid="clsid:FC25B780-75BE-11CF-8B01-444553540000"
31
+ CODEBASE="http://activex.microsoft.com/controls/iexplorer/iechart.ocx#Version=4,70,0,1161"
32
+ TYPE="application/x-oleobject"
33
+ id=Chart1
34
+ width=200
35
+ height=200
36
+ align=left
37
+ hspace=0
38
+ vspace=0
39
+ >
40
+
41
+ <param name="_extentX" value="300">
42
+ <param name="_extentY" value="150">
43
+ <param name="ChartStyle" value="0">
44
+ <param name="ChartType" value="4">
45
+ <param name="hgridStyle" value="0">
46
+ <param name="vgridStyle" value="0">
47
+ <param name="colorscheme" value="0">
48
+ <param name="rows" value="2">
49
+ <param name="columns" value="4">
50
+ <param name="data[0][0]" value="30">
51
+ <param name="data[0][1]" value="2">
52
+ <param name="data[0][2]" value="20">
53
+ <param name="data[0][3]" value="40">
54
+ <param name="data[1][0]" value="15">
55
+ <param name="data[1][1]" value="33">
56
+ <param name="data[1][2]" value="21">
57
+ <param name="data[1][3]" value="45">
58
+ <param name="BackStyle" value="1">
59
+
60
+
61
+ </object>
62
+
63
+
64
+ <SCRIPT LANGUAGE="Python">
65
+
66
+
67
+ # Calls the AboutBox Method. This displays the Chart Object About Box
68
+ def DoChartAboutBox():
69
+ ax.Chart1.AboutBox()
70
+
71
+ # Changes the type of chart. WhatType is passed as a value (0-5) when one of the Chart Type radio buttons is selected
72
+ def DoChartType(WhatType):
73
+ ax.Chart1.ChartType = WhatType
74
+
75
+ # Turns horizontal gridlines on or off depending on value of chkHorizontal checkbox
76
+ def DoHorizontalGrid():
77
+ print(ax.chkHorizontal.Checked)
78
+ if ax.chkHorizontal.Checked:
79
+ ax.Chart1.HGridStyle = 1
80
+ else:
81
+ ax.Chart1.HGridStyle = 0
82
+
83
+ # Sets the background of the chart to Opaque or Transparent
84
+ def DoBackground(intBackGround):
85
+ ax.Chart1.BackStyle = intBackGround
86
+
87
+ # Turns vertical gridlines on or off depending on value of chkVertical checkbox
88
+ def DoVerticalGrid():
89
+ if ax.chkVertical.Checked:
90
+ ax.Chart1.VGridStyle = 1
91
+ else:
92
+ ax.Chart1.VGridStyle = 0
93
+
94
+ </SCRIPT>
95
+
96
+
97
+
98
+ <TABLE BORDER = 0 XBORDER=5 BGCOLOR="#FFFFCC" WIDTH=300 ALIGN=LEFT>
99
+ <TR><TD colspan=2 BGCOLOR=NAVY ALIGN=CENTER><FONT COLOR=FFFFCC>Chart Type</TR>
100
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(0)"> Simple Pie </TD>
101
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(11)"> Simple Column </TD></TR>
102
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(1)"> Pie with Wedge Out </TD>
103
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(12)"> Stacked Column </TD></TR>
104
+
105
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(2)"> Simple Point </TD>
106
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(13)"> Full Column </TD></TR>
107
+
108
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(3)"> Stacked Point </TD>
109
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(14)"> Simple Bar </TD></TR>
110
+
111
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(4)"> Full Point </TD>
112
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(15)"> Stacked Bar </TD></TR>
113
+
114
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(5)"> Simple Line </TD>
115
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(16)"> Full Bar </TD></TR>
116
+
117
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(6)"> Stacked Line </TD>
118
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(17)"> HLC Stock </TD></TR>
119
+
120
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(7)"> Full Line </TD>
121
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(18)"> HLC Stock WSJ</TD></TR>
122
+
123
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(8)"> Simple Area </TD>
124
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(19)"> OHLC Stock </TD></TR>
125
+
126
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(9)"> Stack Area </TD>
127
+ <TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(20)"> OHLC Stock WSJ </TD></TR>
128
+
129
+ <TR><TD><INPUT TYPE=RADIO NAME=ChartType onClick="DoChartType(10)"> Full Area </TD></TR>
130
+ </TABLE>
131
+
132
+
133
+
134
+
135
+
136
+ <TABLE XBORDER=5 WIDTH=125 BGCOLOR="#FFFFCC" ALIGN=LEFT>
137
+ <TR><TD BGCOLOR=NAVY ALIGN=CENTER><FONT COLOR=FFFFCC>Gridlines</TR>
138
+ <TR><TD><INPUT TYPE=CHECKBOX NAME="chkHorizontal" onClick="DoHorizontalGrid()">Horizontal</TD></TR>
139
+ <TR><TD><INPUT TYPE=CHECKBOX NAME="chkVertical" onClick="DoVerticalGrid()">Vertical</TD></TR>
140
+ <TR><TD BGCOLOR=NAVY ALIGN=CENTER><FONT COLOR=FFFFCC>Background</TR>
141
+ <TR><TD><INPUT TYPE=RADIO NAME=BackStyle onClick="DoBackground(1)">Opaque</TD></TR>
142
+ <TR><TD><INPUT TYPE=RADIO NAME=BackStyle onClick="DoBackground(0)">Transparent</TD></TR>
143
+
144
+ </TABLE>
145
+
146
+ <BR CLEAR=ALL>
147
+ <BR>
148
+
149
+ <INPUT TYPE=BUTTON VALUE="About Chart Control" NAME="cdmChartAboutBox" onClick="DoChartAboutBox()">
150
+
151
+ <BR CLEAR=ALL>
152
+ <BR><BR>
153
+
154
+ <HR>
155
+ <B><FONT SIZE=4>Notes</FONT></B><BR>
156
+ The chart's properties on this page are changed by selecting the various radio buttons and check boxes. The OnClick event of these intrinsic controls calls VBScript procedures that change the chart properties.<BR>
157
+ <P>
158
+ The About Chart Control command button calls the chart's AboutBox method.<BR>
159
+ <P>
160
+ To view the source code for this page, select <SAMP>Source</SAMP> from the <SAMP>View</SAMP> menu.<BR>
161
+ <P>
162
+ If you have any questions or comments about this example, please send them to <A HREF ="mailto:billr@smart.net">billr@smart.net</A>. We would appreciate feedback and would like to hear about other developers' experiences with these new tools.<BR>
163
+
164
+
165
+ <HR>
166
+
167
+ </BODY>
168
+
169
+
170
+
171
+ <ADDRESS>
172
+ <FONT SIZE=2>
173
+ &copy; 1996 Rollins & Associates, Inc.<BR>
174
+ Page last updated 08/28/96<BR>
175
+ Please send comments to <A HREF ="mailto:billr@smart.net">billr@smart.net</A><BR>
176
+ </FONT>
177
+ </ADDRESS>
178
+
179
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/FOO.HTM ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+ Let's try this out:
4
+
5
+ <FORM>
6
+ <INPUT NAME="Button1" TYPE="Button" OnClick="foo1" LANGUAGE="VBScript">
7
+ <FORM METHOD="GET" NAME="MyForm">
8
+ <INPUT TYPE="TEXT" NAME="Text1" SIZE=25>
9
+ <INPUT TYPE="SUBMIT">
10
+ <INPUT NAME="Button2" TYPE="Button" VALUE="Hi" OnClick="text2.value=window.document.location" LANGUAGE="VBScript">
11
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Text2">
12
+ </FORM>
13
+ And here is a second form
14
+ <P>
15
+ <FORM NAME="Form2" METHOD="GET">
16
+ <INPUT NAME="Button2" TYPE="Button" VALUE="Hi" OnClick="button2.value=window.document.location" LANGUAGE="VBScript">
17
+ </FORM><BR>
18
+
19
+ <SCRIPT LANGUAGE="JScript">
20
+ y=15
21
+ </SCRIPT>
22
+
23
+ <SCRIPT LANGUAGE="VBScript">
24
+ x = 13
25
+ Sub foo1
26
+ Dim y
27
+ y = 14
28
+ alert "Hello"
29
+ End Sub
30
+
31
+ Sub Window_OnLoad
32
+ foo1
33
+ MyForm.button2.value = "Loaded"
34
+ Form2.button2.value = "Loaded"
35
+ End Sub
36
+ Sub Link_MouseMove(b, s, x, y)
37
+ MsgBox b
38
+ End Sub
39
+ </SCRIPT>
40
+
41
+ <SCRIPT LANGUAGE="Python">
42
+ print("Python loaded")
43
+ </SCRIPT>
44
+
45
+ </BODY>
46
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/MarqueeText1.htm ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <HEAD>
3
+ <base target="text">
4
+ <TITLE> Internet Workshop </TITLE>
5
+ </HEAD>
6
+ <BODY leftmargin=8 bgcolor="#FFFFFF" VLINK="#666666" LINK="#FF0000">
7
+ <FONT FACE="ARIAL,HELVETICA" SIZE="2">
8
+
9
+ <P>
10
+ <BR>
11
+ <P><FONT FACE="ARIAL,HELVETICA" SIZE="5"><B>Python AX Script Engine</B></FONT>
12
+ <BR>Demo using the Marquee Control
13
+ <BR>Mark Hammond.
14
+
15
+ <P>This is really quite a boring demo, as the Marquee control does everything. However, there is Python code behind the buttons that change the speed. This code is all of 2 lines per button!!!
16
+
17
+ <P>For more information on Python as an ActiveX scripting language, see
18
+
19
+ <P><B>Python</B>
20
+ <BR><A HREF="https://www.python.org">https://www.python.org</A>
21
+
22
+ </FONT>
23
+ </BODY>
24
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/calc.htm ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <HEAD><TITLE>Python Script sample: Calculator</TITLE></HEAD>
3
+ <BODY><FONT FACE=ARIAL SIZE=3> <!-- global default -->
4
+ <SCRIPT LANGUAGE="Python">
5
+ # globals
6
+ Accum = 0.0 # Previous number (operand) awaiting operation
7
+ FlagNewNum = 1 # Flag to indicate a new number (operand) is being entered
8
+ NullOp = lambda x,y: y
9
+ PendingOp = NullOp# Pending operation waiting for completion of second operand
10
+ numberButNames = ['Zero','One','Two','Three','Four','Five','Six','Seven','Eight','Nine']
11
+
12
+ def NumPressed(Num):
13
+ print("NumPressed", Num)
14
+ global FlagNewNum
15
+ if FlagNewNum:
16
+ ax.document.Keypad.ReadOut.Value = Num
17
+ FlagNewNum = None
18
+ else:
19
+ if ax.document.Keypad.ReadOut.Value == "0":
20
+ ax.document.Keypad.ReadOut.Value = str(Num)
21
+ else:
22
+ ax.document.Keypad.ReadOut.Value= ax.document.Keypad.ReadOut.Value + str(Num)
23
+
24
+ # Dynamically create handlers for all the decimal buttons.
25
+ # (ie, this will dynamically create "One_OnClick()"... etc handlers
26
+ for i in range(len(numberButNames)):
27
+ exec "def %s_OnClick():\tNumPressed(%d)\n" % (numberButNames[i],i)
28
+
29
+ def Decimal_OnClick():
30
+ global curReadOut, FlagNewNum
31
+ curReadOut = ax.document.Keypad.ReadOut.Value
32
+ if FlagNewNum:
33
+ curReadOut = "0."
34
+ FlagNewNum = None
35
+ else:
36
+ if not ("." in curReadOut):
37
+ curReadOut = curReadOut + "."
38
+ ax.document.Keypad.ReadOut.Value = curReadOut
39
+
40
+ import sys, string
41
+
42
+ def Operation(Op, fn):
43
+ global FlagNewNum, PendingOp, Accum
44
+ ReadOut = ax.document.Keypad.ReadOut.Value
45
+ print("Operation", Op, ReadOut, PendingOp, Accum)
46
+ if FlagNewNum:
47
+ # User is hitting op keys repeatedly, so don't do anything
48
+ PendingOp = NullOp
49
+ else:
50
+ FlagNewNum = 1
51
+ Accum = PendingOp( Accum, float(ReadOut) )
52
+ ax.document.Keypad.ReadOut.Value = str(Accum)
53
+ PendingOp = fn
54
+
55
+ def ClearEntry_OnClick():
56
+ # Remove current number and reset state
57
+ global FlagNewNum
58
+ ax.document.Keypad.ReadOut.Value = "0"
59
+ FlagNewNum = 1
60
+
61
+ def Clear_OnClick():
62
+ global Accum, PendingOp
63
+ Accum = 0
64
+ PendingOp = NullOp
65
+ ClearEntry_OnClick()
66
+
67
+ def Neg_OnClick():
68
+ ax.document.Keypad.ReadOut.Value = str(-float(ax.document.Keypad.ReadOut.Value))
69
+ </SCRIPT>
70
+
71
+
72
+ <form action="" Name="Keypad">
73
+ <TABLE>
74
+ <B>
75
+ <TABLE BORDER=2 WIDTH=50 HEIGHT=60 CELLPADDING=1 CELLSPACING=5>
76
+ <CAPTION ALIGN=top> <b>Calculator</b><p> </CAPTION>
77
+ <TR>
78
+ <TD COLSPAN=3 ALIGN=MIDDLE><INPUT NAME="ReadOut" TYPE="Text" SIZE=24 VALUE="0" WIDTH=100%></TD>
79
+ <TD></TD>
80
+ <TD><INPUT NAME="Clear" TYPE="Button" VALUE=" C " ></TD>
81
+ <TD><INPUT NAME="ClearEntry" TYPE="Button" VALUE=" CE " ></TD>
82
+ </TR>
83
+ <TR>
84
+ <TD><INPUT NAME="Seven" TYPE="Button" VALUE=" 7 " ></TD>
85
+ <TD><INPUT NAME="Eight" TYPE="Button" VALUE=" 8 " ></TD>
86
+ <TD><INPUT NAME="Nine" TYPE="Button" VALUE=" 9 " ></TD>
87
+ <TD></TD>
88
+ <TD><INPUT NAME="Neg" TYPE="Button" VALUE=" +/- " ></TD>
89
+ <TD><INPUT NAME="Percent" TYPE="Button" VALUE=" % " OnClick="Operation('%', lambda x,y: x*y/100.0)"></TD>
90
+ </TR>
91
+
92
+ <TR>
93
+ <TD><INPUT NAME="Four" TYPE="Button" VALUE=" 4 " ></TD>
94
+ <TD><INPUT NAME="Five" TYPE="Button" VALUE=" 5 " ></TD>
95
+ <TD><INPUT NAME="Six" TYPE="Button" VALUE=" 6 " ></TD>
96
+ <TD></TD>
97
+ <TD ALIGN=MIDDLE><INPUT NAME="Plus" TYPE="Button" VALUE=" + " OnClick="Operation('+', lambda x,y: x+y)"></TD>
98
+ <TD ALIGN=MIDDLE><INPUT NAME="Minus" TYPE="Button" VALUE=" - " OnClick="Operation('-', lambda x,y: x-y)"></TD>
99
+ </TR>
100
+ <TR>
101
+ <TD><INPUT NAME="One" TYPE="Button" VALUE=" 1 " ></TD>
102
+ <TD><INPUT NAME="Two" TYPE="Button" VALUE=" 2 " ></TD>
103
+ <TD><INPUT NAME="Three" TYPE="Button" VALUE=" 3 " ></TD>
104
+ <TD></TD>
105
+ <TD ALIGN=MIDDLE><INPUT NAME="Multiply" TYPE="Button" VALUE=" * " OnClick="Operation('*', lambda x,y: x*y)" ></TD>
106
+ <TD ALIGN=MIDDLE><INPUT NAME="Divide" TYPE="Button" VALUE=" / " OnClick="Operation('/', lambda x,y: x/y)" ></TD>
107
+ </TR>
108
+ <TR>
109
+ <TD><INPUT NAME="Zero" TYPE="Button" VALUE=" 0 " ></TD>
110
+ <TD><INPUT NAME="Decimal" TYPE="Button" VALUE=" . " ></TD>
111
+ <TD COLSPAN=3></TD>
112
+ <TD><INPUT NAME="Equals" TYPE="Button" VALUE=" = " OnClick="Operation('=', lambda x,y: x)"></TD>
113
+ </TR></TABLE></TABLE></B>
114
+ </FORM>
115
+ </FONT></BODY></HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/dbgtest.htm ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+
4
+ <SCRIPT>
5
+ b="Hello There, how are you"
6
+ </SCRIPT>
7
+
8
+ <SCRIPT LANGUAGE="Python">
9
+ print("Hello")
10
+ a="Hi there"
11
+ document.write("Hello<P>")
12
+ alert("Hi there")
13
+ </SCRIPT>
14
+
15
+ </BODY>
16
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo.htm ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <HEAD>
3
+ <TITLE>Python AXScript Demos</TITLE>
4
+ </HEAD>
5
+
6
+
7
+ <SCRIPT LANGUAGE="Python">
8
+ def Window_OnLoad():
9
+ pass
10
+ # import win32traceutil
11
+ # print("Frames are", ax.window.frames._print_details_())
12
+ # print("Frame 0 href = ", ax.frames.Item(0).location.href)
13
+
14
+ def Name_OnLoad():
15
+ print("Frame loading")
16
+
17
+ </SCRIPT>
18
+
19
+ <FRAMESET FRAMEBORDER=1 COLS = "250, *">
20
+ <FRAME SRC="demo_menu.htm">
21
+ <FRAME SRC="demo_check.htm" NAME="Body">
22
+ </FRAMESET>
23
+
24
+
25
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_check.htm ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <H1>Engine Registration</H1>
3
+
4
+ <BODY>
5
+
6
+ <p>The Python ActiveX Scripting Engine is not currently registered.<p>
7
+
8
+ <p>Due to a <a href="https://web.archive.org/web/20080305234321/http://starship.python.net:80/crew/mhammond/win32/PrivacyProblem.html">
9
+ privacy concern</a> discovered in the engine, the use of Python inside IE has been disabled.</p>
10
+
11
+ Before any of the supplied demos will work, the engine must be successfully registered.
12
+
13
+ <P>To install a version of the engine, that does work with IE, you can execute the Python program
14
+ <CODE>win32com\axscript\client\pyscript_rexec.py</CODE> must be run. You can either do this manually, or follow the instructions below.</p>
15
+
16
+ <H2>Register the engine now!</H2>
17
+
18
+ <p>If you have read about the <a href="https://web.archive.org/web/20080305234321/http://starship.python.net:80/crew/mhammond/win32/PrivacyProblem.html">
19
+ privacy concern</a> and still wish to register the engine, just follow the process outlined below:</p>
20
+ <OL>
21
+ <LI>Click on the link below
22
+ <LI><B>A dialog will be presented asking if the file should be opened or saved to disk. Select "Open it".</B>
23
+ <LI>A Console program will briefly open, while the server is registered.
24
+ </OL>
25
+
26
+ <P><A HREF="..\..\..\client\pyscript_rexec.py">Register the engine now</A>
27
+
28
+ <H2>Checking the registration</H2>
29
+ After the registration is complete, simply hit the Reload button. If the
30
+ registration was successful, the page will change to the Python/AvtiveX Demo Page.
31
+
32
+
33
+ <SCRIPT LANGUAGE="Python">
34
+ try:
35
+ window.open("demo_intro.htm", "Body")
36
+ except:
37
+ history.back()
38
+ </SCRIPT>
39
+ </BODY></HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_intro.htm ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+
4
+ <H1>
5
+ <MARQUEE NAME="Marquee1" DIRECTION=LEFT BEHAVIOR=SCROLL SCROLLAMOUNT=10 SCROLLDELAY=200
6
+ >Python ActiveX Scripting Demonstation
7
+ </MARQUEE>
8
+ </H1>
9
+
10
+ <p>Congratulations on installing the Python ActiveX Scripting Engine</p>
11
+
12
+ <p>Be warned that there is a <a href="https://web.archive.org/web/20080305234321/http://starship.python.net:80/crew/mhammond/win32/PrivacyProblem.html">
13
+ privacy concern</a> with this engine. Please read this information, including how to disable the feature.</p>
14
+
15
+
16
+ <H3>Object model</H3>
17
+ <P>Except as described below, the object module exposed should be similar to that exposed
18
+ by Visual Basic, etc. Due to the nature of ActiveX Scripting, the details for each
19
+ host are different, but Python should work "correctly".
20
+
21
+ <P>The object model exposed via Python for MSIE is not as seamless as VB. The biggest limitation is
22
+ the concept of a "local" namespace. For example, in VB, you can
23
+ code <code>text="Hi there"</code>, but in Python, you must code
24
+ <code>MyForm.ThisButton.Text="Hi There"</code>. See the <A HREF="foo2.htm">foo2</A> sample
25
+ for futher details.
26
+
27
+ <H3>Known bugs and problems</H3>
28
+ <UL>
29
+ <LI><P>This release seems to have broken Aaron's mouse-trace sample. No idea why, and I'm supposed to be looking into it.
30
+ <LI><P>Builtin objects such as MARQUEE are giving me grief. Objects accessed via forms are generally
31
+ no problem.
32
+ <LI><P>If you are trying to use Python with the Windows Scripting Host, note that
33
+ .pys files are not correct registered - you will need to explicitly
34
+ specify either cscript.exe or wscript.exe on the command line.
35
+ </UL>
36
+
37
+ </BODY></HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/demo_menu.htm ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+ <H1>Scripting Demos</H1>
4
+ <P>An <A HREF="demo_check.htm" TARGET=Body>Introduction</A> to the
5
+ scripting engine.
6
+
7
+ <P>The <A HREF="calc.htm" TARGET=Body>Calculator Demo</A> is a very
8
+ cool sample written by Aaron Watters.
9
+
10
+ <P><A HREF="mouseTrack.htm" TARGET=Body>Mouse track</A> is another of
11
+ Aaron's samples, and shows how fast the Python engine is!
12
+
13
+ <P>The <A HREF="foo2.htm" TARGET=Body>foo2 sample</A> is mainly used
14
+ for debugging and testing, but does show some forms in action.
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/docwrite.htm ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+ A page generated by Python
4
+
5
+ <SCRIPT LANGUAGE="XXXVBScript">
6
+ document.open()
7
+ document.writeLn "<P>Hello from VBScript"
8
+ document.close()
9
+ </SCRIPT>
10
+
11
+ <SCRIPT LANGUAGE="Python">
12
+ ax.document.write("<P>Hello from Python")
13
+ ax.document.close()
14
+ ax.document.open()
15
+ ax.document.write("<P>Hello again from Python")
16
+ ax.document.close()
17
+
18
+ def Window_OnLoad():
19
+ pass
20
+ # ax.document.write("<P>Hello from Load from Python")
21
+ # ax.document.close()
22
+ </SCRIPT>
23
+
24
+ </BODY>
25
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/foo2.htm ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+
4
+ <SCRIPT>
5
+ b="Hello"
6
+ </SCRIPT>
7
+
8
+ <SCRIPT LANGUAGE="Python">
9
+ import win32traceutil
10
+ import sys
11
+ print("Hello")
12
+ a="Hi there"
13
+ print("Location is", document.location)
14
+ document.write("Hello", " from version ", 2, " of the Python AXScript Engine","<P>")
15
+ document.writeln("This is Python", sys.version)
16
+
17
+ </SCRIPT>
18
+
19
+ <P>The caption on the first button is set by the Window Load code. Clicking
20
+ that button changes the text in the first edit box.
21
+
22
+ <P>The second button changes its own text when clicked.
23
+
24
+ <P>The fourth button calls a global function, defined in the global 'script' scope,
25
+ rather than the 'MyForm' scope.
26
+
27
+ <FORM NAME="MyForm" METHOD="GET">
28
+ <SCRIPT LANGUAGE="Python">
29
+ print("Hello from in the form")
30
+ </SCRIPT>
31
+ <INPUT NAME="Button1" TYPE="Button" OnClick="MyForm.Text1.value='Hi'" LANGUAGE="Python">
32
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
33
+ <INPUT NAME="Button2" TYPE="Button" VALUE="Click for 'Hi'" OnClick="a='Howdy'; MyForm.Button2.value='Hi'" LANGUAGE="Python">
34
+ <INPUT NAME="Button3" TYPE="Button" VALUE="Click for URL" OnClick="MyForm.Text2.value=document.location" LANGUAGE="Python">
35
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Text2">
36
+ <INPUT NAME="Button4" TYPE="Button" VALUE="Call global fn" OnClick="foo1()" LANGUAGE="Python">
37
+ <INPUT NAME="Button5" TYPE="Button" VALUE="Script for... Test">
38
+ <script for="Button5" event="onClick" language="Python">
39
+ print("HelloThere")
40
+ window.alert("Hello")
41
+ def ATest():
42
+ print("Hello from ATEst")
43
+
44
+ ATest()
45
+ </script>
46
+ <INPUT NAME="Button6" TYPE="Button" VALUE="Set Other" OnClick="Form2.Text1.Value='Hi from other'" LANGUAGE="Python">
47
+
48
+ </FORM><BR>
49
+ <P>
50
+ And here is a second form
51
+ <P>
52
+ <FORM NAME="Form2" METHOD="GET">
53
+ <INPUT NAME="Button1" TYPE="Button" OnClick="Form2.Text1.Value='Hi'" LANGUAGE="Python">
54
+ <INPUT NAME="Button2" TYPE="Button" VALUE="Set Other" OnClick="MyForm.Text1.Value='Hi from other'" LANGUAGE="Python">
55
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
56
+ <INPUT NAME="ButRExec" TYPE="Button" VALUE="RExec fail" OnClick="import win32api;win32api.MessageBox(0,'Oops')" LANGUAGE="Python">
57
+ <INPUT NAME="ButRExec2" TYPE="Button" VALUE="RExec fail 2" OnClick="import sys,win32traceutil;print(sys.modules);from win32com.client import dynamic;import win32com.client.dynamic, pythoncom, win32com.client;o=win32com.client.Dispatch('Word.Application')" LANGUAGE="Python">
58
+ <INPUT NAME="ButVB" TYPE="Button" VALUE="VBScript Button" OnClick='alert("Hi from VBScript")'>
59
+ <INPUT NAME="ButCallChain" TYPE="Button" VALUE="Multi-Language call" OnClick='CallPython()'>
60
+ </FORM><BR>
61
+
62
+ <SCRIPT LANGUAGE="VBScript">
63
+ function CallPython()
64
+ alert("Hello from VB - I'm about to call Python!")
65
+ PythonGlobalFunction()
66
+ end function
67
+ </SCRIPT>
68
+
69
+ <SCRIPT LANGUAGE="JScript">
70
+ function JScriptFunction()
71
+ {
72
+ alert("Hello from JScript");
73
+ }
74
+ </SCRIPT>
75
+
76
+ <SCRIPT LANGUAGE="Python">
77
+ x=13
78
+
79
+ def foo1():
80
+ y = 14
81
+ for name, item in globals().items():
82
+ print(name, "item")
83
+ alert ("Hello from AXCode")
84
+ print("Y is ", y)
85
+
86
+ def PythonGlobalFunction():
87
+ window.alert("Hello from Python - I'm about to call JScript!")
88
+ window.JScriptFunction()
89
+
90
+ def Window_OnLoad():
91
+ print("X is", x)
92
+ print("a is", a)
93
+ # print("------ GLOBALS ----------")
94
+ # for n,v in globals().items():
95
+ # print(n, '=', v)
96
+ print("MyForm is", MyForm)
97
+ print("MyForm is repr", "MyForm")
98
+ print("MyForm.Button1 is", "MyForm.Button1")
99
+ MyForm.Button1.Value = "Python Rules!"
100
+ Form2.Button1.value = "Form2!"
101
+ MyForm.Text1.value = document.location
102
+ </SCRIPT>
103
+
104
+ </BODY>
105
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/form.htm ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <BODY>
3
+
4
+ <FORM NAME="TestForm" METHOD="POST" >
5
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Name">Name<br>
6
+ <INPUT TYPE="TEXT" SIZE=25 NAME="Address">Address<br>
7
+ <INPUT TYPE=SUBMIT
8
+ </FORM>
9
+
10
+ <SCRIPT LANGUAGE="Python" for="TestForm" Event="onSubmit">
11
+ return Validate()
12
+ </SCRIPT>
13
+
14
+ <SCRIPT LANGUAGE="Python">
15
+
16
+ def Validate():
17
+ if not TestForm.Name.Value or not TestForm.Address.Value:
18
+ ax.alert("You must enter a name and address.")
19
+ return 1
20
+ return 0
21
+
22
+ </SCRIPT>
23
+
24
+ </BODY>
25
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/marqueeDemo.htm ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+ <HEAD>
3
+ <base target="text">
4
+ <TITLE> Internet Workshop </TITLE>
5
+ </HEAD>
6
+ <BODY leftmargin=8 bgcolor="#FFFFFF" VLINK="#666666" LINK="#FF0000">
7
+ <FONT FACE="ARIAL,HELVETICA" SIZE="2">
8
+
9
+ <P>
10
+ <BR>
11
+ <P><FONT FACE="ARIAL,HELVETICA" SIZE="5"><B>Marquee Demo</B></FONT>
12
+
13
+ <P>
14
+
15
+
16
+ <OBJECT
17
+ ID="Marquee1"
18
+ CLASSID="CLSID:1A4DA620-6217-11CF-BE62-0080C72EDD2D"
19
+ CODEBASE="/workshop/activex/gallery/ms/marquee/other/marquee.ocx#Version=4,70,0,1112"
20
+ TYPE="application/x-oleobject"
21
+ WIDTH=100%
22
+ HEIGHT=80
23
+ >
24
+ <PARAM NAME="szURL" VALUE="marqueeText1.htm">
25
+ <PARAM NAME="ScrollPixelsX" VALUE="0">
26
+ <PARAM NAME="ScrollPixelsY" VALUE="-5">
27
+ <PARAM NAME="ScrollDelay" VALUE="100">
28
+ <PARAM NAME="Whitespace" VALUE="0">
29
+ </OBJECT>
30
+
31
+ <br> <br>
32
+
33
+ <INPUT TYPE="Button" NAME="btnFaster" VALUE="Faster">
34
+ <INPUT TYPE="Button" NAME="btnNormal" VALUE="Normal">
35
+ <INPUT TYPE="Button" NAME="btnSlower" VALUE="Slower">
36
+
37
+ <SCRIPT Language="Python">
38
+
39
+ def btnFaster_Onclick():
40
+ ax.Marquee1.ScrollDelay = 0
41
+
42
+ def btnNormal_Onclick():
43
+ ax.Marquee1.ScrollDelay = 50
44
+
45
+ def btnSlower_Onclick():
46
+ ax.Marquee1.ScrollDelay = 300
47
+
48
+ </SCRIPT>
49
+
50
+
51
+ <P>&nbsp;
52
+ <HR>
53
+ <B>Notes:</B>
54
+ <P>
55
+
56
+
57
+ </FONT>
58
+ </BODY>
59
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/mousetrack.htm ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <HTML>
2
+
3
+ <HEAD><TITLE>Python Scripting sample: Mouse tracking</TITLE></HEAD>
4
+ <BODY BGCOLOR="#FFFFFF" TOPMARGIN=8>
5
+ <FONT SIZE=5>
6
+ <TABLE Border=0><TR VALIGN=MIDDLE><TD>
7
+ <A ID="Image"> <IMG
8
+ SRC="file:..\..\..\..\..\win32com\html\image\pycom_blowing.gif"
9
+ ALT="Clickable Map Image" HEIGHT=113 WIDTH=624 BORDER=0></A>
10
+
11
+ </TD></TR>
12
+ <TR><TD>&nbsp;</TD></TR>
13
+ <TR VALIGN=MIDDLE><TD VALIGN=MIDDLE ALIGN=CENTER><FONT SIZE=5><INPUT
14
+ TYPE="text" NAME="TxtLinkDescription" SIZE=50></FONT></TD></TR></TABLE>
15
+ </FONT>
16
+
17
+ <P>
18
+ A mouse tracking demo. Move the mouse over the image above...
19
+
20
+ <SCRIPT Language="Python">
21
+ <!--
22
+ # Remember the last location clicked
23
+ # print("here we go", 1)
24
+ mx = my = 0
25
+
26
+ # class for rectangle testing
27
+ class rect:
28
+ def __init__(self, lowx, lowy, upx, upy, desc, url):
29
+ self.lowx, self.lowy, self.upx, self.upy, self.desc, self.url = \
30
+ lowx, lowy, upx, upy, desc, url
31
+ def inside(self, x, y):
32
+ # print((x,y), "inside", self.desc)
33
+ result = self.lowx <= x <= self.upx and self.lowy <= y <= self.upy
34
+ # print(result)
35
+ return result
36
+ def mouse_move(self):
37
+ # print("move", self.desc)
38
+ ax.TxtLinkDescription.Value = coords + " - " + self.desc
39
+ def onclick(self):
40
+ # print("click", self.desc)
41
+ ax.TxtLinkDescription.Value = coords +" click! " + `self.url`
42
+ if self.url: ax.location = self.url
43
+
44
+ blows = "Blows away "
45
+ rects =[rect(12,48,59,101,blows+"Visual Basic", ""),
46
+ rect(107,0,172,58,blows+"Internet Explorer", ""),
47
+ rect(193,0,261,56,blows+"Microsoft Access", ""),
48
+ rect(332,43,392,93,blows+"Microsoft Word", ""),
49
+ rect(457,52,521,99,blows+"Microsoft Excel", ""),
50
+ rect(537,12,613,85,"Python blows them all away!", "https://www.python.org"),
51
+ ]
52
+
53
+ default = rect(0,0,0,0,"Click on an icon","")
54
+
55
+ def Image_MouseMove(s, b, x, y):
56
+ global mx, my, coords
57
+ coords =`(x,y)`
58
+ # print(coords)
59
+ mx, my = x, y
60
+ for r in rects:
61
+ if r.inside(x,y):
62
+ # print(r.desc)
63
+ r.mouse_move()
64
+ break
65
+ else:
66
+ # print(default.desc)
67
+ default.mouse_move()
68
+
69
+ def Image_OnClick():
70
+ for r in rects:
71
+ if r.inside(mx,my):
72
+ r.onclick()
73
+ break
74
+ -->
75
+ </SCRIPT>
76
+
77
+ <P>
78
+
79
+ </FONT>
80
+
81
+ </BODY>
82
+ </HTML>
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/ie/pycom_blowing.gif ADDED
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/blank.pys ADDED
File without changes
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/excel.pys ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #app=WScript.Application
2
+ #app._print_details_() # Use this to see what Python knows about a COM object.
3
+
4
+ g_index = 1
5
+ # A procedure, using a global.
6
+ def Show(desc, value = None):
7
+ global g_index # Need global for g_index, as I locally assign.
8
+ # No global needed to "xl" object, as only referenced.
9
+ # Also note "xl" is assigned later in the script - ie, Python is very late bound.
10
+ xl.Cells(g_index, 1).Value = desc
11
+ if value: xl.Cells(g_index, 2).Value = value
12
+ g_index = g_index + 1
13
+
14
+ xl = WScript.CreateObject("Excel.Application")
15
+ import sys
16
+
17
+ xl.Visible = 1
18
+ xl.Workbooks.Add()
19
+
20
+ # Show the WScript properties.
21
+ Show("Application Friendly Name", WScript.Name)
22
+ Show("Application Version", WScript.Version)
23
+ Show("Application Context: Fully Qualified Name", WScript.FullName)
24
+ Show("Application Context: Path Only", WScript.Path)
25
+ Show("State of Interactive Mode", WScript.Interactive)
26
+
27
+ Show("All script arguments:")
28
+ args = WScript.Arguments
29
+
30
+ for i in range(0,args.Count()):
31
+ Show("Arg %d" % i, args(i))
loan-advisor-agent/.venv/Lib/site-packages/win32comext/axscript/Demos/client/wsh/registry.pys ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Windows Script Host Sample Script
2
+ ' Ported to Python
3
+ '
4
+ ' ------------------------------------------------------------------------
5
+ ' Copyright (C) 1996 Microsoft Corporation
6
+ '
7
+ ' You have a royalty-free right to use, modify, reproduce and distribute
8
+ ' the Sample Application Files (and/or any modified version) in any way
9
+ ' you find useful, provided that you agree that Microsoft has no warranty,
10
+ ' obligations or liability for any Sample Application Files.
11
+ ' ------------------------------------------------------------------------
12
+ '
13
+ ' This sample demonstrates how to write/delete from the registry.
14
+ """
15
+
16
+ WshShell = WScript.CreateObject("WScript.Shell")
17
+
18
+ WshShell.Popup("This script shows how to use registry related methods.", 2)
19
+
20
+ WshShell.Popup("Create key HKCU\\Foo with value 'Top level key'")
21
+ WshShell.RegWrite("HKCU\\Foo\\", "Top level key")
22
+
23
+ WshShell.Popup("Create key HKCU\\Foo\\Bar with value 'Second level key'")
24
+ WshShell.RegWrite( "HKCU\\Foo\\Bar\\", "Second level key")
25
+
26
+ WshShell.Popup ("Set value HKCU\\Foo\\Value to REG_SZ 1")
27
+ WshShell.RegWrite( "HKCU\\Foo\\Value", 1)
28
+
29
+ WshShell.Popup ("Set value HKCU\\Foo\\Bar to REG_DWORD 2")
30
+ WshShell.RegWrite ("HKCU\\Foo\\Bar", 2, "REG_DWORD")
31
+
32
+ WshShell.Popup ("Set value HKCU\\Foo\\Bar to REG_EXPAND_SZ '3'")
33
+ WshShell.RegWrite ("HKCU\\Foo\\Bar\\Baz", "%SystemRoot%\\Foo")
34
+
35
+ WshShell.Popup ("Delete value HKCU\\Foo\\Bar\\Baz")
36
+ WshShell.RegDelete ("HKCU\\Foo\\Bar\\Baz")
37
+
38
+ WshShell.Popup ("Delete key HKCU\\Foo\\Bar")
39
+ WshShell.RegDelete ("HKCU\\Foo\\Bar\\")
40
+
41
+ WshShell.Popup ("Delete key HKCU\\Foo")
42
+ WshShell.RegDelete ("HKCU\\Foo\\")
43
+
44
+ WScript.Echo ("Done")