C # realize docking Telecom payment Easy automatic pay

Source: Internet
Author: User

He has such a JS passguardctrl.js part code 1 defaults:{2 obj:null, 3 random:null,//random factor number 4 HIDP Wdname: ' Password ',//Hide Password box name, used to save EncryptPassword value after  5             Outinputclass: ",//Where to write the password input box to the location  6             params:{//additional properties, optional  7                 Pgepath: "./ocx/",//Control file directory  8                 Pgeid: "_ocx_password",//control id 9                 pgeedittype:0,//control type, 0 asterisk, 1 plaintext                 PGEEREG1: "[\\s\\s]*",//character type restrictions during input                 PGEEREG2: "[\\s\\s]{6,50}",    //character type criteria after input                 pgemaxlength:50,//allow maximum input length of &nbs P               Pgetabindex:2,//tab key sequence             &NBSP ;   Pgeclass: "Ocx_style",//control CSS style                 Pgeinstallclass: "Ocx_sty Le ",//for installation or upgrade of &nbsP               Pgeonkeydown: "Formsubmit ()",//Enter response function,         &NBSP ;       Tabcallback: "_ocx_password2"            }  This JS is the initialization of the password control. Backstage I It will be changed to  c#   _setrandom:function () {                if (null== This.settings.random) {                    alert ("Error:random is Empty") ;                    return false;          &NB Sp    }                this.object.pwdSetSk (this.settings.random);                return true;           }     &NB Sp  }     Pwdsetsk:function (s) {                if (This.checkin Stall ()) {  &nbsp                 Try {                &NBSP ;       var control = document.getElementById (this.settings.pgeId);                        if (this.osbrowser==1 | | this.osbrowser==3 | | this.osbrowser==6 | | this.osbrows er==8) {                            Control.input1=s ;                       } else if (this.osbrowser==2 | | this. osbrowser==4 | | this.osbrowser==5) {                            cont Rol.input (1,s);                       }                                       } CA TCH (err) {                   }               }                    This JS file is a random factor for setting up a security control   operation Full Control input1    pwdresult:function () {                 V AR code = ';                 if (!this.checkinstall ()) {                     code = ';                }                else{               &NBS P       Try {                        VAR control = document.getElementById (this.settings.pgeId);                    &NBS P   if (this.osbrOwser==1 | | this.osbrowser==3) {                            code = control.output1;                       } else if (THIS.OSB rowser==2 | | this.osbrowser==4 | | this.osbrowser==5) {                            code = Control.output (7);                       }else if (this.os browser==6 | | this.osbrowser==8) {                            code = CONTROL.GET_OUTPUT1 ();                          &NBS P                                  &NBS P } catch (Err) {                  &NBsp     Code = ";                   }               }               //alert (code);      & nbsp         return code;           },  This file is our main character, that is, when we enter content in a security control, the automatic Encrypt our password. But the added password is not the cipher that was submitted, but also a BASE64 encryption   function setpwdval (clazz) {    var _$=jquery;    _$ ("input." +clazz). Each (function (i,n) {        var _objid = _$ (n). attr ("ObjId");        var _c Ode = null;        var control = _$ ("#" +_objid) [0];            _code=window["Passguardctrl" +control.id.split ("-") [0].tolocalelowercase ()] . Pwdresult ();       //_code = Base64.encoder (_code);        _code= Base64.encoder (_code);        _$ (n). Val (_code);  &nbsp });}   In this method, you can see that the use of a BASE64 encryption, after the above steps. You can encrypt our password sing woo commit the same time,  vs add security control, you may have used, the basic is first right-click on the toolbar, select the item- >com component, select the corresponding component, OK      but unfortunately when you drag the control into the interface, your vs is blown, and I use vs2005,vs2008 vs2010 vs2013 All collapse did not find a good way, only to create their own manual, this estimate point of .  I guess this is the security of the control caused by the VS crash Bar, before the support of the machine to pay the same as vs will collapse, found that the control is actually the same, just a different name, (should be Telecom and mobile projects outsourced to the same company, hehe)   Now paste the core code snippet of password and encryption code into,       public static String Getpaypass ( Axpassguardctrllib.axpassguard paypwd, String Random) {        PAYPWD.INPUT1 = random;    &N Bsp   Paypwd.edittype = 0;        paypwd.maxlength = 50;        PAYPWD.INPUT2 = " [\\s\\s]*];//character type restriction during input         paypwd.input13 = "[\\s\\s]{6,50}";        String Strpwd = paypwd.output1;        PAYPWD. Clearsectrl ();        return EncodeBase64 (strpwd);   }  This random stochastic factor big on the page you landed on, you can find & nbsp;  NoteMeaning oh, this is not the same, every time it seems to be different when you refresh the page, all we have to log on the homepage first request the landing surface to get this random factor   below is my landing part method .            internal void Login () {            String Result = "";    &NB Sp       NET. URL = "Https://b.bestpay.com.cn/bppf/login.do?method=login";            NET. Method = nethelper.requestmethod.get;            NET. Isstream = false;            Result = net. SendRequest ();            if (Result.startswith ("1")) {LastError = "Unable to connect to server"; return;}             String random = Utils.getvalue (Result, "pwdsetsk\\ (\" "," \ "");    &nbs P       Utils.setpassword (Passguard, Loginpass);              NET. URL = "https://b.bestpay.com.cn/bppf/vimage.do?0." + utils.getunixtime ();            NET.referer = "Https://b.bestpay.com.cn/bppf/login.do?method=login";            NET. Isstream = true;            NET. Method = nethelper.requestmethod.get;            NET. SendRequest ();            if (net. IOStream = = null) {LastError = "failed to get verification code"; return;}              Bitmap bmp = new Bitmap (NET. IOStream);            String Chkcode = captcha.getcheckstring (BMP);      &NBS P    //Inspection Verification code             NET. URL = "Https://b.bestpay.com.cn/bppf/verifyCode";            NET. PostData = "verifycode=" + chkcode;            NET. Isstream = false;            NET. Method = nethelper.requestmethod.post;            Result = net. SendRequest ();            if (Result.startswith ("1") | | Result = "true") {LastError = "Cannot connect to server"; return;}             String loginpwd = Utils.getpaypass (Passguard, Random);             NET. URL = "Https://b.bestpay.com.cn/bppf/login.do";            NET. PostData = "Signature=&certsn=&tourl=&tourl_menuid=&syslogintype=bppf&username=" + MerchantId + "&password=" + loginpwd + "&method=login&verifycode=" + chkcode;            NET. Method = nethelper.requestmethod.post;            NET. Encode = "GBK";            NET. Isstream = false;            Result = net. SendRequest ();            LastError = result;            if (R Esult. Contains ("Merchant ID:" + merchantid)) {        &NBSp       IsLogin = true;                dAmt0 = Convert.todecimal (Util S.getvalue (Result, "account balance: <span class=\" property-amount\ ">", "</span>"));                DAMT1 = Convert.todecimal (Utils.getvalue (Result, "Available Balance: <span class=\" property-amount\ " > "," </span> "));                DAMT2 = Convert.todecimal (utils.getvalue (Result, "Remuneration balance: <span class=\" property-amount\ ">", "</span>"));                 DAMT3 = Convert.todecimal (Utils.getvalue (Result, "Frozen Amount: <span cl Ass=\ "property-amount\" > "," </span> ");           }       }& nbsp: Mobile Recharge Order Method           internal Boolean Mobilepay (order order, ref String msg) {  &nbsp ;         Boolean issuccess = false;        &nbsp   for (int i = 0; i < 3; i++) {                String Result = "";  & nbsp             NET. URL = "Https://b.bestpay.com.cn/bppf/ipos/mobilerecharge.do?method=process";                NET. Method = nethelper.requestmethod.post;                NET. PostData = "mobile=" + order. Account + "&othermoney=" + order. Price + "&moneytext=";                NET. Isstream = false;                Result = net. SendRequest ();                if (Result.startswith ("1")) {continue;}                 if (! Result.contains ("Please check carrier information, recharge number and amount to avoid wrong") {continue;}                  String random = Utils.getvalue (Result, "pwdsetsk\\ (\"),"\" ");                String token = Utils.getvalue (Result," \ "Org.apache\\.struts \\.taglib\\.html\\. Token\ "", "type");                token = Utils.getvalue (Result, "value=\", "\" ") . Trim ();                String phone = Utils.getvalue (Result, "name=\" phone\ "value =\"", "\""). Trim ();                String money = Utils.getvalue (Result, "name=\" money\ "value =\"", "\""). Trim ();                String txnamount = Utils.getvalue (Result, "name=\" Txnamount \ "Value=\" "," \ ""). Trim ();                String poundage = Utils.getvalue (Result, "name=\" poundage\ " Value=\ "", "\" "). Trim ();                Utils.setpassword (Passguard, PayPass);                 if (order. Account! = PhOne) {                    msg = "Recharge account 袚 tamper"; return false;    &N Bsp          }                if (order. Price! = Money) {                    msg = "Recharge amount 袚 tamper"; return false;&nbsp ;              }                 String pay PWD = Utils.getpaypass (Passguard, Random);                 NET. URL = "https://b.bestpay.com.cn/bppf/ipos/mobilerecharge.do?method=checkPayPwd&payPwd=" + paypwd;                NET. Method = nethelper.requestmethod.post;                NET. PostData = "";                NET. Isstream = false;                Result = NET.sendrequest ();                Log.write (Result, "Debut.txt");    &nbs P                         -net. URL = "Https://b.bestpay.com.cn/bppf/ipos/mobilerecharge.do?method=confirm";                NET. Method = nethelper.requestmethod.post;                NET. PostData = String.Format ("Org.apache.struts.taglib.html.token={0}&phone={1}&money={2}&txnamount={3} &AMP;POUNDAGE={4}&AMP;RECEIVEPHONE={5}&AMP;PAYPWD={6} ", token, phone, money, Txnamount, poundage, phone, paypwd);                 log.write (net. PostData, "Debug.txt");                NET. Isstream = false;                Result = net. SendRequest ();                if (result.cOntains ("Top-up success") {                    MSG = "Payment order Success";                    return true;               }&NB Sp               msg = Utils.getvalue (result, "Top Up failure Reason: </span><span class=\" title \ "style=\" color:red;\ ">", "</span>");                Log.write (Result, "Debut.txt");           }            return issuccess;       }

C # realize docking telecommunications payment easy automatic Payments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.