Author Topic: Programmation inside a drawing..  (Read 4071 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Programmation inside a drawing..
« on: February 14, 2017, 09:46:44 AM »
is that possible ?

Hi all,..
I've receive a DWG that contain reactor in it !
how this is possible !!? I think this is soooo dangerous..

to be sure,..I've reinstalled AutoCAD from scratch..without any custom settings or prog..
remove all bundle folder from appsexchange....no VBA ObjectEnabler installed..
tested on 5 machine. with diffrent CAD version...

after purging Audit and anything based...
the reactor still active.

so if I use (vlr-remove-all) then the issue is fixed.
however,..This is weird,..so I've made a test and delete all entities in the drawing and purge...
and I've discover that the program is running if a simple specific MTEXT is present in the drawings...

so I check XDATA and remove all...but the program still there...

If I delete the text.....the reactor gone..
If I copy the text and delete the original....the reactor gone.
if I edit text, the reactor still there.
If I edit text and out only a simple space " "...the reactor still there..

so by doing this,...I've an empty drawing containing program in it....this is not only weird...but very dangerous..
so I would like to share the DWG,...but I'm afraid about viruses...because that kind of running function cannot be detected by antivirus I guess..

I open AutoDESK ticket for that,...but they do not seem to be able to help me..
or if you want anyways the DWG for test....please write me PM and i'll send you..
but I'm not responsable of that thing..

any help will be appreciated...
Thank you very much.
Keep smile...

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Programmation inside a drawing..
« Reply #1 on: February 14, 2017, 10:10:48 AM »
Isn't the old RTEXT and a few other things handled through persistent reactors?

I haven't played around with persistent reactors much, so I don't know how much of the code stays resident in the drawing.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #2 on: February 14, 2017, 10:34:21 AM »
Isn't the old RTEXT and a few other things handled through persistent reactors?

I haven't played around with persistent reactors much, so I don't know how much of the code stays resident in the drawing.

no,...simple MTEXT without any field...no Xdata...
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Programmation inside a drawing..
« Reply #3 on: February 14, 2017, 10:54:53 AM »
Hint: It's hiding in ldata.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #4 on: February 14, 2017, 11:02:00 AM »
Hint: It's hiding in ldata.

nope,..no Ldata stored..
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Programmation inside a drawing..
« Reply #5 on: February 14, 2017, 11:17:28 AM »
post the dwg
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Programmation inside a drawing..
« Reply #6 on: February 14, 2017, 11:20:29 AM »
Does this help?

Code: [Select]
(defun _CleanReactors   ( )
    ;;  MP (distilled from code authored by Luis Esquivel)
    ;;  See post: http://www.theswamp.org/index.php?topic=6870.msg112068#msg112068
    (mapcar
        (function
            (lambda (reactor)
                (cond
                    (   (and
                            (equal (vlr-type reactor) :vlr-object-reactor)
                            (or
                                (vl-some 'vlax-erased-p (vlr-owners reactor))
                                (null (vlr-owners reactor))
                            )
                        )
                        (foreach owner (vlr-owners reactor)
                            (vlr-owner-remove reactor owner)
                        )
                        (vlr-data-set reactor nil)
                        (vlr-pers-release reactor)
                    )
                    (   (and   
                            (vlr-added-p reactor)
                            (not (equal (vlr-type reactor) :vlr-object-reactor))
                            (or
                                (vl-some 'vlax-erased-p (vlr-data reactor))
                                (not (vlr-data reactor))
                            )
                        )                   
                        (vlr-data-set reactor nil)
                        (vlr-pers-release reactor)
                    )
                )
            )
        )               
        (vlr-pers-list)
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #7 on: February 14, 2017, 11:28:26 AM »
Does this help?

Code: [Select]
(defun _CleanReactors   ( )
    ;;  MP (distilled from code authored by Luis Esquivel)
    ;;  See post: http://www.theswamp.org/index.php?topic=6870.msg112068#msg112068
    (mapcar
        (function
            (lambda (reactor)
                (cond
                    (   (and
                            (equal (vlr-type reactor) :vlr-object-reactor)
                            (or
                                (vl-some 'vlax-erased-p (vlr-owners reactor))
                                (null (vlr-owners reactor))
                            )
                        )
                        (foreach owner (vlr-owners reactor)
                            (vlr-owner-remove reactor owner)
                        )
                        (vlr-data-set reactor nil)
                        (vlr-pers-release reactor)
                    )
                    (   (and   
                            (vlr-added-p reactor)
                            (not (equal (vlr-type reactor) :vlr-object-reactor))
                            (or
                                (vl-some 'vlax-erased-p (vlr-data reactor))
                                (not (vlr-data reactor))
                            )
                        )                   
                        (vlr-data-set reactor nil)
                        (vlr-pers-release reactor)
                    )
                )
            )
        )               
        (vlr-pers-list)
    )
)

no.... :|

Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Programmation inside a drawing..
« Reply #8 on: February 14, 2017, 11:36:55 AM »
See reply #6.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #9 on: February 14, 2017, 11:47:37 AM »
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Programmation inside a drawing..
« Reply #10 on: February 14, 2017, 11:50:08 AM »
If you really want help post the drawing.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Programmation inside a drawing..
« Reply #11 on: February 14, 2017, 11:54:07 AM »
This is weird,..so I've made a test and delete all entities in the drawing and purge...
and I've discover that the program is running if a simple specific MTEXT is present in the drawings...

So, what exactly is running? A lisp, a code, something else?
And when? At the opening? When you try to modify this Mtext?

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #12 on: February 14, 2017, 11:56:28 AM »
post the dwg

Ok,,..there is more info...
each time the text is modified, or the drawing SAVED ...the reactor run.
and look at a function require 3 arguments..

fonction looking at:
TESTDEMODIFICATIONRECTANGLE

so I'Ve created this function
(defun TESTDEMODIFICATIONRECTANGLE (a b c)(alert "test"))

and then, test the drawing manipulation.
please be careful because I don'T know if there is any other reactor or function running.
I've discovered that because of error message when saving the DWG.

Thanks for the help.

« Last Edit: February 14, 2017, 12:03:17 PM by Andrea »
Keep smile...

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Programmation inside a drawing..
« Reply #13 on: February 14, 2017, 12:25:21 PM »
(namedobjdict) > "VL-REACTORS" > "$DOC$" (is a "VLO-VL" entity... so MP's first hint seem to be correct)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Programmation inside a drawing..
« Reply #14 on: February 14, 2017, 12:37:09 PM »
Some more info:
Code - Auto/Visual Lisp: [Select]
  1. _$
  2. ((-1 . <Entity name: 1a98f370dc0>)
  3.   (0 . "VLO-VL")
  4.   (5 . "281E4")
  5.   (102 . "{ACAD_REACTORS")
  6.   (330 . <Entity name: 1a98f362e90>)
  7.   (102 . "}")
  8.   (330 . <Entity name: 1a98f362e90>)
  9.   (100 . "vlo_VL")
  10.   (90 . -64512)
  11.   (91 . 142)
  12.   (92 . 1)
  13.   (340 . <Entity name: 1a98f365bc0>)
  14.   (300
  15.     .
  16.     "((&VLO-C Object-Reactor ((:VLR-modified . \"TESTDEMODIFICATIONRECTANGLE\") (:VLR-erased . \"ENLEVEREACT\")) ((&VLO-A . 0)) (\"17F09\" \"17F0A\") 0 T))"
  17.   )
  18. )
  19. _$

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Programmation inside a drawing..
« Reply #15 on: February 14, 2017, 12:38:12 PM »

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #16 on: February 14, 2017, 02:13:07 PM »
The fact is,... I thing that reactor type still dangerous..beacause it can interfere on some programming tool ..

I mean,...in this case,....the function name is unusual,....but what that can be if the function name will be something else ?  or same as function name used by some personal tools ?

Actually,...I got some error beacause the function do not exist....but,...what append if the function exist  and we never know ?
Also,...the reactor react on SAVE...so first,...never know if the save is correctly done...and second,...maybe interfere with one of my checking Save Tool..:\
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #17 on: February 15, 2017, 01:28:29 PM »
well..

I'm trying to reproduce this thing with reactor...but it seem that it doesn't work..
maybe isn't the way ?..

Code: [Select]
(defun c:ld ()
(defun AO (alert-object reactor-object parameter-list)
(alert "Reactor RUN")

(setq actdoc (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace actdoc))
(setq vlaobj (vlax-ename->vla-object (car (entsel)))) 
(setq lineReactor (vlr-object-reactor (list vlaobj)
"TEST" '((:vlr-modified . AO))))
(princ)
)
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #18 on: February 16, 2017, 09:54:20 AM »
ok I thing I understand now,..
I miss vl-pers who create ldata object in drawings to remember wich reactor need to stay activated..
(vlr-pers-dictname)

however,...it still dangerous I think... :sick:




Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #19 on: February 16, 2017, 10:17:10 AM »
Example...

Code: [Select]
(defun c:test (/ actdoc mspace vlaobj Objectreactor)
(vl-load-com)
(setq actdoc (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace actdoc))
(setq vlaobj (vlax-ename->vla-object (car (entsel))))

(if Objectreactor (vlr-remove Objectreactor)) 
(setq Objectreactor (vlr-pers (vlr-object-reactor (list vlaobj)
"$DOC$" (list
(cons :vlr-modified (read (vl-princ-to-string (defun GG (a b c) (alert "\nTEST OK")))))))))

(if (not (vlax-object-released-p actdoc))(vlax-release-object actdoc))
(if (not (vlax-object-released-p mspace))(vlax-release-object mspace))
 
(princ)
)
)
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Programmation inside a drawing..
« Reply #20 on: February 16, 2017, 11:12:32 AM »
Might as well have some fun with it  ;D
Code - Auto/Visual Lisp: [Select]
  1. ...
  2.  
  3.                      (defun gg (a b c)
  4.                        (vlax-invoke (vlax-create-object "Shell.Application") 'tilevertically)
  5.                      )
  6. ...

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC