/// <summary> /// HttpInternalGetCollectionsData() --> Gets all the collections for the table 'customer' for eFlowAppName. /// </summary> /// <param name="tName">Indicates the name of the table from the Supplier Portal where the data will be read from</param> /// <param name="port">Indicates the port to make the HTTP request</param> /// <param name="ssl">If SSL is used or not (True or False)</param> /// </summary> /// <example><code>s.HttpInternalGetCollectionsData("topimagesystems.com_CLS", 80, false);</code></example> protected string HttpInternalGetCollectionsData(string tName, int port, bool ssl) { string response = String.Empty; try { if (tName != String.Empty) { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UseGet(); req.Path = Constants.cStrHttpGetBaseCollectionDataUrl + Constants.cStrFlexibleDb + "/" + tName; Chilkat.HttpResponse resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }
protected string HttpInternalDeleteAllRowsFromTable(string tbl, int port, bool ssl) { string response = String.Empty; try { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UsePost(); req.Path = Constants.cStrHttpDeleteAllRowsInTable; req.AddParam("db", Constants.cStrFlexibleDb); req.AddParam("table", tbl); Chilkat.HttpResponse resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }
/// <summary> /// HttpPostInternalCollectionTableQry() --> Performs an HTPP POST (for a CollectionData Table query) request using the Chilkat engine. Returns an HTTP string response. /// Basically gets the table name and table data. /// </summary> /// <param name="tName">Indicates the name of the table from the Supplier Portal where the data will be read from</param> /// <param name="port">Indicates the port to make the HTTP request</param> /// <param name="ssl">If SSL is used or not (True or False)</param> /// <example><code>s.HttpPostInternalCollectionTableQry("topimagesystems.com_CLS", 80, false);</code></example> protected string HttpPostInternalCollectionTableQry(string tName, int port, bool ssl) { string response = String.Empty; try { if (tName != String.Empty) { if (tName != String.Empty) { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UsePost(); req.Path = Constants.cStrHttpPostCollectionDataTableUrl; req.AddParam(Constants.cStrHttpPostCollectionDatatName, tName); Chilkat.HttpResponse resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }
public static string getCurrentLumiIPVer2(string ipforward, decimal portforward) { string currentIP = null; try { Chilkat.Http http = new Chilkat.Http(); bool success; success = http.UnlockComponent("Anything for 30-day trial"); if (success != true) { MessageBox.Show("Error when retrieve IP" + http.LastErrorText, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { http.SocksHostname = ipforward; http.SocksVersion = 5; http.SocksPort = (int)portforward; Chilkat.HttpRequest req = new Chilkat.HttpRequest(); currentIP = http.QuickGetStr("http://lumtest.com/myip"); } } catch (Exception e) { MessageBox.Show("Error when retrieve IP" + e.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand); } return(currentIP); }
public string GetHtml(string URL, ref Chilkat.Http http) { string response = string.Empty; ChangeProxy(); if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06")) { } ///Save Cookies... http.CookieDir = "memory"; //http.CookieDir = Application.StartupPath + "\\cookies"; http.SendCookies = true; http.SaveCookies = true; http.SetRequestHeader("Accept-Encoding", "gzip,deflate"); http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24"); http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); //http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); //http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); http.SetRequestHeader("Connection", "keep-alive"); http.AllowGzip = true; response = http.QuickGetStr(URL); return(response); }
// Get the request token and verifier. private void button1_Click(object sender, EventArgs e) { Chilkat.OAuth1 oauth = new Chilkat.OAuth1(); oauth.GenNonce(16); oauth.GenTimestamp(); // The 1st step is to get a request token by sending an HTTP GET like this: oauth.OauthVersion = "1.0"; oauth.OauthMethod = "GET"; oauth.OauthUrl = "https://api.login.yahoo.com/oauth/v2/get_request_token"; oauth.ConsumerKey = ConsumerKey; oauth.ConsumerSecret = ConsumerSecret; oauth.SignatureMethod = "HMAC-SHA1"; oauth.AddParam("oauth_callback", "oob"); // Generate the OAuth1 signature and URL. bool success = oauth.Generate(); if (success != true) { textBox1.Text = oauth.LastErrorText; return; } // Properties set by the Generate method: //textBox1.Text = "BaseString: " + oauth.BaseString + "\r\n" + // "EncodedSignature : " + oauth.EncodedSignature + "\r\n" + // "HmacKey : " + oauth.HmacKey + "\r\n" + // "GeneratedUrl : " + oauth.GeneratedUrl + "\r\n" + // "QueryString : " + oauth.QueryString + "\r\n" + // "Signature : " + oauth.Signature + "\r\n" + // "AuthorizationHeader : " + oauth.AuthorizationHeader + "\r\n" // ; string requestTokenUrl = oauth.GeneratedUrl + "&oauth_signature=" + oauth.EncodedSignature; Chilkat.Http http = new Chilkat.Http(); // Get the request token... Chilkat.HttpResponse resp = http.QuickGetObj(requestTokenUrl); if (resp == null) { textBox1.Text = http.LastErrorText; return; } // Get User Authorization -- get a request verifier interactively via the embedded web browser: string encodedResponseParams = resp.BodyStr; OAuthToken = resp.UrlEncParamValue(encodedResponseParams, "oauth_token"); OAuthTokenSecret = resp.UrlEncParamValue(encodedResponseParams, "oauth_token_secret"); string userAuthUrl = "https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=" + OAuthToken; webBrowser1.Navigate(userAuthUrl); return; }
public bool LogoutChilkat(ref Chilkat.Http http) { try { string pageSource1 = http.QuickGetStr("http://www.facebook.com/"); if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string h = string.Empty; string post_form_id = string.Empty; string fb_dtsg = string.Empty; if (pageSource1.Contains("\"h\"")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200); string[] ArrTemp = strTemp.Split('"'); h = ArrTemp[3]; } if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg")) { string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200); string[] ArrTemp = strTemp.Split('"'); post_form_id = ArrTemp[2]; fb_dtsg = ArrTemp[6]; } Chilkat.HttpRequest reqLogout = new Chilkat.HttpRequest(); reqLogout.UsePost(); //req.Path = "/login.php?login_attempt=1"; reqLogout.RemoveAllParams(); reqLogout.AddHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"); //req.SetFromUrl("http://www.facebook.com/login.php?login_attempt=1"); reqLogout.AddParam("post_form_id", post_form_id); reqLogout.AddParam("fb_dtsg", fb_dtsg); reqLogout.AddParam("ref", "mb"); reqLogout.AddParam("h", h); Chilkat.HttpResponse respUsingPostURLEncoded = http.PostUrlEncoded("http://www.facebook.com/logout.php", reqLogout); string ResponseLoginPostURLEncoded = respUsingPostURLEncoded.BodyStr; string pageSource12 = http.QuickGetStr("http://www.facebook.com/"); return(true); } return(false); } catch (Exception ex) { return(false); Console.WriteLine(ex.Message); } }
public void StartVerification() { foreach (string email in lstParentVerifyEmail) { string Email = string.Empty; string Pass = string.Empty; Chilkat.Http Http = new Chilkat.Http(); EmailActivator.ClsEmailActivator ActivateEmail = new EmailActivator.ClsEmailActivator(); ActivateEmail.Hotmails(Email, Pass, ref Http); } }
private void WorkerThread_DoWork(object sender, DoWorkEventArgs e) { DateTime startTime = DateTime.Now; _keepRunning = true; while (_keepRunning) { Thread.Sleep(500); Chilkat.Http http = new Chilkat.Http(); http.SocksVersion = 5; int count_item = listBox2.Items.Count; int count = 0; for (int i = 0; i < listBox2.Items.Count; i++) { count++; this.Invoke(new MethodInvoker(delegate() { listBox2.SelectedIndex = i; } )); string line = listBox2.Items[i].ToString(); this.Invoke(new MethodInvoker(delegate() { label3.Text = "Đang từ khóa: " + line; } )); /** * Bắt đầu chạy Sock * */ for (int z = 0; z < listBox1.Items.Count; z++) { string keyword = listBox2.Items[z].ToString(); BrowserLoad mainLoad = new Boom.BrowserLoad(); mainLoad.InitBrowser("https://www.google.com/search?q=" + keyword + "&ie=utf-8&oe=utf-8&client=firefox-b ", listBox1.Items[i].ToString(), 1000); } } string timeElapsedInstring = (DateTime.Now - startTime).ToString(@"hh\:mm\:ss"); workerThread.ReportProgress(0, timeElapsedInstring); if (workerThread.CancellationPending) { e.Cancel = true; break; } } }
// Exchange the Request Token and OAuth Verifier for an Access Token private void button2_Click(object sender, EventArgs e) { Chilkat.OAuth1 oauth = new Chilkat.OAuth1(); oauth.GenNonce(16); oauth.GenTimestamp(); // The 1st step is to get a request token by sending an HTTP GET like this: oauth.OauthVersion = "1.0"; oauth.OauthMethod = "GET"; oauth.OauthUrl = "https://api.login.yahoo.com/oauth/v2/get_token"; oauth.ConsumerKey = ConsumerKey; oauth.ConsumerSecret = ConsumerSecret; oauth.Token = OAuthToken; oauth.TokenSecret = OAuthTokenSecret; oauth.SignatureMethod = "HMAC-SHA1"; oauth.AddParam("oauth_verifier", txtVerifier.Text); // Generate the OAuth1 signature and URL. bool success = oauth.Generate(); if (success != true) { textBox1.Text = oauth.LastErrorText; return; } string getAccessTokenUrl = oauth.GeneratedUrl + "&oauth_signature=" + oauth.EncodedSignature; Chilkat.Http http = new Chilkat.Http(); // Get the request token... Chilkat.HttpResponse resp = http.QuickGetObj(getAccessTokenUrl); if (resp == null) { textBox1.Text = http.LastErrorText; return; } // Get the access token. string encodedResponseParams = resp.BodyStr; OAuthAccessToken = resp.UrlEncParamValue(encodedResponseParams, "oauth_token"); OAuthAccessTokenSecret = resp.UrlEncParamValue(encodedResponseParams, "oauth_token_secret"); textBox1.Text = "success!\n"; return; }
/// <summary> /// HttpPostCollectionDataQry() --> Performs an HTPP POST (for a CollectionData query) request using the Chilkat engine. /// Returns an HTTP string response. /// Basically gets a collection data from a table. /// </summary> /// <param name="tName">Indicates the name of the table from the Supplier Portal where the data will be read from</param> /// <param name="fn">Indicates the name of the field to query.</param> /// <param name="fv">Indicates the value of the field to query.</param> /// <param name="port">Indicates the port to make the HTTP request</param> /// <param name="ssl">If SSL is used or not (True or False)</param> /// <example><code>s.HttpPostCollectionDataQry("topimagesystems.com_CLS", "cln", "00000002", 80, false);</code></example> protected string HttpPostCollectionDataQry(string tName, string fn, string fv, int port, bool ssl) { string response = String.Empty; try { if (tName != String.Empty && fn != String.Empty && fv != String.Empty) { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UsePost(); req.Path = Constants.cStrHttpPostCollectionDataQuery; req.AddParam(Constants.cStrHttpPostCollectionDatatName, tName); req.AddParam(Constants.cStrHttpPostCollectionDataFn, fn); if (fn == Constants.cStrHttpPostCollectionDatacollectionNameQryCln) { req.AddParam(Constants.cStrHttpPostCollectionDataFv, Constants.cStrCollectionDataNamePrefix + fv); } else { req.AddParam(Constants.cStrHttpPostCollectionDataFv, fv); } Chilkat.HttpResponse resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }
/// <summary> /// HttpPostCollectionDataSimple() --> Performs an HTPP POST (for CollectionData) request using the Chilkat engine. Returns an HTTP string response. /// </summary> /// <param name="tName">Indicates the name of the table from the Supplier Portal where the data will be written to</param> /// <param name="collectionName">Indicates the name of the collection for which the request is valid.</param> /// <param name="cVersion">Indicates the version of the collection for which the request is valid.</param> /// <param name="users">The users from the domains which are allowed to 'view' the data posted.</param> /// <param name="strData">The data to POST in string format.</param> /// <param name="port">Indicates the port to make the HTTP request</param> /// <param name="ssl">If SSL is used or not (True or False)</param> /// <example><code>s.HttpPostCollectionDataSimple("topimagesystems.com_CLS", "00000323", 1, "TEST1|SYSTEM|CLS|00000323|FreeProcess|1|Invoice_Date=|Invoice_Number=|Net_Amount1=|PO_Number=963645|Supplier_Name=|Total_Amount=0.00|VAT_Amount1=|VAT1=|speedyservices.com_CLS-00000323.tif", 80, false);</code></example> protected string HttpPostCollectionDataSimple(string tName, string collectionName, int cVersion, string strData, int port, bool ssl) { string response = String.Empty; try { if (tName != String.Empty && collectionName != String.Empty && strData != String.Empty) { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UsePost(); req.Path = Constants.cStrHttpPostCollectionDataUrl; req.AddParam(Constants.cStrHttpPostCollectionDatatName, tName); req.AddParam(Constants.cStrHttpPostCollectionDatacollectionName, Constants.cStrCollectionDataNamePrefix + collectionName); req.AddParam(Constants.cStrHttpPostCollectionDatacollectionNameQryCln, Constants.cStrCollectionDataNamePrefix + collectionName); req.AddParam(Constants.cStrHttpPostCollectionDatastrData, strData); Chilkat.HttpResponse resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }
public void SockCheckHttpRequest() { Thread thr = Thread.CurrentThread; string proxy = thr.Name; string MyProxyHostString = proxy.Split(':')[0]; int MyProxyPort = int.Parse(proxy.Split(':')[1]); Demo w = new Demo(); try { Chilkat.Http http = new Chilkat.Http(); http.SocksHostname = MyProxyHostString; http.SocksPort = MyProxyPort; ////http.SocksUsername = "******"; ////http.SocksPassword = "******"; //// Set the SOCKS version to 4 or 5 based on the version //// of the SOCKS proxy server: http.SocksVersion = 5; bool success1; //// Any string unlocks the component for the 1st 30-days. success1 = http.UnlockComponent("Anything for 30-day trial"); if (success1 != true) { Console.WriteLine(http.LastErrorText); return; } //// Send the HTTP GET and return the content in a string. string responseFromServer = http.QuickGetStr("https://whoer.net/"); // Display the content. string info = ProcessReponseString(thr, responseFromServer); w.WriteToFileThreadSafe(proxy + "\t" + info, "proxyWithCityHttpRequest.txt"); } catch (Exception e) { w.WriteToFileThreadSafe(proxy, "proxyWithCityHttpRequest.txt"); Console.WriteLine("{0} Second exception caught.", e); } }
private async void button1_Click(object sender, RoutedEventArgs e) { Chilkat.Http http = new Chilkat.Http(); if (!checkUnlocked()) { return; } http.ReceiveRate += Http_ReceiveRate; http.ProgressInfo += Http_ProgressInfo; http.PercentDone += Http_PercentDone; StorageFolder folder = ApplicationData.Current.LocalFolder; //textBox1.Text = folder.Path; http.VerboseLogging = true; bool success = await http.DownloadAsync("https://chilkatdownload.com/9.5.0.76/chilkatax-9.5.0-win32.zip", folder.Path + @"\chilkatAx.zip"); textBox1.Text = http.LastErrorText; }
public void SetHttp(ref Chilkat.Http http) { this.http = http; }
public void SetCookie(string rawCookieStr, ref Chilkat.Http http) { http.SetRequestHeader("Cookie", rawCookieStr); }
public string GetHtmlProxy(string URL, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref Chilkat.Http http) { string response = string.Empty; this.proxyAddress = proxyAddress; this.proxyPort = proxyPort; this.proxyUsername = proxyUsername; this.proxyPassword = proxyPassword; ChangeProxy(); if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06")) { } ///Save Cookies... http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; http.SetRequestHeader("Accept-Encoding", "gzip,deflate"); http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24"); http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); response = http.QuickGetStr(URL); return(response); }
public static void Sign() { // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // The SOAP XML to be signed in this example contains the following: // <?xml version="1.0" encoding="UTF-8" standalone="no" ?> // <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> // <SOAP-ENV:Header> // <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"></wsse:Security> // </SOAP-ENV:Header> // <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body"> // <z:FooBar xmlns:z="http://example.com" /> // </SOAP-ENV:Body> // </SOAP-ENV:Envelope> // // The above XML is available at https://www.chilkatsoft.com/exampleData/soapToSign.xml // Fetch the XML and then sign it.. string url = "https://www.chilkatsoft.com/exampleData/soapToSign.xml"; Chilkat.Http http = new Chilkat.Http(); Chilkat.StringBuilder sbSoapXml = new Chilkat.StringBuilder(); bool success = http.QuickGetSb(url, sbSoapXml); //Not Working if (success != true) { Debug.WriteLine(http.LastErrorText); return; } // Load a PFX file containing the certificate + private key. Chilkat.Cert cert = new Chilkat.Cert(); success = cert.LoadPfxFile("E:\\XML\\keystore-demo\\certificate-sha256.pfx", "1234567890"); if (success != true) { Debug.WriteLine(cert.LastErrorText); return; } // Get the RSA private key for signing... Chilkat.PrivateKey rsaKey = cert.ExportPrivateKey(); if (cert.LastMethodSuccess != true) { Debug.WriteLine(cert.LastErrorText); return; } // To create the XML digital signature (i.e. embed the signature within // the SOAP XML), we specify what is desired, and then call the method to // create the XML signature. // // For example, the application must provide the following: // - Where to put the signature. // - What to sign. // - The algorithms to be used. // - The key to be used for signing. // Chilkat.XmlDSigGen xmlSigGen = new Chilkat.XmlDSigGen(); // In this example, we're going to put the signature within the wsse:Security element. // To specify the location, set the SigLocation property to the XML path to this element, // using vertical bar characters to separate tags. xmlSigGen.SigLocation = "SOAP-ENV:Envelope|SOAP-ENV:Header|wsse:Security"; // An XML digital signature contains one or more references. These are references to the parts // of the XML document to be signed (a same document reference), or can be external references. // This example will add a single same-document reference. We'll add a reference to the XML fragment // at SOAP-ENV:Body, which is indicated by providing the value of the "ID" attribute (where "ID" is case // insensitive). For each same-document reference, we must also indicate the hash algorithm and XML canonicalization // algorithm to be used. For this example we'll choose SHA-256 and Exclusive XML Canonicalization. xmlSigGen.AddSameDocRef("Body", "sha256", "EXCL_C14N", "", ""); // Let's provide the RSA key to be used for signing: xmlSigGen.SetPrivateKey(rsaKey); // We're leaving the following properties at their default values: // // - SigNamespacePrefix (default is "ds") // - SigningAlg (for RSA keys. The default is PKCS1-v1_5, can be changed to RSASSA-PSS.) // - SignedInfoCanonAlg (default is EXCL_C14N) // - SignedInfoDigestMethod (default is sha256) // - KeyInfoType (default is "KeyValue", where the RSA public key is included in the Signature) // Note: Each Reference has it's own specified algorithms for XML canonicalization and hashing, // and the actual signature part (the SignedInfo) has it's own algorithms for the same. // They may or may not be the same. In this example, we use Exclusive XML Canonicalization and SHA-256 throughout. // Finally, we're going to set one property that's optional, but commonly used. // It's the SignedInfoPrefixList. In this case, we're using Exclusive Canonicalization, and the signature // will be placed in a location within the XML document where namespace prefixes are used in the ancestors. // Specifically, the "wsse" and "SOAP-ENV" namespace prefixes are used. xmlSigGen.SignedInfoPrefixList = "wsse SOAP-ENV"; // OK, everything's specified, so let's create the XML digital signature: // This in-place signs the XML. If successful, sbSoapXml will contain the // XML with the digital signature at the specified location. success = xmlSigGen.CreateXmlDSigSb(sbSoapXml); if (success != true) { Debug.WriteLine(xmlSigGen.LastErrorText); return; } // Examine the signed SOAP XML: Debug.WriteLine(sbSoapXml.GetAsString()); // This is the signed SOAP XML. // Chilkat emits the Signature in compact form on a single line. Whitespace in XML signatures // matters. Chilkat's opinion is that writing the Signature without whitespace minimizes the chance // for problems with whatever software might be verifying the signature. // <?xml version="1.0" encoding="UTF-8" standalone="no" ?> // <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> // <SOAP-ENV:Header> // <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse SOAP-ENV"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#Body"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>OwgHPZNfDkXnZsjpfzXqAcT3RV3HzmTsEy2bP44FJ0M=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>C+7FWngUpJ33Q1yq8uuscjCyPN2IO4cJhpMv03Jrrht1V+4gvJQLIBk6HHjo1uPQyfYj6zji3pg+fOyGUptp17CsRvjCzSpP35vB2lEzHeS8dcY8XfrEtTP/0FNn75LmhhkOPy0wjWkgDVbgzhXpEk9az8r8fQVTM3vrcmXT+WdMWJXKBRFt6PLAhsFt0scOFTWAkLGyCwygzimDKX2nT63TOit9BigtIx7fPRuMkbybMKCGGABq2DiEbvrPOiN3SUYpyMNR9KehRAGN+OWnESaDC6DhOvbKR88XHkM+GeaRe9PWdrRHrwGfp3qgolKjR/wFRSa1YGSBKAhDJFBcdg==</ds:SignatureValue><ds:KeyInfo><ds:KeyValue><ds:RSAKeyValue><ds:Modulus>sXeRhM55P13FbpNcXAMR3olbw2Wa6keZIHu5YTZYUBTlYWId+pNiwUz3zFIEo+0IfYR0H27ybIycQO+1IIzJofUFNMAL3tZps2OKPlsjuCPls6kXpXhv/gvhux8LrCtp4PcKWqJ6QVOZKChc7WAx40qFWzHi57ueqRTv3x0kESqGg/VjsqyTEvb55psJO2RsfhLT7+YVh3hImRM3RDaJdkTkPuOxeFyT6N7VXD09329sLuS3QkUbE9zEKDnz9X3d8dEQdJhSI9ba5fxl8R7fu8pB67ElfzFml96X1jLFtzy1pzOT5Fc4ROcaqlYckVzdBq9sxezm6MYmDBjNAcibRw==</ds:Modulus><ds:Exponent>AQAB</ds:Exponent></ds:RSAKeyValue></ds:KeyValue></ds:KeyInfo></ds:Signature></wsse:Security> // </SOAP-ENV:Header> // <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body"> // <z:FooBar xmlns:z="http://example.com" /> // </SOAP-ENV:Body> // </SOAP-ENV:Envelope> // Here's the signature part formatted for easier reading. // (Adding whitespace to the SignedInfo breaks the signature, so you wouldn't want to do this..) // <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> // <ds:SignedInfo> // <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> // <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse SOAP-ENV" /> // </ds:CanonicalizationMethod> // <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> // <ds:Reference URI="#Body"> // <ds:Transforms> // <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> // </ds:Transforms> // <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> // <ds:DigestValue>OwgHPZNfDkXnZsjpfzXqAcT3RV3HzmTsEy2bP44FJ0M=</ds:DigestValue> // </ds:Reference> // </ds:SignedInfo> // <ds:SignatureValue>C+7FWngUp....BKAhDJFBcdg==</ds:SignatureValue> // <ds:KeyInfo> // <ds:KeyValue> // <ds:RSAKeyValue> // <ds:Modulus>sXeRhM55P13FbpNcXAMR....MYmDBjNAcibRw==</ds:Modulus> // <ds:Exponent>AQAB</ds:Exponent> // </ds:RSAKeyValue> // </ds:KeyValue> // </ds:KeyInfo> // </ds:Signature> }
public static void RequestJSCSSIMG(string pageSource, ref Chilkat.Http http) { ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; List <string> listURLs = new List <string>(); ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr(); //CSS Request foreach (string item in GetHrefsFromString(pageSource)) { if (item.Contains(".css")) { string cssSource = item.Replace(" ", "").Trim(); try { //string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); listURLs.Add(cssSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { } } } } //JS Request string[] scriptArr = Regex.Split(pageSource, "/script>"); foreach (string item in scriptArr) { try { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.LastIndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf(">", startIndx) - 1; string jsSource = item.Substring(startIndx, endIndx - startIndx); //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak.")) { try { //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); listURLs.Add(jsSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { } } } } } catch (Exception) { } } string[] moreScriptArray = Regex.Split(pageSource, "\"src\":"); foreach (string item in moreScriptArray) { try { int startIndx = 1; int endIndx = item.IndexOf("\"", startIndx); string jsSource = item.Substring(startIndx, endIndx - startIndx).Replace("\\", ""); if (jsSource.Contains(".js")) { //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); listURLs.Add(jsSource); } } catch (Exception) { } } ///IMG Request string[] imageArr = Regex.Split(pageSource, "<img"); foreach (string item in imageArr) { try { if (item.Contains("static.ak.") || item.Contains("profile.ak.")) { int startIndx = item.IndexOf("src=") + "src=".Length + 1; int endIndx = item.IndexOf("\"", startIndx + 1); string jsSource = item.Substring(startIndx, endIndx - startIndx); //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.")) if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak.")) { if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg")) { try { //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); listURLs.Add(jsSource); } catch (Exception) { Thread.Sleep(500); try { string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource)); } catch (Exception) { } } } } } } catch { }; } listURLs = listURLs.Distinct().ToList(); foreach (string item in listURLs) { try { string res = HttpHelper.GetHtmlProxy(item, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http); } catch { }; } }
public List <string> ExtractFriendIDs(ref BaseLib.ChilkatHttpHelpr HttpHelper, ref Chilkat.Http http, ref string userID) { try { string pgSrc_HomePage = HttpHelper.GetHtml("http://www.facebook.com/", ref http); string ProFileURL = string.Empty; string UserId = string.Empty; #region Get User or Account ID if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id=")) { ///Modified Sumit [10-12-2011] #region int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id="); int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1); ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx); if (ProFileURL.Contains("&")) { string[] Arr = ProFileURL.Split('&'); ProFileURL = Arr[0]; } #endregion } if (ProFileURL.Contains("http://www.facebook.com/profile.php?id=")) { UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", ""); if (UserId.Contains("&")) { UserId = UserId.Remove(UserId.IndexOf("&")); } userID = UserId; } #endregion List <string> lstFriend = new List <string>(); string pgSrc_FriendsPage = HttpHelper.GetHtml("http://www.facebook.com/profile.php?id=" + UserId + "&sk=friends&v=friends", ref http); if (pgSrc_FriendsPage.Contains("http://www.facebook.com/profile.php?id=")) { string[] arr = Regex.Split(pgSrc_FriendsPage, "href"); foreach (string strhref in arr) { if (!strhref.Contains("<!DOCTYPE")) { if (strhref.Contains("profile.php?id")) { int startIndx = strhref.IndexOf("profile.php?id") + "profile.php?id".Length + 1; int endIndx = strhref.IndexOf("\"", startIndx); string profileID = strhref.Substring(startIndx, endIndx - startIndx); if (profileID.Contains("&")) { profileID = profileID.Remove(profileID.IndexOf("&")); } if (profileID.Contains("\\")) { profileID = profileID.Replace("\\", ""); } lstFriend.Add(profileID); } } } } List <string> itemId = lstFriend.Distinct().ToList(); return(itemId); } catch (Exception) { return(null); } }
public bool CheckVerificationChilkat(string response, ref Chilkat.Http Http) { //** FB Account Check email varified or not ***********************************************************************************// #region FB Account Check email varified or not string pageSourceCheck = string.Empty; pageSourceCheck = response; string pageSrc1 = string.Empty; string pageSrc2 = string.Empty; string pageSrc3 = string.Empty; string pageSrc4 = string.Empty; string substr1 = string.Empty; //if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step")) //{ // pageSrc1 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"); //} //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip")) //{ // pageSrc2 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"); //} //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip")) //{ // pageSrc3 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=summary"); //} //if (pageSrc3.Contains("complete the sign-up process")) //{ // return false; //} //if (pageSourceCheck.Contains("complete the sign-up process")) //{ // return false; //} //#endregion ////** FB Account Check email varified or not ***********************************************************************************// //return true; if ((pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step")) || pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/gettingstarted.php")) { pageSrc1 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"); //} Thread.Sleep(300); //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip")) //{ pageSrc2 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"); Thread.Sleep(300); //} //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip")) //{ pageSrc3 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=summary"); Thread.Sleep(300); //} ///Check if asks for email //If asks then Set Status as PhoneVerfiedOnly if (pageSrc3.Contains("complete the sign-up process")) { PumpMessage("Account : " + Username + " is NOT Email verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly)); return(false); } else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email")) { PumpMessage("Account : " + Username + " is NOT Email verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly)); return(false); } } ///Means NOT Email verified //Check if asks for email //If asks then Set Status as PhoneVerfiedOnly if (pageSourceCheck.Contains("complete the sign-up process")) { PumpMessage("Account : " + Username + " is NOT Email verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly)); return(false); } else if (pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/confirmemail.php")) { PumpMessage("Account : " + Username + " is NOT Email verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly)); return(false); } else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email")) { PumpMessage("Account : " + Username + " is NOT Email verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly)); return(false); } #endregion //** FB Account Check email varified or not ***********************************************************************************// PumpMessage("Account : " + Username + " is Email & Phone verified"); InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhonePlusEmailVerified)); return(true); }
/// <summary> /// applica la marca temporale al file /// </summary> /// <param name="pathFileSign">file firmato</param> /// <param name="tsaUrl">url TSA</param> /// <param name="pathFileTimeStamped">file tsr da TSA</param> /// <param name="lastError">ultimo errore nella funzionalità</param> /// <param name="userName">user TSA (opzionale)</param> /// <param name="password">password TSA (opzionale)</param> /// <returns>true se la funzionalità ha avuto successo</returns> /// <example> /// if (Utilities.MarcaTemporale(@"c:\temp\IT01234567890_FPA01.xml.p7m", "https://freetsa.org/tsr", out pathFileTimeStamped, ref lastError, "myUser", "myPassword")) /// { /// pathFileTimeStamped -> c:\temp\IT01234567890_FPA01.xml.p7m.tsr /// } /// </example> public static bool MarcaTemporale(string pathFileSign, string tsaUrl, out string pathFileTimeStamped, ref string lastError, string userName = null, string password = null) { bool success = false; pathFileTimeStamped = null; try { string fileName = Path.GetFileName(pathFileSign); if (Utilities.glob.UnlockStatus == 0) { lastError = "Licenza bloccata"; return(success); } Chilkat.Crypt2 crypt = new Chilkat.Crypt2(); crypt.HashAlgorithm = "sha256"; crypt.EncodingMode = "base64"; string base64Hash = crypt.HashFileENC(pathFileSign); Chilkat.Http http = new Chilkat.Http(); Chilkat.BinData requestToken = new Chilkat.BinData(); string optionalPolicyOid = string.Empty; bool addNonce = false; bool requestTsaCert = false; if (!string.IsNullOrWhiteSpace(userName) && !string.IsNullOrWhiteSpace(password)) { http.Login = userName; http.Password = password; http.BasicAuth = true; } // Create a time-stamp request token success = http.CreateTimestampRequest("sha256", base64Hash, optionalPolicyOid, addNonce, requestTsaCert, requestToken); if (!success) { lastError = http.LastErrorText; return(success); } Chilkat.HttpResponse resp = http.PBinaryBd("POST", tsaUrl, requestToken, "application/timestamp-query", false, false); if (!http.LastMethodSuccess) { lastError = http.LastErrorText; return(success); } Chilkat.BinData timestampReply = new Chilkat.BinData(); resp.GetBodyBd(timestampReply); if (!timestampReply.LastMethodSuccess) { return(success); } string s = Path.ChangeExtension(fileName, $".{Enum.GetName(typeof(EstensioniFile), EstensioniFile.tsr)}"); success = timestampReply.WriteFile(s); if (success) { pathFileTimeStamped = s; } } catch { throw; } return(success); }
private void backworker_DoWork(object sender, DoWorkEventArgs e) { switch (m_process) { case _process.form_loading: { if (m_client != null) { m_phone_count = m_client.PhoneCollection.Count(); } break; } case _process.send_sms: { int demo_count = datam.GetSmsDemoCount(); if (demo_count >= DEMO_MAX) { MessageBox.Show("Your SMS Demo Version Has Expired"); return; } else { //if (m_phone_count > demo_count) //{ // if (m_phone_count > DEMO_MAX) // { // m_phone_count = DEMO_MAX - demo_count; // } // else // { // m_phone_count = m_phone_count - demo_count; // } // MessageBox.Show(string.Format("Your SMS Demo Version Has Almost Over,Only {0} SMS Will Be Sent", m_phone_count)); // m_PhoneCollection = m_PhoneCollection.Take(m_phone_count); //} // m_phone_count = 2; } m_phone_count = 2; #region Webservice Settings // Chilkat.HttpRequest req = new Chilkat.HttpRequest(); Chilkat.Http http = new Chilkat.Http(); bool success; //Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent("30277129240"); if (success != true) { MessageBox.Show("Invalid Use Of The Chilkat Library"); return; } // Build an HTTP POST Request: req.UsePost(); req.Path = "/api.php"; req.AddParam("username", "*****@*****.**"); req.AddParam("password", "prpc2qb7"); req.AddParam("from", m_HEADER); req.AddParam("message", m_MESSAGE); // req.AddParam("recipients", "256772332619,256772508360"); req.AddParam("recipients", "256701871684"); m_PhoneString = GetPhoneString(); // req.AddParam("recipients", m_PhoneString); #region compression //MessageBox.Show(m_PhoneString.Length.ToStringNullable(); //Chilkat.Gzip gzip = new Chilkat.Gzip(); //// Any string unlocks the component for the 1st 30-days. //success = gzip.UnlockComponent("ZIP12345678_4F507D55AD1G"); //if (success != true) //{ // MessageBox.Show(gzip.LastErrorText); // return; //} //string cs; //cs = gzip.DeflateStringENC(m_PhoneString, "windows-1252", "base64"); //MessageBox.Show(cs.Length.ToStringNullable(); //return; #endregion //req.AddParam("recipients", m_PhoneString); req.AddParam("type", "normal"); req.AddParam("token", "c4ca4238a0b923820dcc509a6f75849b"); // Send the HTTP POST and get the response. Note: This is a blocking call. // The method does not return until the full HTTP response is received. string domain; int port; bool ssl; domain = "http://208.111.47.244"; port = 80; ssl = false; Chilkat.HttpResponse resp = null; resp = http.SynchronousRequest(domain, port, ssl, req); if (resp == null) { // MessageBox.Show(http.LastErrorText); MessageBox.Show("There Seems To Be A Problem With Your Internet Connection ,SMS Has Not Been Sent", "SMS Failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var _res = resp.BodyStr.Trim(); string error_str = null; if (!string.IsNullOrEmpty(_res)) { int _ret = -1; if (_res.Split(new char[] { ':' }).Length > 1) { _res = _res.Split(new char[] { ':' })[0]; } int.TryParse(_res, out _ret); if (_ret >= 0) { switch ((_sms_status)_ret) { case _sms_status.success: { m_status = _sms_status.success; break; } case _sms_status.insufficientcredit: { error_str = "You Do Not Have Sufficient Credit On Your Account,Please Contact Smart IT Solutions"; m_status = _sms_status.insufficientcredit; break; } case _sms_status.invalid_request: { error_str = "The Http Request You Made Is Not Valid"; m_status = _sms_status.invalid_request; break; } case _sms_status.invalid_user: { m_status = _sms_status.invalid_user; error_str = "Invalid UserName Or Password"; break; } default: { error_str = "Unknown Error,Please Contact Smart IT Solutions"; m_status = _sms_status.unknown; break; } } } } if (!string.IsNullOrEmpty(error_str)) { dbm.ErrorMessage(error_str, "SMS Send ERROR"); } } http.Dispose(); #endregion break; } case _process.test_mode: { m_status = _sms_status.success; break; } } }
public string GetHtmlProxy(string URL, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref Chilkat.Http http) { string response = string.Empty; this.proxyAddress = proxyAddress; this.proxyPort = proxyPort; this.proxyUsername = proxyUsername; this.proxyPassword = proxyPassword; ChangeProxy(); response = http.QuickGetStr(URL); return(response); }
private void bgWorker_req_maker_DoWork(object sender, DoWorkEventArgs e) { if (AbdalControler.unauthorized_process == true) { MessageBox.Show("This domain is unauthorized !"); Application.Exit(); } else { try { if (ExtractRichTextBox.Lines.Length <= 1) { MessageBox.Show("Crawled links must be greater than one ! "); } else { BackgroundWorker worker = sender as BackgroundWorker; Chilkat.Http http = new Chilkat.Http(); http.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36"; int number_of_attack_req = Convert.ToInt32(textBox_number_of_views.Value) * (Convert.ToInt32(ExtractRichTextBox.Lines.Length) - 1); radProgressBar1.Maximum = number_of_attack_req; radProgressBar1.Minimum = 0; radialGaugeArc2.RangeStart = 0; radialGaugeArc2.RangeEnd = number_of_attack_req; radialGaugeArc1.RangeStart = 0; radialGaugeArc1.RangeEnd = number_of_attack_req; radRadialGauge1.RangeEnd = number_of_attack_req; //Sound Alert For Start Attack using (var soundPlayer = new SoundPlayer(@"start.wav")) { soundPlayer.PlaySync(); // can also use soundPlayer.Play() } int trafficSizebyte = 0; int traffic_counter = 0; for (int i = 1; i <= textBox_number_of_views.Value; i++) { if (worker.CancellationPending == true) { e.Cancel = true; break; } else { string[] RichTextBoxLines = ExtractRichTextBox.Lines; foreach (string line_url_addr in RichTextBoxLines) { if (line_url_addr != "") { traffic_counter++; radRadialGauge1.Value = traffic_counter; radProgressBar1.Value2 = traffic_counter; //randString = RandomString(rnd.Next(15, 30)); // Send the HTTP GET and return the content in a string. http.ReadTimeout = 20; http.ConnectTimeout = 20; http.FollowRedirects = true; if (spoofUrlTextBox.Text != "") { http.Referer = spoofUrlTextBox.Text; } string reponse_http = http.QuickGetStr(line_url_addr); trafficSizebyte += System.Text.ASCIIEncoding.Unicode.GetByteCount(reponse_http); trafficSizebyte_Label.Text = (trafficSizebyte / 1024).ToString() + " KB"; //Add AttackLog in Result Box ResultTextEditor.AppendText(line_url_addr + Environment.NewLine); ResultTextEditor.SelectionStart = ResultTextEditor.Text.Length; ResultTextEditor.ScrollToCaret(); // Perform a time consuming operation and report progress. if (FastTrafficGenToggleSwitch.Value == false) { System.Threading.Thread.Sleep(500); } worker.ReportProgress(i); } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } // End else }
public void CrawlingPageDataSource(string Url, ref GlobusHttpHelper HttpHelper) { // if (SearchCriteria.starter) { // if (SearchCriteria.starter) { try { Log("[ " + DateTime.Now + " ] => [ Start Parsing Process ]"); #region Data Initialization string Industry = string.Empty; string URLprofile = string.Empty; string firstname = string.Empty; string lastname = string.Empty; string location = string.Empty; string country = string.Empty; string postal = string.Empty; string phone = string.Empty; string USERemail = string.Empty; string code = string.Empty; string education1 = string.Empty; string education2 = string.Empty; string titlecurrent = string.Empty; string companycurrent = string.Empty; string titlepast1 = string.Empty; string companypast1 = string.Empty; string titlepast2 = string.Empty; string html = string.Empty; string companypast2 = string.Empty; string titlepast3 = string.Empty; string companypast3 = string.Empty; string titlepast4 = string.Empty; string companypast4 = string.Empty; string Recommendations = string.Empty; string Connection = string.Empty; string Designation = string.Empty; string Website = string.Empty; string Contactsettings = string.Empty; string recomandation = string.Empty; string titleCurrenttitle = string.Empty; string titleCurrenttitle2 = string.Empty; string titleCurrenttitle3 = string.Empty; string titleCurrenttitle4 = string.Empty; string Skill = string.Empty; string TypeOfProfile = "Public1"; string Finaldata = string.Empty; #endregion #region LDS_DataInitialization string LDS_FirstName = string.Empty; string LDS_LastName = string.Empty; string LDS_UserProfileLink = string.Empty; string LDS_HeadLineTitle = string.Empty; string LDS_CurrentTitle = string.Empty; string LDS_PastTitles = string.Empty; string LDS_Loction = string.Empty; string LDS_Country = string.Empty; string LDS_Connection = string.Empty; string LDS_Recommendations = string.Empty; string LDS_SkillAndExpertise = string.Empty; string LDS_Education = string.Empty; string LDS_Experience = string.Empty; string LDS_ProfileType = "Public"; string LDS_Groups = string.Empty; string LDS_UserEmail = string.Empty; string LDS_UserContactNumber = string.Empty; string LDS_CurrentCompany = string.Empty; string LDS_PastCompany = string.Empty; string LDS_LoginID = string.Empty; string LDS_Websites = string.Empty; string LDS_Industry = string.Empty; #endregion #region Chilkat Initialization Chilkat.Http http = new Chilkat.Http(); ///Chilkat Http Request to be used in Http Post... Chilkat.HttpRequest req = new Chilkat.HttpRequest(); Chilkat.HtmlUtil htmlUtil = new Chilkat.HtmlUtil(); // Any string unlocks the component for the 1st 30-days. bool success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"); if (success != true) { Console.WriteLine(http.LastErrorText); return; } http.CookieDir = "memory"; http.SendCookies = true; http.SaveCookies = true; html = HttpHelper.getHtmlfromUrl1(new Uri(Url)); html = htmlUtil.EntityDecode(html); //// Convert the HTML to XML: Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml(); Chilkat.HtmlToXml htmlToXml1 = new Chilkat.HtmlToXml(); Chilkat.HtmlToXml htmlToXml2 = new Chilkat.HtmlToXml(); success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O"); if ((success != true)) { Console.WriteLine(htmlToXml.LastErrorText); return; } string xHtml = null; string xHtml1 = null; //string xHtml2 = null; htmlToXml.Html = html; xHtml = htmlToXml.ToXml(); Chilkat.Xml xml = new Chilkat.Xml(); xml.LoadXml(xHtml); //// Iterate over all h1 tags: Chilkat.Xml xNode = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml); #endregion #region for paRSING List<string> list = new List<string>(); List<string> Grouplist = new List<string>(); List<string> listtitle = new List<string>(); List<string> Currentlist = new List<string>(); List<string> Skilllst = new List<string>(); list.Clear(); //new parshing code List<string> TempFirstName = objChilkat.GetDataTagAttributewithId(html, "div", "name-container"); xBeginSearchAfter = null; xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); Grouplist.Clear(); xBeginSearchAfter = null; #region parsergroup xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data"); while ((xNode != null)) { Finaldata = xNode.AccumulateTagContent("text", "/text"); Grouplist.Add(Finaldata); string[] tempC1 = Regex.Split(Finaldata, " at "); xBeginSearchAfter = xNode; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data"); } int groupcounter = 0; string AllGRoup = string.Empty; foreach (string item in Grouplist) { if (item.Contains("Join")) { if (groupcounter == 0) { LDS_Groups = item; groupcounter++; } else { LDS_Groups = AllGRoup + ";" + item; } } } #endregion #region parserSkill xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); Skilllst.Clear(); xBeginSearchAfter = null; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills"); while ((xNode != null)) { Finaldata = xNode.AccumulateTagContent("text", "/text"); if (Finaldata.Contains("extlib: _toggleclass")) { try { string[] Temp = Finaldata.Split(';'); LDS_SkillAndExpertise = Temp[4]; } catch { } } else { try { LDS_SkillAndExpertise = Finaldata.Replace("Skills & Expertise", " "); Skilllst.Add(Finaldata); } catch { } } xBeginSearchAfter = xNode; xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills"); } if (LDS_SkillAndExpertise.Contains(" Endorsements LI.i18n.register('section_skills_person_endorsed_tmpl")) { LDS_SkillAndExpertise = string.Empty; } Skilllst.Distinct(); #endregion #region UrlProfile try { if (html.Contains("webProfileURL")) { int FirstPointForProfileURL = html.IndexOf("webProfileURL"); string FirstSubStringForProfileURL = html.Substring(FirstPointForProfileURL); int SecondPointForProfileURL = FirstSubStringForProfileURL.IndexOf(">"); int ThirdPointForProfileURL = FirstSubStringForProfileURL.IndexOf("</a>"); string SecondSubStringForProfileURL = FirstSubStringForProfileURL.Substring(SecondPointForProfileURL, ThirdPointForProfileURL - SecondPointForProfileURL); LDS_UserProfileLink = SecondSubStringForProfileURL.Replace(">", string.Empty); //qm.AddProfileUrl(URLprofile, DateTime.Now.ToString(), "0"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } try { string[] UrlFull = System.Text.RegularExpressions.Regex.Split(Url, "&authType"); LDS_UserProfileLink = UrlFull[0]; LDS_UserProfileLink = Url; } catch { } #endregion #region Connection if (html.Contains("overview-connections")) { try { Connection = html.Substring(html.IndexOf("leo-module mod-util connections"), 500); string[] Arr = Connection.Split('>'); string tempConnection = Arr[5].Replace("</strong", "").Replace(")</h3", "").Replace("(", ""); if (tempConnection.Length < 8) { LDS_Connection = tempConnection + "Connection"; } else { LDS_Connection = string.Empty; } } catch (Exception ex) { //overview-connections try { LDS_Connection = html.Substring(html.IndexOf("overview-connections"), 50); string[] Arr = Connection.Split('>'); string tempConnection = Arr[3].Replace("</strong", "").Replace(")</h3", "").Replace("(", ""); LDS_Connection = tempConnection + "Connection"; } catch { } } } #endregion #region Recommendation if (html.Contains("Recommendations")) { try { string[] rList = System.Text.RegularExpressions.Regex.Split(html, "Recommendations"); string[] R3List = rList[2].Split('\n'); string temprecomandation = R3List[4].Replace("</strong>", "").Replace("<strong>", ""); if (temprecomandation.Contains("recommended")) { LDS_Recommendations = temprecomandation; } else { LDS_Recommendations = ""; } } catch (Exception ex) { LDS_Recommendations = string.Empty; } } #endregion #region Websites if (html.Contains("websites")) { try { string websitedem = html.Substring(html.IndexOf("websites"), 500); string[] Arr = Regex.Split(websitedem, "href"); foreach (string item in Arr) { if (item.Contains("redir/redirect?url")) { string tempArr = item.Substring(item.IndexOf("name="), 50); string[] temarr = tempArr.Split('\n'); LDS_Websites = temarr[1]; } } } catch (Exception ex) { LDS_Websites = string.Empty; } } #endregion #region Getting Industry try { string Industrytemp = html.Substring(html.IndexOf("Find users in this industry"), 100); string[] TempIndustery = Industrytemp.Split('>'); LDS_Industry = TempIndustery[1].Replace("</strong", "").Replace("</a", ""); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Getting First Name try { if (html.Contains("given-name")) { int FirstPointForProfilename = html.IndexOf("given-name"); string FirstSubStringForProfilename = html.Substring(FirstPointForProfilename); int SecondPointForProfilename = FirstSubStringForProfilename.IndexOf(">"); int ThirdPointForProfilename = FirstSubStringForProfilename.IndexOf("</span>"); string SecondSubStringForProfilename = FirstSubStringForProfilename.Substring(SecondPointForProfilename, ThirdPointForProfilename - SecondPointForProfilename); LDS_FirstName = SecondSubStringForProfilename.Replace(">", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region LastName try { if (html.Contains("family-name")) { int FirstPointForProfilelastname = html.IndexOf("family-name"); string FirstSubStringForProfilelastname = html.Substring(FirstPointForProfilelastname); int SecondPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf(">"); int ThirdPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf("</span>"); string SecondSubStringForProfilelastname = FirstSubStringForProfilelastname.Substring(SecondPointForProfilelastname, ThirdPointForProfilelastname - SecondPointForProfilelastname); string templastname = SecondSubStringForProfilelastname.Replace(">", string.Empty); if (templastname.Contains(",")) { string[] arrylastname = templastname.Split(','); LDS_LastName = arrylastname[0]; } else { LDS_LastName = templastname; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Designation Company Current try { if (html.Contains("phonetic-full-name")) { int FirstPointForProfileCurrent = html.IndexOf("phonetic-full-name"); string FirstSubStringForProfileCurrent = html.Substring(FirstPointForProfileCurrent); int SecondPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("display:block"); int ThirdPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("</p>"); string SecondSubStringForProfileCurrent = FirstSubStringForProfileCurrent.Substring(SecondPointForProfileCurrent, ThirdPointForProfileCurrent - SecondPointForProfileCurrent); titlecurrent = SecondSubStringForProfileCurrent.Replace("\">", "").Replace("display:block", string.Empty).Replace("<strong class=\"highlight\"", string.Empty).Replace("</strong", string.Empty).Trim(); string[] tempCCurent = Regex.Split(titlecurrent, " at "); LDS_HeadLineTitle = titlecurrent.Replace(",", ";"); LDS_CurrentCompany = tempCCurent[1].Replace(",", ";"); } else if (html.Contains("<p class=\"title\"")) { LDS_HeadLineTitle = html.Substring(html.IndexOf("<p class=\"title\""), 150); string[] HeadLineTitle = LDS_HeadLineTitle.Split('>'); string tempHeadLineTitle = HeadLineTitle[1].Replace("\n", "").Replace(")</h3", "").Replace("</p", ""); LDS_HeadLineTitle = tempHeadLineTitle; try { string[] tempCCurent = Regex.Split(tempHeadLineTitle, " at "); LDS_HeadLineTitle = tempCCurent[0]; LDS_CurrentCompany = tempCCurent[1]; } catch { } } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Education try { if (html.Contains("summary-education")) { int FirstPointForProfileeducation1 = html.IndexOf("summary-education"); string FirstSubStringForProfileeducation1 = html.Substring(FirstPointForProfileeducation1); int SecondPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("<li>"); int ThirdPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("</li>"); string SecondSubStringForProfileeducation1 = FirstSubStringForProfileeducation1.Substring(SecondPointForProfileeducation1, ThirdPointForProfileeducation1 - SecondPointForProfileeducation1); education1 = SecondSubStringForProfileeducation1.Replace("<li>", string.Empty).Replace(",", string.Empty).Trim(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Country try { if (html.Contains("locality")) { int FirstPointForlocality = html.IndexOf("locality"); string FirstSubStringForlocality = html.Substring(FirstPointForlocality); int SecondPointForlocality = FirstSubStringForlocality.IndexOf("location"); int ThirdPointForlocality = FirstSubStringForlocality.IndexOf("</a>"); string SecondSubStringForlocality = FirstSubStringForlocality.Substring(SecondPointForlocality, ThirdPointForlocality - SecondPointForlocality); string temlocation = SecondSubStringForlocality.Replace("location", string.Empty).Replace(">", string.Empty).Replace('"', ' '); string[] temp = temlocation.Split(','); LDS_Loction = temp[0].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty); LDS_Country = temp[1].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty); // country = temp[1].Replace("</strong", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region User Email try { if (html.Contains("Email & Phone:")) { int FirstPointFortitlepast1 = html.IndexOf("abook-email"); string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1); int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<a"); int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("</a>"); string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1); string[] tempEmail = SecondSubStringFortitlepast1.Split('>'); LDS_UserEmail = tempEmail[1]; } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region Type Of profile try { if (html.Contains("profile-header")) { int FirstPointForProfileType = html.IndexOf("profile-header"); string FirstSubStringForProfileType = html.Substring(FirstPointForProfileType); int SecondPointForProfileType = FirstSubStringForProfileType.IndexOf("class=\"n fn\""); int ThirdPointForProfileType = FirstSubStringForProfileType.IndexOf("</span>"); string SecondSubStringForProfileType = FirstSubStringForProfileType.Substring(SecondPointForProfileType, ThirdPointForProfileType - SecondPointForProfileType); string[] tempProfileType = SecondSubStringForProfileType.Split('>'); string ProfileType = tempProfileType[1]; LDS_ProfileType = ProfileType; } //<h1><span id="name" class="n fn">Private</span> else if (html.Contains(" class=\"n fn\"")) { try { string ProfileTypetemp = html.Substring(html.IndexOf("class=\"n fn\""), 20); string[] TempProfileType = ProfileTypetemp.Split('>'); LDS_ProfileType = TempProfileType[1].Replace("</strong", "").Replace("</a", ""); } catch { } } if (LDS_ProfileType != "Public") { LDS_ProfileType = "Private"; } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion #region PhonNumber try { if (html.Contains("<dt>Phone:</dt>")) { int FirstPointFortitlepast1 = html.IndexOf("profile-personal"); string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1); int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<p>"); int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<span"); string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1); LDS_UserContactNumber = SecondSubStringFortitlepast1.Replace("<p>", string.Empty); } } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion xNode = xml.SearchForTag(xBeginSearchAfter, "dt"); xBeginSearchAfter = xNode; list.Clear(); #endregion #region Regionfor PastCompney try { if (html.Contains("summary-past")) { int FirstPointForPasttitle = html.IndexOf("summary-past"); string FirstSubStringForPasttitle = html.Substring(FirstPointForPasttitle); int SecondPointForPasttitle = FirstSubStringForPasttitle.IndexOf("<li>"); int ThirdPointForPasttitle = FirstSubStringForPasttitle.IndexOf("summary-education"); string SecondSubStringForPasttitle = FirstSubStringForPasttitle.Substring(SecondPointForPasttitle, ThirdPointForPasttitle - SecondPointForPasttitle); string FirstSubStringForPasttitlelast = htmlUtil.EntityDecode(SecondSubStringForPasttitle); htmlToXml1.Html = FirstSubStringForPasttitlelast; xHtml1 = htmlToXml1.ToXml(); Chilkat.Xml xml1 = new Chilkat.Xml(); xml1.LoadXml(xHtml1); //// Iterate over all h1 tags: Chilkat.Xml xNode1 = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml); list.Clear(); string[] tempC1 = null; xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); while ((xNode1 != null)) { Finaldata = xNode1.AccumulateTagContent("text", "/text"); listtitle.Add(Finaldata); // list.Add(Finaldata); try { tempC1 = Regex.Split(Finaldata, " at "); } catch { } if (tempC1 != null) { try { list.Add(tempC1[1]); } catch { } } xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); xBeginSearchAfter1 = xNode1; } if (listtitle.Count > 0 || list.Count > 0) { try { titlepast1 = listtitle[0] != null ? listtitle[0] : string.Empty; titlepast2 = listtitle[1] != null ? listtitle[1] : string.Empty; titlepast3 = listtitle[2] != null ? listtitle[2] : string.Empty; titlepast4 = listtitle[3] != null ? listtitle[3] : string.Empty; } catch { } try { companypast1 = list[0] != null ? list[0] : string.Empty; companypast2 = list[1] != null ? list[1] : string.Empty; companypast3 = list[2] != null ? list[2] : string.Empty; companypast4 = list[3] != null ? list[3] : string.Empty; } catch { } } } } catch { }; list.Clear(); #endregion string companyCurrenttitle1 = string.Empty; string companyCurrenttitle2 = string.Empty; string companyCurrenttitle3 = string.Empty; string companyCurrenttitle4 = string.Empty; #region Regionfor summary-current try { if (html.Contains("summary-current")) { int FirstPointForCurrenttitle = html.IndexOf("summary-current"); string FirstSubStringForCurrenttitle = html.Substring(FirstPointForCurrenttitle); int SecondPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("<li>"); int ThirdPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("summary-past"); string SecondSubStringForCurrenttitle = FirstSubStringForCurrenttitle.Substring(SecondPointForCurrenttitle, ThirdPointForCurrenttitle - SecondPointForCurrenttitle); string FirstSubStringForCurrenttitlelast = htmlUtil.EntityDecode(SecondSubStringForCurrenttitle); htmlToXml1.Html = FirstSubStringForCurrenttitlelast; xHtml1 = htmlToXml1.ToXml(); Chilkat.Xml xml1 = new Chilkat.Xml(); xml1.LoadXml(xHtml1); //// Iterate over all h1 tags: Chilkat.Xml xNode1 = default(Chilkat.Xml); Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml); Currentlist.Clear(); list.Clear(); string[] tempC1 = null; xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); while ((xNode1 != null)) { Finaldata = xNode1.AccumulateTagContent("text", "/text"); Currentlist.Add(Finaldata); // list.Add(Finaldata); try { tempC1 = Regex.Split(Finaldata, " at "); } catch { } if (tempC1 != null) { try { list.Add(tempC1[1]); } catch { } } xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li"); xBeginSearchAfter1 = xNode1; } if (Currentlist.Count > 0 || list.Count > 0) { try { titleCurrenttitle = Currentlist[0] != null ? Currentlist[0] : string.Empty; titleCurrenttitle2 = Currentlist[1] != null ? Currentlist[1] : string.Empty; titleCurrenttitle3 = Currentlist[2] != null ? Currentlist[2] : string.Empty; titleCurrenttitle4 = Currentlist[3] != null ? Currentlist[3] : string.Empty; } catch { } try { companyCurrenttitle1 = list[0] != null ? list[0] : string.Empty; companyCurrenttitle2 = list[1] != null ? list[1] : string.Empty; companyCurrenttitle3 = list[2] != null ? list[2] : string.Empty; companyCurrenttitle4 = list[3] != null ? list[3] : string.Empty; } catch { } } } } catch { }; list.Clear(); #endregion #region RegionForEDUCATION try { if (html.Contains("summary-education")) { int FirstPointForEDUCATION = html.IndexOf("summary-education"); string FirstSubStringForEDUCATION = html.Substring(FirstPointForEDUCATION); int SecondPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("<li>"); int ThirdPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("</ul>"); string SecondSubStringForEDUCATION = FirstSubStringForEDUCATION.Substring(SecondPointForEDUCATION, ThirdPointForEDUCATION - SecondPointForEDUCATION); //string tempEDu = SecondSubStringForEDUCATION.Replace("<li>", string.Empty).Replace("</li>", string.Empty).Replace(" ", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Trim(); string temptg = SecondSubStringForEDUCATION.Replace("<li>", ""); string[] templis6t = temptg.Split('/'); education1 = templis6t[0].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim(); education2 = templis6t[1].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("li>", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim(); } } catch { }; list.Clear(); #endregion string GroupPastJob = string.Empty; string GroupEduction = string.Empty; LDS_PastTitles = titlepast1 + ";" + titlepast3; LDS_PastCompany = companypast1 + ";" + companypast3; LDS_Education = education1 + ";" + education2; LDS_CurrentTitle = titleCurrenttitle; LDS_LoginID = _UserName;//SearchCriteria.LoginID; //"ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumbe" + "," + "PastTitles" + "," + "PastCompany" + "," + "Loction" + "," + "Country" + "," + "titlepast3" + "," + "companypast3" + "," + "titlepast4" + "," + "companypast4" + ","; string LDS_FinalData = LDS_ProfileType.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ","; if (LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("<span class=\"full-name\"") || LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("overview-connections\">")) { LDS_FinalData = LDS_FinalData.Replace("<span class=\"full-name\"", "").Replace("\n", "").Replace("<strong class=\"highlight\"", "").Replace("overview-connections\">", "").Replace("</strong>", "").Replace("<strong>", ""); } if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName)) { Log(LDS_FinalData); } // if (SearchCriteria.starter) { string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace("Public", "").Replace(",", "").Replace(LDS_LoginID, "").Trim(); if (!string.IsNullOrEmpty(tempFinalData)) { //AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_ScrappedMembersFromGroup); string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "Current Title " + "," + "Current Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ","; string CSV_Content = TypeOfProfile.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";"); //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ","; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ScrappedMembersFromGroup); Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File With URL >>> " + LDS_UserProfileLink + " ]"); } //if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName)) //{ // AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName); //} } } catch (Exception ex) { }; } } }
/// <summary> /// HttpPostCollectionDataDeleteAll() --> Performs an HTPP POST (for a CollectionData delete) request using the Chilkat engine. Returns an HTTP string response. ALL instances of collection data matching 'collectionName' WILL BE DELETED! /// </summary> /// <param name="tName">Indicates the name of the table from the Supplier Portal where the data will be DELETED from</param> /// <param name="collectionName">Indicates the name of the collection for which the request is valid.</param> /// <param name="port">Indicates the port to make the HTTP request</param> /// <param name="ssl">If SSL is used or not (True or False)</param> /// <example><code>s.HttpPostCollectionDataDeleteAll("topimagesystems.com_CLS", "00000323", 80, false);</code></example> protected string HttpPostCollectionDataDeleteAll(string tName, string collectionName, int port, bool ssl) { string response = String.Empty; try { if (tName != String.Empty && collectionName != String.Empty) { Chilkat.HttpRequest req = new Chilkat.HttpRequest(); using (Chilkat.Http http = new Chilkat.Http()) { http.UnlockComponent(Constants.cStrChilkatHttpLic); req.UsePost(); req.Path = Constants.cStrHttpPostCollectionDataDeleteAll; req.AddParam(Constants.cStrHttpPostCollectionDatatName, tName); req.AddParam(Constants.cStrHttpPostCollectionDatacollectionName, Constants.cStrCollectionDataNamePrefix + collectionName); Chilkat.HttpResponse resp = null; try { resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); } catch (AccessViolationException exVio) { Logging.WriteLog(exVio.ToString()); } catch (Exception ex) { Logging.WriteLog(ex.ToString()); } Thread.Sleep(50); if (resp == null) { try { resp = http.SynchronousRequest(Constants.cStrDomain, port, ssl, req); } catch (AccessViolationException exVio) { Logging.WriteLog(exVio.ToString()); } catch (Exception ex) { Logging.WriteLog(ex.ToString()); } response = (resp == null) ? http.LastErrorText : resp.BodyStr; } else { response = (resp == null) ? http.LastErrorText : resp.BodyStr; } } } } catch (Exception ex) { response = ex.ToString(); Logging.WriteLog(response); } return(response); }