Protected by

The goat will get ya.

 

Site Navigation
Home
Up

Hosting by Yahoo!

 

 


VB Winsock

Remote Shell Client/Server

This is the beginnings of how to build a Remote Shell Server in Visual Basic 6.0.

The Basic API Calls

Public Const AF_INET = 2

Public Const INVALID_SOCKET = -1

Public Const SOCKET_ERROR = -1

Public Const FD_READ = &H1&

Public Const FD_WRITE = &H2&

Public Const FD_CONNECT = &H10&

Public Const FD_CLOSE = &H20&

Public Const PF_INET = 2

Public Const SOCK_STREAM = 1

Public Const IPPROTO_TCP = 6

Public Const GWL_WNDPROC = (-4)

Public Const WINSOCKMSG = 1025

Public Const WSA_DESCRIPTIONLEN = 256

Public Const WSA_DescriptionSize = WSA_DESCRIPTIONLEN + 1

Public Const WSA_SYS_STATUS_LEN = 128

Public Const WSA_SysStatusSize = WSA_SYS_STATUS_LEN + 1

Public Const INADDR_NONE = &HFFFF

Public Const SOL_SOCKET = &HFFFF&

Public Const SO_LINGER = &H80&

Public Const hostent_size = 16

Public Const sockaddr_size = 16

Type WSADataType

wVersion As Integer

wHighVersion As Integer

szDescription As String * WSA_DescriptionSize

szSystemStatus As String * WSA_SysStatusSize

iMaxSockets As Integer

iMaxUdpDg As Integer

lpVendorInfo As Long

End Type

Type HostEnt

h_name As Long

h_aliases As Long

h_addrtype As Integer

h_length As Integer

h_addr_list As Long

End Type

Type sockaddr

sin_family As Integer

sin_port As Integer

sin_addr As Long

sin_zero As String * 8

End Type

Type LingerType

l_onoff As Integer

l_linger As Integer

End Type

Public Declare Function setsockopt Lib "wsock32.dll" (ByVal s As Long, ByVal Level As Long, ByVal optname As Long, optval As Any, ByVal optlen As Long) As Long

Public Declare Function getsockopt Lib "wsock32.dll" (ByVal s As Long, ByVal Level As Long, ByVal optname As Long, optval As Any, optlen As Long) As Long

Public Declare Function WSAGetLastError Lib "wsock32.dll" () As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Declare Function WSAIsBlocking Lib "wsock32.dll" () As Long

Public Declare Function WSACleanup Lib "wsock32.dll" () As Long

Public Declare Function Send Lib "wsock32.dll" Alias "send" (ByVal s As Long, buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long

Public Declare Function recv Lib "wsock32.dll" (ByVal s As Long, buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long

Public Declare Function WSAStartup Lib "wsock32.dll" (ByVal wVR As Long, lpWSAD As WSADataType) As Long

Public Declare Function htons Lib "wsock32.dll" (ByVal hostshort As Long) As Integer

Public Declare Function ntohs Lib "wsock32.dll" (ByVal netshort As Long) As Integer

Public Declare Function socket Lib "wsock32.dll" (ByVal af As Long, ByVal s_type As Long, ByVal protocol As Long) As Long

Public Declare Function closesocket Lib "wsock32.dll" (ByVal s As Long) As Long

Public Declare Function Connect Lib "wsock32.dll" Alias "connect" (ByVal s As Long, addr As sockaddr, ByVal namelen As Long) As Long

Public Declare Function WSAAsyncSelect Lib "wsock32.dll" (ByVal s As Long, ByVal hwnd As Long, ByVal wMsg As Long, ByVal lEvent As Long) As Long

Public Declare Function inet_addr Lib "wsock32.dll" (ByVal cp As String) As Long

Public Declare Function gethostbyname Lib "wsock32.dll" (ByVal host_name As String) As Long

Public Declare Sub MemCopy Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal cb&)

Public Declare Function inet_ntoa Lib "wsock32.dll" (ByVal inn As Long) As Long

Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Any) As Long

Public Declare Function WSACancelBlockingCall Lib "wsock32.dll" () As Long

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hit Counter

This page last edited on Thursday October 20, 2005