CIPCrafter Class Reference#include <IPCrafter.h>
Inheritance diagram for CIPCrafter:
![]()
Collaboration diagram for CIPCrafter:
![]()
Detailed DescriptionDefinition at line 52 of file IPCrafter.h. Constructor & Destructor Documentation
Definition at line 53 of file IPCrafter.cpp. 00053 : CSpoofBase() 00054 { 00055 try 00056 { 00057 //Set our name 00058 SetName(CIPCrafter_Class); 00059 00060 //Set the default data 00061 SetDefault(); 00062 } 00063 ERROR_HANDLER("CIPCrafter") 00064 }
Member Function Documentation
Definition at line 115 of file IPCrafter.cpp. 00120 { 00121 try 00122 { 00123 //Get the original header 00124 LPIpHeader lpHead; 00125 00126 //Check what header length to pass 00127 unsigned char ucLength; 00128 00129 if (m_ucHeaderLength==IPCRAFTER_DEFAULT_HEADER_SIZE) 00130 ucLength=ucHeaderLength; 00131 else 00132 ucLength=m_ucHeaderLength; 00133 00134 //Get the header 00135 lpHead=CSpoofSocket::ConstructStaticIPHeader(ucProtocol, 00136 m_usFragmentationFlags, 00137 ucTTL, 00138 m_usIdentification, 00139 ucLength); 00140 00141 //Check we have it 00142 if (!lpHead) 00143 return NULL; 00144 00145 //Set the type of service 00146 //Precedence 00147 lpHead->ucTypeOfService=m_ucTypeOfService; 00148 00149 //Done 00150 return lpHead; 00151 } 00152 ERROR_HANDLER_RETURN("ConstructCraftedIPHeader",NULL) 00153 }
Definition at line 155 of file IPCrafter.cpp. 00160 { 00161 try 00162 { 00163 //Check if the length is too big 00164 if (IpHeaderLength+(long)usBufferSize>65535) 00165 { 00166 //Report it 00167 ReportError("GetCraftedPacket","Packet can't be greater then 65k!"); 00168 00169 //Exit 00170 return NULL; 00171 } 00172 00173 //Header length 00174 unsigned char ucHeaderLength=IpHeaderLength; 00175 00176 if (pSocket->HasOptions()) 00177 ucHeaderLength+=pSocket->GetOptions()->GetBufferLength(); 00178 00179 //First construct the packet 00180 LPIpHeader lpHead=pSocket->ConstructIPHeader(pSocket->GetProtocol(), 00181 IpFragFlag_DONT_FRAG, 00182 pSocket->GetTTL(), 00183 (unsigned short)GetCurrentProcessId(), 00184 ucHeaderLength); 00185 00186 //Set the address 00187 pSocket->SetIPHeaderAddress(lpHead, 00188 pSocket->GetSourceAddress(), 00189 ulDestinationAddress); 00190 00191 //Now add some more options 00192 unsigned short usTotalLength; 00193 usTotalLength=ucHeaderLength+usBufferSize; 00194 00195 //Set the header 00196 lpHead->usTotalLength=htons(usTotalLength); 00197 00198 //Need to construct a new packet 00199 char* pNewBuf; 00200 pNewBuf=new char[usTotalLength]; 00201 00202 //Copy two buffers 00203 memcpy(pNewBuf, 00204 lpHead, 00205 IpHeaderLength); 00206 00207 //Do we need to copy options ? 00208 if (pSocket->HasOptions()) 00209 memcpy(pNewBuf+IpHeaderLength, 00210 pSocket->GetOptions()->GetBuffer(), 00211 pSocket->GetOptions()->GetBufferLength()); 00212 00213 //Only if not null 00214 if (pBuffer) 00215 memcpy(pNewBuf+ucHeaderLength, 00216 pBuffer, 00217 usBufferSize); 00218 00219 //Calculate the checksum 00220 lpHead->usChecksum=pSocket->CalculateChecksum((unsigned short*)pNewBuf, 00221 ucHeaderLength); 00222 00223 //Alert everyone this is the final header 00224 pSocket->FinalIPHeader(lpHead); 00225 00226 //Recopy the ip 00227 memcpy(pNewBuf, 00228 lpHead, 00229 IpHeaderLength); 00230 00231 //Set the total size 00232 usTotalSize=usTotalLength; 00233 00234 //Return to the user 00235 return pNewBuf; 00236 } 00237 ERROR_HANDLER_RETURN("GetCraftedPacket",NULL) 00238 }
Definition at line 90 of file IPCrafter.cpp. 00091 { 00092 try 00093 { 00094 m_usFragmentationFlags=IpFragFlag_DONT_FRAG; 00095 m_usIdentification=(unsigned short)GetCurrentProcessId(); 00096 m_ucHeaderLength=IPCRAFTER_DEFAULT_HEADER_SIZE; //Default size 00097 m_ucTypeOfService=IpService_ROUTINE; 00098 00099 //Default checksum used 00100 m_DefaultChecksum=TRUE; 00101 } 00102 ERROR_HANDLER("SetDefault") 00103 }
Definition at line 70 of file IPCrafter.cpp. 00071 { 00072 m_usFragmentationFlags=usFragmentationFlags; 00073 }
Definition at line 75 of file IPCrafter.cpp. 00076 { 00077 m_usIdentification=usIdentification; 00078 }
Definition at line 85 of file IPCrafter.cpp. 00086 { 00087 m_ucTypeOfService=ucTypeOfService; 00088 }
Member Data Documentation
Definition at line 102 of file IPCrafter.h.
Definition at line 97 of file IPCrafter.h.
Definition at line 98 of file IPCrafter.h.
Definition at line 101 of file IPCrafter.h.
Definition at line 95 of file IPCrafter.h.
Definition at line 96 of file IPCrafter.h.
The documentation for this class was generated from the following files: |