public string QueryOTP(BeanfunGameAccountData acc) { try { string ret = spwc.DownloadString("http://tw.beanfun.com/beanfun_block/game_zone/game_start_step2.aspx?service_code=610074&service_region=T9&sotp=" + acc.Number + "&dt=" + dt(), Encoding.UTF8); Regex regCT = new Regex(@"ServiceAccountCreateTime: \x22([^\x22]+)\x22"); string ct = regCT.Match(ret).Groups[1].Value; Regex regKey = new Regex(@"GetResultByLongPolling&key=([^\x22]+)\x22"); string key = regKey.Match(ret).Groups[1].Value; Regex regSecret = new Regex(@"var m_strSecretCode = '(\w+)';"); string secret = regSecret.Match(spwc.DownloadString("http://tw.newlogin.beanfun.com/generic_handlers/get_cookies.ashx")).Groups[1].Value; NameValueCollection data = new NameValueCollection(); data.Add("service_code", "610074"); data.Add("service_region", "T9"); data.Add("service_account_id", acc.Account); data.Add("service_sotp", acc.Number); data.Add("service_display_name", acc.Name); data.Add("service_create_time", ct); spwc.UploadValues("http://tw.beanfun.com/beanfun_block/generic_handlers/record_service_start.ashx", data); ret = spwc.DownloadString("http://tw.beanfun.com/generic_handlers/get_result.ashx?meth=GetResultByLongPolling&key=" + key + "&_=" + getUTCTime().ToString(), Encoding.UTF8); ret = spwc.DownloadString( "http://tw.beanfun.com/beanfun_block/generic_handlers/get_webstart_otp.ashx" + "?SN=" + key + "&WebToken=" + this.webtoken + "&SecretCode=" + secret + "&ppppp=FE40250C435D81475BF8F8009348B2D7F56A5FFB163A12170AD615BBA534B932" + "&ServiceCode=610074" + "&ServiceRegion=T9" + "&ServiceAccount=" + acc.Account + "&CreateTime=" + ct.Replace(" ", "%20") ); if (ret[0] == '1') { ret = ret.Substring(2); return(WCDESComp.DecryptString(ret.Substring(0, 8), ret.Substring(8, 32))); } return(null); } catch (NotSupportedException) { throw new BeanfunIsBusyException("正在處理其他的事情"); } }
private void bgwk_DoWork(object sender, DoWorkEventArgs e) { string[] arg = e.Argument as string[]; if (arg == null) { return; } string acc, pwd; switch (arg[0]) { case "start": startingGame = true; acc = arg[1]; last = new BeanfunGameAccountData(acc, arg[2], arg[3]); pwd = bf.QueryOTP(last); if (pwd == null) { e.Result = new Result(arg[0], true); } else { try { e.Result = new Result(arg[0], false); lastGame = Process.Start(GamePath, "tw.login.maplestory.gamania.com 8484 BeanFun " + acc + " " + pwd); } catch (Win32Exception w) { startingGame = false; MessageBox.Show("楓之谷在哪呢?" + w.Message); } } break; case "getpwd": startingGame = true; acc = arg[1]; last = new BeanfunGameAccountData(acc, arg[2], arg[3]); pwd = bf.QueryOTP(last); if (pwd == null) { e.Result = new Result(arg[0], true); } else { e.Result = new Result(arg[0], false, new string[] { acc, pwd }); } break; } }
public string QueryOTP(BeanfunGameAccountData acc) { try { string ret = spwc.DownloadString("http://tw.beanfun.com/beanfun_block/game_zone/game_start_step2.aspx?service_code=610074&service_region=T9&sotp=" + acc.Number + "&dt=" + dt(), Encoding.UTF8); Regex regCT = new Regex(@"ServiceAccountCreateTime: \x22([^\x22]+)\x22"); string ct = regCT.Match(ret).Groups[1].Value; Regex regKey = new Regex(@"GetResultByLongPolling&key=([^\x22]+)\x22"); string key = regKey.Match(ret).Groups[1].Value; Regex regSecret = new Regex(@"var m_strSecretCode = '(\w+)';"); string secret = regSecret.Match(spwc.DownloadString("http://tw.newlogin.beanfun.com/generic_handlers/get_cookies.ashx")).Groups[1].Value; NameValueCollection data = new NameValueCollection(); data.Add("service_code", "610074"); data.Add("service_region", "T9"); data.Add("service_account_id", acc.Account); data.Add("service_sotp", acc.Number); data.Add("service_display_name", acc.Name); data.Add("service_create_time", ct); spwc.UploadValues("http://tw.beanfun.com/beanfun_block/generic_handlers/record_service_start.ashx", data); ret = spwc.DownloadString("http://tw.beanfun.com/generic_handlers/get_result.ashx?meth=GetResultByLongPolling&key=" + key + "&_=" + getUTCTime().ToString(), Encoding.UTF8); ret = spwc.DownloadString( "http://tw.beanfun.com/beanfun_block/generic_handlers/get_webstart_otp.ashx" + "?SN=" + key + "&WebToken=" + this.webtoken + "&SecretCode=" + secret + "&ppppp=FE40250C435D81475BF8F8009348B2D7F56A5FFB163A12170AD615BBA534B932" + "&ServiceCode=610074" + "&ServiceRegion=T9" + "&ServiceAccount=" + acc.Account + "&CreateTime=" + ct.Replace(" ", "%20") ); if (ret[0] == '1') { ret = ret.Substring(2); return WCDESComp.DecryptString(ret.Substring(0, 8), ret.Substring(8, 32)); } return null; } catch (NotSupportedException) { throw new BeanfunIsBusyException("正在處理其他的事情"); } }
private void bgwk_DoWork(object sender, DoWorkEventArgs e) { string[] arg = e.Argument as string[]; if (arg == null) return; string acc, pwd; switch (arg[0]) { case "start": startingGame = true; acc = arg[1]; last = new BeanfunGameAccountData(acc, arg[2], arg[3]); pwd = bf.QueryOTP(last); if (pwd == null) { e.Result = new Result(arg[0], true); } else { try { e.Result = new Result(arg[0], false); lastGame = Process.Start(GamePath, "tw.login.maplestory.gamania.com 8484 BeanFun " + acc + " " + pwd); } catch(Win32Exception w) { startingGame = false; MessageBox.Show("楓之谷在哪呢?" + w.Message); } } break; case "getpwd": startingGame = true; acc = arg[1]; last = new BeanfunGameAccountData(acc, arg[2], arg[3]); pwd = bf.QueryOTP(last); if (pwd == null) { e.Result = new Result(arg[0], true); } else { e.Result = new Result(arg[0], false, new string[] { acc, pwd }); } break; } }