It is currently Thu Sep 09, 2010 3:53 am


Welcome to Mango12!


Mango12 is a programming orientated community that primarily focuses on creating bots, macros, and other such applications to make things on the web easier; from things like simulating game play to submitting web forms. For more info, Read the FAQ or Join the IRC.

All times are UTC



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Simple FakeNameGenerator Class
PostPosted: Thu Jun 17, 2010 3:13 pm 
Offline
Forum Guru
User avatar

Joined: Sat May 31, 2008 10:30 am
Posts: 656
Location: (͡๏̯͡๏)
Given: 72 thanks
Received: 430 thanks
Known Programming Languages: c++ c# php x86asm js
  1.    class FNG
  2.     {
  3.         public string FirstName;
  4.         public string MiddleInitial;
  5.         public string LastName;
  6.         public string StreetAddress;
  7.         public string City;
  8.         public string State;
  9.         public string ZipCode;
  10.         public string Password;
  11.         public string Phone;
  12.         public string Birthday;
  13.  
  14.         public FNG()
  15.         {
  16.             WebClient http = new WebClient();
  17.             string html;
  18.             try
  19.             {
  20.                 html = http.DownloadString("http://www.fakenamegenerator.com/");
  21.             }
  22.             catch (Exception ex)
  23.             {
  24.                 throw new Exception("The web request to FNG failed", ex);
  25.             }
  26.  
  27.             Match m = Regex.Match(html, @"given-name"">(?<FirstName>[^<]+).*?additional-name"">(?<MiddleIntial>[^<]+).*?family-name"">(?<LastName>[^<]+).*?street-address"">(?<StreetAddress>[^<]+).*?locality"">(?<City>[^<]+).*?region"">(?<State>[^<]+).*?postal-code"">(?<ZipCode>[^<]+).*?Password:</li>\s*<li>(?<Password>[^<]+).*?tel""><span class=""value"">(?<Phone>[^<]+).*?bday"".*?title=""(?<Birthday>[^""]+)", RegexOptions.Singleline);
  28.             if (!m.Success) throw new Exception("The regex to get FNG information failed. Did FNG site layout change?");
  29.  
  30.             FirstName = m.Groups["FirstName"].Value;
  31.             MiddleInitial = m.Groups["MiddleInitial"].Value;
  32.             LastName = m.Groups["LastName"].Value;
  33.             StreetAddress = m.Groups["StreetAddress"].Value;
  34.             City = m.Groups["City"].Value;
  35.             State = m.Groups["State"].Value;
  36.             ZipCode = m.Groups["ZipCode"].Value;
  37.             Password = m.Groups["Password"].Value;
  38.             Phone = m.Groups["Phone"].Value;
  39.             Birthday = m.Groups["Birthday"].Value;
  40.         }
  41.     }

_________________
Image
Image


Top
 Profile  
 
The following user would like to thank Fatalis for his or her post:
aadster
 Post subject: Re: Simple FakeNameGenerator Class
PostPosted: Thu Jul 15, 2010 1:05 am 
Offline
Forum Elder

Joined: Tue May 13, 2008 10:33 pm
Posts: 293
Location: Kansas
Given: 24 thanks
Received: 64 thanks
Known Programming Languages: HTML/XHTML, AHK, Python, some C# and PHP
Wasn't working for me, they probably changed the page source. I wrote one, might be more reliable since it checks a URL i found in the page.
  1. public void GetFakeName()
  2.         {
  3.             this.MainForm.SetStatus("Getting a fake identity...");
  4.  
  5.             string nameSource = Http.GetData("http://www.fakenamegenerator.com/");
  6.             int index = nameSource.IndexOf("<li class=\"first\"><div class=\"content\"><a href=\"/fireform");
  7.             if (index > -1)
  8.             {
  9.                 Regex regex = new Regex("\\.php\\?i=(.*?)--(.*?)--(.*?)--(.*?)--(.*?)--(.*?)--(.*?)--(.*?)-(.*?)-(.*?)--(.*?)--(.*?)--(.*?)--(.*?)--(.*?)%40example\\.com\">");
  10.                 Match match = regex.Match(nameSource);
  11.                 //fireform.php?i=Lisa--Ringer--Mrs.--1866+Wolf+Pen+Road--95113--CA--San+Jose--650-446-1566--27--8--1980--29--LisaGRinger%40example.com">
  12.                 if (match.Success)
  13.                 {
  14.                     this.firstName = match.Groups[1].Value;
  15.                     this.lastName = match.Groups[2].Value;
  16.                     this.email = match.Groups[15].Value + "%40example.com";
  17.                 }
  18.                 else
  19.                 {
  20.                     this.MainForm.SetStatus("Error getting information to create accounts.");
  21.                 }
  22.  
  23.             }
  24.         }
  25.  


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2007 phpBB Group
xand 2 for phpBB3 by Thomas Hoornstra and Shadow_One reklama