18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

is it possible to encrypt sahi script and run

gaveyomgaveyom Members
edited November -1 in Sahi - Open Source
Dear Sahi Team/ Users,

is it possible to encrypt sahi script and run the encrypted script in sahi tool ?

please let me know, is it possible ?

its an urgent, pls let me know as soon as possible

thank you

Comments

  • In my experience you can not encrypt because sahi javascript code used. Javascript is an interpreted code and does not allow these encryption and should be read in the browser. Obfuscar should think about the code.

    example:

    obfuscated function

    function e7f4f5b9a($83f5359633f99ec84a9f6562335942ae,$eb5c1e707c23eebce3269014f8104829,$e7f4f5b9aac2feabd6cd24085cbbf3f5){
    var $eb5c1e7O7c23eebce3269014f8104829="";
    var $83t5359633f99ec84a9f6562335942ae=$83f5359633f99ec84a9f6562335942ae.split(".");
    while ($e7f4f5b9aac2feabd6cd24085cbbf3f5++ <= $eb5c1e707c23eebce3269014f8104829) {
    if($eb5c1e7O7c23eebce3269014f8104829!=""){
    $eb5c1e7O7c23eebce3269014f8104829=$eb5c1e7O7c23eebce3269014f8104829+String.fromCharCode($83t5359633f99ec84a9f6562335942ae[$e7f4f5b9aac2feabd6cd24085cbbf3f5]);
    }
    if($eb5c1e7O7c23eebce3269014f8104829==""){
    $eb5c1e7O7c23eebce3269014f8104829=String.fromCharCode($83t5359633f99ec84a9f6562335942ae[$e7f4f5b9aac2feabd6cd24085cbbf3f5]);
    }}
    return $eb5c1e7O7c23eebce3269014f8104829;
    }


    normal function

    function DiripOri($ip,$vari,$i){
    var $ret=0;
    var $valor=$ip.split(".");
    while ($i++ <= $vari) {
    if($ret!=0){
    $ret=$ret+String.fromCharCode($valor[$i]);
    }
    if($ret==0){
    $ret=String.fromCharCode($valor[$i]);
    }
    }
    return $ret;
    }

    Good Luck
  • Hi facilos,

    thanks for your reply,

    but my doubt is how is it possible to execute Javascript code with encryption

    Below is the original and encryption code

    Original Code
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <script>
    
        function testEncryption()
        {
            var val=10;
            alert(val);
        }
    </script>
    </HEAD>
    
    <BODY onload="testEncryption()">
    
    </BODY>
    </HTML>
    
    
    


    Encrypted Code
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <script>
    
        eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 2(){5 0=3;4(0)}',6,6,'val|function|testEncryption|10|alert|var'.split('|'),0,{}))
    
    </script>
    </HEAD>
    
    <BODY onload="testEncryption()">
    
    </BODY>
    </HTML>
    
    
    
Sign In or Register to comment.