// /** // * File: Program.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using Renci.SshNet; using ln.skyscanner.identify; using System.Net; using System.Collections.Generic; using ln.snmp.types; using System.IO; using ln.snmp; using ln.snmp.endpoint; using System.Diagnostics; using ln.perfdb.storage; using ln.logging; using System.Security.Cryptography; using ln.snmp.asn1; using System.Linq; using ln.types; using System.Runtime.InteropServices; using ln.snmp.rfc1213; using ln.types.sync; using ln.skyscanner.crawl; using System.Threading; using ln.skyscanner.crawl.tests; using Castle.DynamicProxy; using ln.types.odb; using System.Net.Sockets; using ln.skyscanner.entities; using ln.types.btree; using ln.types.test; using ln.types.threads; using ln.types.net; namespace ln.skyscanner { class MainClass { public static void Main(string[] args) { new IPv4(0); FileLogger fileLogger = new FileLogger("skyscanner.log"); fileLogger.MaxLogLevel = LogLevel.INFO; Logger.Default.Backends.Add(fileLogger); Logger.ConsoleLogger.MaxLogLevel = LogLevel.DEBUGDETAIL; Initialize(); SkyScanner skyScanner = new SkyScanner(args); skyScanner.Start(); return; IEnumerable nodes = skyScanner.Entities.nodeCollection; foreach (Node node in nodes) { Console.WriteLine("Node: {0}", node); skyScanner.Entities.nodeCollection.Update(node); foreach (Node checkNode in SkyScanner.Instance.Entities.nodeCollection.Select("PrimaryIP", node.PrimaryIP)) { Console.WriteLine("Node (lookup primary ip): {0}", checkNode); if (!checkNode.ID.Equals(node)) { if ((checkNode.Interfaces.Count() == 0)) { SkyScanner.Instance.Entities.nodeCollection.Delete(checkNode); } } } //IEnumerable interfaces = Timing.Meassure("node.Interfaces",() => node.Interfaces); //foreach (NetworkInterface intf in interfaces) //{ // Console.WriteLine(" Interface: {0}", intf); //} Console.WriteLine(""); Console.WriteLine(""); } throw new Exception(); } private static void Initialize() { SNMPEngine.DefaultEngine.Timeout = 3500; //using (ODB odb = new ODB("odb")) //{ //ODBCollection col = odb.GetCollection("test"); //foreach (ODBDocument odoc in col) //{ // Console.WriteLine("Stored DOC: {0}", odoc); // if (!odoc.Contains("counter")) // odoc["counter"] = 0; // else // odoc["counter"] = odoc["counter"].AsInt + 1; // col.Upsert(odoc); //} //ODBDocument doc = new ODBDocument(); //doc["snmp.msg"] = "Hallo WelT!"; //doc["name"] = "Harald"; //doc["alter"] = 39; //doc["genauer"] = 34.5; //ODBDocument ndoc = new ODBDocument(); //doc["keywords"] = ndoc; //ndoc["eins"] = 1; //ndoc["zwei"] = 2; //ndoc["drei"] = 3; //Console.WriteLine(doc); //col.Insert(doc); //Node node = new Node(CIDR.Parse("1.2.3.4")); //ODBDocument nodeDoc = ODBMapper.Default.ToODBValue(node).AsDocument; //Console.WriteLine("Node: {0}", nodeDoc); //Node node2 = ODBMapper.Default.ToNativeValue(nodeDoc); //} } } }