Hot Downloads



The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Packet crafting

Packet crafting 14 years 4 months ago #5306

I was wondering if anyone could point me a good linux socket tutorial that will give me the basics on how to create my own crafted packets. Try not to get the wrong idea, this is purely because I want to satisfy my own curiousity. I do have SOME experience with C as well as other random programming languages. Programming has always been a tough subject for me to grasp as it takes a lot of abstract lines of thinking and isn't always as logical as many people make it.

So by saying that, direct me towards a tutorial that doesnt assume a lot and has applicable examples. Thanks in advance for whomever can find me one. :D
"He who breaks something to find out what it is, has left the path of wisdom."

Gandalf the Grey

Re: Packet crafting 14 years 4 months ago #5311

Socket Programming:

If you're looking to learn c/c++, this site has a pretty good quantity of c++ tutorials, along with tutorials of other languages,

Fallenzer0 posted this link a few weeks ago:
it also has lots of e-books, and e-books usually have applicable examples

I thought myself a few languages, but then I lost interest, maybe I was learning from the wrong place because I couldn't relate what I was learning to what I wanted to do. Programming isn't for everyone. Some are born programmers, it comes easy to some, and some struggle to learn it.

In my opinion, for c/c++ its good to learn the purposes and functions of a good quantity of header files, because most c/c++ tutorials only tell you about the basic ones, and not those that you can do "cool" things with. Checking out a book in the library is also a good idea, I used Teach Yourself C++ in 21 Days.

Hope that helps

::::Gees, the guy asks a simple question and I answer him in essay form :-p :::::

Re: Packet crafting 14 years 4 months ago #5313

Linux socket programming in C is 99% the same as in Windows, don't use any of the functions starting with WSA (you wont need WSAstartup, WSAsocket etc), your basic functions will be exactly the same :



The packet structures are also still the same



As far as the header files go, you'll want to include
#include <sys\socket.h>
#include <netinet\in.h>
#include <netdb.h>

Just grab yourself the code for any small client-server application and you'll understand instantly.

Since you're talking about crafting your own packets you will have to use SOCK_RAW when you declare the socket. Then you will have to create structures for the IP header and TCP header and fill these up with the values you want.

If you need more help, let me know I will post sample code for you to get started.

Hmmm socket programming 101 ;)

Sahir Hidayatullah. Staff - Associate Editor & Security Advisor

Re: Packet crafting 14 years 4 months ago #5319

Killa- Thanks for those links, very informative. But, I decided to pick up a book specifically for sooket programming. Im more of a visual learner so diagrams would be helpful. any suggestions?

P.S. essay form is a hell of a lotter easier to read :-P

Sahirh- Well Im always for seeing another persons style of code (no hurt in taking direction from somelses style of coding), so if you're up to feel free 8)
"He who breaks something to find out what it is, has left the path of wisdom."

Gandalf the Grey
  • Page:
  • 1
Time to create page: 0.110 seconds


Cisco Routers

  • SSL WebVPN
  • Securing Routers
  • Policy Based Routing
  • Router on-a-Stick

VPN Security

  • Understand DMVPN
  • GRE/IPSec Configuration
  • Site-to-Site IPSec VPN
  • IPSec Modes

Cisco Help

  • VPN Client Windows 8
  • VPN Client Windows 7
  • CCP Display Problem
  • Cisco Support App.

Windows 2012

  • New Features
  • Licensing
  • Hyper-V / VDI
  • Install Hyper-V


  • File Permissions
  • Webmin
  • Groups - Users
  • Samba Setup