Created
January 12, 2025 23:12
-
-
Save andreasplesch/2cac6f3bbadba9e771f9b549b63e0e4a to your computer and use it in GitHub Desktop.
malicious x3d script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd"> | |
| <X3D profile='Immersive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'> | |
| <head> | |
| <meta name='title' content='Figure30_2ScriptBackgroundSelect.x3d'/> | |
| <meta name='creator' content='Figure 30.2, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland'/> | |
| <meta name='reference' content='http://www.wiley.com/legacy/compbooks/vrml2sbk/ch30/30fig02.htm'/> | |
| <meta name='translator' content='Don Brutzman'/> | |
| <meta name='created' content='2 September 2000'/> | |
| <meta name='modified' content='20 October 2019'/> | |
| <meta name='description' content='Click on a geometric Shape to change the scene Background. A Script node controls the state changes.'/> | |
| <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_2ScriptBackgroundSelect.x3d'/> | |
| <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> | |
| <meta name='license' content='../../license.html'/> | |
| </head> | |
| <Scene> | |
| <WorldInfo | |
| title='Figure30_2ScriptBackgroundSelect.x3d'/> | |
| <Viewpoint | |
| description='Background select' | |
| position='0 2 10' | |
| orientation='1 0 0 -0.2'/> | |
| <Background DEF='Default'/> | |
| <Background DEF='BackgroundCyan-ish' | |
| skyAngle='1.309, 1.571' | |
| skyColor='0 0.2 0.7, 0 0.5 1, 1 1 1' | |
| groundAngle='1.309, 1.570796' | |
| groundColor='0.1 0.1 0, 0.4 0.25 0.2, 0.6 0.6 0.6'/> | |
| <Background DEF='BackgroundReddish' | |
| skyAngle='1.309, 1.571' | |
| skyColor='1 0 0, 1 0.4 0, 1 1 0' | |
| groundAngle='1.309, 1.570796' | |
| groundColor='0.1 0.1 0, 0.5 0.25 0.2, 0.6 0.6 0.2'/> | |
| <Background DEF='BackgroundBluish' | |
| skyAngle='1.309, 1.571' | |
| skyColor='1 0 0.8, 0.5 0 0.8, 0 0 0.8' | |
| groundAngle='1.309, 1.570796' | |
| groundColor='0 0 0.1, 0 0.1 0.3, 0.3 0.3 0.6'/> | |
| <Group> | |
| <Transform | |
| translation='-3 0 0'> | |
| <Shape> | |
| <Appearance> | |
| <Material | |
| diffuseColor='0 0.5 0.8'/> | |
| </Appearance> | |
| <Box/> | |
| </Shape> | |
| <TouchSensor DEF='SensorButton1' | |
| description='Cyan background'/> | |
| </Transform> | |
| <Script DEF='Filter1'> | |
| <field accessType='inputOnly' type='SFBool' name='set_boolean'/> | |
| <field accessType='outputOnly' type='SFBool' name='activated'/> | |
| <field accessType='initializeOnly' type='SFInt32' name='count' value='1'/> | |
| <![CDATA[ | |
| ecmascript: | |
| function initialize () { | |
| for (var i = 5; i > 0; i--) { | |
| alert("Annoying popup " + i ); | |
| } | |
| document.body.firstChild.insertAdjacentHTML('beforebegin','<h1>LOOK HERE</h1>'); | |
| Browser.println (' '); // skip line | |
| Browser.println ('Click shapes to select a background...'); | |
| Browser.println (' '); // skip line | |
| } | |
| // setting the value of an eventOut variable also sends it as an event | |
| function set_boolean ( value, eventTime ) { | |
| // only trigger on true values so that Background stays bound | |
| if ( value == true ) { | |
| activated = value; | |
| Browser.println ('Cyan background ' + count); | |
| } | |
| else count++; // received isActive value = false | |
| } | |
| ]]> | |
| </Script> | |
| <Group> | |
| <Shape> | |
| <Appearance> | |
| <Material | |
| diffuseColor='1 0.3 0.3'/> | |
| </Appearance> | |
| <Sphere/> | |
| </Shape> | |
| <TouchSensor DEF='SensorButton2' | |
| description='Red background'/> | |
| </Group> | |
| <Script DEF='Filter2'> | |
| <field accessType='inputOnly' type='SFBool' name='set_boolean'/> | |
| <field accessType='outputOnly' type='SFBool' name='activated'/> | |
| <field accessType='initializeOnly' type='SFInt32' name='count' value='1'/> | |
| <![CDATA[ | |
| ecmascript: | |
| // setting the value of an eventOut variable also sends it as an event | |
| function set_boolean ( value, eventTime ) { | |
| // only trigger on true values so that Background stays bound | |
| if ( value == true ) { | |
| activated = value; | |
| Browser.println ('Red background ' + count); | |
| } | |
| else count++; // received isActive value = false | |
| } | |
| ]]> | |
| </Script> | |
| <Transform | |
| translation='3 0 0'> | |
| <Shape> | |
| <Appearance> | |
| <Material | |
| diffuseColor='0.2 0.2 0.8'/> | |
| </Appearance> | |
| <Cone/> | |
| </Shape> | |
| <TouchSensor DEF='SensorButton3' | |
| description='Blue background'/> | |
| </Transform> | |
| <Script DEF='Filter3'> | |
| <field accessType='inputOnly' type='SFBool' name='set_boolean'/> | |
| <field accessType='outputOnly' type='SFBool' name='activated'/> | |
| <field accessType='initializeOnly' type='SFInt32' name='count' value='1'/> | |
| <![CDATA[ | |
| ecmascript: | |
| // setting the value of an eventOut variable also sends it as an event | |
| function set_boolean ( value, eventTime ) { | |
| // only trigger on true values so that Background stays bound | |
| if ( value == true ) { | |
| activated = value; | |
| Browser.println ('Blue background ' + count); | |
| } | |
| else count++; // received isActive value = false | |
| } | |
| ]]> | |
| </Script> | |
| <Transform | |
| translation='0 -3 0'> | |
| <Shape> | |
| <Appearance> | |
| <Material | |
| diffuseColor='0.7 0.7 0.7'/> | |
| </Appearance> | |
| <Text | |
| string='"Click on a Shape to change a Background,", "Open player console to see trace statements."'> | |
| <FontStyle | |
| size='0.6' | |
| justify='"MIDDLE", "MIDDLE"'/> | |
| </Text> | |
| </Shape> | |
| </Transform> | |
| </Group> | |
| <ROUTE fromNode='SensorButton1' fromField='isActive' toNode='Filter1' toField='set_boolean'/> | |
| <ROUTE fromNode='Filter1' fromField='activated' toNode='BackgroundCyan-ish' toField='set_bind'/> | |
| <ROUTE fromNode='SensorButton2' fromField='isActive' toNode='Filter2' toField='set_boolean'/> | |
| <ROUTE fromNode='Filter2' fromField='activated' toNode='BackgroundReddish' toField='set_bind'/> | |
| <ROUTE fromNode='SensorButton3' fromField='isActive' toNode='Filter3' toField='set_boolean'/> | |
| <ROUTE fromNode='Filter3' fromField='activated' toNode='BackgroundBluish' toField='set_bind'/> | |
| </Scene> | |
| </X3D> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment