示例#1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbwork    db     = new dbwork();
        IPAddress fromip = null;
        IPAddress toip   = null;

        if (db.tableexist(dbaddress, "forscan"))
        {
            db.droptdforscandb(dbaddress, "forscan");
            db.addtbforscandb(dbaddress, "forscan");
        }
        else
        {
            db.addtbforscandb(dbaddress, "forscan");
        }


        try
        {
            fromip = IPAddress.Parse(scanrangefrombox.Text);
            toip   = IPAddress.Parse(scanrangetobox.Text);
        }
        catch
        { scanstate.Text = "Wrong ip"; }
        icmp temp = new icmp();

        int re = 1, id = 1;

        re = System.Int32.Parse(retrycountbox.Text);
        string group = groupnamebox.Text;
        var    ips   = temp.ExpandIpRange(fromip, toip);

        foreach (var ip in ips)
        {
            id++;
            db.insertdb(dbaddress, "INSERT INTO forscan (Код,ip,grp) values (" + id + ",'" + ip + "','" + group + "')");
        }
        //      scanstate.Text = "Range send to check";
    }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbwork db = new dbwork();
        IPAddress fromip = null;
        IPAddress toip = null;

        if (db.tableexist(dbaddress, "forscan"))
        {
            db.droptdforscandb(dbaddress, "forscan");
            db.addtbforscandb(dbaddress, "forscan");
        }
        else
        {
            db.addtbforscandb(dbaddress, "forscan");
        }

        try
        {
            fromip = IPAddress.Parse(scanrangefrombox.Text);
            toip = IPAddress.Parse(scanrangetobox.Text);
        }
        catch
        { scanstate.Text = "Wrong ip"; }
        icmp temp = new icmp();

        int re = 1, id = 1;
        re = System.Int32.Parse(retrycountbox.Text);
        string group = groupnamebox.Text;
        var ips = temp.ExpandIpRange(fromip, toip);
        foreach (var ip in ips)
        {
            id++;
            db.insertdb(dbaddress, "INSERT INTO forscan (Код,ip,grp) values (" + id + ",'" + ip + "','" + group + "')");
        }
          //      scanstate.Text = "Range send to check";
    }
示例#3
0
 public void DbCreateTableTest()
 {
     dbaddress = newdb.getdbparam("config.txt").GetValue(1).ToString();
     newdb.addtbforscandb(dbaddress, "forscan");
 }