D y n a m i c s o f S e l f - r e p l i c a t i n g C o d e B e h a v i o r This article is not about Dynamics of Self-replicating Code Behavior. I just wanted to make sure that you gonna read this article. 8-) And now that know what it feels like for the poor guy who realises that 'FUCKING_WITH_DOGS.SCR' is not a screen saver, let this article self-renamed into: P o l y m o r p h i s m u s i n g X M L The code presented here is based on the concept of my SPLVM engine. I would like to thank rajaat for giving me the idea of using VBScript and XML to implement those stuff. This article is not going to teach you what XML is and how to handle XML data with VBScript. I make use of XML because it's a good way to handle structured data. The code consists of a couple of functions that recursivly traverse the xml document tree and produce the output. Let's see how it works with a 'hello-world!'-type example. Create a file named polyxml.xml and put in the following text: Kyle's mom, is a stupid bitch! now you have to call the engine with the following code: 'Variables Dim xmlDoc Dim parsedDoc Dim nodeList Dim currNode Dim count 'Initialize randomizer Randomize 'Create 1 instance of an XML Object 'turn of asynchronous comminication 'preserve WhiteSpace/tabs/newlines/etc Set xmlDoc = CreateObject("Microsoft.XMLDOM") xmlDoc.async = false xmlDoc.preserveWhiteSpace = true 'Load the XML document xmlDoc.load("polyxml.xml") 'Call the engine and presend the result WScript.Echo PolyGenerate(xmlDoc.documentElement) The above code will create an XML Document using the Microsoft XML parser. Loading the xml from a file is not very usefull for a virus. You can use the function loadxml(string) instead. (ex: xmlDoc.loadxml("Hello World!") ) Run the file polyxml.xml to see the results. Now lets make it complex. What about having more words in place of the word 'stupid', and select one randomly? Test the following code. (polyxml1.xml) Kyle's mom, is a bitch! Load this file in the engine. Get the idea? Now let's add a 'all day long' before or after the 'is a * bitch'. (polyxml2.xml) Kyle's mom, all day long is a bitch ! Time to stop for a little bit of explanation here. Till now we show the , is for choising one action, between several similar actions. When the engine reach a element. is for grouping together things that can be places in random order. The engine will randomly select one child, evaluate it, and return it's result. This process will keep on, till all of the childs get fully evaluated (=removed), when the engine will remove this element. There is one more tag named . See an example first and we will explain it afterwards: (polyxml3.xml) dim CryptLength CryptLength = 16 dim CryptKey CryptKey = "FoD5N8sDtGfdx4jI" Here we want to define two variables and then asign values to them. Definition must happen before the asignment for each variable, but we also want the 4 lines of code to be placed in an as random as possiple order. That's why we use the tag to tell that we want to preserve the order of evaluation for some elements, but let it freelly mix them with all other childs of element. is for preserving the order of evaluation. When the engine reach a element it will evaluate the first child and return it's result. One by one, the childs will get fully evaluated and removed from the XML document. Once there are no childs left, the element will be removed too. Some things you can do to improve the engine is to: - implement a tag, that returns the string plus a new line character. - improve the tag, so that you will be able to write to the output string. - Using an attribute in the elements with the same attribute get synchronized - evaluating the same N-th child element. - implement a mechanism to perform backpatching in the output stream. exemple in Binaries dirz ANAkTOS[MATRiX]