Python Script to add internal hosts on ACS 5.2
Hi,
is there any example how to add/remove a internal host via python script, like you would do it via the GUI under "User and Identity Stores -> Internal Identity Stores -> Hosts" ?
regards
Dirk
Hi Dirk,
where do you plan to run your script ? on a server external to the ACS I guess right ?
Then the question is more "is there a way to add a user through CLI on ACS" because that is what the script would be using right ? And there isn't such a way to my knowledge.
Nicolas
===
don't forget to rate answers that you find useful
Similar Messages
-
[ACS 5.4] Add Internal hosts using API
Hi,
I tried Machine authentication after importing MAC Address in internal hosts.
Is it possible to use ACS API to import those MAC Address?
I want to develop a specific web interface for support to do this action.
Thanks for your help,
PatrickHi Horst,
Currently this feature is not there, you cannot use filters based on admin created attrbutes,
An enhancement is already open:
CSCui17182 ACS user filtering using custom attribute
Supposed to be included in 5.5, but it was not, so you can look forward to it on future ACS patch.
Save this ID on the bug search and you will get a notification.
**Share your knowledge. It’s a way to achieve immortality.
--Dalai Lama**
Please Rate if helpful.
Regards
Ed -
Need help running a Python script when DVD inserted
We had an intern that created a custom Python script to rip our old event recording DVDs back to a digital format. The script creates a JSON description file and asks a set of questions to create the metadata in the JSON file (e.g. Date of event).
The way the intern set this up was that you'd click on the Python script which would open a terminal window where you fill in the metadata. It then asks if the DVD is in the computer. At this point you place the DVD in. A few seconds later, the Python script notices the DVD and proceeds to rip the DVD at our specific file size requirements along with the inputted metadata.
We then upgraded the Mac from Mountain Lion to Lion and the script stopped working. Our intern has since left. I have now moved the Python script onto my Mountain Lion Mac. The intern's last message to me was that he had written an AppleScript that ran when the DVD was inserted which then referred to the Python script. The intern has since stopped replying to emails.
This is a very important project that I would like to continue. Any help would be greatly appreciated!well, oddly, that should never have worked.
Try this: open the applescript editor, copy in the following line:
tell application "Terminal"
do script "python /Users/medialab/dvddrip rename"
activate
end tell
Save it, making sure that the 'File Format' pull down says Script (the new file will have a '.scpt' extension). You'll be able to select that file in the cd/dvd preferences.
I assumed that you wanted this to open in terminal so that you can enter options on the command line. If that's not correct, let me know. -
Maximum "Internal Hosts accounts" on ACS 5.2
Is there a maximum number of "Internal Hosts account" IDs that the local database in a ACS 5.2 can handle?
Thanks....I hope you're right, jrabinow
Because I have 7,000 hosts that I need to add. I dont want to find out that max number of host is less than 7,000..that would be really frustrating..lol
@ ewood2624
you are referring to max number to import using csv, not max number of hosts that could reside internally. -
ACS 5.2 Import Internal Hosts
Tyring to use the "File Operations" option to import hosts into ACS. I go through the wizard and click "Finish", the pop up goes blank and just hangs there. No errors are genereated. Anyone ever come accros this?
Which browser version are you using? Do you have popups enabled?
-
Unexpected error when running Python scripts?
I always get this crash when I try to run python scripts. Anyone know what is causing this or how to fix it?
Process: Python [8022]
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/C ontents/MacOS/Python
Identifier: Python
Version: 2.7.2 (2.7.2)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
User ID: 501
Date/Time: 2012-11-23 05:13:46.990 -0700
OS Version: Mac OS X 10.8.2 (12C60)
Report Version: 10
Interval Since Last Report: 62859 sec
Crashes Since Last Report: 6
Per-App Crashes Since Last Report: 4
Anonymous UUID: 9A83E25A-0D91-6DC9-960B-E7126A515A89
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007faa1b19ad5e
VM Regions Near 0x7faa1b19ad5e:
MALLOC_TINY 00007faa1b000000-00007faa1b100000 [ 1024K] rw-/rwx SM=COW
-->
MALLOC_SMALL 00007faa1b800000-00007faa1c800000 [ 16.0M] rw-/rwx SM=COW
Application Specific Information:
*** single-threaded process forked ***
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_c.dylib 0x00007fff87fafde1 tiny_free_list_add_ptr + 112
1 libsystem_c.dylib 0x00007fff87fb354e tiny_malloc_from_free_list + 1078
2 libsystem_c.dylib 0x00007fff87fb3ad8 szone_malloc_should_clear + 971
3 libsystem_c.dylib 0x00007fff87fa6153 malloc_zone_malloc + 71
4 libsystem_c.dylib 0x00007fff87fa6c61 realloc + 82
5 org.python.python 0x00000001065e6ac9 0x10658b000 + 375497
6 org.python.python 0x00000001065e4b23 0x10658b000 + 367395
7 org.python.python 0x00000001065e6646 0x10658b000 + 374342
8 org.python.python 0x00000001065a4494 PyEval_EvalFrameEx + 8967
9 org.python.python 0x00000001065a2147 PyEval_EvalCodeEx + 1934
10 org.python.python 0x00000001065dbd7a 0x10658b000 + 331130
11 org.python.python 0x000000010659a6c6 PyObject_Call + 97
12 org.python.python 0x00000001065b79bf 0x10658b000 + 182719
13 org.python.python 0x000000010659a6c6 PyObject_Call + 97
14 org.python.python 0x00000001065a8018 PyEval_CallObjectWithKeywords + 177
15 org.python.python 0x00000001065ba46e PyCodec_Encode + 78
16 org.python.python 0x0000000106633978 PyUnicodeUCS2_AsEncodedString + 141
17 org.python.python 0x00000001065c232f 0x10658b000 + 226095
18 org.python.python 0x00000001065c0c91 0x10658b000 + 220305
19 org.python.python 0x00000001065bfc43 0x10658b000 + 216131
20 org.python.python 0x00000001065bff0d PyArg_ParseTuple + 143
21 _socket.so 0x0000000106b2c7f3 0x106b28000 + 18419
22 _socket.so 0x0000000106b2b743 0x106b28000 + 14147
23 org.python.python 0x00000001065a2f72 PyEval_EvalFrameEx + 3557
24 org.python.python 0x00000001065a2147 PyEval_EvalCodeEx + 1934
25 org.python.python 0x00000001065dbd7a 0x10658b000 + 331130
26 org.python.python 0x000000010659a6c6 PyObject_Call + 97
27 _functools.so 0x00000001068d34a2 0x1068d2000 + 5282
28 org.python.python 0x000000010659a6c6 PyObject_Call + 97
29 org.python.python 0x00000001065a478d PyEval_EvalFrameEx + 9728
30 org.python.python 0x00000001065a2147 PyEval_EvalCodeEx + 1934
31 org.python.python 0x00000001065a88df 0x10658b000 + 121055
32 org.python.python 0x00000001065a463a PyEval_EvalFrameEx + 9389
33 org.python.python 0x00000001065a2147 PyEval_EvalCodeEx + 1934
34 org.python.python 0x00000001065a88df 0x10658b000 + 121055
35 org.python.python 0x00000001065a463a PyEval_EvalFrameEx + 9389
36 org.python.python 0x00000001065a8869 0x10658b000 + 120937
37 org.python.python 0x00000001065a463a PyEval_EvalFrameEx + 9389
38 org.python.python 0x00000001065a2147 PyEval_EvalCodeEx + 1934
39 org.python.python 0x00000001065a19b3 PyEval_EvalCode + 54
40 org.python.python 0x00000001065ddc70 0x10658b000 + 339056
41 org.python.python 0x00000001065ddd3c PyRun_FileExFlags + 165
42 org.python.python 0x00000001065dd726 PyRun_SimpleFileExFlags + 410
43 org.python.python 0x0000000106601e27 Py_Main + 2715
44 libdyld.dylib 0x00007fff8fe447e1 start + 1
Thread 1:: Dispatch queue: com.apple.libsystem_network
0 libsystem_c.dylib 0x00007fff87fb32dd tiny_malloc_from_free_list + 453
1 libsystem_c.dylib 0x00007fff87fb3ad8 szone_malloc_should_clear + 971
2 libsystem_c.dylib 0x00007fff87fa6153 malloc_zone_malloc + 71
3 libsystem_c.dylib 0x00007fff87fa6ba7 malloc + 41
4 libsystem_c.dylib 0x00007fff8801026d tre_make_trans + 412
5 libsystem_c.dylib 0x00007fff8800ff59 tre_ast_to_tnfa + 145
6 libsystem_c.dylib 0x00007fff8800ff2f tre_ast_to_tnfa + 103
7 libsystem_c.dylib 0x00007fff8800e30b tre_compile + 4627
8 libsystem_c.dylib 0x00007fff8800c79f regncomp_l + 346
9 libsystem_c.dylib 0x00007fff87f9b278 __asl_parse_time_block_invoke_0 + 151
10 libdispatch.dylib 0x00007fff8a6ce0b6 _dispatch_client_callout + 8
11 libdispatch.dylib 0x00007fff8a6ce041 dispatch_once_f + 50
12 libsystem_c.dylib 0x00007fff87f9ad57 asl_parse_time + 61
13 libsystem_c.dylib 0x00007fff87fa139a _asl_time_string + 72
14 libsystem_c.dylib 0x00007fff87fa130e asl_msg_to_string_raw + 322
15 libsystem_c.dylib 0x00007fff87f99c77 _asl_send_message + 1273
16 libsystem_c.dylib 0x00007fff87f99412 _asl_lib_vlog + 513
17 libsystem_c.dylib 0x00007fff87f86839 vsyslog + 107
18 libdispatch.dylib 0x00007fff8a6d3cd1 _dispatch_log + 224
19 libdispatch.dylib 0x00007fff8a6cfba0 _dispatch_update_kq + 430
20 libdispatch.dylib 0x00007fff8a6cf9ee _dispatch_mgr_wakeup + 16
21 libdispatch.dylib 0x00007fff8a6cee65 _dispatch_wakeup + 28
22 libdispatch.dylib 0x00007fff8a6cee10 _dispatch_queue_push_list_slow2 + 33
23 libdispatch.dylib 0x00007fff8a6ceecd _dispatch_wakeup + 132
24 libdispatch.dylib 0x00007fff8a6cf027 _dispatch_resume_slow + 17
25 libxpc.dylib 0x00007fff8ea12ff2 _xpc_connection_listen_for_reply + 198
26 libxpc.dylib 0x00007fff8ea13ccf xpc_connection_send_message_with_reply + 122
27 libsystem_network.dylib 0x00007fff9163bd8c __net_helper_get_settings_block_invoke_0 + 181
28 libdispatch.dylib 0x00007fff8a6d1f01 _dispatch_call_block_and_release + 15
29 libdispatch.dylib 0x00007fff8a6ce0b6 _dispatch_client_callout + 8
30 libdispatch.dylib 0x00007fff8a6cf47f _dispatch_queue_drain + 235
31 libdispatch.dylib 0x00007fff8a6cf2f1 _dispatch_queue_invoke + 52
32 libdispatch.dylib 0x00007fff8a6cf1c3 _dispatch_worker_thread2 + 249
33 libsystem_c.dylib 0x00007fff87f8fcab _pthread_wqthread + 404
34 libsystem_c.dylib 0x00007fff87f7a171 start_wqthread + 13
Thread 2:
0 libsystem_kernel.dylib 0x00007fff85af06d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff87f8feec _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff87f8fcb3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff87f7a171 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00000000000fffe0 rbx: 0x00000000000009ac rcx: 0x00007faa1b000000 rdx: 0x00007faa1b09ad80
rdi: 0x0000000106585000 rsi: 0x00000001066fea00 rbp: 0x00007fff5967ced0 rsp: 0x00007fff5967cec8
r8: 0x000000000000003f r9: 0x000007faa1b09ad8 r10: 0x00007faa1b0b6300 r11: 0x000000000000fffe
r12: 0x0000000000000002 r13: 0x00007faa1b09ad60 r14: 0x00000000066efffe r15: 0x00000001066fea00
rip: 0x00007fff87fafde1 rfl: 0x0000000000010202 cr2: 0x00007faa1b19ad5e
Logical CPU: 0
Binary Images:
0x106581000 - 0x106581fff org.python.python (2.7.2 - 2.7.2) <A3CE5618-7FE0-3307-B2C1-DE2661C936B2> /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/C ontents/MacOS/Python
0x10658b000 - 0x106698fff org.python.python (2.7.2 - 2.7.2) <B2E5B3C9-2D7C-37D7-B23D-84DEF8DDAF28> /System/Library/Frameworks/Python.framework/Versions/2.7/Python
0x10689b000 - 0x10689efff operator.so (60.3) <16E539EB-683E-3BDF-83AA-77ED26146560> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/operator.so
0x1068d2000 - 0x1068d3fff _functools.so (60.3) <610F4A5F-CEE5-3353-94CD-F586D4F2DAD0> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_functools.so
0x1068d7000 - 0x1068d8fff _locale.so (60.3) <D7B03EB6-5126-3306-8699-D3816B044AAB> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_locale.so
0x1068dc000 - 0x1068ddfff time.so (60.3) <B81E8A2D-38E3-3BA7-AA2F-7A543F20DACF> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/time.so
0x106924000 - 0x106926fff select.so (60.3) <191F03CF-4038-38AF-A0BA-22AC770298A0> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/select.so
0x10692c000 - 0x10692dfff fcntl.so (60.3) <5E2DBA68-27EB-3589-B7B4-8B7918DC9716> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/fcntl.so
0x106931000 - 0x106934fff _struct.so (60.3) <2D1A807F-2084-3CEE-9E4B-DE124502AB69> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_struct.so
0x10693a000 - 0x10693cfff binascii.so (60.3) <A96BD9F2-1025-3803-A942-AC8AE48243A9> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/binascii.so
0x106940000 - 0x106941fff cStringIO.so (60.3) <F4174A1F-B66E-3986-985C-0632FCD266F9> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/cStringIO.so
0x106946000 - 0x106949fff _collections.so (60.3) <20EAC750-00E1-3216-BB1F-472C0CEA6118> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_collections.so
0x10698f000 - 0x106995fff itertools.so (60.3) <C273B16D-A69E-3D3C-B3F5-43F6B0BC333F> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/itertools.so
0x10699e000 - 0x10699efff _bisect.so (60.3) <BEAA36C6-86EF-3272-9F95-29AED2B60109> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_bisect.so
0x1069a2000 - 0x1069a3fff _heapq.so (60.3) <C02D109C-B83B-385E-86E9-04F551749448> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_heapq.so
0x1069a8000 - 0x1069b3ff7 datetime.so (60.3) <B359E7F5-D6D1-343C-A770-F1186D123691> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/datetime.so
0x1069bc000 - 0x1069c5fff _sqlite3.so (60.3) <C0006BFF-3590-3B8E-A9B5-DECD4A764236> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_sqlite3.so
0x106acf000 - 0x106ad3fff math.so (60.3) <15868E58-734E-3A35-A4C2-AC4625F37902> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/math.so
0x106b19000 - 0x106b1afff _hashlib.so (60.3) <9B8C96E2-6DE6-3830-B300-35C790DA40C7> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_hashlib.so
0x106b1f000 - 0x106b22fff strop.so (60.3) <33FECDE8-3D85-37A8-95CA-08C1F2B820D4> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/strop.so
0x106b28000 - 0x106b2eff7 _socket.so (60.3) <E186283B-C7D4-3D7E-9198-CD7761B70100> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_socket.so
0x106b36000 - 0x106b39fff _ssl.so (60.3) <2AEDA15A-56F4-3E82-9415-297BFE6C8F38> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_ssl.so
0x106b7f000 - 0x106b7ffff _scproxy.so (60.3) <43CCA6F3-BA7C-3186-8450-B63D00D8AC6F> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_scproxy.so
0x106bc4000 - 0x106bc8fff array.so (60.3) <56A0FB1F-7603-3450-AF31-9801D9AB95D5> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/array.so
0x106bce000 - 0x106bcffff _random.so (60.3) <E2D3E74F-9797-30D4-A9B7-E9FE72564C50> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_random.so
0x106bd3000 - 0x106bdffff cPickle.so (60.3) <869D9434-2C00-3EC8-93A1-2A8104957B7E> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/cPickle.so
0x106c25000 - 0x106c29fff _json.so (60.3) <5899CF83-4D57-34C0-A01F-DC215C5C26D0> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_json.so
0x106cae000 - 0x106cbffff _io.so (60.3) <79CDBE7E-1D18-39A6-99AA-CA9466FAD6C2> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_io.so
0x106d4e000 - 0x106d4efff grp.so (60.3) <F1C42F13-D323-3F5A-B59E-ACB09DD18ABE> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/grp.so
0x106fd2000 - 0x106fd4fff zlib.so (60.3) <987E51DB-7827-3F1A-AD5E-CF58C673E644> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/zlib.so
0x106fd9000 - 0x106fdffff pyexpat.so (60.3) <72D45F21-63F8-3EEF-B71D-DC73B0309D55> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/pyexpat.so
0x107066000 - 0x107077fff _ctypes.so (60.3) <A4E934BA-B8B3-3CD6-9AA6-78458DEAA491> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/_ctypes.so
0x10740e000 - 0x1074b2ff7 unicodedata.so (60.3) <D2954B53-CE7D-3182-8056-F04F7CAABC6C> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynl oad/unicodedata.so
0x7fff66181000 - 0x7fff661b593f dyld (210.2.3) <A40597AA-5529-3337-8C09-D8A014EB1578> /usr/lib/dyld
0x7fff84fa3000 - 0x7fff8518cfff com.apple.CoreFoundation (6.8 - 744.12) <EF002794-DAEF-31C6-866C-E3E3AC387A9F> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff851b6000 - 0x7fff853b6fff libicucore.A.dylib (491.11.1) <CC318A27-878A-38CE-9292-1B98353FA9C7> /usr/lib/libicucore.A.dylib
0x7fff85724000 - 0x7fff85729fff libcompiler_rt.dylib (30) <08F8731D-5961-39F1-AD00-4590321D24A9> /usr/lib/system/libcompiler_rt.dylib
0x7fff85ade000 - 0x7fff85af9ff7 libsystem_kernel.dylib (2050.18.24) <C0535565-35D1-31A7-A744-63D9F10F12A4> /usr/lib/system/libsystem_kernel.dylib
0x7fff85dc3000 - 0x7fff85dcefff libsystem_notify.dylib (98.5) <C49275CC-835A-3207-AFBA-8C01374927B6> /usr/lib/system/libsystem_notify.dylib
0x7fff861ed000 - 0x7fff861eeff7 libSystem.B.dylib (169.3) <365477AB-D641-389D-B8F4-A1FAE9657EEE> /usr/lib/libSystem.B.dylib
0x7fff86617000 - 0x7fff86625fff libcommonCrypto.dylib (60026) <2D6537F5-1B5E-305C-A1CF-D1FA80CA3939> /usr/lib/system/libcommonCrypto.dylib
0x7fff87f30000 - 0x7fff87f38fff liblaunch.dylib (442.26.2) <2F71CAF8-6524-329E-AC56-C506658B4C0C> /usr/lib/system/liblaunch.dylib
0x7fff87f79000 - 0x7fff88045fe7 libsystem_c.dylib (825.25) <8CBCF9B9-EBB7-365E-A3FF-2F3850763C6B> /usr/lib/system/libsystem_c.dylib
0x7fff88046000 - 0x7fff88058ff7 libz.1.dylib (43) <2A1551E8-A272-3DE5-B692-955974FE1416> /usr/lib/libz.1.dylib
0x7fff88134000 - 0x7fff88159ff7 libc++abi.dylib (24.4) <E7BD9363-1D25-3551-A68A-2E2FF6ABECD7> /usr/lib/libc++abi.dylib
0x7fff88221000 - 0x7fff88272ff7 com.apple.SystemConfiguration (1.12.2 - 1.12.2) <E095637C-457F-3D8F-AE32-A032F9D5A46C> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfi guration
0x7fff8835f000 - 0x7fff8838dff7 libsystem_m.dylib (3022.6) <B434BE5C-25AB-3EBD-BAA7-5304B34E3441> /usr/lib/system/libsystem_m.dylib
0x7fff89823000 - 0x7fff8982bff7 libsystem_dnssd.dylib (379.32.1) <62AA0B84-188A-348B-8F9E-3E2DB08DB93C> /usr/lib/system/libsystem_dnssd.dylib
0x7fff89f9d000 - 0x7fff8a09afff libsqlite3.dylib (138.1) <ADE9CB98-D77D-300C-A32A-556B7440769F> /usr/lib/libsqlite3.dylib
0x7fff8a6cc000 - 0x7fff8a6e1ff7 libdispatch.dylib (228.23) <D26996BF-FC57-39EB-8829-F63585561E09> /usr/lib/system/libdispatch.dylib
0x7fff8a704000 - 0x7fff8a750ff7 libauto.dylib (185.1) <73CDC482-16E3-3FC7-9BB4-FBA2DA44DBC2> /usr/lib/libauto.dylib
0x7fff8ac23000 - 0x7fff8ac24fff libsystem_blocks.dylib (59) <D92DCBC3-541C-37BD-AADE-ACC75A0C59C8> /usr/lib/system/libsystem_blocks.dylib
0x7fff8acf1000 - 0x7fff8adf3fff libcrypto.0.9.8.dylib (47) <74F165AD-4572-3B26-B0E2-A97477FE59D0> /usr/lib/libcrypto.0.9.8.dylib
0x7fff8aeea000 - 0x7fff8b00292f libobjc.A.dylib (532.2) <90D31928-F48D-3E37-874F-220A51FD9E37> /usr/lib/libobjc.A.dylib
0x7fff8b070000 - 0x7fff8b072fff com.apple.TrustEvaluationAgent (2.0 - 23) <A97D348B-32BF-3E52-8DF2-59BFAD21E1A3> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/Tru stEvaluationAgent
0x7fff8b112000 - 0x7fff8b113ff7 libsystem_sandbox.dylib (220) <3C3B03CF-C525-3CB3-8557-62E91B93AC95> /usr/lib/system/libsystem_sandbox.dylib
0x7fff8ba1a000 - 0x7fff8ba1bff7 libdnsinfo.dylib (453.18) <E7595861-ECF9-336E-9901-BED2620FAA80> /usr/lib/system/libdnsinfo.dylib
0x7fff8bbfa000 - 0x7fff8bc62ff7 libc++.1.dylib (65.1) <20E31B90-19B9-3C2A-A9EB-474E08F9FE05> /usr/lib/libc++.1.dylib
0x7fff8c0fb000 - 0x7fff8c132ff7 libssl.0.9.8.dylib (47) <923945E6-C489-3406-903B-A362410753F8> /usr/lib/libssl.0.9.8.dylib
0x7fff8cd20000 - 0x7fff8cd56fff libsystem_info.dylib (406.17) <4FFCA242-7F04-365F-87A6-D4EFB89503C1> /usr/lib/system/libsystem_info.dylib
0x7fff8d244000 - 0x7fff8d249fff libcache.dylib (57) <65187C6E-3FBF-3EB8-A1AA-389445E2984D> /usr/lib/system/libcache.dylib
0x7fff8ea07000 - 0x7fff8ea29ff7 libxpc.dylib (140.41) <FAC04D8B-680E-325F-8F0C-DD69859D0E01> /usr/lib/system/libxpc.dylib
0x7fff8eadd000 - 0x7fff8eb2cff7 libcorecrypto.dylib (106.2) <CE0C29A3-C420-339B-ADAA-52F4683233CC> /usr/lib/system/libcorecrypto.dylib
0x7fff8eb55000 - 0x7fff8eb57fff libquarantine.dylib (52) <4BE2E642-A14F-340A-B482-5BD2AEFD9C24> /usr/lib/system/libquarantine.dylib
0x7fff8f0ec000 - 0x7fff8f0f2fff libmacho.dylib (829) <BF332AD9-E89F-387E-92A4-6E1AB74BD4D9> /usr/lib/system/libmacho.dylib
0x7fff8fe42000 - 0x7fff8fe45ff7 libdyld.dylib (210.2.3) <F59367C9-C110-382B-A695-9035A6DD387E> /usr/lib/system/libdyld.dylib
0x7fff8fe93000 - 0x7fff8fe95ff7 libunc.dylib (25) <92805328-CD36-34FF-9436-571AB0485072> /usr/lib/system/libunc.dylib
0x7fff8fe96000 - 0x7fff8fe9dfff libcopyfile.dylib (89) <876573D0-E907-3566-A108-577EAD1B6182> /usr/lib/system/libcopyfile.dylib
0x7fff9022f000 - 0x7fff90230fff libffi.dylib (18) <D20FE81C-271C-3446-ABC8-50B6A6F5BEA4> /usr/lib/libffi.dylib
0x7fff904f0000 - 0x7fff9050bff7 libexpat.1.dylib (12) <95D59F1F-0A5C-3F33-BA97-26F7D796CE7A> /usr/lib/libexpat.1.dylib
0x7fff908e2000 - 0x7fff908e3fff libDiagnosticMessagesClient.dylib (8) <8548E0DC-0D2F-30B6-B045-FE8A038E76D8> /usr/lib/libDiagnosticMessagesClient.dylib
0x7fff90c13000 - 0x7fff90c14ff7 libremovefile.dylib (23.1) <DBBFAF35-AC78-3856-92F6-6E4FD9DF14A2> /usr/lib/system/libremovefile.dylib
0x7fff912c0000 - 0x7fff912c6ff7 libunwind.dylib (35.1) <21703D36-2DAB-3D8B-8442-EAAB23C060D3> /usr/lib/system/libunwind.dylib
0x7fff91562000 - 0x7fff915cbfff libstdc++.6.dylib (56) <EAA2B53E-EADE-39CF-A0EF-FB9D4940672A> /usr/lib/libstdc++.6.dylib
0x7fff915cc000 - 0x7fff915ccfff libkeymgr.dylib (25) <CC9E3394-BE16-397F-926B-E579B60EE429> /usr/lib/system/libkeymgr.dylib
0x7fff91635000 - 0x7fff91643ff7 libsystem_network.dylib (77.10) <0D99F24E-56FE-380F-B81B-4A4C630EE587> /usr/lib/system/libsystem_network.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 5843
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=67.5M resident=24.5M(36%) swapped_out_or_unallocated=43.0M(64%)
Writable regions: Total=66.6M written=11.4M(17%) resident=19.8M(30%) swapped_out=0K(0%) unallocated=46.8M(70%)
REGION TYPE VIRTUAL
=========== =======
MALLOC 55.5M
MALLOC guard page 32K
STACK GUARD 56.0M
Stack 10.6M
VM_ALLOCATE 20K
__DATA 1924K
__LINKEDIT 53.6M
__TEXT 13.9M
__UNICODE 544K
shared memory 12K
=========== =======
TOTAL 192.0M
Model: MacBookAir4,2, BootROM MBA41.0077.B0F, 2 processors, Intel Core i7, 1.8 GHz, 4 GB, SMC 1.73f65
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xE9), Broadcom BCM43xx 1.0 (5.106.98.81.22)
Bluetooth: Version 4.0.9f33 10885, 2 service, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM256C, 251 GB
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
USB Device: Internal Memory Card Reader, apple_vendor_id, 0x8404, 0xfd110000 / 3
USB Device: FaceTime Camera (Built-in), apple_vendor_id, 0x850a, 0xfa200000 / 3
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x024c, 0xfa120000 / 5
USB Device: BRCM20702 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x821f, 0xfa113000 / 8I guess you could say Cheetah is in stable release since 2010 as that was when it was last updated. Python has changed considerably since then.
Pypl.org shows a list of available packages by ascending Python version. By the time one looks for Cheetah support in Python 2.6, it is strictly Linux. In the Python 2.7 section, there is no Cheetah package listed at all.
In my estimation, development on Cheetah has been abandoned, and it remains incompatible with Python 2.7.2 as installed on OS X. You should abandon Cheetah. Look at Jinja2, or Django.
OS X still uses Python scripts for some system activity. If the system version of Python gets messed up with an incompatible module, these system python scripts are compromised too.
Seriously, look at Pythonbrew. It allows you to create full-blown Python installs and switch between versions and virtual environments. -
How to run a Python Script in Terminal ?
Hello,
how can you run a Python Script in Terminal ? (OS X 10.4.5 - not OS X Server)
It´s about this Sript:
http://www.macosxhints.com/article.php?story=20060225091102170
Thanks
iMac G5 20" Mac OS X (10.4.5)While this isn't really specific at all to OS X Server (please keep your questions in the "Mac OS X Server" topic area related to OS X Server, it helps you and everyone else
Now then:
Please note the comments of "robg" (the site-"mom"/host):
"You'll want to save the script without the .txt extension, and remember to make it executable with chmod a+x site2template.sh
Save the file to your Desktop, and remove the ".txt" from the name so it's named: site2template.sh
then in the Terminal, issue:
chmod +x ~/Desktop/site2template.sh
"~" is shortcut for "the current user's (my) home directory"
From there you can simply use:
~/Desktop/site2template.sh /your/site
But, far better to:
choose a location to save the script, typically /usr/local/bin:
make the directory if you don't have one:
sudo mkdir /usr/local/bin
sudo cp ~/Desktop/site2template.sh /usr/local/bin/
then adjust the permissions:
sudo chmod 755 /usr/local/bin/site2template.sh
You may want to add /usr/local/bin to your path.
cat /etc/profile
and if you don't see it, add:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
export PATH
ie:
sudo cp /etc/profile /etc/profile.bak
(back it up to play safe)
sudo pico /etc/profile
and add
:/usr/local/bin
to the path info.
Save it (ctl w)
exit (ctl x)
then type: source /etc/profile
(start learning vi or emacs eventually)
and you'll be able to run:
site2template /path\ to/your/site/to\ convert -
How can I map SSH from an outside network range to an internal host (ASA 5505)
Cisco Adaptive Security Appliance Software Version 7.2(4)
Device Manager Version 5.2(4)
- External network range that needs SSH access: 8.8.8.0/24
- Outside interface: 10.1.10.2 (NAT'd from 7.7.7.7)
- Inside Network: 192.168.100.0/24
- Inside host to redirect external SSH to: 192.168.100.98
Hi All,
I have a Cisco ASA 5505 (version above) and I have someone that needs to SSH into a box behind the ASA. I'm having a few issues trying to configure this access-list and NAT. I've tried many combinations and clearly my IOS is not as good as I thought.
Can anyone help with this? What commands should I enter to accomplish mapping SSH from an outside network range to an internal host?
Many thanks,
TarranThis may or may not work depending on how your modem handles the natting. On your firewall try this -
static (inside,outside) tcp interface 22 192.168.100.98 22
then add this to your acl on the outside interface of your ASA -
access-list outside_in permit tcp 8.8.8.0 255.255.255.0 host 10.1.10.2 eq 22
if you don't have an acl applied then add this extra step -
access-group outside_in in interface outside
Jon -
Have 2 host cluster as part of infrastructure adding to VMM.
Added cluster server. 1st had no issue and has picked up it's VMs. Second gave this error below:
Error (416)
Agent installation timed out while waiting on service VMMAgentInstaller on host02domain.private.
Recommended Action
Ensure that the Windows Installer service is running on host02.domain.private and try the operation again.
Sure the Windows Installer has nothing to do with this but in case I manually started it on the server without issue.
On retrying first without starting Windows Installer manually and then doing so in both instances I get:
Error (2912)
An internal error has occurred trying to contact the host02.domain.private server: : .
WinRM: URL: [http://host02.domain.private:5985], Verb: [INVOKE], Method: [GetVirtualizationStatus], Resource: [http://schemas.microsoft.com/wbem/wsman/1/wmi/root/scvmm/AgentManagement]
An instance of the service is already running (0x80070420)
Recommended Action
Check that WS-Management service is installed and running on server host02.domain.private. For more information use the command "winrm helpmsg hresult". If host02.domain.private is a host/library/update server or a PXE server role then ensure
that VMM agent is installed and running. Refer to http://support.microsoft.com/kb/2742275 for more details.
I've tried killing the VMM Agent running on the host (which is running now after the attempted deploy) and rerunning - as the second error indicates it can't run because it's already running (far as I can figure). But even though it takes longer to run then
it still fails with exactly the same error.
I've checked the host and winrm shows as already running and already set up for remote management.
Am I missing something?Hi Allister,
What is the version of SCVMM ?
Did you follow the document ?
As for VMM 2008R2 :
"On the Select Host Servers page, in the Computer name box, type either the name of the cluster or the name of any node in the cluster, and then click
Add."
"Do not skip Active Directory name verification. If you do, the wizard will add the host as a stand-alone host instead of discovering the cluster nodes "
"When you specify the name of a failover cluster that was created in Windows Server 2008 or Windows Server 2008 R2, or you specify a node in one of these clusters, the Add Hosts Wizard discovers all nodes in the cluster and adds
them to VMM. "
https://technet.microsoft.com/en-us/library/ee236431.aspx
Also 2012 :
https://technet.microsoft.com/en-us/library/gg610648.aspx
For your case , I would suggest you to stop VMM service and remove the added cluster from
scvmm then follow the article and add cluster again .
Best Regards,
Elton Ji
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] . -
Python script to parse 'iwlist scan' into a table
Hi,
I've written a small python script that parses the output of the command "iwlist interface scan" into a table.
Why ?
Like many arch linux users I think, I use netcfg instead of something like network manager or wicd. So the most natural way to scan for wifi networks in range is iwlist scan. But the output of this command is huge and I find it difficult to retrieve information. So this script parses it into a table : one network, one line.
Example output
Name Address Quality Channel Encryption
wifi_1 01:23:45:67:89:AB 100 % 11 WPA v.1
wifi_2 01:23:45:67:89:AC 76 % 11 WEP
wifi_3 01:23:45:67:89:AD 51 % 11 Open
wifi_4 01:23:45:67:89:AE 50 % 11 WPA v.1
wifi_5 01:23:45:67:89:AF 43 % 4 Open
wifi_6 01:23:45:67:89:AG 43 % 4 WPA v.1
Details
It reads from stdin so you use it like that: iwlist wlan0 scan | iwlistparse.py
The width of the columns is determined by what's in it.
You can easily do a bit more than just parsing the info: in the example above, the quality has been calculated to percents from a ratio (e.g. 46/70).
It is sorted, too.
Customization
It's python so it's easy to customize. See the comments in the code.
Code
#!/usr/bin/env python
# iwlistparse.py
# Hugo Chargois - 17 jan. 2010 - v.0.1
# Parses the output of iwlist scan into a table
import sys
# You can add or change the functions to parse the properties of each AP (cell)
# below. They take one argument, the bunch of text describing one cell in iwlist
# scan and return a property of that cell.
def get_name(cell):
return matching_line(cell,"ESSID:")[1:-1]
def get_quality(cell):
quality = matching_line(cell,"Quality=").split()[0].split('/')
return str(int(round(float(quality[0]) / float(quality[1]) * 100))).rjust(3) + " %"
def get_channel(cell):
return matching_line(cell,"Channel:")
def get_encryption(cell):
enc=""
if matching_line(cell,"Encryption key:") == "off":
enc="Open"
else:
for line in cell:
matching = match(line,"IE:")
if matching!=None:
wpa=match(matching,"WPA Version ")
if wpa!=None:
enc="WPA v."+wpa
if enc=="":
enc="WEP"
return enc
def get_address(cell):
return matching_line(cell,"Address: ")
# Here's a dictionary of rules that will be applied to the description of each
# cell. The key will be the name of the column in the table. The value is a
# function defined above.
rules={"Name":get_name,
"Quality":get_quality,
"Channel":get_channel,
"Encryption":get_encryption,
"Address":get_address,
# Here you can choose the way of sorting the table. sortby should be a key of
# the dictionary rules.
def sort_cells(cells):
sortby = "Quality"
reverse = True
cells.sort(None, lambda el:el[sortby], reverse)
# You can choose which columns to display here, and most importantly in what order. Of
# course, they must exist as keys in the dict rules.
columns=["Name","Address","Quality","Channel","Encryption"]
# Below here goes the boring stuff. You shouldn't have to edit anything below
# this point
def matching_line(lines, keyword):
"""Returns the first matching line in a list of lines. See match()"""
for line in lines:
matching=match(line,keyword)
if matching!=None:
return matching
return None
def match(line,keyword):
"""If the first part of line (modulo blanks) matches keyword,
returns the end of that line. Otherwise returns None"""
line=line.lstrip()
length=len(keyword)
if line[:length] == keyword:
return line[length:]
else:
return None
def parse_cell(cell):
"""Applies the rules to the bunch of text describing a cell and returns the
corresponding dictionary"""
parsed_cell={}
for key in rules:
rule=rules[key]
parsed_cell.update({key:rule(cell)})
return parsed_cell
def print_table(table):
widths=map(max,map(lambda l:map(len,l),zip(*table))) #functional magic
justified_table = []
for line in table:
justified_line=[]
for i,el in enumerate(line):
justified_line.append(el.ljust(widths[i]+2))
justified_table.append(justified_line)
for line in justified_table:
for el in line:
print el,
print
def print_cells(cells):
table=[columns]
for cell in cells:
cell_properties=[]
for column in columns:
cell_properties.append(cell[column])
table.append(cell_properties)
print_table(table)
def main():
"""Pretty prints the output of iwlist scan into a table"""
cells=[[]]
parsed_cells=[]
for line in sys.stdin:
cell_line = match(line,"Cell ")
if cell_line != None:
cells.append([])
line = cell_line[-27:]
cells[-1].append(line.rstrip())
cells=cells[1:]
for cell in cells:
parsed_cells.append(parse_cell(cell))
sort_cells(parsed_cells)
print_cells(parsed_cells)
main()
I hope you find it useful. Please report bugs, I haven't tested it a lot. You may have to customize it though, because I think not all iwlist scan outputs are the same. Again, see comments, it should be easy.This tool is very helpfull. I am trying to add a new function to the existing code to parse the signal level parameter from the output of iwlist wlan0 scan, but I am getting lot of issues .Since I am new to python script can anyone help me to extract the signal level also from the scan put put.
The parametr to be used is Signal level=-44 dBm ,I am trying to create a one more column with Signal level and print its out in the table.
Example:-
Signal level
-44db
The error I am getting
File "iwlist_parser_Testing.py", line 146, in <module>
main()
File "iwlist_parser_Testing.py", line 144, in main
print_cells(parsed_cells)
File "iwlist_parser_Testing.py", line 123, in print_cells
print_table(table)
File "iwlist_parser_Testing.py", line 102, in print_table
widths=map(max,map(lambda l:map(len,l),zip(*table))) #functional magic
File "iwlist_parser_Testing.py", line 102, in <lambda>
widths=map(max,map(lambda l:map(len,l),zip(*table))) #functional magic
TypeError: object of type 'NoneType' has no len()
Could some pls help me to solve this issue
Thanks -
Include python script inside an app
Hi all, I'm writing an applescript app which should use a python script.
how can I include the script inside the apple and have it called by the applescript?
Thank you!Now, is there a way to let the user choose both the output file directory and the output file name (out.iso)?
To get the filename, add this after the code to select the directory:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;">
set outPutName to text returned of (display dialog "Now, please enter a filename:" default answer "out" with title "Enter Filename") & ".iso"</pre>
But you need to remove "quoted form of the" from dirOutput.
Also, "set dirOutput to POSIX path of the dirOut" is not needed.
so, this should work:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;">
set dirOut to (POSIX path of (choose folder with prompt "Scegli la posizione in cui salvare il file convertito"))
set outPutName to text returned of (display dialog "Now, please enter a filename:" default answer "out" with title "Enter Filename") & ".iso"
if outPutName is ".iso" then set outPutName to "out.iso" -- simple error check for blank name
if outPutName contains "/" then set outPutName to "out.iso" -- simple error check for bad charater in name
set fullPathOut to quoted form of (dirOut & outPutName)
</pre>
Tony -
Using the advanced telemetry Python script (unrecognized signature)
I am trying to profile an AIR for Mobile project (using AIR 3.5) in Scout. I (apparently) cannot compile the project in Flash Builder because it utilizies CameraRoll. I'm trying to add advanced telemetry using the Python script at https://github.com/adamcath/telemetry-utils
First, AFAICT that script has typos in it, where tabs and spaces were mixed for indentation. After fixing those (I think), I always get the error:
"add-opt-in.py", line 158, in <module>
raise Exception("Bad SWF: Unrecognized signature: %s" % signature)
Exception: Bad SWF: Unrecognized signature: b'CWS'Hi,
I have converted all space based indentations to tabs in the attached script and it works fine for all the SWFs that I tried.
Could you please give this a try with your SWFs and let us know if it works ?
Dowload link - https://docs.google.com/open?id=0B_py8ocVzd4edG51cEN3MkhPbWM
If it still does not work, can you send us below details and a sample SWF if possible.
1. OS : Win / Mac version
2. Version of Python
3. Compiler / IDE / SDK used to generate the SWF
Thanks
Srinivas -
XChat2 python script in /usr/lib/xchat/plugins?
I'm trying to globally add cap_sasl_xchat.py, a python script to negotiate SASL authentication. I tried putting it in /usr/lib/xchat/plugins, but it doesn't seem to be auto-loading. If it's in ~/.xchat2/, it works. Any thoughts?
That is how it's designed it only loads plugins from there you must load scripts per user. There are multiple SASL plugins though you can find and compile, and HexChat in the AUR comes with SASL support.
-
Python Script to Generate MySQL Stored Routines
Here is a quick Python script that reads a MySQL scheme (database) and for each table, it generates Insert, Update, Get and Delete stored routines. The script is just a "quick-n-dirty" script, but it does take into account that the Update, Get and Delete routines need to key off the primary key (and if there's not one, there could be trouble!). Each stored routine is output into a separate file.
I'm attaching the script so you professional Python people can tell me where I could improve the script with respect to simplicity, readability, cleanliness, etc.
I have NOT yet got the command line parameters added to this script, but plan to soon.
#!/usr/bin/env python
# spgen.py
# Copyright 2008 Matt Runion <[email protected]>
import sys
import MySQLdb
# The INSERT template
insertTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
INSERT INTO %s (
%s
) VALUES (
%s
END$$
DELIMITER ;
# The UPDATE template
updateTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
UPDATE %s SET
%s
WHERE
%s;
END$$
DELIMITER ;
# The GET template
getTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
SELECT
%s
FROM %s
WHERE
%s;
END$$
DELIMITER ;
# The DELETE template
deleteTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
DELETE FROM %s
WHERE
%s;
END$$
DELIMITER ;
def generateSPs(dbhost, dbname, dbuser, dbpasswd):
This method reads all the tables from the database and for each of them
generates the following stored routines:
<TableName>_Insert
<TableName>_Update
<TableName>_Get
<TableName>_Delete
# Open the database connection
print 'Connecting to database [%s] on host [%s]' % (dbname, dbhost)
dbConn = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpasswd, db=dbname)
cur = dbConn.cursor()
# Get a list of all tables in the database
print 'Reading tables...'
cur.execute("SHOW TABLES FROM %s" % dbname)
tables = cur.fetchall()
for table in tables:
print 'Generating stored procs for table [%s]...' % table[0]
# Get a list of a columns in the current table
cur.execute("SHOW COLUMNS FROM %s" % table[0])
columns = cur.fetchall()
insertUpdateParms = ''
getDeleteParms = ''
whereClause = ''
insertList = ''
valuesList = ''
updateList = ''
for column in columns:
# Reset some variables
print ' %s -- %s [%s, %s, %s]' % (column[0], column[1], column[2], column[3], column[4])
# Append the columns to the input parms
if (len(insertUpdateParms) > 0):
insertUpdateParms += ',\n'
insertList += ',\n'
valuesList += ',\n'
if (len(updateList) > 0):
updateList += ',\n'
insertUpdateParms += '%sIN ' % column[0]
if ((column[1][0:3].lower() == 'var') or (column[1][0:3].lower() == 'cha')):
insertUpdateParms += '%s' % column[1]
elif (column[1][0:3].lower() == 'enu'):
insertUpdateParms += 'varchar(50)'
else:
insertUpdateParms += (column[1].split('('))[0]
insertList += column[0]
valuesList += '%sIN' % column[0]
# Generate the key parms that are used for the Get and Delete
# stored procs, and generate the values for the WHERE clause
# for the Update, Get and Delete stored procs
if (column[3].lower() == 'pri'):
if (len(getDeleteParms) > 0):
getDeleteParms += ',\n'
getDeleteParms += '%sIN ' % column[0]
if (column[1][0:3].lower() == 'var'):
getDeleteParms += '%s' % column[1]
else:
getDeleteParms += (column[1].split('('))[0]
if (len(whereClause) > 0):
whereClause += ' AND \n'
whereClause += '%s = %sIN' % (column[0], column[0])
else:
updateList += '%s = %sIN' % (column[0], column[0])
#print '---'
#print insertUpdateParms
#print '---'
#print getDeleteParms
#print '---'
#print whereClause
#print 'INSERT:'
#print insertTemplate % (table[0] + '_Insert', table[0] + '_Insert', insertUpdateParms, table[0], insertList, valuesList)
#print 'UPDATE:'
#print updateTemplate % (table[0] + '_Update', table[0] + '_Update', insertUpdateParms, table[0], updateList, whereClause)
#print 'GET:'
#print getTemplate % (table[0] + '_Get', table[0] + '_Get', getDeleteParms, insertList, table[0], whereClause)
#print 'DELETE:'
#print deleteTemplate % (table[0] + '_Delete', table[0] + '_Delete', getDeleteParms, table[0], whereClause)
# Write out the INSERT stored proc
file = open('./test/' + table[0] + '_Insert', 'w')
file.write(insertTemplate % (table[0] + '_Insert', table[0] + '_Insert', insertUpdateParms, table[0], insertList, valuesList))
file.close()
# Write out the UPDATE stored proc
file = open('./test/' + table[0] + '_Update', 'w')
file.write(updateTemplate % (table[0] + '_Update', table[0] + '_Update', insertUpdateParms, table[0], updateList, whereClause))
file.close()
# Write out the GET stored proc
file = open('./test/' + table[0] + '_Get', 'w')
file.write(getTemplate % (table[0] + '_Get', table[0] + '_Get', getDeleteParms, insertList, table[0], whereClause))
file.close()
# Write out the DELETE stored proc
file = open('./test/' + table[0] + '_Delete', 'w')
file.write(deleteTemplate % (table[0] + '_Delete', table[0] + '_Delete', getDeleteParms, table[0], whereClause))
file.close()
return 0
if __name__ == '__main__':
generateSPs('<SERVER>', '<DATABASE>', '<USER>', '<PASSWD>')I found and fixed a bug with some misplaced parenthesis that forced the path to be made all lower-case. This was a bad thing if the path had some upper case letters in it!
#!/usr/bin/env python
# spgen.py
# Copyright 2008 Matt Runion <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
import sys
import getopt
import os
import MySQLdb
# The INSERT template
insertTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
INSERT INTO %s (
%s
) VALUES (
%s
END$$
DELIMITER ;
# The UPDATE template
updateTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
UPDATE %s SET
%s
WHERE
%s;
END$$
DELIMITER ;
# The GET template
getTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
SELECT
%s
FROM %s
WHERE
%s;
END$$
DELIMITER ;
# The DELETE template
deleteTemplate = """
DELIMITER $$
DROP PROCEDURE IF EXISTS `%s`$$
CREATE PROCEDURE `%s` (%s)
BEGIN
DELETE FROM %s
WHERE
%s;
END$$
DELIMITER ;
def generateSPs(dbhost, dbname, dbuser, dbpasswd, outPath):
This method reads all the tables from the database and for each of them
generates the following stored routines:
<TableName>_Insert
<TableName>_Update
<TableName>_Get
<TableName>_Delete
# Open the database connection
print 'Connecting to database [%s] on host [%s]' % (dbname, dbhost)
dbConn = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpasswd, db=dbname)
cur = dbConn.cursor()
# Get a list of all tables in the database
print 'Reading tables...'
cur.execute("SHOW TABLES FROM %s" % dbname)
tables = cur.fetchall()
for table in tables:
print 'Generating stored procs for table [%s]...' % table[0]
# Get a list of a columns in the current table
cur.execute("SHOW COLUMNS FROM %s" % table[0])
columns = cur.fetchall()
insertUpdateParms = ''
getDeleteParms = ''
whereClause = ''
insertList = ''
valuesList = ''
updateList = ''
for column in columns:
# Reset some variables
print ' %s -- %s [%s, %s, %s]' % (column[0], column[1], column[2], column[3], column[4])
# Append the columns to the input parms
if (len(insertUpdateParms) > 0):
insertUpdateParms += ',\n'
insertList += ',\n'
valuesList += ',\n'
if (len(updateList) > 0):
updateList += ',\n'
insertUpdateParms += '%sIN ' % column[0]
if ((column[1][0:3].lower() == 'var') or (column[1][0:3].lower() == 'cha')):
insertUpdateParms += '%s' % column[1]
elif (column[1][0:3].lower() == 'enu'):
insertUpdateParms += 'varchar(50)'
else:
insertUpdateParms += (column[1].split('('))[0]
insertList += column[0]
valuesList += '%sIN' % column[0]
# Generate the key parms that are used for the Get and Delete
# stored procs, and generate the values for the WHERE clause
# for the Update, Get and Delete stored procs
if (column[3].lower() == 'pri'):
if (len(getDeleteParms) > 0):
getDeleteParms += ',\n'
getDeleteParms += '%sIN ' % column[0]
if (column[1][0:3].lower() == 'var'):
getDeleteParms += '%s' % column[1]
else:
getDeleteParms += (column[1].split('('))[0]
if (len(whereClause) > 0):
whereClause += ' AND \n'
whereClause += '%s = %sIN' % (column[0], column[0])
else:
updateList += '%s = %sIN' % (column[0], column[0])
# Write out the INSERT stored proc
file = open(os.path.join(outPath,(table[0] + '_Insert.sql').lower()), 'w')
file.write(insertTemplate % (table[0] + '_Insert', table[0] + '_Insert', insertUpdateParms, table[0], insertList, valuesList))
file.close()
# Write out the UPDATE stored proc
file = open(os.path.join(outPath,(table[0] + '_Update.sql').lower()), 'w')
file.write(updateTemplate % (table[0] + '_Update', table[0] + '_Update', insertUpdateParms, table[0], updateList, whereClause))
file.close()
# Write out the GET stored proc
file = open(os.path.join(outPath,(table[0] + '_Get.sql').lower()), 'w')
file.write(getTemplate % (table[0] + '_Get', table[0] + '_Get', getDeleteParms, insertList, table[0], whereClause))
file.close()
# Write out the DELETE stored proc
file = open(os.path.join(outPath,(table[0] + '_Delete.sql').lower()), 'w')
file.write(deleteTemplate % (table[0] + '_Delete', table[0] + '_Delete', getDeleteParms, table[0], whereClause))
file.close()
return 0
def main(argv):
SPGen reads all the tables from the given database and for each of
those tables generates the following stored routines:
<TableName>_Insert
<TableName>_Update
<TableName>_Get
<TableName>_Delete
Command line arguments are:
-?, --help: Help
-o, --outputpath: File output path
-h, --host: Database host/server
-d, --database: Database name
-u, --user: Database user
-p, --password Database password
# Set defaults...
outputPath = os.getcwd()
host = 'localhost'
database = ''
user = ''
password = ''
# See what command line options we have
try:
opts, args = getopt.getopt(argv[1:], '?o:h:d:u:p:', ['help', 'outputpath=', 'host=', 'database=', 'user=', 'password='])
except getopt.GetoptError:
print main.__doc__
sys.exit(2)
for opt, arg in opts:
if opt in ['-?', '--help']:
print main.__doc__
sys.exit()
elif opt in ['-o', '--outputpath']:
outputPath = arg
elif opt in ['-h', '--host']:
host = arg
elif opt in ['-d', '--database']:
database = arg
elif opt in ['-u', '--user']:
user = arg
elif opt in ['-p', '--password']:
password = arg
generateSPs(dbhost=host, dbname=database, dbuser=user, dbpasswd=password, outPath=outputPath)
if __name__ == '__main__':
main(sys.argv)
Last edited by mrunion (2008-11-20 19:33:37) -
Is there a way to internally host a form?
Hi Adobe
I want to know if it's possible to internally host a form instead of using the adobe site.
Is there a way to convert the form into html and have it uploaded to my own server?
We are using the form to register students coming into our facility, we want to make sure that information is not accessed by third party and that even when the adobe servers are down we can still access the form.
ThanksSorry you can't host the HTML yourself. Storing the data on our system is pretty secure (see http://forums.adobe.com/docs/DOC-1384) and we are rarely down. You can also export the data once in a while to a local system so you can access it when offline.
But if this doesn't work for you then one thing I can proposed to you (if you really want to take care of the data yourself) is to generate a PDF form instead of an HTML form. You will need a paid subscription for this. Then you can generate the PDF without a submit button. FormsCentral then won't collect data for this PDF. You can then use Adobe Acrobat to add a submit button to email the completed form to you via email. This way you are in charge of the data. See http://forums.adobe.com/message/5417336#5417336 for help on how to do this.
Hope this helps
Gen
Maybe you are looking for
-
The Exception of https connection
When i connect to https server if i input the IP,it throws java.io.IOException: HTTPS hostname wrong: should be <X.X.X.X>, but cert says<server> But if i input the server name, i.e. "server" it throws java.net.UnknownHostException:server what is the
-
What are the usable colors for SAPALOGO.bmp (wave animation in GUI) ?
Dear experts, I was trying to set up an own SAPALOGO.bmp - filmstrip with our companys own elements. The result is okay as far as the animation is concerned (it's got the same size and number of included pictures as the original), but the colors are
-
Move Photoshop CS 5 to New Computer
Running Photoshop CS 5 on Windows 7 computer. CS 5 was installed as "upgrade" to previous version of Photoshop. Buying new PC which will obviously have no previous versions of Photoshop installed. How do I get CS 5 installed on the new PC? Thanks
-
E71 Messaging won't connect with gmail ?
Last week i updated a E71 to the latest software versions. After this updatei'm unable to connect to gmail , i've already checked messaging.nokia.com and downloaded the latest version, 9.07(21) of the software, but to no avail. After going through t
-
hi sap gurus i need clarification about in asset account i.e in middle period of a fiscal year we made additions for buildings or made repairs, those are expences how i add to that asset, regards venkatareddy