Auto Login
New message [0] Online [0] Away [0]
[C#] Simple UrlDump Program [.NET]



 
HomeLatest imagesRegisterLog in

Share
 

 [C#] Simple UrlDump Program [.NET]

View previous topic View next topic Go down 
AuthorMessage
Sunder

[C#] Simple UrlDump Program [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyMon Jan 02, 2012 5:11 am

I had to help someone with this, so I figured I'd share this small but surprisingly useful bit of code. What it does is get all the IP addresses from a website's url and saves it to a file. This is a fairly complete program, and quite useful, so enjoy.
Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace UrlDump
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string url;
                List<string> AddressList = new List<string>();//Create a list for us to store our strings in.
                Console.WriteLine("Enter a website.");
                url = Console.ReadLine();
                IPAddress[] AddressArray = Dns.GetHostAddresses(url);//Get a collection of addresses for the specified host or site.
                foreach (IPAddress addr in AddressArray)//Add each one to our list.
                {
                    AddressList.Add(addr.ToString());
                }
                string[] Addresses = AddressList.ToArray<string>();//Create an array from that list.
                File.AppendAllLines(url + ".txt", Addresses);//Write the array to the file.
                Console.WriteLine("Addresses Recorded. Press any key to exit.");
                Console.ReadLine();//If nothing went wrong, process will exit.
            }
            catch (Exception e)
            {
                File.AppendAllText("ErrorMessage.txt", e.Message);
                File.AppendAllText("ErrorStackTrace", e.StackTrace);
            }
        }
    }
}
If anyone has a request for a different version of this, or a request for any program really, let me know.

Edit: The forum smushes the code and forces it to be word-wrapped to the next line if it's too long, so copy/paste to Visual Studio. It should run when you press F5.
Back to top Go down
Avith

[C#] Simple UrlDump Program [.NET] Founder
Avith

Posts : 115

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyMon Jan 02, 2012 6:32 am

Sunder wrote:
I had to help someone with this, so I figured I'd share this small but surprisingly useful bit of code. What it does is get all the IP addresses from a website's url and saves it to a file. This is a fairly complete program, and quite useful, so enjoy.
Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace UrlDump
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string url;
                List<string> AddressList = new List<string>();//Create a list for us to store our strings in.
                Console.WriteLine("Enter a website.");
                url = Console.ReadLine();
                IPAddress[] AddressArray = Dns.GetHostAddresses(url);//Get a collection of addresses for the specified host or site.
                foreach (IPAddress addr in AddressArray)//Add each one to our list.
                {
                    AddressList.Add(addr.ToString());
                }
                string[] Addresses = AddressList.ToArray<string>();//Create an array from that list.
                File.AppendAllLines(url + ".txt", Addresses);//Write the array to the file.
                Console.WriteLine("Addresses Recorded. Press any key to exit.");
                Console.ReadLine();//If nothing went wrong, process will exit.
            }
            catch (Exception e)
            {
                File.AppendAllText("ErrorMessage.txt", e.Message);
                File.AppendAllText("ErrorStackTrace", e.StackTrace);
            }
        }
    }
}
If anyone has a request for a different version of this, or a request for any program really, let me know.

Edit: The forum smushes the code and forces it to be word-wrapped to the next line if it's too long, so copy/paste to Visual Studio. It should run when you press F5.
Most people will take your coding skills more seriously if you compile your program/file as well
Back to top Go down
https://acidicburn.forumotion.com
Sunder

[C#] Simple UrlDump Program [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyMon Jan 02, 2012 3:29 pm

Yeah, I was thinking about that last night. I think what I'll do is a collection of tools, utilities, and other programs that I've made and put them in an installer program and upload that.
Back to top Go down
Avith

[C#] Simple UrlDump Program [.NET] Founder
Avith

Posts : 115

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyMon Jan 02, 2012 4:34 pm

Sunder wrote:
Yeah, I was thinking about that last night. I think what I'll do is a collection of tools, utilities, and other programs that I've made and put them in an installer program and upload that.
Upload the to mediafire when your finished
Back to top Go down
https://acidicburn.forumotion.com
8bit

[C#] Simple UrlDump Program [.NET] Smod
8bit

Posts : 39
Age : 30
Location : Cyberspace

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 11:29 am

Avith wrote:
Sunder wrote:
Yeah, I was thinking about that last night. I think what I'll do is a collection of tools, utilities, and other programs that I've made and put them in an installer program and upload that.
Upload the to mediafire when your finished
Hey Bro If You Want I Can Create A FTP Server For Us
Back to top Go down
https://acidicburn.forumotion.com
Sunder

[C#] Simple UrlDump Program [.NET] Coder


Posts : 21
Age : 30
Location : Upstate New York

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 8:21 pm

An FTP server would be handy, good idea. Very Happy
Back to top Go down
8bit

[C#] Simple UrlDump Program [.NET] Smod
8bit

Posts : 39
Age : 30
Location : Cyberspace

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 8:39 pm

Sunder wrote:
An FTP server would be handy, good idea. Very Happy
If You Want I Can Get Started Making The Server.
Back to top Go down
https://acidicburn.forumotion.com
Avith

[C#] Simple UrlDump Program [.NET] Founder
Avith

Posts : 115

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 8:59 pm

8bit wrote:
Sunder wrote:
An FTP server would be handy, good idea. Very Happy
If You Want I Can Get Started Making The Server.
You Should, and I'm thinking about making a advertisement team to get this site more popular
Back to top Go down
https://acidicburn.forumotion.com
Laser

[C#] Simple UrlDump Program [.NET] Smod


Posts : 116
Age : 27

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 9:17 pm

if you do i will advertise
Back to top Go down
8bit

[C#] Simple UrlDump Program [.NET] Smod
8bit

Posts : 39
Age : 30
Location : Cyberspace

[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] EmptyTue Jan 03, 2012 9:27 pm

Avith wrote:
8bit wrote:
Sunder wrote:
An FTP server would be handy, good idea. Very Happy
If You Want I Can Get Started Making The Server.
You Should, and I'm thinking about making a advertisement team to get this site more popular
OK Already Made One That Has 1,000,000 Gb Of Memory
Back to top Go down
https://acidicburn.forumotion.com
Sponsored content




[C#] Simple UrlDump Program [.NET] Empty
PostSubject: Re: [C#] Simple UrlDump Program [.NET]   [C#] Simple UrlDump Program [.NET] Empty

Back to top Go down
 

[C#] Simple UrlDump Program [.NET]

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Programming :: C++/C Programming/Tools Release & Downloads-
Social Media Buttons