private static string MainPhpDarkTeleport(string html) { // abil_1(3,'5526edcf95299cde84cc07c5fb7d630b') var vcode = HelperStrings.SubString(html, "abil_1(3,'", "'"); if (string.IsNullOrEmpty(vcode)) { return(null); } /* * <input type=hidden name=useaction value="addon-action"> * <input type=hidden name=addid value="1"> * <input type=hidden name=post_id value="31"> * <input type=hidden name=vcode value="'+vcode+'"> * <SELECT name=wtelid class=zayavki> 1-12 */ var sb = new StringBuilder(); sb.Append( HelperErrors.Head() + "Используем сумеречный телепорт..."); sb.Append("<form action=main.php method=POST name=ff>"); sb.Append(@"<input name=useaction type=hidden value="""); sb.Append("addon-action"); sb.Append(@""">"); sb.Append(@"<input name=addid type=hidden value="""); sb.Append(1); sb.Append(@""">"); sb.Append(@"<input name=post_id type=hidden value="""); sb.Append(31); sb.Append(@""">"); sb.Append(@"<input name=vcode type=hidden value="""); sb.Append(vcode); sb.Append(@""">"); int wtelid = Dice.Make(12) + 1; sb.Append(@"<input name=wtelid type=hidden value="""); sb.Append(wtelid); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); }
private static string MainPhpDarkFog(string html) { // abil_2(3,'29396edee4f3a980ee244816a7b8a46d') var vcode = HelperStrings.SubString(html, "abil_2(3,'", "'"); if (string.IsNullOrEmpty(vcode)) { return(null); } /* * <input type=hidden name=useaction value="addon-action"> * <input type=hidden name=addid value="1"> * <input type=hidden name=post_id value="32"> * <input type=hidden name=vcode value="'+vcode+'"> * <INPUT TYPE="text" name=pnick class=zayavki maxlength=25> */ var sb = new StringBuilder(); sb.Append( HelperErrors.Head() + "Используем сумеречный туман..."); sb.Append("<form action=main.php method=POST name=ff>"); sb.Append(@"<input name=useaction type=hidden value="""); sb.Append("addon-action"); sb.Append(@""">"); sb.Append(@"<input name=addid type=hidden value="""); sb.Append(1); sb.Append(@""">"); sb.Append(@"<input name=post_id type=hidden value="""); sb.Append(32); sb.Append(@""">"); sb.Append(@"<input name=vcode type=hidden value="""); sb.Append(vcode); sb.Append(@""">"); sb.Append(@"<INPUT name=pnick type=hidden value="""); sb.Append(AppVars.Profile.UserNick); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); }
private static string BuildRedirect(string description, string link) { var sb = new StringBuilder(HelperErrors.Head()); sb.Append(description); sb.Append( @"<script language=""JavaScript"">" + @" window.location = """); sb.Append(link); sb.Append( @""";</script></body></html>"); return(sb.ToString()); }
private static byte[] GamePhp(byte[] array) { var html = Russian.Codepage.GetString(array); html = RemoveDoctype(html); if (AppVars.WaitFlash) { if (!string.IsNullOrEmpty(AppVars.Profile.UserPasswordFlash)) { // flashvars="plid=827098" const string flashid = @"flashvars=""plid="; var pos = html.IndexOf(flashid, StringComparison.OrdinalIgnoreCase); if (pos > -1) { pos += flashid.Length; var pose = html.IndexOf('"', pos); if (pose > -1) { var pid = html.Substring(pos, pose - pos); var sb = new StringBuilder( HelperErrors.Head() + "Ввод флеш-пароля..." + @"<form action=""./game.php"" method=POST name=ff>" + @"<input name=flcheck type=hidden value="""); sb.Append(AppVars.Profile.UserPasswordFlash); sb.Append(@"""> <input name=nid type=hidden value="""); sb.Append(pid); sb.Append( @"""></form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); AppVars.ContentMainPhp = sb.ToString(); return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp)); } AppVars.ContentMainPhp = html; return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp)); } } } AppVars.WaitFlash = false; AppVars.ContentMainPhp = html; return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp)); }
private static string MainPhpRobinHood(string html) { // <tr><td bgcolor=#FCFAF3><font class=nickname><img src=http://image.neverlands.ru/money_all.gif width=16 height=14 border=0 alt="Передать NV" align=absmiddle onclick="transferform('0','0','Игровую валюту','4d8d6bcae1bcc64ed7931c66b4728da6','0','0','0','0')" vspace=1> Деньги:</td><td width=100% bgcolor=#fafafa nowrap><font class=nickname><b id="user_nv"> 20727.15 NV</td></tr> //<tr><td bgcolor=#FCFAF3><font class=nickname><img src=http://image.neverlands.ru/money_all.gif width=16 height=14 border=0 alt="Передать NV" align=absmiddle onclick="transferform('0','0','Игровую валюту','4e0a895cb4438bd572d4a66036afbed3','0','0','0','0')" vspace=1> Деньги:</td><td width=100% bgcolor=#fafafa nowrap><font class=nickname><b id="user_nv"> 22546.43 NV</td></tr> //<tr><td bgcolor =#F0F0F0><img src=http://image.neverlands.ru/money_dea.gif width=14 height=14 border=0 alt="Передать DNV" align=absmiddle onclick="m_form('3cfcefee8a91e38ae21b888702e9ed37')" vspace=1></td><td width=100% bgcolor=#F0F0F0 nowrap><font class=nickname><b id="user_deamoney"> 5.00 DNV</td></tr> double nv; var nvStr = HelperStrings.SubString(html, "<b id=\"user_nv\"> ", " NV</td></tr>"); // 20727.15 if (!string.IsNullOrEmpty(nvStr)) { if (!double.TryParse(nvStr, NumberStyles.Any, CultureInfo.InvariantCulture, out nv)) { nv = 0f; } } else { return(null); } var dnv = 0.0; var dnvStr = HelperStrings.SubString(html, "<b id=\"user_deamoney\"> ", " DNV</td></tr"); // 5.00 if (!string.IsNullOrEmpty(nvStr)) { if (!double.TryParse(dnvStr, NumberStyles.Any, CultureInfo.InvariantCulture, out dnv)) { dnv = 0f; } } var intnv = (int)(nv / 2.0) - 1; if (intnv >= 1 && (html.IndexOf(" NV переданы для ", StringComparison.CurrentCultureIgnoreCase) == -1) && (Dice.Make(10) == 0)) { var movenv = HelperStrings.SubString(html, "Передать NV\" align=absmiddle onclick=\"transferform(", ")"); // '0','0','Игровую валюту','4d8d6bcae1bcc64ed7931c66b4728da6','0','0','0','0' if (!string.IsNullOrEmpty(movenv)) { var users = RoomManager.MyLocation; if (users.Count > 1) { var user = users[Dice.Make(users.Count)]; if (!user.Equals(AppVars.Profile.UserNick, StringComparison.CurrentCultureIgnoreCase)) { var par = movenv.Split(','); if (par.Length >= 8) { /* * transferform(wuid,wtrprice,wnametxt,wtcode,wwprice,wmas,wcs,wms) * * <input type=hidden name=post_id value=22> * <input type=hidden name=transfernametxt value="'+wnametxt+'"> * <input type=hidden name=transferprice value="'+wtrprice+'"> * <input type=hidden name=wwprice value="'+wwprice+'"> * <input type=hidden name=wmas value="'+wmas+'"> * <input type=hidden name=wcs value="'+wcs+'"> * <input type=hidden name=wms value="'+wms+'"> * <input type=hidden name=transferuid value='+wuid+'> * <input type=hidden name=transfercode value='+wtcode+'> * <INPUT TYPE="text" name=fornickname class=LogintextBox maxlength=25> * <input type=text name=sum class=LogintextBox2> * <input type=text name=ttext class=LogintextBox6 maxlength=150 size=52> * * 1 NV переданы для 0н. * * post_id=22&transfernametxt=%C8%E3%F0%EE%E2%F3%FE+%E2%E0%EB%FE%F2%F3&transferprice=0&wwprice=0&wmas=0&wcs=0&wms=0&transferuid=0&transfercode=7e17c0e81151e12118d3ef0611de3b73&fornickname=0%ED&sum=1&ttext=%F1%EF%EE%F0%29 * * post_id=22&transfernametxt=%C8%E3%F0%EE%E2%F3%FE+%E2%E0%EB%FE%F2%F3&transferprice=0&wwprice=0&wmas=0&wcs=0&wms=0&transferuid=0&transfercode=7e1c3da786b7aca61348b01e557cc279&fornickname=%D3%EC%ED%E8%EA&sum=1&ttext=%29 */ var wuid = par[0].Trim('\''); var wtrprice = par[1].Trim('\''); var wnametxt = par[2].Trim('\''); var wtcode = par[3].Trim('\''); var wwprice = par[4].Trim('\''); var wmas = par[5].Trim('\''); var wcs = par[6].Trim('\''); var wms = par[7].Trim('\''); var sb = new StringBuilder(); sb.Append( HelperErrors.Head() + "Конфискация NV..."); sb.Append("<form action=main.php method=POST name=ff>"); sb.Append(@"<input type=hidden name=post_id value="""); sb.Append(22); sb.Append(@""">"); sb.Append(@"<input type=hidden name=transfernametxt value="""); sb.Append(wnametxt); sb.Append(@""">"); sb.Append(@"<input type=hidden name=transferprice value="""); sb.Append(wtrprice); sb.Append(@""">"); sb.Append(@"<input type=hidden name=wwprice value="""); sb.Append(wwprice); sb.Append(@""">"); sb.Append(@"<input type=hidden name=wmas value="""); sb.Append(wmas); sb.Append(@""">"); sb.Append(@"<input type=hidden name=wcs value="""); sb.Append(wcs); sb.Append(@""">"); sb.Append(@"<input type=hidden name=wms value="""); sb.Append(wms); sb.Append(@""">"); sb.Append(@"<input type=hidden name=transferuid value="""); sb.Append(wuid); sb.Append(@""">"); sb.Append(@"<input type=hidden name=transfercode value="""); sb.Append(wtcode); sb.Append(@""">"); sb.Append(@"<input type=hidden name=fornickname value="""); sb.Append(user); sb.Append(@""">"); sb.Append(@"<input type=hidden name=sum value="""); sb.Append(intnv); sb.Append(@""">"); sb.Append(@"<input type=hidden name=ttext value="""); sb.Append("противоугонка ABClient"); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); } } } } } var intdnv = (int)(dnv / 2.0) - 1; if (intdnv >= 1 && (html.IndexOf(" DNV зачислено на счет персонажа ", StringComparison.CurrentCultureIgnoreCase) == -1) && (Dice.Make(10) == 0)) { var movednv = HelperStrings.SubString(html, "alt=\"Передать DNV\" align=absmiddle onclick=\"m_form('", "')"); // 3cfcefee8a91e38ae21b888702e9ed37 if (!string.IsNullOrEmpty(movednv)) { /* * <input type=hidden name=post_id value=42> * <input type=hidden name=vcode value='+vcode+'> * <INPUT TYPE="text" name=fnick class=LogintextBox maxlength=25> * <input type=text name=sum class=LogintextBox2> * <input type=submit value="передать" class=lbut> * <input type=button class=lbut onclick=\"c_form()\" value=\" x \"> * * post_id=42&vcode=9ea3225b0845791a3672bad2540ab2a3&fnick=%D3%EC%ED%E8%EA&sum=1 */ var sb = new StringBuilder(); sb.Append( HelperErrors.Head() + "Конфискация DNV..."); sb.Append("<form action=main.php method=POST name=ff>"); sb.Append(@"<input type=hidden name=post_id value="""); sb.Append(42); sb.Append(@""">"); sb.Append(@"<input type=hidden name=vcode value="""); sb.Append(movednv); sb.Append(@""">"); sb.Append(@"<input type=hidden name=fnick value="""); sb.Append("Шандор-Волшебник"); sb.Append(@""">"); sb.Append(@"<input type=hidden name=sum value="""); sb.Append(intdnv); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); } } return(null); }
private bool CheckCrap(TimeSpan diff) { if (AppVars.ContentMainPhp != null && (AppVars.ContentMainPhp.IndexOf(HelperErrors.Marker(), StringComparison.OrdinalIgnoreCase) != -1 || AppVars.ContentMainPhp.IndexOf(HelperErrors.Head(), StringComparison.OrdinalIgnoreCase) != -1)) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke), new object[] { }); } } catch (InvalidOperationException) { } return(true); } if (diff.TotalSeconds > 360) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke), new object[] { }); } } catch (InvalidOperationException) { } return(true); } if (diff.TotalSeconds > 420) { UpdateGame("Перезаход из-за подвисания или обрыва"); return(true); } var last = DateTime.Now.Subtract(AppVars.LastInitForm).TotalMinutes; try { if (browserGame.Document == null) { if (last > 2) { UpdateGame("Сбой главной страницы (Document == null)"); return(true); } return(false); } if (browserGame.Document.All.Count == 0) { if (last > 2) { UpdateGame("Сбой главной страницы (Document.All.Count == 0)"); return(true); } return(false); } if (browserGame.Document.Body == null) { if (last > 2) { UpdateGame("Сбой главной страницы (Document.Body == null)"); return(true); } return(false); } if (browserGame.Document.Body.InnerHtml == null) { if (last > 2) { UpdateGame("Сбой главной страницы (Document.Body.InnerHtml == null)"); return(true); } return(false); } var currentWindow = browserGame.Document.Window; if (currentWindow == null) { if (last > 2) { UpdateGame("Сбой главной страницы (Document.Window == null)"); return(true); } return(false); } if (currentWindow.Frames == null || currentWindow.Frames.Count == 0) { if (last > 2) { UpdateGame("Сбой главной страницы (Document.Window.Frames.Count == 0)"); return(true); } return(false); } var frame = currentWindow.Frames["main_top"]; if (frame == null) { if (last > 2) { UpdateGame("Сбой главной страницы (frame == null)"); return(true); } return(false); } if (frame.Document == null) { if (last > 2) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke), new object[] { }); } } catch (InvalidOperationException) { } return(true); } return(false); } if (frame.Document.Body == null) { if (last > 2) { AppVars.DocumentBodyNullCount++; if (AppVars.DocumentBodyNullCount > 5) { UpdateGame("Сбой верхнего фрейма (Document.Body == null)"); return(true); } UpdateTexLog("Сбой верхнего фрейма (Document.Body == null). Счетчик: " + AppVars.DocumentBodyNullCount); } return(false); } AppVars.DocumentBodyNullCount = 0; if (frame.Document.All.Count == 0) { if (last > 2) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke), new object[] { }); } } catch (InvalidOperationException) { } return(true); } return(false); } if (!string.IsNullOrEmpty(AppVars.ContentMainPhp) && DateTime.Now.Subtract(AppVars.LastMainPhp).TotalSeconds > 30) { if (AppVars.ContentMainPhp.IndexOf(HelperErrors.Marker(), StringComparison.OrdinalIgnoreCase) != -1) { if (AppVars.ContentMainPhp.IndexOf(AppConsts.HttpServerError, StringComparison.Ordinal) != -1 || AppVars.ContentMainPhp.IndexOf("Connection error", StringComparison.Ordinal) != -1 || AppVars.ContentMainPhp.IndexOf("Server failure", StringComparison.Ordinal) != -1) { UpdateGame("Ошибка связи с сервером игры"); } else { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke), new object[] { }); } } catch (InvalidOperationException) { } } return(true); } } } catch (Exception ex) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new UpdateTexLogDelegate(AppVars.MainForm.UpdateTexLog), new object[] { "Ошибка с IE: " + ex.Message }); } } catch (InvalidOperationException) { } } return(false); }
private static byte[] IndexCgi(byte[] array) { var html = Russian.Codepage.GetString(array); if (html.IndexOf(@"<form method=""post"" id=""auth_form"" action=""./game.php"">", StringComparison.OrdinalIgnoreCase) == -1) { /* * if (html.IndexOf("Cookie...", StringComparison.CurrentCultureIgnoreCase) != -1) * { * html = "<HTML><HEAD><title>Please Wait...</title></HEAD><script type=\"text/javascript\">window.location.reload(true);</script><BODY>Cookie...</BODY></HTML>"; * return Russian.Codepage.GetBytes(html); * } */ return(array); } const string serror = @"show_warn("""; var pos = html.IndexOf(serror, StringComparison.OrdinalIgnoreCase); if (pos != -1) { pos += serror.Length; var pose = html.IndexOf('"', pos); if (pose != -1) { var error = html.Substring(pos, pose - pos); if (!string.IsNullOrEmpty(error)) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new UpdateAccountErrorDelegate(AppVars.MainForm.UpdateAccountError), error); } } catch (InvalidOperationException) { } return(Russian.Codepage.GetBytes(string.Empty)); } } } var jump = "game.php"; /* * if (AppVars.Profile.UserNick.Equals("Alonso", StringComparison.OrdinalIgnoreCase) || * AppVars.Profile.UserNick.Equals("FENDER", StringComparison.OrdinalIgnoreCase) || * AppVars.Profile.UserNick.Equals("(ПСИХ)", StringComparison.OrdinalIgnoreCase)) * { * jump = string.Empty; * } */ var sb = new StringBuilder( HelperErrors.Head() + "Ввод имени и пароля..." + @"<form action=""./" + jump + @""" method=POST name=ff>" + @"<input name=player_nick type=hidden value="""); sb.Append(HttpUtility.HtmlEncode(AppVars.Profile.UserNick)); sb.Append(@"""> <input name=player_password type=hidden value="""); sb.Append(HttpUtility.HtmlEncode(AppVars.Profile.UserPassword)); sb.Append( @"""></form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); AppVars.WaitFlash = true; AppVars.ContentMainPhp = sb.ToString(); return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp)); }
internal void FailSession(int intError, string strErrorStatusText, string strErrorBody) { if ((intError >= 400) && (strErrorBody.Length < 0x200)) { strErrorBody = strErrorBody.PadRight(0x200, ' '); } _session.ResponseBodyBytes = Encoding.UTF8.GetBytes(strErrorBody); _session.Response.Headers = new HttpResponseHeaders { HttpResponseCode = intError, HttpResponseStatus = string.Format( CultureInfo.InvariantCulture, "{0} {1}", intError, strErrorStatusText) }; _session.Response.Headers.Add("Content-Type", "text/html"); _session.Response.Headers.Add("Connection", "close"); _session.ReturnResponse(false); if (!string.IsNullOrEmpty(_session.Url)) { var address = "http://" + _session.Url; try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new UpdateTexLogDelegate(AppVars.MainForm.UpdateTexLog), new object[] { "Ошибка с " + address }); } } catch (InvalidOperationException) { } } var sb = new StringBuilder( HelperErrors.Head() + "Connection error<br>" + @"<br><span class=""gray"">"); sb.Append(intError); sb.Append(" "); sb.AppendLine(strErrorStatusText); sb.Append(strErrorBody); sb.Append( "</span>" + "</body>" + "</html>"); if (!string.IsNullOrEmpty(_session.Url) && (_session.Url.Equals("www.neverlands.ru/") || _session.Url.StartsWith("www.neverlands.ru/index.cgi") || _session.Url.StartsWith("www.neverlands.ru/game.php") || _session.Url.StartsWith("www.neverlands.ru/main.php"))) { AppVars.ContentMainPhp = sb.ToString(); } intError = 200; strErrorStatusText = "OK"; _session.ResponseBodyBytes = Encoding.UTF8.GetBytes(sb.ToString()); _session.Response.Headers = new HttpResponseHeaders { HttpResponseCode = intError, HttpResponseStatus = string.Format(CultureInfo.InvariantCulture, "{0} {1}", intError, strErrorStatusText) }; _session.Response.Headers.Add("Content-Type", "text/html"); _session.Response.Headers.Add("Connection", "close"); _session.ReturnResponse(false); }
private static string MainPhpRemovePoison(string html) { // magicreform('74717180','Черный','Зелье Лечения Отравлений','73f8b8aa2932d667a6f37b843aa407e6') var namepotion = '\'' + "Зелье Лечения Отравлений" + '\''; var p0 = html.IndexOf(namepotion, StringComparison.OrdinalIgnoreCase); if (p0 == -1) { return(null); } var ps = html.LastIndexOf('<', p0); if (ps == -1) { return(null); } ps++; var pe = html.IndexOf('>', p0); if (pe == -1) { return(null); } var args = html.Substring(ps, pe - ps); if (args.IndexOf("magicreform(", StringComparison.Ordinal) == -1) { return(null); } args = HelperStrings.SubString(args, "magicreform('", "')"); if (string.IsNullOrEmpty(args)) { return(null); } var arg = args.Split('\''); if (arg.Length < 7) { return(null); } var wuid = arg[0]; var wmcode = arg[6]; var sb = new StringBuilder( HelperErrors.Head() + "Используем "); sb.Append("Зелье Лечения Отравлений"); sb.Append(" на себя..."); sb.Append("<form action=main.php method=POST name=ff>"); sb.Append(@"<input name=magicrestart type=hidden value="""); sb.Append(1); sb.Append(@""">"); sb.Append(@"<input name=magicreuid type=hidden value="""); sb.Append(wuid); sb.Append(@""">"); sb.Append(@"<input name=vcode type=hidden value="""); sb.Append(wmcode); sb.Append(@""">"); sb.Append(@"<input name=post_id type=hidden value="""); sb.Append(46); sb.Append(@""">"); sb.Append(@"<input name=fornickname type=hidden value="""); sb.Append(AppVars.Profile.UserNick); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); }
private static string MainPhpCure(string html) { if (string.IsNullOrEmpty(html)) { return(null); } // <input type=button class=invbut onclick="doctorform('29442375','00adf70b4369200af717408637365b7e','1','0','9')" value="Лечить лёгкую травму"> // <input type=button class=invbut onclick="doctorform('29850516','0f3205e857a3141a1dd22545c1aa0049','1','1','12')" value="Лечить среднюю травму"> // <input type=button class=invbut onclick="doctorform('29434480','5c675ad197ffd77e48f3bcd933ad3c7f','1','2','6')" value="Лечить тяжелую травму"> /* * function doctorform(duid,vcode,dprice,dtype,dcurs) * { * var add_txt = ''; * switch(dtype) * { * case '0': add_txt = 'легкая травма'; break; * case '1': add_txt = 'средняя травма'; break; * case '2': add_txt = 'тяжёлая травма'; break; * case '4': add_txt = 'боевая травма'; break; * } * top.frames['ch_buttons'].document.FBT.text.focus(); * document.all("doctordiv").innerHTML = ' * * <form action=main.php method=POST> * <input type=hidden name=useaction value="addon-action"> * <input type=hidden name=dtype value="'+dtype+'"> * <input type=hidden name=addid value=2> * <input type=hidden name=post_id value=3> * <input type=hidden name=dprice value="'+dprice+'"> * <input type=hidden name=dcurs value="'+dcurs+'"> * <input type=hidden name=duid value='+duid+'> * <input type=hidden name=vcode value='+vcode+'> * <INPUT TYPE="text" name=fnick class=LogintextBox maxlength=25> * <input type=submit value="лечить" class=lbut> * </FORM>'; * document.all("doctordiv").style.visibility = "visible"; * document.all("fnick").focus(); * ActionFormUse='fnick'; * } */ string dtext; switch (AppVars.CureTravm) { case "1": dtext = "0"; break; case "2": dtext = "1"; break; case "3": dtext = "2"; break; case "4": dtext = "4"; break; default: goto failed; } const string patternDoctorForm = "doctorform("; int p1 = 0; while (p1 != -1) { p1 = html.IndexOf(patternDoctorForm, p1, StringComparison.OrdinalIgnoreCase); if (p1 == -1) { break; } p1 += patternDoctorForm.Length; var p2 = html.IndexOf(")", p1, StringComparison.OrdinalIgnoreCase); if (p2 == -1) { continue; } var args = html.Substring(p1, p2 - p1); if (string.IsNullOrEmpty(args)) { continue; } var arg = args.Split(','); if (arg.Length < 5) { continue; } var duid = arg[0].Trim(new[] { '\'' }); var vcode = arg[1].Trim(new[] { '\'' }); var dprice = arg[2].Trim(new[] { '\'' }); var dtype = arg[3].Trim(new[] { '\'' }); var dcurs = arg[4].Trim(new[] { '\'' }); if (!dtype.Equals(dtext, StringComparison.OrdinalIgnoreCase)) { continue; } var sb = new StringBuilder(); sb.Append( HelperErrors.Head() + "Используем аптечку на "); sb.Append(AppVars.CureNick); sb.Append("..."); sb.Append("<form action=main.php method=POST name=ff>"); /* * sb.Append(@"<input name=useaction type=hidden value="""); * sb.Append(@"addon-action"); * sb.Append(@""">"); */ sb.Append(@"<input name=dtype type=hidden value="""); sb.Append(dtype); sb.Append(@""">"); sb.Append(@"<input name=addid type=hidden value="""); sb.Append(2); sb.Append(@""">"); sb.Append(@"<input name=post_id type=hidden value="""); sb.Append(3); sb.Append(@""">"); sb.Append(@"<input name=dprice type=hidden value="""); sb.Append(dprice); sb.Append(@""">"); sb.Append(@"<input name=dcurs type=hidden value="""); sb.Append(dcurs); sb.Append(@""">"); sb.Append(@"<input name=duid type=hidden value="""); sb.Append(duid); sb.Append(@""">"); sb.Append(@"<input name=vcode type=hidden value="""); sb.Append(vcode); sb.Append(@""">"); sb.Append(@"<input name=fnick type=hidden value="""); sb.Append(AppVars.CureNick); sb.Append(@""">"); sb.Append( @"</form>" + @"<script language=""JavaScript"">" + @"document.ff.submit();" + @"</script></body></html>"); return(sb.ToString()); } failed: return(null); }
private void Execute(object objThreadstate) { var flag = false; var flag2 = false; var flagsavedtrafic = false; if ((Request != null) && (Response != null)) { if (!Request.ReadRequest()) { CloseSessionPipes(); return; } RequestBodyBytes = Request.TakeEntity(); ExecuteBasicRequestManipulations(); RequestBodyBytes = Filter.PreProcess("http://" + Url, RequestBodyBytes); if (Url.StartsWith("www.neverlands.ru/cgi-bin/go.cgi?uid=", StringComparison.OrdinalIgnoreCase)) { flag = true; Response = new ServerChatter(this, "HTTP/1.1 304 Not Modified\r\nServer: Cache\r\n\r\n"); goto afterresponse; } if (Url.Contains("top.list.ru") || Url.Contains("counter.yadro.ru")) { flag = true; Response = new ServerChatter(this, "HTTP/1.1 304 Not Modified\r\nServer: Cache\r\n\r\n"); goto afterresponse; } if (!string.IsNullOrEmpty(Proxy.BasicAuth)) { Request.Headers.Add("Proxy-Authorization", Proxy.BasicAuth); } if (_isCustomFilter) { if (Request.Headers.Exists("If-Modified-Since")) { Request.Headers.Remove("If-Modified-Since"); } if (Request.Headers.Exists("If-None-Match")) { Request.Headers.Remove("If-None-Match"); } } else { if (Request.Headers.Exists("If-Modified-Since") || Request.Headers.Exists("If-None-Match")) { flag = true; Response = new ServerChatter(this, "HTTP/1.1 304 Not Modified\r\nServer: Cache\r\n\r\n"); goto afterresponse; } flagsavedtrafic = true; } Request.Headers.Remove("Cookie"); var cookiedata = CookiesManager.Obtain(Host); if (!string.IsNullOrEmpty(cookiedata)) { Request.Headers.Add("Cookie", cookiedata); } if (_isCache) { var data = Cache.Get(Url, AppVars.CacheRefresh); if (data != null) { if (flagsavedtrafic) { try { if (AppVars.MainForm != null) { AppVars.MainForm.UpdateSavedTrafficSafe(data.Length); } } catch (InvalidOperationException) { } } flag = true; Response = new ServerChatter(this, "HTTP/1.1 200 OK\r\nServer: Cache\r\n\r\n"); if (_isCustomFilter) { _isCustomFilter = false; var pdata = Filter.Process("http://" + Url, data); Response.AssignData(pdata); } else { Response.AssignData(data); } _isCache = false; goto afterresponse; } } // Begin of request IdleManager.AddActivity(); try { if (AppVars.MainForm != null) { AppVars.MainForm.AddAddressToStatusString(Url); } } catch (InvalidOperationException) { } flag = Response.ResendRequest(0); if (flag) { flag = Response.ReadResponse(); } if (!flag) { CloseSessionPipes(); } else { ResponseBodyBytes = Response.TakeEntity(); } try { if (AppVars.MainForm != null) { AppVars.MainForm.RemoveAddressFromStatusString(Url); } } catch (InvalidOperationException) { } // End of request IdleManager.RemoveActivity(); } afterresponse: ExecuteBasicResponseManipulations(); if (Response != null) { if (Url.StartsWith("www.neverlands.ru/main.php", StringComparison.OrdinalIgnoreCase)) { if (Response.Headers.Exists("Date")) { var stringDateTime = Response.Headers["Date"]; DateTime serverDateTime; if (DateTime.TryParse(stringDateTime, AppVars.EnUsCulture, DateTimeStyles.None, out serverDateTime)) { try { if (AppVars.MainForm != null) { AppVars.MainForm.BeginInvoke( new UpdateServerTimeDelegate(AppVars.MainForm.UpdateServerTime), new object[] { serverDateTime }); } } catch (InvalidOperationException) { } } } } for (var i = 0; i < Response.Headers.Count(); i++) { if (Response.Headers[i].Name.Equals("Set-Cookie", StringComparison.OrdinalIgnoreCase)) { CookiesManager.Assign(Host, Response.Headers[i].Value); } } Response.Headers.Remove("Set-Cookie"); if (Response != null && Response.Headers != null && Response.Headers.HttpResponseCode == 200) { if (Url.StartsWith("www.neverlands.ru/modules/code/code.php?", StringComparison.OrdinalIgnoreCase)) { AppVars.CodePng = ResponseBodyBytes; } else { if (_isCache) { Cache.Store(Url, ResponseBodyBytes, _isGameHost); } if (_isCustomFilter && ResponseBodyBytes != null) { var pdata = Filter.Process("http://" + Url, ResponseBodyBytes); Response.AssignData(pdata); } } } else { if (Response != null && Response.Headers != null && Response.Headers.HttpResponseCode >= 400 & Response.Headers.HttpResponseCode != 404 && _isCustomFilter) { var sb = new StringBuilder( HelperErrors.Head() + "Отказ сервера <br>" + @"<br><span class=""gray"">"); sb.AppendLine(Response.Headers.HttpResponseStatus); sb.Append( "</span>" + "</body>" + "</html>"); Response.AssignData(Encoding.UTF8.GetBytes(sb.ToString())); Response.Headers = new HttpResponseHeaders { HttpResponseCode = 200, HttpResponseStatus = "OK" }; } } } var flag3 = false; if (!BufferResponse) { flag3 = true; } if (Response != null && Response.Headers != null) { if (((Response.Headers.HttpResponseCode == 0x191) && (string.Compare(Response.Headers["WWW-Authenticate"], 0, "N", 0, 1, StringComparison.OrdinalIgnoreCase) == 0)) || ((Response.Headers.HttpResponseCode == 0x197) && (string.Compare(Response.Headers["Proxy-Authenticate"], 0, "N", 0, 1, StringComparison.OrdinalIgnoreCase) == 0))) { flag2 = DoNTLM(0x197 == Response.Headers.HttpResponseCode); } else if (Response.ServerSocket != null) { if (Response.Headers.ExistsAndEquals("Connection", "close") || (!Response.ServerSocket.Connected || (Response.Headers.HttpVersion != "HTTP/1.1"))) { if (Response.ServerSocket.Connected) { try { if (Response.ServerSocket != null) { Response.ServerSocket.Shutdown(SocketShutdown.Both); Response.ServerSocket.Close(); } } catch (Exception) { } Response.ServerSocket = null; } } Response.ServerSocket = null; } } if (!flag3) { if (flag) { ReturnResponse(flag2); } /* * if (!flag) * { * if (Request != null) * if (Response != null) * Request.FailSession(400, "Bad Response", "Reading response failed. Response was:\n" + Response); * } */ } if (Request != null && ((Request.ClientSocket != null) && flag3)) { if (Response != null && Response.Headers != null) { if (flag2 || (((!Response.Headers.ExistsAndEquals("Connection", "close")) && !Request.Headers.ExistsAndEquals("Connection", "close")) && ((Response.Headers.HttpVersion == "HTTP/1.1") || Response.Headers.ExistsAndContains("Connection", "Keep-Alive")))) { if (!flag2) { Thread.Sleep(0x19); } if (flag2 || (0 < Request.ClientSocket.Available)) { _nextSession = flag2 ? new Session(Request.ClientSocket, Response.ServerSocket, Response.WasForwarded) : new Session(Request.ClientSocket, null, false); Request.ClientSocket = null; goto next; } } } try { if (Request.ClientSocket != null) { Request.ClientSocket.Shutdown(SocketShutdown.Both); Request.ClientSocket.Close(); } } catch (Exception) { } Request.ClientSocket = null; } next: if (_nextSession != null) { _nextSession.Execute(null); } }