frmMenu.frm
资源名称:FireWall.rar [点击查看]
上传用户:yinyu8822
上传日期:2021-04-28
资源大小:79k
文件大小:3k
源码类别:
防火墙与安全工具
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frmMenu
- Caption = "防火墙"
- ClientHeight = 345
- ClientLeft = 165
- ClientTop = 735
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 345
- ScaleWidth = 4680
- StartUpPosition = 3 '窗口缺省
- Begin VB.Menu mnuMain
- Caption = "mnuMain"
- Begin VB.Menu mnuOpen
- Caption = "打开(&O)"
- End
- Begin VB.Menu mnuSep
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "退出(&x)"
- End
- End
- Begin VB.Menu mnuConn
- Caption = "mnuConn"
- Begin VB.Menu mnuDis
- Caption = "断开连接(非阻止)"
- End
- Begin VB.Menu mnuSep2
- Caption = "-"
- End
- Begin VB.Menu mnuBlockAll
- Caption = "阻止所有"
- End
- Begin VB.Menu mnuBlockIP
- Caption = "阻止IP"
- End
- Begin VB.Menu mnuBlockRP
- Caption = "阻止远程端口"
- End
- Begin VB.Menu mnuBlockLP
- Caption = "阻止本地端口"
- End
- End
- End
- Attribute VB_Name = "frmMenu"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 'Download by http://www.codefans.net
- Private Sub mnuBlockAll_Click()
- BlockList True, True, True
- End Sub
- Private Sub mnuBlockIP_Click()
- BlockList True, False, False
- End Sub
- Private Sub mnuBlockLP_Click()
- BlockList False, False, True
- End Sub
- Private Sub mnuBlockRP_Click()
- BlockList False, True, False
- End Sub
- Private Sub mnuDis_Click()
- Dim tcpt As MIB_TCPTABLE
- Dim l As Long
- Dim i As Long
- Dim RemA As String, RemP As String, LocP As String
- i = Right(frmMain.ListView1.SelectedItem.key, Len(frmMain.ListView1.SelectedItem.key) - 1) + 1
- RemA = frmMain.ListView1.ListItems(i)
- RemP = frmMain.ListView1.ListItems(i).SubItems(1)
- LocP = frmMain.ListView1.ListItems(i).SubItems(2)
- l = Len(MIB_TCPTABLE)
- GetTcpTable tcpt, l, 0
- tcpt.table(i - 1).dwState = 12
- SetTcpEntry tcpt.table(i - 1)
- DoEvents
- Log RemA, RemP, LocP, "disconnected connection (no block)"
- End Sub
- Private Sub mnuExit_Click()
- frmWarnExit.Show
- End Sub
- Private Sub mnuOpen_Click()
- If frmMain.WindowState = 0 Then
- frmMain.Show
- frmMain.WindowState = 0
- Else
- frmMain.Show
- SetFGWindow frmMain.hwnd, True
- End If
- End Sub
- Public Function BlockList(ra As Boolean, rp As Boolean, lp As Boolean)
- Dim i As Long
- Dim RemA As String, RemP As String, LocP As String
- i = Right(frmMain.ListView1.SelectedItem.key, Len(frmMain.ListView1.SelectedItem.key) - 1) + 1
- RemA = frmMain.ListView1.ListItems(i)
- RemP = frmMain.ListView1.ListItems(i).SubItems(1)
- LocP = frmMain.ListView1.ListItems(i).SubItems(2)
- If ra Then modReg.bSetRegValue HKEY_LOCAL_MACHINE, SREG & "blockip", RemA, "1"
- If rp Then modReg.bSetRegValue HKEY_LOCAL_MACHINE, SREG & "blockrp", RemP, "1"
- If lp Then modReg.bSetRegValue HKEY_LOCAL_MACHINE, SREG & "blocklp", LocP, "1"
- frmMain.RefreshTable True
- Log RemA, RemP, LocP, "blocked all"
- End Function