Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net;
- using System.Text.RegularExpressions;
- using System.IO;
- using System.Threading;
- using System.Diagnostics;
- public class Program
- {
- public static void Main()
- {
- var client = new WebClient();
- //http://www.geoplugin.net/php.gp?ip=
- var proxys = File.ReadAllLines("config");
- for (var x = 0; x < proxys.Length; x++)
- {
- var _params = proxys[x].Split(':');
- Program.GetCountry(_params[0], int.Parse(_params[1]));
- }
- }
- public static void GetCountry(string address, int port)
- {
- var client = new WebClient();
- // client.Proxy = new WebProxy(string.Format("{0}:{1}", address, port));
- var requestThread = new Thread(() =>
- {
- try
- {
- var result = client.DownloadString(string.Format("http://www.geoplugin.net/php.gp?ip={0}",
- address));
- var arr = result.Split(new string[] { "geoplugin_countryName" }, StringSplitOptions.None);
- var str = arr[1].Split(':');
- var country = str[2].Replace("\"", null).Replace(";", null);
- Console.WriteLine("IPAddress: {0}, Country: {1}", address, country);
- Console.ReadLine();
- } catch (Exception ex)
- {
- Debug.Print(ex.Message);
- }
- });
- requestThread.Start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement