| CSpoofSocket |

Class | Declared in: SpoofSocket.h

## Overview

Copyright (c) 2000 Barak Weichselbaum <barak@komodia.com> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact info: Site: http://www.komodia.com Email: barak@komodia.com

Hierarchy Chart

## Base Classes

|  | CSpoofBase |

## Data Items

| sockaddr_in | m_ConnectedTo | Remote address we are conencted to
| `CIPOptions` * | m_IPOptions | Our options
| BOOL | m_Options | Do we have options
| unsigned char | m_Protocol | The protocol
| BOOL | m_Raw | Are we raw ?
| LPCSTR | m_SourceAddress | Our source address
| SOCKET | m_SpoofSocket | The actual socket handle
| unsigned char | m_TTL | Time to live

## Constructors

|  | CSpoofSocket( SOCKET sok ) | Attach to a socket by constructor
|  | CSpoofSocket() | ctor and dtor

## Destructors

| virtual | ~CSpoofSocket() |

## Functions

| void | AssignSocket( SOCKET sok, unsigned char ucProtocol=IPPROTO_TCP ) | Attach to a socket
| virtual BOOL | Bind( LPCSTR lpSourceAddress, int iPort=0 ) | Bind to a specific address
| unsigned short | CalculateChecksum( const unsigned short* usBuf, int iSize ) const | Calculate the data checksum
| unsigned short | CalculatePseudoChecksum( const char *buf, int BufLength, LPCSTR lpDestinationAddress, int iPacketLength ) const | Calculate the checksum for TCP and UDP
| BOOL | CanRead() const | Check if socket if ready for reading
| BOOL | CanWrite() const | Check if socket if ready for writing
| BOOL | CheckSocketValid() const | Check this socket is valid
| virtual BOOL | Close() | Close the socket
| virtual LPIpHeader | ConstructIPHeader( unsigned char ucProtocol, unsigned short usFragmentationFlags, unsigned char ucTTL, unsigned short usIdentification, unsigned char ucHeaderLength ) | Create an IP header
| static LPIpHeader | ConstructStaticIPHeader( unsigned char ucProtocol, unsigned short usFragmentationFlags, unsigned char ucTTL, unsigned short usIdentification, unsigned char ucHeaderLength ) | Create an IP header
| BOOL | Create( int iProtocol ) | Create a socket
| virtual void | FinalIPHeader( LPIpHeader lpHead ) | Last stop before sending the header
| SOCKET | GetHandle() const | Get the socket handle
| `CIPOptions` * | GetOptions() | Get the IP options
| long | GetPeerAddress() const | Get the address of the remote connected system
| unsigned short | GetPeerPort() const | Get the port if the remote connected system
| virtual void | InitializeIP() | initialize all the private memebers
| BOOL | isRaw() const | Indication if we are a raw socket
| sockaddr_in | pResolveDNS( LPCSTR lpAddress ) | Reseolve DNS
| virtual int | Receive( char* buf, int bufLen ) | Recieve data from remote socket
| long | ResolveDNS( LPCSTR lpAddress ) | Resolve a DNS entry
| virtual BOOL | Send( LPCSTR lpDestinationAddress, const char* buf, int bufLength, unsigned short usDestinationPort=0 ) | Send data to a socket
| virtual void | SetIPHeaderAddress( LPIpHeader lpHead, LPCSTR lpSourceAddress, LPCSTR lpDestinationAddress ) | Set the address in the IP header
| void | SetOptions( BOOL bOptions ) | Do we allow options on this socket ?
| void | SetProtocol( int iProtocol ) | Set the protocol we are working on
| void | SetRaw( BOOL bRaw ) | Are we a raw socket ?
| void | SetSourceAddress( LPCSTR lpSourceAddress ) | Set source address for spoofing
| void | SetTTL( unsigned char ucTTL ) | Set the packet Time to live
| BOOL | Shutdown( SocketShutdown eHow ) | Close one way of the socket (receive,send,both)
| virtual BOOL | Sniff( BOOL bSniff ) | Turn to be a sniffer socket
| static BOOL | ValidAddress( LPCSTR lpAddress ) | Check if an address is valid
| BOOL | ValidSocket() const | Is our socket valid ?

## Custom Code

- Custom Code in Header Before Includes (62 bytes)
- Custom Code in Header After Includes (11954 bytes)
- Custom Code in Header After Class Declaration (188 bytes)
- Custom Code in Header Public Section (87 bytes)
- Custom Code in Source After Includes (84 bytes)

## Implementation Details

File(s)
  C:\dev\Komodia\SpoofSocket.cpp
  C:\dev\Komodia\SpoofSocket.h

Header Includes

  SpoofBase.h |

Source Includes

  stdafx.h | for precompiled header directive
  SpoofSocket.h |

Owner
  LibV3

Last Modified
  27-Jun-01 7:19:26 PM

This web site was generated using Surveyor V4.50.811.1. Click here for more information. | Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.