Advertisement
Guest User

GetAddresses

a guest
Jan 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using System.Text.RegularExpressions;
  8.  
  9. using Botting;
  10.  
  11.  
  12. namespace Botting
  13. {
  14.     class GetAddresses
  15.     {
  16.         public string first, last, add, city, state, zip, phone;
  17.         public bool failed;
  18.         public List<string> adds;
  19.  
  20.         public GetAddresses(string state_, string last_, string first_ = "")
  21.         {
  22.             Init();
  23.             state = state_;
  24.             last = last_;
  25.             first = first_;
  26.             FindAddresses();
  27.         }
  28.  
  29.         public void Init()
  30.         {
  31.             first = ""; last = "";
  32.             add = ""; city = ""; state = ""; zip = "";
  33.             phone = ""; adds = new List<string>(); failed = false;
  34.         }
  35.  
  36.  
  37.         /*
  38.             GET http://www.addresses.com/ HTTP/1.1
  39.             Accept: text/html, application/xhtml+xml, * / *
  40.  
  41.             <title>People Search
  42.  
  43.             First + last + state
  44.  
  45.             GET http://www.addresses.com/results.php?qf=John&qn=Smith&qloc=NY HTTP/1.1
  46.             Accept: text/html, application/xhtml+xml, * / *
  47.             Referer: http://www.addresses.com/
  48.             Cookie: PHPSESSID=bb3ce96fa2eaee6dbf37ad0db3c03742; campaign=1-1KWVZd6kEQ9tQGVNVHFBNIkwRQyeQNVYWsn; ABTestCase_2=1-IgDVlFkJ0wWGQfBI9wT000AXVVYn4RFFGRfF5QcEB6Q; BIGipServerp-directory=420528394.20480.0000; __utma=40186866.1411263180.1516383885.1516383885.1516383885.1; __utmb=40186866.2.10.1516383885; __utmc=40186866; __utmz=40186866.1516383885.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utmt=1; __gads=ID=87a9bd17b547d053:T=1516383585:S=ALNI_MboEfHx4zPPskQkcwThRGA3tUeHfg; sbi_debug=false
  49.  
  50.             Location: /people/john+smith/ny
  51.  
  52.             First + state / Page 2
  53.  
  54.             GET http://www.addresses.com/people/smith/ny/p2 HTTP/1.1
  55.             Accept: text/html, application/xhtml+xml, * / *
  56.             Referer: http://www.addresses.com/people/smith/ny
  57.  
  58.                <div id="results_wp_outer" class="clearfix">
  59.                <h2 class="wp_found_text">
  60.                   <span class="found_string">Found 61 Results for John Smith, NY</span>
  61.             <span class="record_count">Showing page 1 of 7</span>      <div class="clear"></div>
  62.                </h2>
  63.                   <div id="results_wp_inner">
  64.             <div class="wp_result even_listing first">
  65.               <div class="clearfix">
  66.                 <div class="wp_result_details detail_column">
  67.                   <div class="wp_detail_name">
  68.                     <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/">John W Smith</a>
  69.                   </div>
  70.                   <div class="wp_detail_addr">
  71.                     <div class="listing_header">(770) 962-7381</div>
  72.                     <div class="listing_detail">207 E 15th ST</br>New York, NY 10003</div>
  73.  
  74.                     <div class="view_more">
  75.                       <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/">View More &raquo;</a>
  76.                     </div>
  77.                   </div>
  78.                 </div>
  79.             </div>
  80.                   <div class="wp_detail_links">
  81.                      <span class="listing_header">Get More Information:&nbsp;&nbsp;</span>
  82.                      <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Detailed Background Report</a>&nbsp;|&nbsp;
  83.                      <a href="/extredir/4034367445/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Email and Unlisted Phone Lookup</a>&nbsp;|&nbsp;
  84.                      <a href="/extredir/586468426/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Property Report</a>&nbsp;|&nbsp;
  85.                      <a href="/people/john+smith/ny/3902486050" title="">Map</a>
  86.                   </div>
  87.             </div>
  88.  
  89.  
  90.             <div class="wp_result odd_listing">
  91.               <div class="clearfix">
  92.                 <div class="wp_result_details detail_column">
  93.                   <div class="wp_detail_name">
  94.                     <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/">John J Smith</a>
  95.                   </div>
  96.                   <div class="wp_detail_addr">
  97.                     <div class="listing_header">(504) 834-1010</div>
  98.                     <div class="listing_detail">110 W State ST</br>Salamanca, NY 14779</div>
  99.  
  100.                     <div class="view_more">
  101.                       <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/">View More &raquo;</a>
  102.                     </div>
  103.                   </div>
  104.                 </div>
  105.             </div>
  106.                   <div class="wp_detail_links">
  107.                      <span class="listing_header">Get More Information:&nbsp;&nbsp;</span>
  108.                      <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Detailed Background Report</a>&nbsp;|&nbsp;
  109.                      <a href="/extredir/4034367445/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Email and Unlisted Phone Lookup</a>&nbsp;|&nbsp;
  110.                      <a href="/extredir/586468426/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Property Report</a>&nbsp;|&nbsp;
  111.                      <a href="/people/john+smith/ny/1266975682" title="">Map</a>
  112.                   </div>
  113.             </div>
  114.          */
  115.         public void FindAddresses()
  116.         {
  117.             failed = false;
  118.             adds = new List<string>();
  119.             Http http = new Http();
  120.             http.Accept = "text/html, application/xhtml+xml, */*";
  121.             http.KeepAlive = true;
  122.             string url = "http://www.addresses.com/";
  123.             string html = http.HttpGet(url);
  124.             if (!html.Contains("<title>People Search"))
  125.             {
  126.                 failed = true;
  127.                 return;
  128.             }
  129.  
  130.             string refurl = url;
  131.             url = "http://www.addresses.com/results.php?";
  132.             if (first != "") { url += "qf=" + first + "&"; }
  133.             url += "qn=" + last + "&qloc=" + state;
  134.             http.KeepAlive = true;
  135.             html = http.HttpGet(url, refurl);
  136.  
  137.             // <div class="wp_result_details detail_column">   ->   <div class="view_more">
  138.             int lc = 0;
  139.             while (true)
  140.             {
  141.                 lc++;
  142.                 if (lc > 50) { break; }
  143.                 Match m = Regex.Match(html, @"<div class=\""wp_result_details detail_column\"">(.*?)<div class=\""view_more\"">");
  144.                if (!m.Success) { break; }
  145.                string phtml = m.Result("$1");
  146.                html = html.Substring((html.IndexOf(phtml) + phtml.Length));
  147.  
  148.                // <a href="/extredir/559850973/800/Westchester+Ave+%23ste+N405/John/A/Smith/Port+Chester/NY/10573/800+Westchester+AVE+STE+N405/9147010170/">John A Smith</a>
  149.                m = Regex.Match(phtml, @"<a href=(.*?)<\/a>");
  150.                if (!m.Success) { continue; }
  151.                string nhtml = m.Result("$1");
  152.                if (nhtml.Contains(">")) { nhtml = nhtml.Split('>')[(nhtml.Split('>').Count() - 1)]; }
  153.                string fn = ""; string ln = "";
  154.                if (nhtml.Contains(" "))
  155.                {
  156.                    string[] narr = nhtml.Split(' ');
  157.                    if (narr.Count() != 3) { continue; }
  158.                    fn = narr[0];
  159.                    ln = narr[2];
  160.                    if (fn.Length < 3 || ln.Length < 3) { continue; }
  161.                }
  162.                else { continue; }
  163.  
  164.                // <div class="listing_detail">800 Westchester AVE #STE #N405</br>Port Chester, NY 10573</div>
  165.                m = Regex.Match(phtml, @"<div class=\""listing_detail\"">(.*?)<\/div>");
  166.                if (!m.Success) { continue; }
  167.                string astr = m.Result("$1");
  168.                if (!astr.Contains("</br>")) { continue; }
  169.                astr = astr.Replace("</br>", "^");
  170.                string[] aarr = astr.Split('^');
  171.                string a1 = aarr[0];
  172.                a1 = a1.Replace("#", "");
  173.  
  174.                 astr = aarr[1];
  175.                 if (!astr.Contains(", ")) { continue; }
  176.                 astr = astr.Replace(", ", "^");
  177.                 aarr = astr.Split('^');
  178.                 string c1 = aarr[0];
  179.  
  180.                 astr = aarr[1];
  181.                 if (!astr.Contains(" ")) { continue; }
  182.                 astr = astr.Replace(" ", "^");
  183.                 aarr = astr.Split('^');                
  184.                 string s1 = aarr[0];
  185.                 string z1 = aarr[1];
  186.                 if (!a1.Contains(" ") || a1.Length < 6 || c1.Length < 3 || s1.Length != 2 ||
  187.                   z1.Length != 5)
  188.                     { continue; }
  189.                 astr = fn + "|" + ln + "|" + a1 + "|" + c1 + "|" + s1 + "|" + z1;
  190.                 adds.Add(astr);
  191.             }
  192.         }
  193.     }
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement