Results 1 to 18 of 18

Thread: [RESOLVED] Use VB6 to develop a tool similar to AstExplorer.net

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Resolved [RESOLVED] Use VB6 to develop a tool similar to AstExplorer.net

    AstExplorer is a very convenient tool, but sometimes I need to use AstExplorer offline, that is to say, use AstExplorer on some computers that cannot connect to the Internet. So I plan to use VB6 to develop a tool similar to AstExplorer. One way is to use the traditional VB6 way, for example: the left panel is WebBrowser/WebView, the right panel is VB6.TreeView (or VB6.MyTreeView) components. Another way is to use WebView (Edge-Chromium) + Html + Js, which means that all operations are performed in WebView.

    The first way is no problem for me, I just need to develop a new MyTreeView component. But now desktop components have been gradually eliminated, so I have no interest in wasting time to develop MyTreeView component. So I tend to adopt the second method, which is more Web-based. Since I have no experience in developing complex web components, I'd like to know whether the second solution is feasible, how difficult and the development workload is, is it necessary to adopt the second solution?
    (Note: I mainly hope to accumulate WebUI development experience through the second solution)

    Any help and suggestions would be greatly appreciated.

    Edit:

    The problem I want to solve is: how to run some Web-Apps containing a large number of third-party JS libraries (such as AstExplorer) in the WebView(Edge-Chromium) of VB6 and be able to interact (communicate) with VB6 code.
    (After I solve the above problems, then I will try how to combine NodeJS and Electron with VB6)

    In addition, the third solution is to deploy AstExplorer locally based on the source code provided by AstExplorer github. But I don't know how to carry out this work.
    Last edited by SearchingDataOnly; May 10th, 2021 at 09:41 PM.

  2. #2
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: Use VB6 to develop a tool similar to AstExplorer.net


  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    So how is this a VB6 question at all, aside from you wanting to wrap this huge pile of poo within a VB6 Form somehow, maybe?

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Sure, but if it is developed with VB6, it IS a VB6 question. I'm not sure on whether the question is about replicating functionality (I have no idea what AstExplorer is) or integrating with something else, but it sure sounds like VB6 to me.
    My usual boring signature: Nothing

  5. #5
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by yokesee View Post
    The github link even includes instructions for running locally, that might solve the OPs problem.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by PlausiblyDamp View Post
    Quote Originally Posted by yokesee View Post
    The github link even includes instructions for running locally, that might solve the OPs problem.
    Yes, I read the source code of AstExplorer on github, but I still don't know how to deploy astExplorer locally.

    I have been studying JavaScript for several years, but I still don't know how to do some complex web development (including deployment), which makes me very frustrated.

    More than 20 years ago, when I graduated from university, I didn't even use Windows. After only 2 weeks of browsing and learning VB3, I was able to carry out formal software development work (developing some complex commercial systems). Later, we used VC+VB for several years of mixed programming (compared with VB, I studied VC hard for 3 months to use VC for formal programming work), but the powerful development efficiency of VB made me finally give up VC completely. This was the biggest mistake in my life. This is why I have been reluctant to use VC again, because it is a painful past.
    Last edited by SearchingDataOnly; May 10th, 2021 at 09:24 PM.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by dilettante View Post
    So how is this a VB6 question at all, aside from you wanting to wrap this huge pile of poo within a VB6 Form somehow, maybe?
    Quote Originally Posted by Shaggy Hiker View Post
    Sure, but if it is developed with VB6, it IS a VB6 question. I'm not sure on whether the question is about replicating functionality (I have no idea what AstExplorer is) or integrating with something else, but it sure sounds like VB6 to me.
    The problem I want to solve is: how to run some Web-Apps containing a large number of third-party JS libraries (such as AstExplorer) in the WebView(Edge-Chromium) of VB6 and be able to interact (communicate) with VB6 code.

    After I solve the above problems, then I'll try how to combine NodeJS and Electron with VB6.

    Edit:
    Hi @Shaggy Hiker,
    Please help me post the video below to that chat thread about COVID-19:
    https://www.youtube.com/watch?v=PwI-K_aLEfo

    Thanks.
    Last edited by SearchingDataOnly; May 10th, 2021 at 11:45 PM.

  8. #8
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by SearchingDataOnly View Post
    Yes, I read the source code of AstExplorer on github, but I still don't know how to deploy astExplorer locally.

    I have been studying JavaScript for several years, but I still don't know how to do some complex web development (including deployment), which makes me very frustrated.

    More than 20 years ago, when I graduated from university, I didn't even use Windows. After only 2 weeks of browsing and learning VB3, I was able to carry out formal software development work (developing some complex commercial systems). Later, we used VC+VB for several years of mixed programming (compared with VB, I studied VC hard for 3 months to use VC for formal programming work), but the powerful development efficiency of VB made me finally give up VC completely. This was the biggest mistake in my life. This is why I have been reluctant to use VC again, because it is a painful past.
    The very last section on that github page is "Build your own version for development". You will need git, nodejs, and yarn installed locally to be able to do those steps though. If you have both of those then you should be able to follow those instructions.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by PlausiblyDamp View Post
    The very last section on that github page is "Build your own version for development". You will need git, nodejs, and yarn installed locally to be able to do those steps though. If you have both of those then you should be able to follow those instructions.
    Thank you, PlausiblyDamp.

    The astexplorer localhost website was installed according to the instructions, and 1947 packages were downloaded. These packages are 395 MB in size and contain 42141 files. During the installation process, many software packages were prompted to have expired. When executing the command "yarn run build" or "yarn run watch", the system showed some error prompts, for example, "JavaScript heap out of memory", "error Command faild with exit code 134"

    Even a small tool like astexplorer is as complicated as an OS.
    Last edited by SearchingDataOnly; May 12th, 2021 at 11:30 AM.

  10. #10
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by SearchingDataOnly View Post
    Thank you, PlausiblyDamp.

    The astexplorer localhost website was installed according to the instructions, and 1947 packages were downloaded. These packages are 395 MB in size and contain 42141 files. During the installation process, many software packages were prompted to have expired. When executing the command "yarn run build" or "yarn run watch", the system showed some error prompts, for example, "JavaScript heap out of memory", "error Command faild with exit code 134"

    Even a small tool like astexplorer is as complicated as an OS.
    That is the joy of working with node based apps the entire thing is nothing but dependencies and their dependencies etc, every time I use node I suspect I am just working with a massive house of cards that will all come crashing down...

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by PlausiblyDamp View Post
    That is the joy of working with node based apps the entire thing is nothing but dependencies and their dependencies etc, every time I use node I suspect I am just working with a massive house of cards that will all come crashing down...
    Yes, nearly 2,000 software packages did cause a lot of psychological pressure on me. I can't imagine what happens when a VB6-App needs to call 2000 components.

  12. #12
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,056

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    sounds legit..

    seriously though this is part of why I love vb6. good balance between dependencies weight and user code,
    and one reason why I could never get on board with .NET

    I was researching some JS AST libraries a while back when I wanted to make a more robust refactoring
    engine to deobsfuscate javascript.

    The ones i have starred in github are

    https://github.com/estools/estraverse
    https://github.com/jquery/esprima

    It has been a few years, I dont exactly remember the outcome. I dont think I could get them to run
    in the MS Script control, but I _may_ have gotten one of them to run in the duk4vb duktape javascript engine.

    its still a messy solution, load a js engine to run a pile of JS to parse another javascript and then have to run
    various script fragments to extract the values from the JS object structure it generated.

    a JS AST parser in VB6 would be great, but a lot of work. Honestly I would even prefer to call into a .NET library
    or some command line program to do the dirty work and then just parse the text output.

    Round tripping between command line programs with vb parsing/ modifying in the middle would even be welcome over
    writing a whole robust AST parser

    https://resources.infosecinstitute.c...p-engineering/

    Choose your battles and have fun with it

  13. #13
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    use webkit core,miniblink.dll only 20MB ,ONLY ONE DLL.
    Chromium for vb

    V8Engine v8.dll for run chrome js,only 1.3mb
    Last edited by xiaoyao; May 12th, 2021 at 09:08 PM.

  14. #14
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by dz32 View Post
    sounds legit..

    It has been a few years, I dont exactly remember the outcome. I dont think I could get them to run
    in the MS Script control, but I _may_ have gotten one of them to run in the duk4vb duktape javascript engine.
    use MS Script control,i add json str,read all keys,all valuse ,like Dictionary.
    but not support JSON.stringify(obj3);
    so a add json2.js to MS Script control,it's funny,only 3kb(2017-6-12)
    json1.js only 1kb(2005 version)
    Code:
    Dim Js As ScriptControl: Set Js = New ScriptControl
    'Dim Js As Object: Set Js = CreateObject("ScriptControl")
    Dim JsCode As String, JsonStr As String
    'json1.js at 2005,For Support JSON.stringify in vb6
    
    JsCode = "var JSON=function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','""':'\\""','\\':'\\\\'},s={'boolean':function(x){return String(x)},number:function(x){return isFinite(x)?String(x):'null'},string:function(x){if(/[""\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\""])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16)})}return'""'+x+'""'},object:function(x){if(x){var a=[],b,f,i,l,v;if(x instanceof Array){a[0]='[';l=x.length;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=','}a[a.length]=v;b=true}}}a[a.length]=']'}else if(x instanceof Object){a[0]='{';for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=','}a.push(s.string(i),':',v);b=true}}}a[a.length]='}'}else{return}return a.join('')}return'null'}};return{"
    JsCode = JsCode & "copyright: '(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function(v){var f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){return v}}return null},parse:function(text){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/""(\\.|[^""\\])*""/g,'')))&&eval('('+text+')')}catch(e){return false}}}}();"
    JsCode = JsCode & "var TempStr=''; function SetTempStr(Str){TempStr=Str;};"
    Js.Language = "Javascript"
    Js.AddCode JsCode
    
    JsonStr = "{""key1"":""●●◆◆"",""key2"":""abc"",""arr1"":[{""c"":""aa"",""d"":""bb""},{""e"":""dd""}]}"
    
    
    'Convert string to Json object
    Js.AddCode "var JsonObj=" & JsonStr
    
    MsgBox Js.Eval("JsonObj.key1")
     Js.Eval ("JsonObj.key3='str3'")
    
    'Convert JSON object to string
    MsgBox Js.Eval("JSON.stringify(JsonObj)")
    
    Js.Run "SetTempStr", "abc" & vbCrLf & "123"
     Js.Eval ("JsonObj.key1=TempStr")
     MsgBox Js.Eval("JsonObj.key1")
    MsgBox Js.Eval("JSON.stringify(JsonObj)")
    Last edited by xiaoyao; May 12th, 2021 at 08:57 PM.

  15. #15
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    json2.js for support [JSON.stringify(JsonObj, null, '\t')]
    Code:
    Dim JsLib As Object
    Set JsLib = CreateObject("ScriptControl")
    
    JsLib.Language = "Javascript"
    Dim JsCode As String
     
     
    JsCode = "if(typeof JSON!==""object""){JSON={}}(function(){""use strict"";var g=/^[\],:{}\s]*$/;var h=/\\(?:[""\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var l=/""[^""\\\n\r]*""|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var m=/(?:^|:|,)(?:\s*\[)+/g;var o=/[\\""\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(n){return(n<10)?""0""+n:n}function this_value(){return this.valueOf()}if(typeof Date.prototype.toJSON!==""function""){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?(this.getUTCFullYear()+""-""+f(this.getUTCMonth()+1)+""-""+f(this.getUTCDate())+""T""+f(this.getUTCHours())+"":""+f(this.getUTCMinutes())+"":""+f(this.getUTCSeconds())+""Z""):null};Boolean.prototype.toJSON"
    JsCode = JsCode & "=this_value;Number.prototype.toJSON=this_value;String.prototype.toJSON=this_value}var q;var r;var s;var t;function quote(b){o.lastIndex=0;return o.test(b)?""\""""+b.replace(o,function(a){var c=s[a];return typeof c===""string""?c:""\\u""+(""0000""+a.charCodeAt(0).toString(16)).slice(-4)})+""\"""":""\""""+b+""\""""}function str(a,b){var i;var k;var v;var c;var d=q;var e;var f=b[a];if(f&&typeof f===""object""&&typeof f.toJSON===""function""){f=f.toJSON(a)}if(typeof t===""function""){f=t.call(b,a,f)}switch(typeof f){case""string"":return quote(f);case""number"":return(isFinite(f))?String(f):""null"";case""boolean"":case""null"":return String(f);case""object"":if(!f){return""null""}q+=r;e=[];if(Object.prototype.toString.apply(f)===""[object Array]""){c=f.length;for(i=0;i<c;i+=1){e[i]=str(i,f)||""null""}v=e.length===0?""[]"":q?(""[\n""+q+e.join("",\n""+q)+""\n""+d+""]""):""[""+e.join("","")+""]"";q=d;return v}if(t&&typeof t===""object"")"
    JsCode = JsCode & "{c=t.length;for(i=0;i<c;i+=1){if(typeof t[i]===""string""){k=t[i];v=str(k,f);if(v){e.push(quote(k)+((q)?"": "":"":"")+v)}}}}else{for(k in f){if(Object.prototype.hasOwnProperty.call(f,k)){v=str(k,f);if(v){e.push(quote(k)+((q)?"": "":"":"")+v)}}}}v=e.length===0?""{}"":q?""{\n""+q+e.join("",\n""+q)+""\n""+d+""}"":""{""+e.join("","")+""}"";q=d;return v}}if(typeof JSON.stringify!==""function""){s={""\b"":""\\b"",""\t"":""\\t"",""\n"":""\\n"",""\f"":""\\f"",""\r"":""\\r"",""\"""":""\\\"""",""\\"":""\\\\""};JSON.stringify=function(a,b,c){var i;q="""";r="""";if(typeof c===""number""){for(i=0;i<c;i+=1){r+="" ""}}else if(typeof c===""string""){r=c}t=b;if(b&&typeof b!==""function""&&(typeof b!==""object""||typeof b.length!==""number"")){throw new Error(""JSON.stringify"");}return str("""",{"""":a})}}if(typeof JSON.parse!==""function""){JSON.parse=function(d,e){var j;function walk(a,b){var k;var v;var c=a[b];if(c&&typeof c===""object""){for(k in c)"
    JsCode = JsCode & "{if(Object.prototype.hasOwnProperty.call(c,k)){v=walk(c,k);if(v!==undefined){c[k]=v}else{delete c[k]}}}}return e.call(a,b,c)}d=String(d);p.lastIndex=0;if(p.test(d)){d=d.replace(p,function(a){return(""\\u""+(""0000""+a.charCodeAt(0).toString(16)).slice(-4))})}if(g.test(d.replace(h,""@"").replace(l,""]"").replace(m,""""))){j=eval(""(""+d+"")"");return(typeof e===""function"")?walk({"""":j},""""):j}throw new SyntaxError(""JSON.parse"");}}}());"
    
    '==============
    JsLib.AddCode JsCode
    
    Function GetJsonObjectStrFormat(Optional ErrInfo As String) As String
        On Error GoTo DoErr
        ErrInfo = ""
        GetJsonObjectStrFormat = JsLib.Eval("JSON.stringify(JsonObj, null, '\t')")
        GetJsonObjectStrFormat = Replace(GetJsonObjectStrFormat, vbLf, vbCrLf)
        Exit Function
    DoErr:    ErrInfo = "ErrNumber:" & Err.Number & ",Description:" & Err.Description
    End Function
    Code:
    {
    	"key1": "●●◆◆",
    	"key2": "abc",
    	"arr1": [
    		{
    			"c": "aa",
    			"d": "bb"
    		},
    		{
    			"e": "dd"
    		}
    	],
    	"a": "CCC\r\n22"
    }

  16. #16
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by SearchingDataOnly View Post
    The problem I want to solve is: how to run some Web-Apps containing a large number of third-party JS libraries (such as AstExplorer) in the WebView(Edge-Chromium) of VB6 and be able to interact (communicate) with VB6 code.

    After I solve the above problems, then I'll try how to combine NodeJS and Electron with VB6.

    Edit:
    Hi @Shaggy Hiker,
    Please help me post the video below to that chat thread about COVID-19:
    https://www.youtube.com/watch?v=PwI-K_aLEfo

    Thanks.
    can use node.js ,websocket for vb6

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by dz32 View Post
    sounds legit..

    seriously though this is part of why I love vb6. good balance between dependencies weight and user code,
    and one reason why I could never get on board with .NET

    I was researching some JS AST libraries a while back when I wanted to make a more robust refactoring
    engine to deobsfuscate javascript.

    The ones i have starred in github are

    https://github.com/estools/estraverse
    https://github.com/jquery/esprima

    It has been a few years, I dont exactly remember the outcome. I dont think I could get them to run
    in the MS Script control, but I _may_ have gotten one of them to run in the duk4vb duktape javascript engine.

    its still a messy solution, load a js engine to run a pile of JS to parse another javascript and then have to run
    various script fragments to extract the values from the JS object structure it generated.

    a JS AST parser in VB6 would be great, but a lot of work. Honestly I would even prefer to call into a .NET library
    or some command line program to do the dirty work and then just parse the text output.

    Round tripping between command line programs with vb parsing/ modifying in the middle would even be welcome over
    writing a whole robust AST parser

    https://resources.infosecinstitute.c...p-engineering/

    Choose your battles and have fun with it
    Thank you very much, dz32.

  18. #18

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Use VB6 to develop a tool similar to AstExplorer.net

    Quote Originally Posted by xiaoyao View Post
    can use node.js ,websocket for vb6
    Thank you, xiaoyao. It would be great if you could provide a simple example.

Posting Permissions

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



Click Here to Expand Forum to Full Width