Author Topic: Connection Deny  (Read 3143 times)

0 Members and 1 Guest are viewing this topic.

Offline ArtificialInsanety

  • Junior Member
  • **
  • Posts: 23
  • Karma: +7/-1
Connection Deny
« on: 09 February, 2009, 21:15:43 »
Hi , I need a script convertion and I need it to block client if connection type isn't in the list. ty
Code: [Select]
-- ConDeny
-- Made by Madman
-- Request by Helios
 
Bot = "ConDeny"
Action = 1 -- 1 = disconnect, 2 = timeban, 3 = redirect
TimeBanTime = 5 -- Minutes to timeban
RedirAddres = "myotherhub.org" -- addy to redirect to
Msg = "Your connection type is not allowed in this hub" -- msg to send
Owner = "Madman"
informOwn = 1 -- if 1, pm owner about connetion not in table
 
-- 1 = Allow, 0 = Deny
Connection = {
["28.8Kbps"] = 1,
["33.6Kbps"] = 1,
["56Kbps"] = 1,
["ISDN"] = 1,
["Satellite"] = 1,
["Cable"] = 1,
["DSL"] = 1,
["LAN(T1)"] = 1,
["LAN(T3)"] = 1,
}
 
function NewUserConnected(curUser)
if Connection[curUser.sConnection] == 0 then
if Action == 1 then
curUser:SendData(Bot,Msg)
curUser:Disconnect()
elseif Action == 2 then
curUser:SendData(Bot,Msg)
curUser:TimeBan(TimeBanTime)
elseif Action == 3 then
curUser:Redirect(RedirAddress,Msg)
end
elseif Connection[curUser.sConnection] == nil then
if informOwn == 1 then
SendPmToNick(Owner,frmHub:GetHubBotName(), curUser.sName.. " logged in with an connetion that aren't in the Connnetion table. His/Hers connetion is -->" ..curUser.sConnection.. "<--")
end
end
end

PtokaX forum

Connection Deny
« on: 09 February, 2009, 21:15:43 »

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Connection Deny
« Reply #1 on: 10 February, 2009, 18:54:23 »
Code: [Select]
-- ConDeny 2.0
-- Made by Madman
-- Request by Helios
-- Converted to API 2 by Madman
-- Requested by ArtificialInsanety

Bot = "ConDeny"
Action = 1 -- 1 = disconnect, 2 = timeban, 3 = redirect
TimeBanTime = 5 -- Minutes to timeban
RedirAddres = "myotherhub.org" -- addy to redirect to
Msg = "Your connection type is not allowed in this hub" -- msg to send
Owner = "Madman"
informOwn = true -- if true, pm owner about connetion not in table

-- true = Deny, false = Allow
Connection = {
["28.8Kbps"] = false,
["33.6Kbps"] = false,
["56Kbps"] = false,
["ISDN"] = false,
["Satellite"] = false,
["Cable"] = false,
["DSL"] = false,
["LAN(T1)"] = false,
["LAN(T3)"] = false,
}

function UserConnected(user)
Core.GetUser(user,4)
if Connection[user.sConnection] then
if Action == 1 then
Core.SendToUser(user,"<" ..Bot.. "> " ..Msg)
Core.Disconnect(user)
elseif Action == 2 then
BanMan.TempBan(user,TimeBanTimer,Msg,Bot,false)
elseif Action == 3 then
Core.Redirect(user,RedirAddress,Msg)
end
elseif (Connection[user.sConnection] == nil) and informOwn then
Core.SendPmToNick(Owner,SetMan.GetString(21),user.sNick.. " logged in with an connection that aren't in the Connection table. His/Hers connection is -->" ..user.sConnection .. "<--")
end
end

I only converted it...
What do you mean by block?
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Offline ArtificialInsanety

  • Junior Member
  • **
  • Posts: 23
  • Karma: +7/-1
Re: Connection Deny
« Reply #2 on: 11 February, 2009, 09:13:35 »
Thanks for the conversion.I need it to block(don't allow user to connect to hub without connection - some dc client with proxy does that).I think its related to its myinfo sent to hub, hope u know what i mean.

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Connection Deny
« Reply #3 on: 11 February, 2009, 09:44:02 »
Blocking proxys are a completly diffrent thing

This script blocks Connections, that are set in the client. It dosent read proxys at all.
I think there is a script to block proxys, don't rember it's name tho
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Offline ArtificialInsanety

  • Junior Member
  • **
  • Posts: 23
  • Karma: +7/-1
Re: Connection Deny
« Reply #4 on: 11 February, 2009, 17:05:03 »
I know what this script does , all i'm asking is to make it to block client if no connection is sent.I already have script that blocks proxys(socks5).

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: Connection Deny
« Reply #5 on: 11 February, 2009, 19:10:13 »
Code: [Select]
-- ConDeny 2.0
-- Made by Madman
-- Request by Helios
-- Converted to API 2 by Madman
-- Requested by ArtificialInsanety
-- Added Action execution on 'empty' connection by CrazyGuy

Bot = "ConDeny"
Action = 1 -- 1 = disconnect, 2 = timeban, 3 = redirect
TimeBanTime = 5 -- Minutes to timeban
RedirAddres = "myotherhub.org" -- addy to redirect to
Msg = "Your connection type is not allowed in this hub" -- msg to send
Owner = "Madman"
informOwn = true -- if true, pm owner about connetion not in table

-- true = Deny, false = Allow
Connection = {
["28.8Kbps"] = false,
["33.6Kbps"] = false,
["56Kbps"] = false,
["ISDN"] = false,
["Satellite"] = false,
["Cable"] = false,
["DSL"] = false,
["LAN(T1)"] = false,
["LAN(T3)"] = false,
}

function UserConnected(user)
Core.GetUser(user,4)
if (user.sConnection == nil) or (Connection[user.sConnection] == true) then
if Action == 1 then
Core.SendToUser(user,"<" ..Bot.. "> " ..Msg)
Core.Disconnect(user)
elseif Action == 2 then
BanMan.TempBan(user,TimeBanTimer,Msg,Bot,false)
elseif Action == 3 then
Core.Redirect(user,RedirAddress,Msg)
end
elseif (user.sConnection) and (Connection[user.sConnection] == nil) and (informOwn) then
Core.SendPmToNick(Owner,SetMan.GetString(21),user.sNick.. " logged in with an connection that aren't in the Connection table. His/Hers connection is -->" ..user.sConnection .. "<--")
end
end

Offline ArtificialInsanety

  • Junior Member
  • **
  • Posts: 23
  • Karma: +7/-1
Re: Connection Deny
« Reply #6 on: 11 February, 2009, 20:18:03 »
I get this right after I load the script
Code: [Select]
Syntax H:\dchub\hub\scripts\condeny.lua:30: bad argument #1 to 'GetUser' (string expected, got table)

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: Connection Deny
« Reply #7 on: 11 February, 2009, 21:13:31 »
I get this right after I load the script
Code: [Select]
Syntax H:\dchub\hub\scripts\condeny.lua:30: bad argument #1 to 'GetUser' (string expected, got table)

You must have had that problem before, as I didn't change anything that has to do with GetUser.

EDIT: Clearly you didn't try Madmans code, as the problem was in there (GetUser vs GetUserData ;))
Below code fixed.
Code: [Select]
-- ConDeny 2.0
-- Made by Madman
-- Request by Helios
-- Converted to API 2 by Madman
-- Requested by ArtificialInsanety
-- Added Action execution on 'empty' connection by CrazyGuy

Bot = "ConDeny"
Action = 1 -- 1 = disconnect, 2 = timeban, 3 = redirect
TimeBanTime = 5 -- Minutes to timeban
RedirAddres = "myotherhub.org" -- addy to redirect to
Msg = "Your connection type is not allowed in this hub" -- msg to send
Owner = "Madman"
informOwn = true -- if true, pm owner about connetion not in table

-- true = Deny, false = Allow
Connection = {
["28.8Kbps"] = false,
["33.6Kbps"] = false,
["56Kbps"] = false,
["ISDN"] = false,
["Satellite"] = false,
["Cable"] = false,
["DSL"] = false,
["LAN(T1)"] = false,
["LAN(T3)"] = false,
}

function UserConnected(user)
Core.GetUserData(user,4)
if (user.sConnection == nil) or (Connection[user.sConnection] == true) then
if Action == 1 then
Core.SendToUser(user,"<" ..Bot.. "> " ..Msg)
Core.Disconnect(user)
elseif Action == 2 then
BanMan.TempBan(user,TimeBanTimer,Msg,Bot,false)
elseif Action == 3 then
Core.Redirect(user,RedirAddress,Msg)
end
elseif (user.sConnection) and (Connection[user.sConnection] == nil) and (informOwn) then
Core.SendPmToNick(Owner,SetMan.GetString(21),user.sNick.. " logged in with an connection that aren't in the Connection table. His/Hers connection is -->" ..user.sConnection .. "<--")
end
end
/code]
« Last Edit: 11 February, 2009, 21:49:14 by CrazyGuy »

Offline ArtificialInsanety

  • Junior Member
  • **
  • Posts: 23
  • Karma: +7/-1
Re: Connection Deny
« Reply #8 on: 13 February, 2009, 19:49:38 »
Thanks :)

PtokaX forum

Re: Connection Deny
« Reply #8 on: 13 February, 2009, 19:49:38 »