by xyr0x (7 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 31st January 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)
i-r0x Port Blocker 1.0 is an excellent way to filter unwanted domains from connecting to your IP, from congested Torrent trackers, websites,
API Declarations
'module to call application to stay ontop
Option Explicit
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const HWND_NOTOPMOST = -2
Public Const LB_ITEMFROMPOINT = &H1A9
Public Declare Function Setwindowpos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Function SetWinPos(iPos As Integer, lHWnd As Long) As Boolean
Dim lwinpos As Long
iPos = 1
Select Case iPos
Case 1
lwinpos = HWND_TOPMOST
End Select
If Setwindowpos(lHWnd, lwinpos, 0, 0, 0, 0, SWP_NOMOVE _
+ SWP_NOSIZE) Then
SetWinPos = True
End If
End Function
'Language: Visual Basic 6.0
'Written: Jan 9th 2006
'Copyright: xyr0x security
'Terms of Use: If you use this, please give me credit.
'(Note that I'm open to sharing more of my opensrc for the members)
'I've commented most the procedures which aren't obviously understood, 'this code is intermediate within socket structuring
'WEBSITES: www.informationleak.net , www.sacred-hacks.net , 'www.concealed-defense.com
'This calls the SetwindowPos (Postition library to stay ontop "Always"
Private Declare Function Setwindowpos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'Dimention the StrData (StringData)
Dim strData As String
'Dimention the listening procedure as Boolean
Dim listening As Boolean
Private Sub Command1_Click()
On Error Resume Next
'if list is empty sports a msgbox with the input port this is used to get around a crash error.
If List1.Text = "" Then
'the msgbox
MsgBox ("Please Input a Port!")
'Error Handling the routine
Else
'if true then does the following, it listens on loaded ports in list1
listening = True
'Put winsock in a Loop...
For i = 0 To List1.ListCount - 1
Load Winsock1(i + 1)
Winsock1(i + 1).LocalPort = List1.List(i)
Winsock1(i + 1).Listen
Next i
'loads info into the Text2 field.
Text2.Text = "Port Blocker :: Activated" & vbCrLf & "-------------------------------" & vbCrLf & vbCrLf
'MsgBox "Port Blocker :: Activated", vbInformation, "i-r0x Port Blocker"
'will disable the command1 from being enabled again. I didn't use this...
'Command1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
'On Err GoTo Err
On Error Resume Next
If Text3 = "" Then
MsgBox ("Please Input a Port!")
Else
List1.AddItem Text3.Text
Text3.Text = ""
If listening = True Then
i = Winsock1.ubound + 1
Load Winsock1(i)
Winsock1(i).LocalPort = List1.List(i - 1)
Winsock1(i).Listen
'Else
'If Err Then
'Err: MsgBox "Address Already In Use!"
'End If
End If
End If
End Sub
'Clear List
Private Sub Command3_Click()
List1.Clear
End Sub
'Cmndlg32 Save List.
Private Sub Command4_Click()
Dim item As String
With CommonDialog1
.Filter = "Text Files(*.txt)|*.txt"
.FilterIndex = 2
.CancelError = True
On Error GoTo ErrHandler
.ShowOpen
Open .FileName For Input As #3
Do While Not EOF(3)
Line Input #3, item
If Len(item) > 0 Then
List1.AddItem item
End If
Loop
Close #3
End With
Exit Sub
ErrHandler:
Exit Sub
End Sub
'Cmndlg32 Open List.
Private Sub Command5_Click()
Dim item As String
With CommonDialog2
.Filter = "Text Files(*.txt)|*.txt"
.FilterIndex = 2
.CancelError = True
On Error GoTo ErrHandler
.ShowSave
Open .FileName For Output As #3
Dim Index As Integer
For Index = 0 To List1.ListCount - 1
item = List1.List(Index)
Print #3, item
Next Index
Close #3
Exit Sub
End With
ErrHandler:
End Sub
'Cmndlg32 Remove single port from List.
Private Sub Command6_Click()
On Error Resume Next
If List1.ListIndex < 0 Then
Exit Sub
'If List1.Text = "" Then
'MsgBox "You must Select a Port to be removed!", vbExclamation, "i-r0x Port Blocker 1.0 Beta"
Else
List1.RemoveItem List1.ListIndex
End If
'End If
End Sub
Private Sub Form_Load()
Text2.Text = "i-r0x Port Blocker Loaded!" & vbCrLf & "Programmer: xyr0x" & vbCrLf & "-------------------------------" & vbCrLf & vbCrLf
'Dim xyr0x, for SetWinPos
Dim xyr0x As Boolean
'sets window postition to Top
If PortBlocker.Enabled Then
xyr0x = SetWinPos(1, Me.hwnd)
End If
End Sub
'Keeps the Text2 from garbling the text2 field, and scrolls with the object
Private Sub Text2_Change()
Text2.SelLength = Len(Text2)
End Sub
'Log the connection, deny request of intrusion...
Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Winsock1(Index).Close
Winsock1(Index).Accept requestID
Text2.Text = "Intrusion Blocked: " & Winsock1(Index).RemoteHostIP & vbCrLf
Beep
Winsock1(Index).Close
Winsock1(Index).LocalPort = List1.List(Index - 1)
Winsock1(Index).Listen
End Sub
'Get Data of Remote attack attempt, The packets, and IP(s)
Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strData As String
Winsock1(Index).GetData strData, vbString
Text2.Text = Text2.Text & strData & vbCrLf
End Sub
'put winsock to close, when unloaded, and if listening is on and new ports are added...
Private Sub Winsock1_Disconnect(j As Integer)
For j = 0 To Winsock1.ubound
Winsock1(j).Close
Next j
End Sub
No comments have been posted about i-r0x Port Blocker 1.0 is an excellent way to filter unwanted domains from connecting to your IP, f. Why not be the first to post a comment about i-r0x Port Blocker 1.0 is an excellent way to filter unwanted domains from connecting to your IP, f.