PDA

View Full Version : سوال: حذف تگ های html و script



abasfar
سه شنبه 20 تیر 1391, 16:48 عصر
سلام
دوستان من میخوام کد زیر را حذف کنم از صفحات


<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->
<center><a href="http://host.com">Web hosting by host.com</a></center>
</textarea></xml></script></noframes></noscript></object></layer></style></title></applet>
<script language="JavaScript" src="http://ads.host.com/serveimages/ad2/WholeInsert2.js"></script>
<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->



مثل یک ویروس در تمام صفحات نمایش میابد
فقط میخوام مخفی کنم یا حذف در همان صفحه

mahmood_4246
سه شنبه 20 تیر 1391, 22:20 عصر
مهندس با جی کوئری راحت حذف میشه..یه سرچ ساده کلی بهت سمپل میده..با hide کار کن

abasfar
چهارشنبه 21 تیر 1391, 00:03 صبح
ممنون از جواب شما اما همان طور که در کد دیده میشه id یا name نداریم ها!
میشه کلمه کلیدی یا چیزی بفرمایید ؟

aebrs@yahoo.com
چهارشنبه 21 تیر 1391, 00:08 صبح
با سلام
فکر کنم این کد کمک میکند البته من خودم آنرا تست نکرده ام :



SimpleText= Regex.Replace(bankResponse, @"\<(.|\r|\n)*\>", "").Trim();


موفق باشید

abasfar
چهارشنبه 21 تیر 1391, 00:39 صبح
ممنون از پاسخ شما اما این عبارت منظم همیه تگها رو پاک میکنه

fakhravari
چهارشنبه 21 تیر 1391, 00:47 صبح
public static string Html_Del(string Html)
{
return Regex.Replace(Html, "<[^>]*>", string.Empty);
}

abasfar
چهارشنبه 21 تیر 1391, 00:51 صبح
ممنون از پاسخ شما اما این هم تمام تگهای را حذف میکند
تفاوت میان بالایی و این ، این است که بالای ئ تمام اطلاعات داخل تگ را پاک میکند همراه تگ
اما این یکی فقط تگ را پاک میکند

aebrs@yahoo.com
چهارشنبه 21 تیر 1391, 06:47 صبح
از دستور Replace برای جایگزینی همه عبارت فوق استفاده کرده اید؟
string.replace("<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->
<center><a href="http://host.com (http://host.com/)">Web hosting by host.com</a></center>
</textarea></xml></script></noframes></noscript></object></layer></style></title></applet>
<script language="JavaScript" src="http://ads.host.com/serveimages/ad2/WholeInsert2.js"></script>
<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->

یا از دستور فرمت : ابتدا عبارت <!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE--> را جستجو و نقطه شروع آنرا پیدا کنید
سپس رشته <!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE--> را جستجو و نقطه پایان آنرا پیدا کنید
حالا همه متن نقطه شروع تا پایان را با "" خالی جلیگزین کنید؟




","")

aminghaderi
چهارشنبه 21 تیر 1391, 07:20 صبح
مثل یک ویروس در تمام صفحات نمایش میابد
پاک کردنش دردی رو دوا نمی کنه؟! چون اون به صورت خودکار ساخته می شود (اون طوری که خودتون می گید!) بهترین کار این هست ، هاست یا سرور خودتون رو عوض کنید ، چون با این روند ، احتمال داره ، هر لحظه یه اسکریپت جدیدی اضافه بشه و شما و کاربران سایتتون از حملات XSS در امان نخواهید بود!

موفق باشی.

abasfar
چهارشنبه 21 تیر 1391, 10:58 صبح
ممنون از جواب شما
خوش بختانه اسکریپ ثابت است حداقل تو این چند سال

abasfar
شنبه 24 تیر 1391, 12:11 عصر
دوستان اسکریپ بالا کد زیر را تولید میکنه


<html>
<head>
<style id="wrc-middle-css" type="text/css">
.wrc_whole_window
{
display: none;
position: fixed;
z-index: 2147483647;
background-color: rgba(40, 40, 40, 0.9);
word-spacing: normal;
margin: 0px;
padding: 0px;
border: 0px;
line-height: normal;
letter-spacing: normal;
}
.wrc_middle_main
{
font-family: Segoe UI, Arial Unicode MS, Arial, Sans-Serif;
font-size: 14px;
width: 600px;
height: auto;
margin: 0px auto;
margin-top: 15%;
background: url("chrome://wrc/skin/png/background-body.png");
background-color: rgb(39, 53, 62);
}
.wrc_middle_logo
{
background: url("chrome://wrc/skin/logo.jpg") no-repeat left bottom;
width: 140px;
height: 42px;
color: orange;
display: table-cell;
text-align: right;
vertical-align: middle;
}
.wrc_icon_warning
{
margin: 20px 10px 20px 15px;
float: left;
background-color: transparent;
}
.wrc_middle_title
{
color: #b6bec7;
height: auto;
margin: 0px auto;
font-size: 2.2em;
white-space: nowrap;
text-align: center;
}
.wrc_middle_hline
{
height: 2px;
width: 100%;
display: block;
}
.wrc_middle_description
{
text-align: center;
margin: 15px;
font-size: 1.4em;
padding: 20px;
height: auto;
color: white;
min-height: 3.5em;
}
.wrc_middle_actions_main_div
{
text-align: center;
margin-bottom: 15px;
}
.wrc_middle_actions_blue_button
{
-moz-appearance: none;
border-radius: 7px;
-moz-border-radius: 7px/7px;
border-radius: 7px/7px;
background-color: rgb(0, 173, 223) !important;
display: inline-block;
width: auto;
cursor: Pointer;
border: 2px solid #00dddd;
text-decoration: none;
}
.wrc_middle_actions_blue_button:hover
{
background-color: rgb(0, 159, 212) !important;
}
.wrc_middle_actions_blue_button:active
{
background-color: rgb(0, 146, 200) !important;
border: 2px solid #00aaaa;
}
.wrc_middle_actions_blue_button div
{
display: inline-block;
width: auto;
cursor: Pointer;
margin: 3px 10px 3px 10px;
color: white !important;
font-size: 1.2em;
font-weight: bold;
}
.wrc_middle_action_low
{
font-size: 0.9em;
white-space: nowrap;
cursor: Pointer;
color: grey !important;
margin: 10px 10px 0px 10px;
text-decoration: none;
}
.wrc_middle_action_low:hover
{
color: #aa4400 !important;
}
.wrc_middle_actions_rest_div
{
padding-top: 5px;
white-space: nowrap;
text-align: center;
}
.wrc_middle_action
{
white-space: nowrap;
cursor: Pointer;
color: red !important;
font-size: 1.2em;
margin: 10px 10px 0px 10px;
text-decoration: none;
}
.wrc_middle_action:hover
{
color: #aa4400 !important;
}
</style>

</head>
<body>
<center>
<a href="http://host.com">Web hosting by host.com</a></center>
<script src="http://ads.mgmt.host.com/serveimages/ad2/WholeInsert2.js" language="JavaScript"></script>
<div style="height: 65px;">
</div>
<div style="opacity: 0.9; z-index: 2147483647; position: fixed; left: 0px; bottom: 0px;
height: 65px; right: 0px; display: block; width: 100%; background-color: #202020;
margin: 0px; padding: 0px;">
</div>
<div onmouseout="D_ssac();" onmouseover="S_ssac();" style="position: fixed; z-index: 2147483647;
left: 0px; bottom: 0px; height: 65px; right: 0px; display: block; width: 100%;
background-color: transparent; margin: 0px; padding: 0px;">
<div style="width: 100%; color: White; font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;">
<div style="margin-right: auto; margin-left: auto; display: table; padding-top: 3px;">
<table cellspacing="6" cellpadding="0">
<tbody>
<tr>
<td>
<div style="padding-right: 40px;">
<a href="http://host.com" style="text-decoration: none;"><span style="color: White;
font-size: 11pt;">ASP.Net web hosting</span><br>
<span style="font-size: 9pt; color: #AAAAAA; padding-top: 2px;">ASP.Net, MVC, MS SQL
from $4.95/Mo</span> </a>
</div>
</td>
<td>
<a href="https://host.com/FreeAspNetHosting.aspx" style="text-decoration: none;"><span
style="color: White; font-size: 11pt;">Free ASP.Net hosting</span><br>
<span style="font-size: 9pt; color: #AAAAAA">ASP.Net, MVC, MS SQL</span> </a>
</td>
<td>
<div style="padding-left: 40px;">
<a href="http://host.com/VirtualServer.aspx" style="text-decoration: none;"><span
style="color: White; font-size: 11pt;">Windows virtual dedicated servers</span><br>
<span style="font-size: 9pt; color: #AAAAAA">2GHz, 1GB RAM, 45GB HDD from $19.95/Mo</span>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div style="margin-right: auto; margin-left: auto; display: table; font-size: 9pt;">
<a href="http://host.com" style="text-decoration: none; color: White; margin-right: 6px;
margin-left: 6px; font-size: 11pt;">Web hosting by host.com</a>
</div>
</div>
</div>
<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->
<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->
<center>
<a href="http://host.com">Web hosting by host.com</a></center>
<script src="http://ads.mgmt.host.com/serveimages/ad2/WholeInsert2.js" language="JavaScript"></script>
<div style="height: 65px;">
</div>
<div style="opacity: 0.9; z-index: 2147483647; position: fixed; left: 0px; bottom: 0px;
height: 65px; right: 0px; display: block; width: 100%; background-color: #202020;
margin: 0px; padding: 0px;">
</div>
<div onmouseout="D_ssac();" onmouseover="S_ssac();" style="position: fixed; z-index: 2147483647;
left: 0px; bottom: 0px; height: 65px; right: 0px; display: block; width: 100%;
background-color: transparent; margin: 0px; padding: 0px;">
<div style="width: 100%; color: White; font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;">
<div style="margin-right: auto; margin-left: auto; display: table; padding-top: 3px;">
<table cellspacing="6" cellpadding="0">
<tbody>
<tr>
<td>
<div style="padding-right: 40px;">
<a href="http://host.com" style="text-decoration: none;"><span style="color: White;
font-size: 11pt;">ASP.Net web hosting</span><br>
<span style="font-size: 9pt; color: #AAAAAA; padding-top: 2px;">ASP.Net, MVC, MS SQL
from $4.95/Mo</span> </a>
</div>
</td>
<td>
<a href="https://host.com/FreeAspNetHosting.aspx" style="text-decoration: none;"><span
style="color: White; font-size: 11pt;">Free ASP.Net hosting</span><br>
<span style="font-size: 9pt; color: #AAAAAA">ASP.Net, MVC, MS SQL</span> </a>
</td>
<td>
<div style="padding-left: 40px;">
<a href="http://host.com/VirtualServer.aspx" style="text-decoration: none;"><span
style="color: White; font-size: 11pt;">Windows virtual dedicated servers</span><br>
<span style="font-size: 9pt; color: #AAAAAA">2GHz, 1GB RAM, 45GB HDD from $19.95/Mo</span>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div style="margin-right: auto; margin-left: auto; display: table; font-size: 9pt;">
<a href="http://host.com" style="text-decoration: none; color: White; margin-right: 6px;
margin-left: 6px; font-size: 11pt;">Web hosting by host.com</a>
</div>
</div>
</div>
<!--SCRIPT GENERATED BY SERVER! PLEASE REMOVE-->
</body>
</html>