zoukankan      html  css  js  c++  java
  • Linksys路由器自动重启加流量

    解决方法完整代码

    代码
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Windows.Forms;
    using Pucome.com;

    namespace Linksys路由器自动重启加流量
    {
        
    public partial class Form1 : Form
        {
            
    public Form1()
            {
                InitializeComponent();
            }
            HttpRequest http
    =new HttpRequest();
            
    private void Form1_Load(object sender, EventArgs e)
            {
                
                
    //http.Referer = "http://192.168.15.1/";
                SetAllowUnsafeHeaderParsing();
                http.OpenRequest(
    "http://192.168.15.1/","");
                textBox1.Text 
    = http.HtmlDocument;
            }

            
    private void button1_Click(object sender, EventArgs e)
            {
                http.OpenRequest(
    "http://192.168.15.1/cgi-bin/webcm""http://192.168.15.1/cgi-bin/webcm?getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html",
                                 
    "security%3Acommand%2Flogout=&getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fhome.html&errorpage=%2Fusr%2Fwww_safe%2Findex.html&var%3Apagename=home&login%3Acommand%2Fusername_ja=admin&login%3Acommand%2Fpassword_ja=admin&var%3Arequestfrom=");
                textBox1.Text 
    = http.HtmlDocument;
            }

            
    private void button2_Click(object sender, EventArgs e)
            {
                http.OpenRequest(
                    
    "http://192.168.15.1/cgi-bin/webcm?getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html""");
                textBox1.Text 
    = http.HtmlDocument;
            }

            
    private void button3_Click(object sender, EventArgs e)
            {
                http.OpenRequest(
    "http://192.168.15.1/cgi-bin/webcm""",
                                 
    "getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html&errorpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html&var%3Apagename=pppoe&var%3Aerrorpagename=&connection0%3Apppoe%3Acommand%2Fstop=1&var%3Aconnect=0");
                textBox1.Text 
    = http.HtmlDocument;
            }

            
    private void button4_Click(object sender, EventArgs e)
            {
                http.OpenRequest(
    "http://192.168.15.1/cgi-bin/webcm""",
                     
    "getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html&errorpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html&var%3Apagename=pppoe&var%3Aerrorpagename=&connection0%3Apppoe%3Acommand%2Fstart=1&var%3Aconnect=1");
                textBox1.Text 
    = http.HtmlDocument;
            }

            
    public static bool SetAllowUnsafeHeaderParsing()
            {
                
    //Get the assembly thatConfiguration contains the internal class
                Assembly aNetAssembly = Assembly.GetAssembly(typeof(System.Net.Configuration.SettingsSection));
                
    if (aNetAssembly != null)
                {
                    
    //Use the assembly in order to get the internal type for                 
                    
    // the internal class                 
                    Type aSettingsType = aNetAssembly.GetType("System.Net.Configuration.SettingsSectionInternal");
                    
    if (aSettingsType != null)
                    {
                        
    //Use the internal static property to get an instance                     
                        
    // of the internal settings class. If the static instance                     
                        
    // isn't created allready the property will create it for us.                     
                        object anInstance = aSettingsType.InvokeMember("Section",
                            BindingFlags.Static 
    | BindingFlags.GetProperty | BindingFlags.NonPublic, nullnullnew object[] { });
                        
    if (anInstance != null)
                        {
                            
    //Locate the private bool field that tells the                         
                            
    // framework is unsafe header parsing should be                         
                            
    // allowed or not                         
                            FieldInfo aUseUnsafeHeaderParsing = aSettingsType.GetField("useUnsafeHeaderParsing", BindingFlags.NonPublic | BindingFlags.Instance); if (aUseUnsafeHeaderParsing != null) { aUseUnsafeHeaderParsing.SetValue(anInstance, true); return true; }
                        }
                    }
                } 
    return false;
            }
        }
    }

  • 相关阅读:
    分布式解决方案的收集
    一天带你入门到放弃vue.js(三)
    一天带你入门到放弃vue.js(二)
    一天带你入门到放弃vue.js(一)
    JDK配置环境变量不成功的原因
    蚂蚁课堂(每特学院)-2期
    Java 使用blob对H5视频播放进行加密《java视频加密》
    Java 实现视频下载功能
    高并发与高可用实战之基础知识大型网站架构特征(一)
    Java线程池实现原理之自定义线程池(一)
  • 原文地址:https://www.cnblogs.com/welcomesay/p/1725833.html
Copyright © 2011-2022 走看看