• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
coderWalker

Retrieving Port Banners? (C# .NET)

5 posts in this topic

How do I get a ports banner?

I have tried the WebResponse class (HTTP):
[CODE]
WebRequest wrq = WebRequest.Create("127.0.0.1:3306/");
WebResponse wrs = wrq.GetResponse();
[/CODE]
I have also tried the TcpClient class:
[CODE]TcpClient Client = new TcpClient();
Client.Connect("127.0.0.1", 3306);
NetworkStream ClientStream = Client.GetStream();[/CODE]

Do one of these classes contain the ports banner? Am I over looking it?

Just for clearification, what exactly are port banners?
It's a message that describes how the ports used, sent by the server to the client right?

Google really turns up nothing about this, so any help is greatly appreciated.

Thanks a ton!
CoderWalker
0

Share this post


Link to post
Share on other sites
In some protocols, on a successful client connection the server will send some information immediately to the client. Mysql (the most common service running on port 3306) sends some text when first connected to. This often includes some kind of protocol identifier, protocol version number and occasionally a string identifying the server's implementation name and / or version number. This can be considered a "banner". As a counter example, HTTP does not do this - it requires the client to submit some data before a response is given.

Assuming you do not have a web server running on port 3306, then using a "WebRequest" probably will not work. It expects a HTTP capable server, and will fail if it is pointed at something else. If you have a service that has this "banner" property (i.e. opening a TCP connection results in data being returned), then a TCP client class should work. Have you tried reading data from the "ClientStream" variable?

Before spending time on the code, I'd recommend you ensure that you'll get a result by using the networking tools on your operating system of choice (e.g. telnet or netcat).
0

Share this post


Link to post
Share on other sites
Port banners are separate from the actual communications.
Some protocols will send "banner text" when you connect to their ports, but those protocols are in the minority.
Another option is /etc/services on UNIX systems, which lists port numbers and the name of the service usually bound to that port.
Also, each protocol you may want to use is probably described in an RFC, so you can go look up the appropriate RFC to know what the protocol is.

If you're wondering about utilities that, for example, look at the open ports on a machine, and say "hey, port 80 is open, and this usually means a web server running HTTP" then the mapping from port to service is done in the utility, not by the networking system. There are a number of "port to protocol description" services on the internet, of various quality.
0

Share this post


Link to post
Share on other sites
[quote name='rip-off' timestamp='1334221609' post='4930518']
In some protocols, on a successful client connection the server will send some information immediately to the client. Mysql (the most common service running on port 3306) sends some text when first connected to. This often includes some kind of protocol identifier, protocol version number and occasionally a string identifying the server's implementation name and / or version number. This can be considered a "banner". As a counter example, HTTP does not do this - it requires the client to submit some data before a response is given.

Assuming you do not have a web server running on port 3306, then using a "WebRequest" probably will not work. It expects a HTTP capable server, and will fail if it is pointed at something else. If you have a service that has this "banner" property (i.e. opening a TCP connection results in data being returned), then a TCP client class should work. Have you tried reading data from the "ClientStream" variable?

Before spending time on the code, I'd recommend you ensure that you'll get a result by using the networking tools on your operating system of choice (e.g. telnet or netcat).
[/quote]

Thanks for all this :)
I saw a page online of a program that does retrieve the banners like so:

Port 80:
[quote]HTTP/1.1 302 Found
Date: 7 Apr 2010 00:48:22 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
Location: http:///xampp/
Content-Length: 109
Connection: close
Content-Type: text/html
[/quote]

Port 3306:
[quote]Host 'localhost' is not allowed to connect to this MySQL server[/quote]

I checked the Clientstream and it has no information at all.
I wonder if I have to manually send something to the server, kinda like a ping but for Server Information?
0

Share this post


Link to post
Share on other sites
[quote]I wonder if I have to manually send something to the server, kinda like a ping but for Server Information? [/quote]

[left][font="helvetica, arial, verdana, tahoma, sans-serif"][size="2"][color="#282828"]Each protocol is different.[/color][/size][/font][/left]
0

Share this post


Link to post
Share on other sites
If you want to get a response from a HTTP server, you'll have to send a valid HTTP request. There is no way to determine in advance if the service on a particular port is actually a HTTP server. There are good heuristics, such as common port numbers (80, 8080, 443 for HTTPS), but there are no guarantees. If you want to reliably determine the type of service sitting on a port, you must be able to probe it using multiple protocols, and you must understand the protocol responses to see if they make sense.

Others who have written such software will do something like this.

Another important note is that not all services will respond, some will require valid authentication to be sent up front, others might be hidden with port-knocking routines.

What are you trying to do? To repeat, I'm not sure you know what you are trying to do, because I'm not convinced you understand how these services and protocols work.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0