public static void CreateKmlFileNew(gpsdata thegpsdata, string theconnectionstring, bool filter) { SQLiteConnectionStringBuilder builder = new SQLiteConnectionStringBuilder(); builder.DataSource = string.Format("{0}\\kismetdata.db", Application.StartupPath); builder.SyncMode = SynchronizationModes.Off; builder.CacheSize = 5000; DatanewTableAdapter thedatanewtableadaptor = new DatanewTableAdapter(); ClientsTableAdapter theclientstableadaptor = new ClientsTableAdapter(); //GPSDatanewTableAdapter thegpsdatadapator = new GPSDatanewTableAdapter(); SQLiteConnection connection = new SQLiteConnection(builder.ToString()); connection.Open(); SQLiteCommand cmdBase = connection.CreateCommand(); SQLiteDataReader readBase = null; double themaxlon=0.0; double theminlon = 0.0; cmdBase.CommandText = "SELECT MAX(lon) as maxlon, min(lon) as minlon FROM gpsdata"; //cmdBase.CommandText = "SELECT oui, bssid, clientmac FROM Clients WHERE bssid='" & thebssid & "'"; readBase = cmdBase.ExecuteReader(); if (readBase.HasRows) { readBase.Read(); themaxlon = System.Convert.ToDouble(readBase["maxlon"].ToString()); theminlon = System.Convert.ToDouble(readBase["minlon"].ToString()); } //Console.WriteLine(themaxlon); //Console.WriteLine(theminlon); Console.WriteLine("Creating KML File"); readBase.Close(); double thestep = theminlon; double newmax = 0.0; newmax = thestep + .010000000; //while (thestep < themaxlon) //{ //Console.WriteLine(thestep); //Console.WriteLine(newmax); //thestep = thestep + .01000000; //newmax = thestep + .010000000; //} DataTable t; DataTable clientt; XmlTextWriter myXmlTextWriter = new XmlTextWriter(Application.StartupPath + "\\kismet.kml", null); myXmlTextWriter.Formatting = Formatting.Indented; myXmlTextWriter.WriteStartDocument(false); myXmlTextWriter.WriteStartElement("Folder"); myXmlTextWriter.WriteElementString("name", null, "KismetLogger"); string[] names = new string[26] { "None","WEP","WEP,CCMP","WEP,TKIP","WEP,TKIP,CCMP","WEP,TKIP,WPA","WEP,TKIP,WPA,AES-CCM","WEP,TKIP,WPA,AES-CCM,CCMP","WEP,TKIP,WPA,PSK","WEP,TKIP,WPA,PSK,AES-CCM","WEP,TKIP,WPA,PSK,AES-CCM,CCMP","WEP,WEP104,TKIP,WPA","WEP,WEP104,TKIP,WPA,AES-CCM","WEP,WEP104,TKIP,WPA,PSK,AES-CCM","WEP,WEP104,WPA","WEP,WEP104,WPA,CCMP","WEP,WEP40,TKIP,WPA","WEP,WEP40,TKIP,WPA,AES-CCM","WEP,WEP40,TKIP,WPA,PSK","WEP,WEP40,WEP104,TKIP,WPA","WEP,WEP40,WEP104,TKIP,WPA,AES-CCM","WEP,WEP40,WPA,AES-CCM","WEP,WPA,AES-CCM","WEP,WPA,AES-CCM,CCMP","WEP,WPA,PSK,AES-CCM","WEP,WPA,PSK,AES-CCM,CCMP"}; //string[] names = new string[1] { "None" }; //string[] names = new string[8] { "2009-03-14","2009-03-15", "2009-03-16","2009-03-23","2009-03-24","2009-03-29","2009-04-01","2009-04-03"}; int nameslength = names.Length; for (int a = 0; a < nameslength; a++) { //if (a != (nameslength - 1)) //{ // t = thedatanewtableadaptor.GetDataByFirstSeen(names[a], names[a + 1]); //} //else //{ //t = thedatanewtableadaptor.GetDataByFirstSeen(names[a], "2009-04-04"); //} t = thedatanewtableadaptor.GetDataByEncType(names[a]); //t = thedatanewtableadaptor.GetDataByLatLon(names[a], -86.25, -86.28); DataTableReader thedatareader = t.CreateDataReader(); myXmlTextWriter.WriteStartElement("Folder"); myXmlTextWriter.WriteElementString("name", null,names[a]); Console.WriteLine(names[a] + " " + t.Rows.Count); //Console.WriteLine(themaxminreader["maxlon"].ToString()); //Console.WriteLine(themaxminreader["minlon"].ToString()); for (int i = 0; i < t.Rows.Count; i++) { thedatareader.Read(); string thebssid = thedatareader["bssid"].ToString(); //Console.WriteLine(thedatareader["lat"].ToString()); //Console.WriteLine(thedatareader["lon"].ToString()); //gpst = thegpsdatadapator.GetDataByGpsData(thebssid); //if (gpst.Rows.Count != 0) //{ string clientstring = ""; myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name", null, thedatareader["Essid"].ToString()); myXmlTextWriter.WriteElementString("styleUrl", null, "#track"); myXmlTextWriter.WriteStartElement("description"); //DataTableReader thegpsreader = gpst.CreateDataReader(); //thegpsreader.Read(); string thelat = thedatareader["lat"].ToString(); //Console.WriteLine(thelat); string thelong = thedatareader["lon"].ToString(); //Console.WriteLine(thelong); clientt = theclientstableadaptor.GetDataByBssid(thebssid); if (clientt.Rows.Count !=0) { DataTableReader clientreader = clientt.CreateDataReader(); clientstring = "<p>Number of clients=" + clientt.Rows.Count + "<p>"; for (int j = 0; j < clientt.Rows.Count; j++) { clientreader.Read(); string theclientmac = clientreader["Clientmac"].ToString(); string theclientoui = clientreader["oui"].ToString(); clientstring += "<p>" + theclientmac + "-" + theclientoui + "</p>"; } } myXmlTextWriter.WriteCData(string.Format("{0}-{1}<p><b>First Seen: </b><br>{2}<br><BR><b> Last Seen: </b><BR>{3}{4}", thedatareader["bssid"], thedatareader["Oui"], thedatareader["FirstTime"], thedatareader["LastTime"], clientstring)); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Style"); myXmlTextWriter.WriteStartElement("Icon"); myXmlTextWriter.WriteElementString("href", null, "root://icons/palette-3.png"); myXmlTextWriter.WriteElementString("x", null, "96"); myXmlTextWriter.WriteElementString("y", null, "160"); myXmlTextWriter.WriteElementString("w", null, "32"); myXmlTextWriter.WriteElementString("h", null, "32"); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Point"); myXmlTextWriter.WriteElementString("coordinates", null, thelong + "," + thelat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); //} } myXmlTextWriter.WriteEndElement(); myXmlTextWriter.Flush(); } myXmlTextWriter.Close(); }
private static void ProcessCSVFiles(string theconnectionstring, DirectoryInfo dir) { thedata Kisdata = new thedata(); gpsdata thegpsdata = new gpsdata(); Kisdata.ConnectionString = theconnectionstring; thegpsdata.ConnectionString = theconnectionstring; int count = 0; double timestamp = 1161883162; DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(timestamp); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. // string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); // Print the date and time Console.WriteLine(dateTime); thegpsdata.LoadAll(); do { if (!Kisdata.LoadByPrimaryKey(thegpsdata.Bssid)) { count++; //Console.WriteLine(thegpsdata.Bssid); } } while (thegpsdata.MoveNext()); Console.WriteLine(count); foreach (FileInfo f in dir.GetFiles("Kismet*.csv")) { StreamReader sr = File.OpenText(Application.StartupPath + "\\logs\\" + f.Name); string input; Console.WriteLine(f.Name); //string aoui = ""; //string[] theoui; //string thecompany = ""; sr.ReadLine(); while ((input = sr.ReadLine()) != null) { if (input.Length != 0) { //Console.WriteLine(input); string[] thestrings; thestrings = input.Split(new char[] { ';' }); //Console.WriteLine(thestrings.Length); if(!Kisdata.LoadByPrimaryKey(thestrings[3])) { Console.WriteLine(thestrings[2]); Console.WriteLine(thestrings[3]); } } } } }
/* private static void CleanGPSFiles(DirectoryInfo dir) { foreach (FileInfo f in dir.GetFiles("Kismet*.gps")) { string input; StreamReader fs2 = File.OpenText("c:\\documents and settings\\luke\\my documents\\kismetlogs\\" + f.Name); //Console.WriteLine("Processing " + f.Name); // GP:SD:TR:AC:KL:OG Regex theregex = new Regex(@"GP:SD:TR:AC:KL:OG", RegexOptions.Compiled); Regex theregex2 = new Regex(@"bssid"); while((input=fs2.ReadLine()) != null) { if(!theregex.IsMatch(input)) { if(theregex2.IsMatch(input)) { Console.WriteLine(input); } } } } } */ public static void CreateKmlFile(gpsdata thegpsdata, string theconnectionstring) { thedata newdata = new thedata(); //clientdata thecd = new clientdata(); thegpsdata.FlushData(); clientdata theclientdata = new clientdata(); //Decimal thebestlon; //Decimal thebestlat; //Decimal thebestsignal; Console.WriteLine("Creating KML File"); theclientdata.ConnectionString = theconnectionstring; newdata.ConnectionString = theconnectionstring; thegpsdata.ConnectionString = theconnectionstring; //thecd.ConnectionString=theconnectionstring; newdata.Where.NetType.Value = "infrastructure"; ///newdata.Where.NetType.Operator = WhereParameter.Operand.Equal; newdata.Where.Encryption.Value = "None"; ///newdata.Where.Encryption.Operator = WhereParameter.Operand.NotEqual; //string firstquery = "Select * from data where nettype=\"infrastructure\" and encryption=\"None\""; //Kisdata.Where.BSSID.Value="00:0F:3D:3E:41:9A"; //Kisdata.Where.BSSID.Operator=WhereParameter.Operand.Equal; //Console.WriteLine(thegpsdata.Query.GenerateSQL()); newdata.Query.Load(); XmlTextWriter myXmlTextWriter = new XmlTextWriter(Application.StartupPath + "\\kismet.kml", null); myXmlTextWriter.Formatting = Formatting.Indented; myXmlTextWriter.WriteStartDocument(false); myXmlTextWriter.WriteStartElement("Folder"); myXmlTextWriter.WriteElementString("name", null, "KismetLogger"); myXmlTextWriter.WriteStartElement("Folder"); myXmlTextWriter.WriteElementString("name", null, "Encrypted"); //Console.WriteLine(newdata.RowCount); if (newdata.RowCount != 0) { newdata.Rewind(); do { thegpsdata.Where.Bssid.Value = newdata.BSSID; ///thegpsdata.Where.Bssid.Operator = WhereParameter.Operand.Equal; //Kisdata.Where.BSSID.Value="00:0F:3D:3E:41:9A"; //Kisdata.Where.BSSID.Operator=WhereParameter.Operand.Equal; //Console.WriteLine(thegpsdata.Query.GenerateSQL()); thegpsdata.Query.Load(); //thebestlat = 0; //thebestlon = 0; //thebestsignal=-257; if (thegpsdata.RowCount != 0) { thegpsdata.Rewind(); //do //{ // 00:0D:72:2A:9A:39 Anne /* myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name",null,newdata.ESSID); myXmlTextWriter.WriteElementString("styleUrl",null,"#track"); myXmlTextWriter.WriteStartElement("Point"); myXmlTextWriter.WriteElementString("coordinates",null, thegpsdata.Lon+","+thegpsdata.Lat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); */ // if(thegpsdata.Signal > thebestsignal) // { // thebestsignal=thegpsdata.Signal; // thebestlon=thegpsdata.Lon; // thebestlat=thegpsdata.Lat; // } //Console.WriteLine(thegpsdata.Bssid); //Console.WriteLine(thegpsdata.Lat); //Console.WriteLine(thegpsdata.Lon); //} while(thegpsdata.MoveNext()); string clientstring = ""; myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name", null, newdata.ESSID); myXmlTextWriter.WriteElementString("styleUrl", null, "#track"); myXmlTextWriter.WriteStartElement("description"); theclientdata.Where.Bssid.Value = newdata.BSSID; ///theclientdata.Where.Bssid.Operator = WhereParameter.Operand.Equal; theclientdata.Query.Load(); if (theclientdata.RowCount != 0) { theclientdata.Rewind(); clientstring = "<p>Number of clients=" + theclientdata.RowCount + "<p>"; do { clientstring += "<p>" + theclientdata.Clientmac + "-" + theclientdata.Oui + "</p>"; } while (theclientdata.MoveNext()); } myXmlTextWriter.WriteCData(newdata.BSSID + "-" + newdata.Oui + "<p><b>First Seen: </b><br>" + newdata.FirstTime + "<br>" + "<BR><b> Last Seen </b>" + newdata.LastTime + clientstring); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Style"); myXmlTextWriter.WriteStartElement("Icon"); myXmlTextWriter.WriteElementString("href", null, "root://icons/palette-3.png"); myXmlTextWriter.WriteElementString("x", null, "96"); myXmlTextWriter.WriteElementString("y", null, "160"); myXmlTextWriter.WriteElementString("w", null, "32"); myXmlTextWriter.WriteElementString("h", null, "32"); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Point"); /* myXmlTextWriter.WriteStartElement("Style"); if(newdata.Encryption=="None") { myXmlTextWriter.WriteElementString("icon",null,"node.open.png"); } else { myXmlTextWriter.WriteElementString("icon",null,"node.closed.png"); } myXmlTextWriter.WriteEndElement(); */ myXmlTextWriter.WriteElementString("coordinates", null, thegpsdata.Lon + "," + thegpsdata.Lat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); } } while (newdata.MoveNext()); } myXmlTextWriter.WriteEndElement(); newdata.Where.NetType.Value = "infrastructure"; ///newdata.Where.NetType.Operator = WhereParameter.Operand.Equal; newdata.Where.Encryption.Value = "None"; ///newdata.Where.Encryption.Operator = WhereParameter.Operand.Equal; //Kisdata.Where.BSSID.Value="00:0F:3D:3E:41:9A"; //Kisdata.Where.BSSID.Operator=WhereParameter.Operand.Equal; //Console.WriteLine(thegpsdata.Query.GenerateSQL()); newdata.Query.Load(); myXmlTextWriter.WriteStartElement("Folder"); myXmlTextWriter.WriteElementString("name", null, "Open"); //Console.WriteLine(newdata.RowCount); if (newdata.RowCount != 0) { newdata.Rewind(); do { thegpsdata.Where.Bssid.Value = newdata.BSSID; ///thegpsdata.Where.Bssid.Operator = WhereParameter.Operand.Equal; //Kisdata.Where.BSSID.Value="00:0F:3D:3E:41:9A"; //Kisdata.Where.BSSID.Operator=WhereParameter.Operand.Equal; //Console.WriteLine(thegpsdata.Query.GenerateSQL()); thegpsdata.Query.Load(); //thebestlat = 0; //thebestlon = 0; //thebestsignal=-257; if (thegpsdata.RowCount != 0) { thegpsdata.Rewind(); //do //{ // 00:0D:72:2A:9A:39 Anne /* myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name",null,newdata.ESSID); myXmlTextWriter.WriteElementString("styleUrl",null,"#track"); myXmlTextWriter.WriteStartElement("Point"); myXmlTextWriter.WriteElementString("coordinates",null, thegpsdata.Lon+","+thegpsdata.Lat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); */ // if(thegpsdata.Signal > thebestsignal) // { // thebestsignal=thegpsdata.Signal; // thebestlon=thegpsdata.Lon; // thebestlat=thegpsdata.Lat; // } //Console.WriteLine(thegpsdata.Bssid); //Console.WriteLine(thegpsdata.Lat); //Console.WriteLine(thegpsdata.Lon); //} while(thegpsdata.MoveNext()); string clientstring = ""; myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name", null, newdata.ESSID); myXmlTextWriter.WriteElementString("styleUrl", null, "#track"); myXmlTextWriter.WriteStartElement("description"); theclientdata.Where.Bssid.Value = newdata.BSSID; ///theclientdata.Where.Bssid.Operator = WhereParameter.Operand.Equal; theclientdata.Query.Load(); if (theclientdata.RowCount != 0) { theclientdata.Rewind(); clientstring = "<p>Number of clients=" + theclientdata.RowCount + "<p>"; do { clientstring += "<p>" + theclientdata.Clientmac + "-" + theclientdata.Oui + "</p>"; } while (theclientdata.MoveNext()); } myXmlTextWriter.WriteCData(newdata.BSSID + "-" + newdata.Oui + "<p><b>First Seen: </b><br>" + newdata.FirstTime + "<br>" + "<BR><b> Last Seen </b>" + newdata.LastTime + clientstring); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Style"); if (newdata.Encryption == "None") { myXmlTextWriter.WriteStartElement("Icon"); myXmlTextWriter.WriteElementString("href", null, "root://icons/palette-3.png"); myXmlTextWriter.WriteElementString("x", null, "64"); myXmlTextWriter.WriteElementString("y", null, "96"); myXmlTextWriter.WriteElementString("w", null, "32"); myXmlTextWriter.WriteElementString("h", null, "32"); myXmlTextWriter.WriteEndElement(); } myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteStartElement("Point"); /* myXmlTextWriter.WriteStartElement("Style"); if(newdata.Encryption=="None") { myXmlTextWriter.WriteElementString("icon",null,"node.open.png"); } else { myXmlTextWriter.WriteElementString("icon",null,"node.closed.png"); } myXmlTextWriter.WriteEndElement(); */ myXmlTextWriter.WriteElementString("coordinates", null, thegpsdata.Lon + "," + thegpsdata.Lat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); } } while (newdata.MoveNext()); } myXmlTextWriter.WriteEndElement(); /* thecd.LoadAll(); thegpsdata.FlushData(); do { thegpsdata.Where.Source.Value=thecd.Clientmac; thegpsdata.Where.Source.Operator=WhereParameter.Operand.Equal; //Kisdata.Where.BSSID.Value="00:0F:3D:3E:41:9A"; //Kisdata.Where.BSSID.Operator=WhereParameter.Operand.Equal; //Console.WriteLine(thegpsdata.Query.GenerateSQL()); thegpsdata.Query.Load(); thebestlat = 0; thebestlon = 0; thebestsignal=-257; if(thegpsdata.RowCount !=0) { thegpsdata.Rewind(); do { // 00:0D:72:2A:9A:39 Anne myXmlTextWriter.WriteStartElement("Placemark"); myXmlTextWriter.WriteElementString("name",null,thecd.Bssid); myXmlTextWriter.WriteElementString("styleUrl",null,"#track"); myXmlTextWriter.WriteStartElement("Point"); myXmlTextWriter.WriteElementString("coordinates",null, thebestlon+","+thebestlat); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndElement(); if(thegpsdata.Signal > thebestsignal) { thebestsignal=thegpsdata.Signal; thebestlon=thegpsdata.Lon; thebestlat=thegpsdata.Lat; } //Console.WriteLine(thegpsdata.Bssid); //Console.WriteLine(thegpsdata.Lat); //Console.WriteLine(thegpsdata.Lon); } while(thegpsdata.MoveNext()); } }while(thecd.MoveNext()); */ myXmlTextWriter.Flush(); myXmlTextWriter.Close(); }
static void Main(string[] args) { //XmlSerializer xs = new XmlSerializer(typeof(detectionrun)); //FileStream fs = new FileStream("c:\\Kismet-Mar-31-2006-3.xml", FileMode.Open); //XmlSerializer xs2 = new XmlSerializer(typeof(gpsrun)); //FileStream fs2 = new FileStream("c:\\Kismet-Mar-31-2006-3gps.xml", FileMode.Open); //detectionrun ds = new detectionrun(); //ds=(detectionrun) xs.Deserialize(fs); string thedir=Application.StartupPath + "\\logs"; //string thedir="c:\\documents and settings\\luke\\my documents\\kismetlogs\\"; string theconnectionstring = "Data Source=" + Application.StartupPath + "\\kismetdata.db;Version=3;Cache Size=3000;New=False;Compress=False;Synchronous=Off"; //gpsrun ds2 = new gpsrun(); //ds2=(gpsrun) xs2.Deserialize(fs2); DirectoryInfo dir= new DirectoryInfo(thedir); Console.WriteLine(dir.ToString()); XmlSerializer xs2 = new XmlSerializer(typeof(gpsrun)); //gpsfiles thegpsfiles = new gpsfiles(); gpsdata thegpsdata= new gpsdata(); bool kml=false; bool gps=false; bool xml=false; bool dot = false; bool clean = false; bool allgps = false; bool wigledata = false; bool newoui = false; bool convertdates = false; //bool oui=false; string theouifilename= Application.StartupPath+"\\oui.txt"; FileInfo fi = new FileInfo(theouifilename); if(fi.Exists) { //Console.WriteLine("Found oui.txt file, enabling oui.txt lookup"); oui=true; CreateOUITable(); } else { Console.WriteLine("No oui.txt file found, disabling oui.txt lookup"); oui=false; } if(args.Length == 0) { Console.WriteLine("No arguments - processing gps and xml files and creating kml file"); kml = true; gps = true; xml = true; clean=false; convertdates = false; } else { if(args[0].IndexOf("d")!=-1) { dot = true; } if(args[0].IndexOf("u") !=-1) { convertdates = true; } if(args[0].IndexOf("o") !=-1) { newoui = true; } if(args[0].IndexOf("x")!=-1) { xml = true; } if(args[0].IndexOf("g")!=-1) { gps = true; } if(args[0].IndexOf("k")!=-1) { kml = true; } if (args[0].IndexOf("c") != -1) { clean = true; } if(args[0].IndexOf("a") !=-1) { allgps = true; } if(args[0].IndexOf("w") !=-1) { wigledata = true; } } /* SQLiteConnectionStringBuilder builder = new SQLiteConnectionStringBuilder(); builder.DataSource = Application.StartupPath + "\\kismetdata.db"; SQLiteConnection cnn = new SQLiteConnection(builder.ToString()); SQLiteCommand command = cnn.CreateCommand(); cnn.Open(); KismetData thenewdata = new KismetData(); string thecommandtext = "INSERT INTO Data(oui , totalpacketsweak , totalpacketstotal , totalpacketsllc , totalpacketsdupeiv , totalpacketsdata , totalpacketscrypt , Network , NetType , ESSID , BSSID , Info , Channel , Cloaked , Encryption , Decrypted , MaxRate , MaxSeenRate , Beacon , LLC , Data , Crypt , Weak , Total , Carrier , Encoding , FirstTime , LastTime , BestQuality , BestSignal , BestNoise , GPSMinLat , GPSMinLon , GPSMinAlt , GPSMinSpd , GPSMaxLat , GPSMaxLon , GPSMaxAlt , GPSMaxSpd , GPSBestLat , GPSBestLon , GPSBestAlt , Datasize , IPType , IP ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; SQLiteDataAdapter theadaptor = new SQLiteDataAdapter("SELECT * from data where NetType=\"infrastructure\"", cnn); DataSet theset = new DataSet(); theadaptor.Fill(theset); foreach (DataRow therow in theset.Tables["Data"].Rows) { Console.WriteLine(therow["bssid"]); } */ //CleanGPSFiles(dir); //-o ouifilename //CreateOUITable(); //-g if(gps) { //ProcessGPSFiles(theconnectionstring, dir, xs2, thegpsdata, thegpsfiles); ProcessGPSFilesNew(dir, xs2); } //-x if(xml) { ProcessCSVFilesNew(dir, enchash); ProcessXMLFilesNew(dir); } if(dot) { //CreateDotFile(); RenameFiles(); } if(convertdates) { convertalldates(); } //-k if(kml) { //AddGPSOrphans(); //ProcessCSVFiles(theconnectionstring, dir); //CreateKmlFile(thegpsdata, theconnectionstring); CreateKmlFileNew(thegpsdata, theconnectionstring, false); } if(clean) { CleanGPSFiles(dir); } if(newoui) { DoNewOuis(); } if(allgps) { /* foreach (FileInfo f in dir.GetFiles("Kismet*.gps")) { //Console.WriteLine(dir.ToString()); FileStream fs2 = new FileStream(f.DirectoryName + "\\" + f.Name, FileMode.Open); Console.WriteLine("Processing " + f.Name); try { gpsrun ds2; ds2 = (gpsrun)xs2.Deserialize(fs2); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } fs2.Close(s); } * */ CleanGPSFiles(dir); ProcessHugeGPSFiles(xs2); } if(wigledata) { DoWigleData(); } //-o //AnalyzeClients(theconnectionstring); /* DirectoryInfo dir= new DirectoryInfo("c:\\"); foreach (FileInfo f in dir.GetFiles("kismet*.csv")) { StreamReader sr = File.OpenText("c:\\" + f.Name); string input; input=sr.ReadLine(); // First line is header string [] split = null; _KismetData thedata = new _KismetData(); while ((input=sr.ReadLine())!=null) { //Console.WriteLine("Insert"); split=input.Split(new char [] {';'}); if(split.Length > 1) { thedata.AddNew(); thedata.Network=split[0]; thedata.NetType=split[1]; thedata.ESSID=split[2]; thedata.BSSID=split[3]; thedata.Info=split[4]; thedata.Channel=System.Convert.ToDecimal(split[5]); thedata.Cloaked=split[6]; thedata.Encryption=split[7]; thedata.Decrypted=split[8]; thedata.MaxRate=System.Convert.ToDecimal(split[9]); thedata.MaxSeenRate=System.Convert.ToDecimal(split[10]); thedata.Beacon=split[11]; thedata.LLC=split[12]; thedata.Data=split[13]; thedata.Crypt=split[14]; thedata.Weak=System.Convert.ToDecimal(split[15]); thedata.Total=System.Convert.ToDecimal(split[16]); thedata.Carrier=System.Convert.ToDecimal(split[17]); thedata.Encoding=split[18]; thedata.FirstTime=split[19]; thedata.LastTime=split[20]; thedata.BestQuality=split[21]; thedata.BestSignal=System.Convert.ToDecimal(split[22]); thedata.BestNoise=System.Convert.ToDecimal(split[23]); thedata.GPSMinLat=System.Convert.ToDecimal(split[24]); thedata.GPSMinLon=System.Convert.ToDecimal(split[25]); thedata.GPSMinAlt=System.Convert.ToDecimal(split[26]); thedata.GPSMinSpd=System.Convert.ToDecimal(split[27]); thedata.GPSMaxLat=System.Convert.ToDecimal(split[28]); thedata.GPSMaxLon=System.Convert.ToDecimal(split[29]); thedata.GPSMaxAlt=System.Convert.ToDecimal(split[30]); thedata.GPSMaxSpd=System.Convert.ToDecimal(split[31]); thedata.GPSBestLat=System.Convert.ToDecimal(split[32]); thedata.GPSBestLon=System.Convert.ToDecimal(split[33]); thedata.GPSBestAlt=System.Convert.ToDecimal(split[34]); thedata.Datasize=split[35]; thedata.IPType=split[36]; thedata.IP=split[37]; thedata.Save(); } } } */ }