Learn to use Visual Basic "hacker" program


This article aims to make people grasp the "hackers" the basic principles of procedure and further vigilance and prevention. Once you master the fundamentals, you can write a so-called "hacker" program. Here I guide you personally use VB to write a remote control program. To reveal its mysterious veil.

First, the use of control

The program will use the Winsock control. Winsock control is an ActiveX control, use the TCP protocol or UDP protocol to connect to remote computers and exchange data with them. And timer control, like, Winsock control in the run-time is not visible. Winsock works is: the client sent connection requests to the server, the server side is constantly monitoring the client's request, when the communication protocol between the client and server to establish the connection between, then the client and server-side two-way data transmission can be achieved. The actual programming, you must create a server-side respectively, application and a client application, both applications have their own Winsock control, respectively. First set the Winsock control protocol used, here we use the TCP protocol. Now, let's start with the VB to create two procedures, one client program myclient, the other is server-side program myserver.

Second, write the client program

First of all, to build client myclient. In myclient process a form, load the Winsock control, called tcpclient, that the use of the TCP protocol, then add two text boxes (text1 and text2), used to enter the server's IP address and port number, and then establish a button (cd1), used to establish a connection, click on the link following can be initialized, the code is as follows:


private sub cd1_click ()

tcpclient.romotehost = text1.text

tcpclient.romoteport = val (text2.text)''port number, default 1001

tcpclient.connect''call the connect method, and specify the IP address of the computer to connect

cd1.enabled = false

end sub

After the connection is how to deal with the problem of data received. Client and server-side connection is established, if there is any new data received at one end, it will trigger the end of winsock control dataarrival event, in response to this event, you can use the getdata sent to the data obtained. Example, in tcpclient the dataarrival event code as follows:
private sub tcpclient_dataarrival (byval bytestotal as long)

dim x as string

tcpclient.getdata x''use getdata be sent to the data

.......

End sub

Behind the omission of some of the received data that the specific treatment, the reader can actually prepare.

Third, write server-side program

First create a form, load the Winsock control, known as tcpserver. Also on the form to add a text box text1 used to display the IP address of the client and client to send over the data.

When the client is running, the client program press the Connect button, the client-side application to request connection to the server, then server-side De connectionrequest Shi Jian Pi Chu Fa, Suo Yi server-side program to 解决 connection problem, use the event to complete Ci connectionrequest function. Code:
''In the form load event to initialize the control on the tcpserver

private sub form_load ()

tcpserver.localport = 1001

tcpserver.listen''put the server monitor test status

end sub

''Server receives the client's connection request, first check the current status is in connection closed

Private sub tcpclient_connectionrequest (Byval requestID as long)

If tcpserver.state <> sckclosed then''Check whether the control of the state property of closed

Tcpserver.close''

Tcpserver.accept requestID''

End if

End sub

Now we are in the server-side program tcpserver's dataarrival event add the following code to enable server-side program can receive the client side command, and run the corresponding program.

Fourth, test the remote control program

Now, you can run these two procedures were used in both TCP / IP protocol networked machine. The client side you press the Connect button, and enter "c: mmand.com", you can see the server side immediately open a DOS window, imagine, if it is running a number of destructive command what will happen? This is a basic remote control program. Of course, the real hack is much more complex, but the basic principle is the same. Now you understood why now?