static void Main(string[] args) { Console.WriteLine("Hello."); monitor m1 = new monitor(); scan s1 = new scan(); dbwork db = new dbwork(); string dbaddress=null; try { dbaddress = db.getdbparam("config.txt").GetValue(1).ToString(); } catch (System.IO.FileNotFoundException) { Console.WriteLine("Config file is not found"); Console.ReadKey(); return; } try { db.tableexist(dbaddress, "hosts"); } catch (InvalidOperationException) { Console.WriteLine("You have no AccessDatabaseEngine. Contact your administrator."); Console.ReadKey(); return; } Console.WriteLine("Database file at "+dbaddress+"\n"); if (args.Length == 0) { m1.checknow(); } else { if (args[0] == "scantd") { s1.scannow(); return; } if (args[0] == "deltd") { Console.WriteLine("Now table forscan delete"); try { db.droptdforscandb(dbaddress, "forscan"); } catch (System.Data.OleDb.OleDbException) { Console.WriteLine("Can not delete"); return; } Console.WriteLine("Complite.\nWrite new cfg"); db.setdbparam("config.txt", 2, "scanstopnow"); Console.WriteLine("Done\nGood bye."); Thread.Sleep(3000); return; } if (args[0] == "check") { m1.checknow(); return; } } }
static void Main(string[] args) { Console.WriteLine("Hello."); monitor m1 = new monitor(); scan s1 = new scan(); dbwork db = new dbwork(); string dbaddress = null; try { dbaddress = db.getdbparam("config.txt").GetValue(1).ToString(); } catch (System.IO.FileNotFoundException) { Console.WriteLine("Config file is not found"); Console.ReadKey(); return; } try { db.tableexist(dbaddress, "hosts"); } catch (InvalidOperationException) { Console.WriteLine("You have no AccessDatabaseEngine. Contact your administrator."); Console.ReadKey(); return; } Console.WriteLine("Database file at " + dbaddress + "\n"); if (args.Length == 0) { m1.checknow(); } else { if (args[0] == "scantd") { s1.scannow(); return; } if (args[0] == "deltd") { Console.WriteLine("Now table forscan delete"); try { db.droptdforscandb(dbaddress, "forscan"); } catch (System.Data.OleDb.OleDbException) { Console.WriteLine("Can not delete"); return; } Console.WriteLine("Complite.\nWrite new cfg"); db.setdbparam("config.txt", 2, "scanstopnow"); Console.WriteLine("Done\nGood bye."); Thread.Sleep(3000); return; } if (args[0] == "check") { m1.checknow(); return; } } }
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"; }
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"; }
public void DbDeleteTableTest() { dbaddress = newdb.getdbparam("config.txt").GetValue(1).ToString(); newdb.droptdforscandb(dbaddress, "forscan"); }