流量精灵自动刷新程序(附源码)
今天在花七七's 部落格发现一个刷流量的好东西——流量精灵
流量精灵运行后系统资源消耗比较大,想了一个方法解放自己的电脑,那就是强制结束进程,每隔10分钟左右重启一次
于是便有了这个自动控制脚本,方便使用
这个压缩包中包括了花七七的去广告流量精灵和我写的脚本,解压缩后放在同一个文件夹下运行就可以了,一定要注意:调整好时间间隔,不然流量会中断。另外,文件名不能修改,否则会出错,需要修改文件名的话把源码修改一下重新编译。
点击下载此文件 (压缩包中有两个控制方法,一个CMD的,一个EXE的,无毒无害源码附在最后)
原理是周期性的开启和关闭流量精灵,比如打开两分钟关闭两分钟。这样可以节约本地资源,同时还不影响流量。
CMD这个是通过调用EXE程序,也就是间接的调用了TerminateProcess()这个函数,这个方法貌似比较完善。直接运行这个CMD脚本就可以了,无视那个EXE,因为EXE仅仅是个接口。
EXE这个是用VB做的简易的小程序,调用的TerminateProcess()这个函数结束进程。TerminateProcess()函数结束进程时,被结束的进程不会得到通知,这样就不会给他做收尾工作的机会。通过测试发现,下次恢复流量精灵进程后,运行状态和结束前完全一样,网址状态依然是“在线”,这个EXE程序仅仅是提供了一个API,必须配合CMD使用。
来得瑟一下今日战果
运行了一段时间,效果图,流量没有中断:
程序源码:(写的比较匆忙,如有BUG欢迎批评指正)
ASP/Visual Basic代码
- Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
- Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
- Private Const SYNCHRONIZE = &H100000
- Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
- Private Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
- Private Declare Function NtSuspendProcess Lib "ntdll.dll" (ByVal hProc As Long) As Long
- Private Declare Function NtResumeProcess Lib "ntdll.dll" (ByVal hProc As Long) As Long
- Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
- Private hProcess As Long
- Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
- Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
- Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
- Private Type PROCESSENTRY32
- dwSize As Long
- cntUsage As Long
- th32ProcessID As Long
- th32DefaultHeapID As Long
- th32ModuleID As Long
- cntThreads As Long
- th32ParentProcessID As Long
- pcPriClassBase As Long
- dwFlags As Long
- szExeFile As String * 1024
- End Type
- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Const TH32CS_SNAPHEAPLIST = &H1
- Const TH32CS_SNAPPROCESS = &H2
- Const TH32CS_SNAPTHREAD = &H4
- Const TH32CS_SNAPMODULE = &H8
- Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
- Const TH32CS_INHERIT = &H80000000
- Public pid As Long
- Public pname As String
- Public a As String
- Public EXEPath As String
- Public TimerCount As Long
- Public CMDCaption As Long
- Public ResumeTimer As Long
- Public TerminateTimer As Long
- Public TotalCount As Long
- Public Sub cmdTerminate()
- a = Trim(LCase(EXEPath))
- Dim my As PROCESSENTRY32
- Dim l As Long
- Dim l1 As Long
- Dim flag As Boolean
- Dim mName As String
- Dim i As Integer
- l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
- If l Then
- my.dwSize = 1060
- End If
- If (Process32First(l, my)) Then
- Do
- i = InStr(1, my.szExeFile, Chr(0))
- mName = LCase(Left(my.szExeFile, i - 1))
- If mName = a Then
- pid = my.th32ProcessID
- End If
- If hProcess Then
- TerminateProcess hProcess, 0
- Else
- If IsNumeric(pid) Then
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, CLng(pid))
- If hProcess <> 0 Then
- TerminateProcess hProcess, 0
- End If
- End If
- End If
- Loop Until (Process32Next(l, my) < 1)
- End If
- End Sub
- Private Sub cmdResume()
- a = Trim(LCase(EXEPath))
- Dim my As PROCESSENTRY32
- Dim l As Long
- Dim l1 As Long
- Dim flag As Boolean
- Dim mName As String
- Dim i As Integer
- l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
- If l Then
- my.dwSize = 1060
- End If
- If (Process32First(l, my)) Then
- Do
- i = InStr(1, my.szExeFile, Chr(0))
- mName = LCase(Left(my.szExeFile, i - 1))
- If mName = a Then
- pid = my.th32ProcessID
- End If
- If IsNumeric(pid) Then
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, CLng(pid))
- If hProcess <> 0 Then
- NtResumeProcess hProcess
- End If
- End If
- Loop Until (Process32Next(l, my) < 1)
- End If
- End Sub
- Private Sub Command1_Click()
- ExePath = "lljl.exe"
- ResumeTimer = Int(Text1.Text)
- TerminateTimer = Int(Text2.Text)
- TotalCount = TerminateTimer + ResumeTimer
- If CMDCaption = 0 Then
- CMDCaption = 1
- Command1.Caption = "停止"
- TimerCount = 0
- Timer1.Interval = 60000
- Timer1.Enabled = True
- Else
- CMDCaption = 0
- Command1.Caption = "开始"
- Timer1.Enabled = False
- End If
- End Sub
- Private Sub Form_Load()
- Me.Show
- ShellExecute 0, "open", "www.izhuyue.com", "", "", 1
- TimerCount = 0
- Timer1.Interval = 60000
- Timer1.Enabled = False
- CMDCaption = 0
- End Sub
- Private Sub Timer1_Timer()
- TimerCountTimerCount = TimerCount + 1
- If TimerCount = ResumeTimer Then
- Call cmdTerminate
- End If
- If TimerCount = TotalCount Then
- Call cmdResume
- TimerCount = 0
- End If
- End Sub
下载链接已失效
对啊、现在木有了= =话说预备重现啊……
'O' is not recognized as an internal or external command,
operable program or batch file.
囧、怎么来这东西的?
囧、好像挺有用的啊!
噢= =木有,原来换一个思路了,把进程挂起了!
图片好像挂了?
我现在一整天下来能刷4000IP到百度搜索结果,不知道这样能刷多少、今晚试试
这样做效率不知道有多少,但是怎么也要支持一下