C:/Web/smbrelay3/src/misc.h

Go to the documentation of this file.
00001 /*
00002  Misc data manipulation functions for Smbrelay
00003  Andres Tarasco
00004 */
00005 #ifndef _MISC_FUNCTIONS_H_
00006 #define _MISC_FUNCTIONS_H_
00007 #define _CRT_SECURE_NO_DEPRECATE
00008 
00009 #include <stdio.h>
00010 
00011 
00012 #pragma pack(1)
00013 #ifdef WIN32
00014 #include <io.h>
00015 #include <windows.h>
00016 #else
00017  #pragma align 1
00018  #include <unistd.h>
00019  #include <fcntl.h>
00020  #include <sys/socket.h>
00021  #include <sys/ioctl.h>
00022  #include <netinet/in.h>
00023  #include <arpa/inet.h>
00024  #include <netdb.h>
00025  #include <pthread.h>  //pthread
00026  #include <ctype.h> //toupper 
00027  #include <time.h>
00028  #include <sys/timeb.h>
00029 #define SOCKET int
00030 #define  _strnicmp strncasecmp 
00031 #define closesocket close
00032 #define Sleep(a) sleep(a/1000)
00033 #define INVALID_SOCKET -1
00034 #endif
00035 //#include "smbrelay.h"
00036 #include "ntlm.h"
00037 
00038 typedef struct
00039 {
00040         SOCKET source;
00041         struct sockaddr_in sourceaddr;
00042 
00043         SOCKET destination;
00044         struct sockaddr_in destinationaddr;
00045 
00046         int dstProtocol;
00047         char hostname[256];
00048 } RELAY;
00049 
00050 #define CONNECT_TIMEOUT  10
00051 #define SMBWAITTIMEOUT 5
00052 #define DBG_DUMP_ROWS   16
00053 
00054 
00055 void DumpMem(void* string, int length) ;
00056 char *ReadFileToSend(int *BackdoorFileSize,char*lpBackdoorFile);
00057 
00058 int ConnectToRemoteHost(RELAY *relay,char *hostname, int port);
00059 //int SendBytesAndWaitForResponse(RELAY *relay,char *source, int nBytes, char *destination, int MaxReadSize,int timeout);
00060 int SendBytesAndWaitForResponse(SOCKET destination,char *source, int nBytes, char *destinationBuffer, int MaxReadSize,int timeout);
00061 void WriteDataToReportFile(char *lpLogFileFilename, tSmbNtlmAuthResponse* NtlmAuthResponse, char *SourceIpAddress,unsigned char *challenge);
00062 void CleanLine(int verbose);
00063 void usage(void);
00064 void Banner(void);
00065 
00066 #endif
00067 

Generated on Wed Nov 12 22:04:28 2008 for Smbrelay version 3 by  doxygen 1.5.4