Use VB to learn "hacker" procedures

zhaozj2021-02-11  236

Using VB to do "hacker" procedure As long as you have mastered the principle, you can also write a so-called "hacker" program. The author led the big house to use VB to write a remote control program. Thus, it unveves its mystery. First, the control used will use the Winsock control in the program. The Winsock control is an ActiveX control that is connected to the remote computer using the TCP protocol or UDP protocol. Like timer controls, Winsock control is invisible at runtime. WINSOCK's working principle is that the client issues a connection request to the server, and the server is constantly listening to the client's request. When the agreement is communicated, the client and the server are established, and the client is connected. Two-way data transfer can be implemented with the server side. In actual programming, a server-side application and a client application must be established, and the two applications have their own Winsock controls. First set the protocol used by the Winsock control, where we use the TCP protocol. Now let's start building two programs with VB, one is the client program myclient, and the other is the server-side program MyServer. Second, write client programs first build client programs MyClient. Create a form in the MyClient program, load the Winsock control, called TCPClient, indicating that the TCP protocol is used, add two text boxes (Text1 and Text2) to enter the server's IP address and port number, and establish one The button (CD1) is used to establish a connection. After pressing, the connection can be initialized, the code is as follows: private sub cd1_click () TcpClient.romotehost = text1.text tclient.romoteport = val (text2.text) 'port number, The default is 1001 tclient.connect 'to call the Connect method, connect the CD1.Enabled = false End Sub connection with the computer that specifies the IP address, is how to handle the data received. Once the client and the server are connected, if there is any end to receive new data, the DataArrival event of the end of the Winsock control is triggered. When responding to this event, you can use the GetData method to get the transmitted data. For example, you can write code in the TCPClient's DataArrival event as follows: Private Sub Tcpclient_dataarrival (Byval Bytestotal As Long) DIM X AS STRING TCPCLIENT.GETDATA X 'Using GetData to get the transmitted data ....... The omission part of the end Sub Indicates the specific processing of the received data, and the reader can be written according to the actual situation. Third, write a server-side program to create a form, load the Winsock control, named TCPServer. In addition, add a text box text1 on the form to display data information from the client's IP address and the client. When the client program is running, the client requests to the server-side program, when the server-side ConnectionRequest event is triggered, so the server-side program is to resolve the connection problem, you can use the ConnectionRequest event to complete this. Features.

转载请注明原文地址:https://www.9cbs.com/read-4866.html

New Post(0)