Active Mode Port Script

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Keeper
Posts: 7
Joined: 2003-01-09 20:05

Active Mode Port Script

Post by Keeper » 2003-01-09 21:25

Looking for a script that will display the port number a person is using in active mode :) Any help would be appreciated, thanks.

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-01-09 21:52

i have a DataPolice,
it is probably not what you want,
but is has helped some users with difficulties to connect:
http://wza.digitalbrains.com/users/walt ... ice.script
it checks if the ConnectToMe IP is the same as the user's ip,
and disconnects the user with a (Dutch, I'm sorry) pm.
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-01-09 22:15

ah, you mean in response to this:
http://dcplusplus.sourceforge.net/forum ... .php?t=163

you'd need a script that enumerates all users and sends them a RevConnectToMe
this is not hard... but I'm seriously doubting the usefulness
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-10 07:06

you could have a script checking the searches and connection attempts as they come, and pop up a warning to the user when you encounter a bad port..

Code: Select all

Sub DataArival (curUser, sCurData)
If instr(1,sCurData, "$ConnectToMe ") then
  sPort = afterlast(sCurData, ":")
  if sPort = "1412" then 
    curUser.Privatemessage "Portcheck", "Message here"
  end if
  if sPort = "412" then 
    curUser.Privatemessage "Portcheck", "Message here"
  end if
end if
End Sub

Function AfterLast(sFrom, sAfterLast)
    If InStr(1, sFrom, sAfterLast) Then
        AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1))
    Else
        AfterLast = ""
    End If
End Function
this should work, and a similar check could be done with the "$Search" if there is a IP in it..
havent tested this, though, wrote it on the fly, correct if needed
and remember this might be really annoying! haha

Keeper
Posts: 7
Joined: 2003-01-09 20:05

Post by Keeper » 2003-01-10 18:27

Thanks aDe, I'm thinking of just making one that will kick them, not ban, but kick stating the reason why and how to go about changing their port so they can connect again.

Code: Select all

Sub NewUserConnected(curUser)
    curUser.SendData "$RevConnectToMe " & CStr(sBotName) & " " & CStr(curUser.sName) 
End Sub



Sub DataArival (curUser, sCurData) 
If instr(1,sCurData, "$ConnectToMe ") then 
sPort = afterlast(sCurData, ":") 
  
  if sPort = "1412" then 
	  curUser.SendChatMessage cstr(ThisBotsName), "YOUR MESSAGE HERE"
	  frmHub.DoEventsForMe
	  curUser.Disconnect
  end if 
  if sPort = "412" then 
	  curUser.SendChatMessage cstr(ThisBotsName), "YOUR MESSAGE HERE"
	  frmHub.DoEventsForMe
	  curUser.Disconnect
  end if 
end if 
End Sub 

Function AfterLast(sFrom, sAfterLast) 
    If InStr(1, sFrom, sAfterLast) Then 
        AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1)) 
    Else 
        AfterLast = "" 
    End If 
End Function
I can either force it that way, or set a timer to go off every hour, reminding them that in so many days, we we are going to not allow connections on those ports at all. Maybe have both sets of code in there, hard code a date in, and it will just auto start not letting them connect on the appropriate day :)

Keeper
Posts: 7
Joined: 2003-01-09 20:05

Post by Keeper » 2003-01-10 20:15

Final version, you can edit this however you like...

Code: Select all

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Global Variables                                                                                                      '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim sBotName
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''





''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Main Sub                                                                                                              '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Main()
	sBotName = "AntiPort"     ' <- name of the bot
frmHub.RegisterBotName(CStr(sBotName))
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''





''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Data Arival                                                                                                           '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub DataArival (curUser, sCurData) 
dim sPort
	If instr(1,sCurData, "$ConnectToMe ") Then
		sPort = AfterLast(scurdata, ":")
		If sPort = "1412" Then 
			curUser.SendChatMessage cstr(sBotName), "You attempted to connect under a banned port:  1412   You must change your active port to something other than 412 or 1412""
			MessageOps curUser.sName, 2
			frmHub.DoEventsForMe
			curUser.Disconnect
		End If 
		If sPort = "412" Then 
			curUser.SendChatMessage cstr(sBotName), "You attempted to connect under a banned port:  412   You must change your active port to something other than 412 or 1412"
			MessageOps curUser.sName, 1
			frmHub.DoEventsForMe
			curUser.Disconnect
		End If 
	End If 
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''




''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'New User Connected                                                                                                    '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub NewUserConnected(curUser)
	Dim sCommand
	sCommand = "$RevConnectToMe " & curUser.sName & " " & sBotName
	curUser.SendData Cstr(sCommand) 
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Op Connected                                                                                                          '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OpConnected(curUser)
	Call NewUserConnected(curUser)
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''




''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Message Op's                                                                                                          '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function MessageOps(sUserName, iMessage)
	Dim sOpText
	Dim sAdminList
	Dim aNicks, sNick
	
	sAdminList = "OP1:OP2:OP3" ' <--  Enter who you want to view, replace OP1/OP2/OP3 with the usernames, more a!!
	
	If iMessage = 1 Then
		sOpText = Now() & "  " & sUserName & "  was connected under invalid port number 412"
	Elseif iMessage = 2 Then
		sOpText = Now() & "  " & sUserName & "  was connected under invalid port number 1412"
	Elseif iMessage = 3 Then
		sOpText = Now() & "  " & sUserName & "  blank :)"
	Elseif iMessage = 4 Then
		sOpText = Now() & "  " & sUserName & "  blank :)"
	Else
		sOpText = Now() & "  " & "WOW, Something if fucked up in the script"
	End If
	
	aNicks = Split(sAdminList, ":")
	For Each sNick In aNicks
		If colUsers.Online(CStr(sNick)) Then
			Set tmpUser = colUsers.ItemByName(CStr(sNick))
			tmpUser.PrivateMessage CStr(sBotName), CStr(sOpText)
			frmHub.DoEventsForMe
		End If
	Next
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''






''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Helper Functions                                                                                                      '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function BeforeFirst(sIn, sFirst)
	BeforeFirst = Left(sIn, InStr(1, sIn, sFirst) - 1)
End Function

Function AfterFirst(sIn, sFirst)
	AfterFirst = Right(sIn, Len(sIn) - InStr(1, sIn, sFirst) - (Len(sFirst) - 1))
End Function

Function isCommand(sData)
	isCommand = (Left(sData,1)="$")
End Function

Public Function AfterLast(sFrom, sAfterLast)
	If InStr(1, sFrom, sAfterLast) Then
		AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1))
	Else
		AfterLast = ""
	End If
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Hope it helps some of you. I tested this out and it was working before posting :)

Locked