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;
            }
        }
    }

  • 相关阅读:
    已有模板与tp框架结合
    模板文件引入css样式文件
    通过vertical-align属性实现“竖向居中”显示
    解决PHP服务端返回json字符串有特殊字符的问题
    PHP数组排序函数:sort、asort和ksort的不同
    PHP常用开发函数解析之数组篇
    PHP将数组存入数据库中的四种方式
    PHP foreach的两种用法 as $key => $value
    sharepoint database 操作
    Enabling Remote Errors in SSRS
  • 原文地址:https://www.cnblogs.com/welcomesay/p/1725833.html
Copyright © 2011-2022 走看看