by AstralSin on 05-20-2008 in Programming

OK, last time I ranted about how most programming tutorials don't really tell you anything.  I've pinpointed exactly what they don't tell you.  Most tutorial writers tell you the proper syntax of loops, functions, methods, whatever, and for most languages that's fine because the programs are written the same way.  But some languages, like Python, don't necessarily rely on functions to define the structure of the code.  In C and many languages like it, there is the main() function and you know thats the beginning of the program.  In Python, there is no main() function. 

While I can figure out to put stuff wherever I can fit it, some people can get confused by this, especially beginner programmers.  I mean, really, authors please take into consideration that your readers may not have as much experience as you and they may need an extra sentence or two describing the structure of a program.  Or like I said earlier, while you're writing your tutorial, write a little program that demonstrates how to use all the primary features of the language while putting them in context.  It makes things alot easier and by doing this, you open the doors to better programmers in the future that may have gotten their start from reading your material.  Take a little pride in your work and put some extra effort into your instruction by adding clear context to your example code.

 

Oh, and btw, please stop using the command line interpreter to show us how to do one line at a time.  No one writes a program one line at a time.  Its completely useless to show us anything there.  Write it with some other code to let us know how at least TWO lines can interact with one another.

0 comments


by AstralSin on 05-20-2008 in Security

darkc0de has written this python script that will attempt to gain information from a URL known to be vulnerable to SQL injections by feeding it a list of common table and column names.  This script does require that you know the vulnerable URL along with the query strings.  Proper syntax is listed in the opening comments.  This should be a great tool to see if your code is properly sanitizing URLs.

0 comments


by AstralSin on 05-20-2008 in Security

A serious bug in the Debian implementation of OpenSSL was found last week that allows an attacker to guess the key.  The vulnerability lies in the random number generator used by this version of OpenSSL and effects any keys created by OpenSSL, including those for SSH.  Updates are available for this flaw and any keys generated between September 2006 and May 13, 2008 should be recreated.  You can recreate these keys with ssh-keygen.  Remember that any clients that have connected to that server will need to delete the key they already have for that server and fetch the new one.  You can read more about this vulnerability on ComputerWorld's website.

0 comments


by AstralSin on 05-19-2008 in Security

When learning about networking and security, you'll see alot of references to RFCs which are documents that basically describe the operation and features of protocols, ports, standards and practices.  They can be rather cryptically written but with the right guide, you can easily find the information you need.  The RFC Sourcebook is this guide.  With it, you can quickly find out about any RFC or standard relating to TCP/IP, data encapsulation, PPP, etc.  It also contains nice reference guides to the stuff you never use but may need in an extreme situation of diagnosing a network problem, like ICMP codes.  Detailed information can be found regarding anything you can think of related to networking, encryption, authors of RFCs, organizations related to the computing world (like IANA, EFF, ICANN, etc), protocols, etc.

So if you've ever been in need of a quick reference for RFCs, I'd give RFC Sourcebook a serious look.

0 comments


by AstralSin on 05-19-2008 in Security

As you may have noticed, I've had that widget promoting free security magazines and whitepapers through Tradepub.  This is a great site that you can go to and get free subscriptions to all sorts of magazines like Network World, Security Magazine, and Dr. Dobb's Journal, among many more,  There is also a plethora of free whitepapers, webcasts, newsletters, case studies, etc all for free.  This is how I get all my trade publications.  Not only can you get all the IT related material you want, there are lots of other categories with free subscriptions to trade publications for those areas as well.  Oh, and recently Electronic Gaming Monthly started offering free subscriptions there.

One of my favorite magazines is absolutely free all the time, its called INSECURE magazine.  This is one of the better security publications I've ever read.  It is packed full of great information regarding practices, software, information security management, and lots of other security and network related articles.  It is only released bi-monthly so there's a while to wait between issues but there are 16 issues to keep you occupied till the next one comes out.

There is alot of great info to be found in both these resources and you should use them to your advantage.  The more you read and the more you learn, the better equipped you are.

0 comments


by AstralSin on 05-15-2008 in Programming

I've read many a programming tutorial and if you've read some, you'll agree that the great majority of them suck. They all just try to tell you what a variable or loop is written in that particular language and that may be useful information for some people, some of us would like a little more contextual relevance. I love tutorials that actually write a program and explain things along the way. This way you get to write a real program, which may or may not be useful to you, and learn how things are really done in that language. This is especially useful if you're treading unfamiliar waters such as learning GUI programming when you're accustomed to CLI programming or learning game programming when you're used to writing database programs.

I've been learning C# lately, just out of the need to know Windows programming so I can make myself more marketable in the job market. I have been following this tutorial which walks you through creating a game in C#. Sure, knowing how to write a game is completely useless in the IT world but this particular tutorial walks you through the Microsoft way of coding C#. It explains and gives examples and hands on exercises with methods (aka functions), classes, AI, polymorphic programming, arrays, and more. This is how a tutorial should be written. Not only is it very informative and comprehensive, its also interesting and rather fun. It really helps when learning a new language to have a) a definite goal and b) an interesting instructor/learning aid.

I'm constantly on the lookout for tutorials of any programming language that follows this archetype. If you know of any, please let me know in the comments.

0 comments


by AstralSin on 05-15-2008 in Programming

One of the most important things to do when a program is finished is to run checks to be as sure as possible that there are no memory leaks or buffer overflows/underruns.  Not only does this lower the chance for your program to crash, it lowers the chance of someone finding an exploitable vulnerability that could do any number of things from crashing the program to providing access to the system.  In the programming world of open source and Linux, there are several options for checking your code against this type of flaw.

These errors are caused by programming mistakes, and they happen.  No one writes perfect code 100% of the time so everyone should run some type of tests against their programs.  I've recently been testing a program with valgrind and electric fence to try and find the cause of a specific error that occurs on a specific platform.  Alas, the problem has not been found but I did learn quite a bit about how to test for programming flaws. 

Valgrind should be run on all your program code.  It checks for memory leaks and helps you determine where the errors may be.  Using this is pretty straightforward, Just run valgrind <binary> and it will log all the memory leaks as they happen.

If you know your program has some flaws and you just can't find them, electric fence may be able to lend a hand. Electric fence is used in combination with gcc and gdb to attempt to find the exact line of code where a malloc() overrun or underrun occurs.  While it doesn't always provide a sure-fire explanation of what's going on, it can provide some valuable information about where the problem could reside.  To use electric fence, link efence with -efence in your build line.  The code is then compiled and a binary is created.  Then call gdb <binary> and type run at the gdb shell and recreate the conditions that cause your program to crash. 

There are other options as well.  gcc has its own malloc() debugger built in, but I won't be documenting it here.  If you need more information, a quick Google search can provide much more information about either of these solutions.  Valgrind and electric fence have been highly recommended to me lately and they've been very useful.  Perhaps you can find them as useful as I have.

0 comments


by AstralSin on 05-13-2008 in Security

There have been tools available for many years that allowed you to hide information in everything from text files, images, and audio files, a practice known as steganography.  Before finding MSU StegoVideo, I had never heard of a video steganography solution.

With the increasing volume of video on the net, and the already existing abundance of images and audio, one has to wonder just how much of it is implanted with hidden information.

0 comments


by AstralSin on 05-07-2008 in Security

One of the most important things you can do while studying to be an ethical hacker or security professional of any kind is practice offensive security.  As we all know, we can't do anything illegal but we can still have wargames.  The trick is to find some like-minded people to get together and set up a sandbox network with servers, network connectivity devices, workstations, whatever else you can think of and then the attack machines of the people participating.

Then you can start having wargames.  You should set things up in such a way that people rotate between offensive and defensive roles between each session.  While some people are attacking, some should be trying to defend but you always want to rotate so everyone gets a taste of both sides.  You should then find some good tutorials on the subject and read up on the methodologies and techniques you need to use.  Then have at it.

There are some really good posts 1 2 3 4 on the Anti-online forums.  There is a plethora of good information there and can get you started with your own Wargame sessions.  If you get something like this going, leave a comment and tell us about it!

0 comments


by AstralSin on 05-07-2008 in Security

Want to get into a security career but have no experience hacking into systems?  Head on over to De-ICE.net and download the penetration testing livecds.  They are preconfigured environments that you'll fire up on a machine in your network (has to be a 192.168.1.0 subnet) and attack with your favorite penetration testing tools (Backtrack 2 Final is recommended).  I just finished the first disk and I gotta say, while its a bit simple, its pretty fun.  Its also a great starting point for anyone who has no experience penetrating linux systems.

There are two cds for level one and one cd so far for level 2, its still under development.  You will need a fairly advanced understanding of linux commands and tools to successfully complete any of these disks, but there is good help on the De-ICE forums.  These disks are great fun and very educational if you're interested in Linux security.

0 comments


1