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 ,