Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    View 'information' that is "return"ed by a javascript program running?

    I am pretty novice. I do not know much about the compilers or how these things run. I do however have a good eye for trends and can figure just about anything out by looking at it.

    With that;

    I have a game that uses a exe launcher with a built in patcher.

    I have found the code for the launcher. There are several "jquery" scripts for basic components like scroll wheel. There are also things like "downloader.js", "inputs.js".

    I am interested in seeing what (and more precisely how many) ip addresses are being retrieved. I fear this patcher is using a hidden bittorrent like download system.

    The code for "downloader" is pretty basic. It clearly uses some other script, but I am wondering if you can point me in the direction of a utility to monitor running JS so that I can see what is being returned.

    Code:
    _Downloader = function()
    {
    	this.downloadStatusCallback = null;
    }
    
    _Downloader.prototype = 
    {
    
    	setDownloadStatusCallback: function(callback)
    	{
    		this.downloadStatusCallback = callback;
    	},
    
    	addDownload: function(downloadName, metaUrl, outputPath, authorizationURL) // returns bool
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnBool('addDownload', 'string:' +  downloadName + '|' + 'string:' +  metaUrl + '|' + 'string:' +  outputPath + '|' + 'string:' +  authorizationURL + '|');
    	},
    
    	removeDownload: function(downloadName) // returns bool
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnBool('removeDownload', 'string:' +  downloadName + '|');
    	},
    
    	getDownloadOption: function(downloadName, optionName) // returns string
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnString('getDownloadOption', 'string:' +  downloadName + '|' + 'string:' +  optionName + '|');
    	},
    
    	setDownloadOptions: function(downloadName, enableBitSources, enableWebSources) // returns bool
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnBool('setDownloadOptions', 'string:' +  downloadName + '|' + 'bool:' +  enableBitSources + '|' + 'bool:' +  enableWebSources + '|');
    	},
    
    	getDownloadActive: function(downloadName) // returns bool
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnBool('getDownloadActive', 'string:' +  downloadName + '|');
    	},
    
    	setDownloadActive: function(downloadName, active) // returns bool
    	{
    		return document.SSNLauncher.SSNLauncher_ReturnBool('setDownloadActive', 'string:' +  downloadName + '|' + 'bool:' +  active + '|');
    	}
    
    }
    
    function __Downloader_reportdownloadStatus(downloadName, state, active, totalBytes, bytesLeft, maxIncoming, averageIncoming, currentIncoming, maxOutgoing, averageOutgoing, currentOutgoing, bytesRead, bytesSent, scanBytesLeft)
    {
    	if (SSN.Downloader.downloadStatusCallback != null)
    	{
    		SSN.Downloader.downloadStatusCallback(downloadName, state, active, totalBytes, bytesLeft, maxIncoming, averageIncoming, currentIncoming, maxOutgoing, averageOutgoing, currentOutgoing, bytesRead, bytesSent, scanBytesLeft);
    	}
    }
    I have tried on several occasions to teach myself programing. I can get the commands and syntax fairly easily, and I am pretty good at 'coming up' with ways to get something done. I just don't have experience in this field (I'm in medical school) so I do not know about the tools and utilities programers use and scouring the internet has been less than fruitful.

    Anybody capable of pointing me in the direction of finding a utility to monitor running js (if that is even possible =/).

    I use dreamweaver CS5 to explore js code.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Firebug.

    Use a FireFox browser and install the Firebug plugin. It allows you to monitor the JS code pretty easily, though it takes a little bit of playing with it to understand how best to use it.

    You can set "breakpoints" in the code and then step through the following code line by line. When another function is called, you can choose to skip over the function call or follow the code into the function.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,188
    Thanks
    10
    Thanked 569 Times in 550 Posts
    since you are constructing objects, firebug won't be able to peep in as easily, and it's hard to tell where the instances are; this is just the constructor.

    replace the constructor with one that collects all instances to a global variable so you can browse the DOM tab of firebug and see what's goin on:
    Code:
    _Downloader = function()
    {
    
    window.INSTANCES=window.INSTANCES||[];
    window.INSTANCES.push(this);
    
    	this.downloadStatusCallback = null;
    }
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    If your main concern is just finding out the IP address(es) or URL(s) being visited you can use Firefox with the "Live HTTP Headers" plugin to view and capture all HTTP requests from Firefox in real time.

    Edit: Had a thought after re-reading your post. If this uses a *.exe file then I suppose you're not using it in-browser? If that is the case and you still want to monitor the IP addresses or URLs in use you can install Wireshark (Windows, Linux, and Mac) or the Windows-only Sysinternals Suite and use the "TCPView."

    Either option should give you total view of the connections being made to external servers.
    Last edited by Rowsdower!; 09-09-2011 at 08:58 PM.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •