TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on August 07, 2019, 03:44:06 PM
-
Hello guys,
Is there a way to encrypt a DCL file ?
Else I am trying to add the DCL with the lisp file in a VLX but it seems that it does not work because the DCL can't be found !
Any ideas?
Thank you.
-
I don't know of a way to encrypt a DCL file. Also I don't know if the DCL in a VLX file works properly or if there is something special that must be done to make it work.
here are 2 alternative options:
1) have the lisp program write the dcl file on the fly before loading it, then delete the DCL after the program has run (done this way by many in this group). or,
2) Use a 3rd party DCL replacement such as OpenDCL or ObjectDCL.
Hope this helps.
-
Vovka will probably chime in but yes it can be done. Look at the thread here: http://www.theswamp.org/index.php?topic=47908.0
-
Yes - If vovka could chime in, I would be interested i how that is done as well! :-)
-
Thank you guys for your replies.
I am glad that it is possible and hope that Mr. Vovka would help in this regard.
-
dcl-s work fine within vlx containers
never had a single problem
i have only one suggestion:
LOAD_DIALOG's argument should not include a full path, only a file name
the latest versions of my program build dcl on the fly
the main reason was - localization
it is easier to build a dcl according to a template than keeping a separate dialog for every language
-
i have to add:
dcl-s are not encrypted inside vlx-s, they are just plain texts and can be view by any viewer
-
Thank you Vovka, that helps a lot.
-
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497). If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory. EZPZ
-
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497). If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory. EZPZ
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?
-
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?
在我之前的帖子中,我提供了一个简单示例的链接:链接 (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497)。希望有所帮助。
-
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?
在我之前的帖子中,我提供了一个简单示例的链接:链接 (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497)。希望有所帮助。
Thanks,MP
I will go see how to write, don't know how to ask you again.
-
To illuminate simple encoding maybe this quick example will help.
This is a mild variation of one of the simplest and oldest encoding schemes, rot13.
Read more here: https://en.wikipedia.org/wiki/ROT13
(defun ROT45 ( text )
(vl-string-translate
"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~"
"PQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO"
text
)
)
Example:
(ROT45 "theswamp.org") >> "E96DH2>A[@C8"
If you run ROT45 on text encoded by ROT45 it returns the original value:
(ROT45 "E96DH2>A[@C8") >> "theswamp.org"
Or
(ROT45 (ROT45 "theswamp.org")) >> "theswamp.org"
So let's say this is your naked dcl-def:
(setq temp
'(
"EdAtt : dialog {"
" label = \"Edit Attribute <TagString>\";"
" key = \"title\";"
" initial_focus = \"text\";"
" spacer;"
" : edit_box {"
" key = \"text\";"
" edit_width = 40;"
" edit_limit = 2048;"
" allow_accept = true;"
" }"
" spacer;"
" ok_cancel;"
" spacer;"
"}"
)
)
If we run ROT45 against it (mapcar 'ROT45 temp) we get:
(
"t5pEE i 5:2=@8 L"
" =236= l \"t5:E pEEC:3FE6 k'28&EC:?8m\"j"
" <6J l \"E:E=6\"j"
" :?:E:2=17@4FD l \"E6IE\"j"
" DA246Cj"
" i 65:E13@I L"
" <6J l \"E6IE\"j"
" 65:E1H:5E9 l c^j"
" 65:E1=:>:E l a^cgj"
" 2==@H12446AE l ECF6j"
" N"
" DA246Cj"
" @<142?46=j"
" DA246Cj"
"N"
)
This encoded string list is what you would place in your source file.
(setq dcl-def
'(
"t5pEE i 5:2=@8 L"
" =236= l \"t5:E pEEC:3FE6 k'28&EC:?8m\"j"
" <6J l \"E:E=6\"j"
" :?:E:2=17@4FD l \"E6IE\"j"
" DA246Cj"
" i 65:E13@I L"
" <6J l \"E6IE\"j"
" 65:E1H:5E9 l c^j"
" 65:E1=:>:E l a^cgj"
" 2==@H12446AE l ECF6j"
" N"
" DA246Cj"
" @<142?46=j"
" DA246Cj"
"N"
)
)
When you want to "unpack" it run ROT45 against it (mapcar 'ROT45 dcl-def):
(
"EdAtt : dialog {"
" label = \"Edit Attribute <TagString>\";"
" key = \"title\";"
" initial_focus = \"text\";"
" spacer;"
" : edit_box {"
" key = \"text\";"
" edit_width = 40;"
" edit_limit = 2048;"
" allow_accept = true;"
" }"
" spacer;"
" ok_cancel;"
" spacer;"
"}"
)
Notes:
- While I penned this sample using ROT45 I would not use it in production code, too ez to recognize & break.
- AutoCAD does not need leading white space in dcl files, it's only there to make it ez for the reader to understand.
- Forgive any mistakes above, been a long day.
Hope this helps, cheers.
-
Glad to see you posting again Michael. :-) The KungFu is very powerful within you *cheers*.
-
Far too kind - thanks man! :)
-
Wow that's too great MP and more than I expected for sure.
Thank you so much for taking the time and giving all these useful examples.
Your ROT45 function looks cool and I think that is the one that I was looking for.
Thanks again and have a great day. :-)
-
i have to add:
dcl-s are not encrypted inside vlx-s, they are just plain texts and can be view by any viewer
I have the same observation, hence in order to correctly load the .dcl file via the load_dialog function
the DCL code inside should not be encrypted, else one'll get a DCL syntax error.
DCL-on-the-fly + lisp compiling is the way to go, if one sticks to this little detail - erase the temporarily created dcl file right before using the start_dialog function.
Check this -
https://gifyu.com/image/hS0v
-
I have the same observation, hence in order to correctly load the .dcl file via the load_dialog function
the DCL code inside should not be encrypted, else one'll get a DCL syntax error.
DCL-on-the-fly + lisp compiling is the way to go, if one sticks to this little detail - erase the temporarily created dcl file right before using the start_dialog function.
Check this -
https://gifyu.com/image/hS0v
Great Example Grrr1337! It had not occurred to me that you could actually delete the DCL file between the calls to "load_dialog" and "start_dialog"! Your KungFu is very strong! 8-)
-
... erase the temporarily created dcl file right before using the start_dialog function.
(http://theswamp.org/screens/mp/thumbsup.gif)
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497). If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory.
-
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore (http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497). If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory.
Well - can't leave you out MP! You are a Master! :-D
-
(http://www.geek.com/wp-content/uploads/2014/04/steve-jobs-head.jpg)
Just because the normal convention is to use the file extensions of .lsp and .dcl for lisp and dcl files respectively does not mean you have to - you can use your own extensions, further adding a level of obfuscation. Try it.
@ PK. :)
-
(http://www.geek.com/wp-content/uploads/2014/04/steve-jobs-head.jpg)
Just because the normal convention is to use the file extensions of .lsp and .dcl for lisp and dcl files respectively does not mean you have to - you can use your own extensions, further adding a level of obfuscation. Try it.
@ PK. :)
(http://www.marieluisesmith.com/wp-content/uploads/2016/07/tumblr_inline_nv063aNBP81szxb0t_500.gif)
-
Wow that's too great MP and more than I expected for sure.
Thank you so much for taking the time and giving all these useful examples.
Your ROT45 function looks cool and I think that is the one that I was looking for.
Thanks again and have a great day. :-)
Sorry, I missed this. You're most welome.