PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: MrCain on 07 April, 2007, 15:42:55

Title: Anti Fake Share Script
Post by: MrCain on 07 April, 2007, 15:42:55
Hi, i have a lot of fakers in the hub . I already use the Fake Share script made by Muther. But i have added already like a 100 more to the script but the wankers are still comming with a other fake share amount...... is there a way that the script is automaticly adding the new ones?? Or a function like in DCDM that al shares with a number of zeros are also blocked from the hub? I used the client version but that didnt worked that well... Anyway : please can anybody help me with this proplem.

Regards,

MrCain
Title: Re: Anti Fake Share Script
Post by: MrCain on 07 April, 2007, 20:20:21
First of all : sorry i spelled youre name wrong....im very sorry for that...i will go further through life as MrShame...... ;D

Anyway ,the script is working fantastic dude!!!! Respect ,i really mean that!


I will post my collection of fake share i collected in 1 month (!)
Maybe others are helped with it.

BadShare = {
[1] = 10000000000,
[2] = 5368709120,
[3] = 10737418240,
[4] = 13630010000,
[5] = 16106127360,
[6] = 21474836480,
[7] = 26843545600,
[8] = 27000000000,
[9] = 32212254720,
[10] = 7970010000,
[11] = 37580963840,
[12] = 37970010000,
[13] = 6599201000000,
[14] = 65992010000000,
[15] = 36772010000000,
[16] = 3677201000000,
[17] = 42949672960,
[18] = 48318382080,
[19] = 214266156265,
[20] = 53687091200,
[21] = 59055800320,
[22] = 1747201000000,
[23] = 16772010000000,
[24] = 147720100000000,
[25] = 10240000000000,
[26] = 64424509440,
[27] = 65719010000,
[28] = 69793218560,
[29] = 75161927680,
[30] = 80530636800,
[31] = 85899345920,
[32] = 91268055040,
[33] = 96636764160,
[34] = 102005473280,
[35] = 102400000000,
[36] = 107374182400,
[37] = 118648471552,
[38] = 128849018880,
[39] = 140301549174,
[40] = 161061273600,
[41] = 174720100000,
[42] = 183287729356,
[43] = 214748364800,
[44] = 268435456000,
[45] = 322122547200,
[46] = 375809638400,
[47] = 397760100000,
[48] = 429496729600,
[49] = 536870912000,
[50] = 657190100000,
[51] = 1024000000000,
[52] = 183287729357,
[53] = 102392020337,
[54] = 13625783747,
[55] = 174719269601,
[56] = 65712999629,
[57] = 26993869455,
[58] = 140295106724,
[59] = 21171699199,
             [60] = 38492561408,
             [61] = 39051993934,
             [62] = 42949672960,
             [63] = 438086654400,
             [64] = 44171435392,
      [65] = 55104430407,
      [66] = 63337526819,
      [67] = 66947802726,
      [68] = 86949673012,
      [69] = 166430355311,
      [70] = 715112427375,
      [71] = 111669147200,
      [72] = 158913786400,
      [73] = 171798688000,
      [74] = 18552221398,
      [75] = 203000004669,
      [76] = 23195309186,
      [77] = 270582933600,
      [78] = 32577036319,
      [79] = 36600541184,
      [80] = 98965856458,
      [81] = 111111111111,
      [82] = 1357822319300,
      [83] = 20000000000,
      [84] = 21000000000,
      [85] = 23000000000,
      [86] = 24000000000,
      [87] = 25000000000,
      [88] = 26000000000,
      [89] = 27000000000,
      [90] = 28000000000,
      [91] = 29000000000,
      [92] = 30000000000,
      [93] = 31000000000,
      [94] = 32000000000,
      [95] = 33000000000,
      [96] = 34000000000,
      [97] = 35000000000,
      [98] = 36000000000,
      [99] = 37000000000,
      [100] = 97500000000,
      [101] = 96000000000,
      [102] = 36457547474,
      [103] = 175446786545,
      [104] = 98000000000,
      [105] = 99000000000,
      [106] = 231274144532,
      [107] = 97000000000,
      [108] = 10100000000,
      [109] = 10200000000,
      [110] = 10300000000,
      [111] = 10400000000,
      [112] = 10500000000,
      [113] = 10600000000,
      [114] = 10700000000,
      [115] = 10800000000,
      [116] = 10900000000,
      [117] = 11000000000,
      [118] = 11100000000,
      [119] = 11200000000,
      [120] = 11300000000,
      [121] = 11400000000,
      [122] = 11500000000,
      [123] = 11600000000,
      [124] = 11700000000,
      [125] = 11800000000,
      [126] = 11900000000,
      [127] = 12000000000,
      [128] = 12100000000,
      [129] = 12200000000,
      [130] = 12300000000,
      [131] = 12400000000,
      [132] = 12500000000,
      [133] = 12600000000,
      [134] = 12700000000,
      [135] = 12800000000,
      [136] = 12900000000,
      [137] = 13000000000,
      [138] = 13100000000,
      [139] = 13200000000,
      [140] = 13300000000,
      [141] = 13400000000,
      [142] = 13500000000,
      [143] = 13600000000,
      [144] = 13700000000,
      [145] = 13800000000,
      [146] = 13900000000,
      [147] = 14000000000,
      [148] = 14100000000,
      [149] = 14200000000,
      [150] = 14300000000,
      [151] = 14400000000,
      [152] = 14500000000,
      [153] = 14600000000,
      [154] = 14700000000,
      [155] = 14800000000,
      [156] = 14900000000,
      [157] = 15000000000,
      [158] = 58456382732,
      [159] = 500000000000,
      [160] = 600000000000,
      [161] = 150000000000,
      [162] = 241658435135,
      [163] = 99998798978,
      [164] = 80000000000,
      [165] = 124512321454,
      [166] = 89889977882,
      [167] = 67954123542,
      [168] = 185462541585,
      [169] = 65564546848,
      [170] = 104108657128,
      [171] = 241658435135,
      [172] = 111221111111,
      [173] = 125999999999,
      [174] = 980980980999,
      [175] = 60000000000,
      [176] = 119991004860,
      [177] = 39443158311455,
      [178] = 123456789235,
      [179] = 80245791301,
      [180] = 144174134841,
      [181] = 856258542542,
      [182] = 122222222222,
      [183] = 223475090568,
      [184] = 102456456464,
      [185] = 1234567888,
[186] = 68000000000,
[187] = 108000000000,
[188] = 87000000000,
[189] = 124000000000,
[190] = 93000000000,
[191] = 176000000000,
[192] = 186000000000,
      [193] = 164000000000,
[194] = 77000000000,
[195] = 107000000000,
[196] = 128000000000,
[197] = 196000000000,
[198] = 194000000000,
[199] = 174000000000,
[200] = 142000000000,
[201] = 109000000000,
      [202] = 157000000000,
      [203] = 64000000000,
[204] = 192000000000,
[205] = 179000000000,
[206] = 66000000000,
[207] = 114000000000,
[208] = 168000000000,
[209] = 138000000000,
[210] = 70000000000,
[211] = 62000000000,
[212] = 144000000000,
[213] = 144000000000,
[214] = 193000000000,
[215] = 180000000000,
[216] = 169000000000,
[217] = 121000000000,
[218] = 135000000000,
[219] = 192000000000,
[220] = 73000000000,
[221] = 165000000000,
[222] = 147000000000,
[223] = 124000000000,
[224] = 131000000000,
[225] = 122000000000,
[226] = 158000000000,
[227] = 117000000000,
[228] = 199000000000,
[229] = 61000000000,
[230] = 148000000000,
[231] = 177000000000,
[232] = 101000000000,
[233] = 166000000000,
[234] = 141000000000,
[235] = 130000000000,
[236] = 112000000000,
[237] = 126000000000,
[238] = 188000000000,
[239] = 175000000000,
[240] = 136000000000,
[241] = 90000000000,
[242] = 94000000000,
},


Thanx for the damn quick service .

Respect,

MrCain
Title: Re: Anti Fake Share Script
Post by: MrCain on 12 April, 2007, 17:41:31
Well the things you added Mutor works really perfect : i have seen no fakers in the hub and the rest of the network is using it now. It blocked like 30 fakers in 24 hours per hub  ;D so the results are there.

You made a owner really happy now   ;D.

Thanx a lot and maybe (i know it for sure  ;) ) till next time!!

Respect

MrCain
Title: Re: Anti Fake Share Script
Post by: Naithif on 13 April, 2007, 10:48:50
Hi guys
I don't seem to understand this part Mutor, can you enlighten me?

local share = tonumber(user.iShareSize) or 0

...

local x = share
while x > 0 do
x = x / 1024
end
if x == 1 then BanUser(user,share) end


So:
Local variable x becomes equal with the user's share in bytes.
Until x > 0 it divides x with 1024
If the final resulting x equals one (dividable with 1024 without leftover) then ban


I mean I have two problems:

There's a fake share of 53687091200 that's 1024^3 * 50 (50GB)
Division goes until reaching 50, and compares with 1, but it doesn't match... Shouldn't it catch every user with share divided with 1024 equals an integer?
The above method seem to catch only 1MB 1GB 1TB users, or I've misunderstood it?


But another thing, x is divided until it's still greater than 0, then even 1 would be divided isn't it? That should mean the division going until it's actually equal or less than zero, but then how it could be equal with 1 ?  ???
Title: Re: Anti Fake Share Script
Post by: bastya_elvtars on 13 April, 2007, 12:11:04
1) iShareSize does not need to be tonumber()'d.
2) <a href="http://www.lua.org/manual/5.1/manual.html#pdf-math.fmod">math.fmod(x,1024) > 0</a> should be enough
Title: Re: Anti Fake Share Script
Post by: MrCain on 13 April, 2007, 15:44:23
Well i tested the script a little (i  know how to fake a share now ;) ) and the multiple numbers only works with the zero, so you still need the table for the other numbers : 155555555 etc. but that is not a problem => im still using the check in my client. And what Naithiff said about the other users that can be kicked because there share is equal with a multypli of 1024 : i added a Opchat reply with ip and share size ( [15:16:02] <??GAME-CONTROLLER??> *** User Butt with IP: 10.0.0.150 is now timebanned for 720 minutes reason: Sharesize 53687091200 => fakeshare....sucker :P ) so if i dont know if the user is a faker i will unban him. Users are refreshing (i hope so...) there share so they are able to come back in the hub. But i think that the change that a users share is exact a multiplication is small.  And it wont block all equals : 24242424 * 1024 = 23.12 gb and the script is not blocking it and the client wont see it either.

You still have to check manually your hub but the script is blocking the most of it so it makes life easyer.

Anyway, im still very happy with the modification in the script and Mutor (it spelled right now??  ;D) tanx for doing it dude!!
It saves me time to do other things then hunting down fakers, like drinking beer and stuff  ;D .

Respect,

MrCain
Title: Re: Anti Fake Share Script
Post by: Cêñoßy†ê on 13 April, 2007, 15:58:01
Should catch every 6x same number now


--[[

ShareCheck 1.0 LUA 5.0/5.1

By Mutor 05/21/06

Requested By Savukala

Bans users with fake share values.
-Cleans the hub on script start
-Checks any changes to shares after login.

***Notes:
This is an old list [BadShare Table] of fake share values
I cannot attest to it's completeness, Add as many as you wish.

+Changes from 1.0
+Added check for share divisible by 1024
+Added check for too may consecutive zeros in share
]]

--Script Configuration
ShareCfg = {
--Admin's Nick
OpNick = "Mutor",
-- Botname pulled from the hub or use "CustomName"
Bot = frmHub:GetHubBotName(),
--TempBan time in minutes, 0 = default tempban time from GUI
BanTime = 0,
--TempBan nicks with these share values
BadShare = {
[1] = 5368709120,
[2] = 10737418240,
[3] = 13630010000,
[4] = 16106127360,
[5] = 21474836480,
[6] = 26843545600,
[7] = 32212254720,
[8] = 7970010000,
[9] = 37580963840,
[10] = 37970010000,
[11] = 42949672960,
[12] = 48318382080,
[13] = 214266156265,
[14] = 53687091200,
[15] = 59055800320,
[16] = 64424509440,
[17] = 65719010000,
[18] = 69793218560,
[19] = 75161927680,
[20] = 80530636800,
[21] = 85899345920,
[22] = 91268055040,
[23] = 96636764160,
[24] = 102005473280,
[25] = 107374182400,
[26] = 118648471552,
[27] = 128849018880,
[28] = 140301549174,
[29] = 161061273600,
[30] = 174720100000,
[31] = 183287729356,
[32] = 214748364800,
[33] = 268435456000,
[34] = 322122547200,
[35] = 375809638400,
[36] = 397760100000,
[37] = 429496729600,
[38] = 536870912000,
[39] = 657190100000,
[40] = 183287729357,
[41] = 102392020337,
[42] = 13625783747,
[43] = 174719269601,
[44] = 65712999629,
[45] = 26993869455,
[46] = 140295106724,
[47] = 21171699199,
},
Same_nr = {
[1] = "000000",
[2] = "111111",
[3] = "222222",
[3] = "333333",
[4] = "444444",
[5] = "555555",
[6] = "666666",
[7] = "777777",
[8] = "888888",
[9] = "999999",
},
}

Main = function()
ShareCfg.GC,ShareCfg.Ver,ShareCfg.Auth,ShareCfg.No = false,"ShareCheck 1.0 L5.1","Mutor",table.getn
if _VERSION:sub(1,7) == "Lua 5.1" then
ShareCfg.GC,ShareCfg.No = "collect",table.maxn
end
for i,v in ipairs(frmHub:GetOnlineUsers()) do
local usr,share = GetItemByName(v.sName),v.iShareSize
share = tonumber(share) or 0
CheckShare(usr,share)
end
collectgarbage(Gc)
OnError("Starting "..ShareCfg.Ver.." by "..ShareCfg.Auth..", Memory Used: "..gcinfo()..
" Kb., Fake Share Entries:"..ShareCfg.No(ShareCfg.BadShare))
end

OnExit = function()
OnError("Shutting down "..ShareCfg.Ver.." by "..ShareCfg.Auth.."...")
end

OnError = function(msg)
SendToNick(ShareCfg.OpNick,"<"..ShareCfg.Bot.."> "..msg)
end

MyINFOArrival = function(user,data)
local share = tonumber(user.iShareSize) or 0
CheckShare(user,share)
collectgarbage(Gc)
end

CheckShare = function(user,share)
if share > 0 then
for _,what in pairs(ShareCfg.BadShare.Same_nr) do
if string.find(share,what) then BanUser(user,share) end
end
for _,x in ipairs(ShareCfg.BadShare) do
if share == x then
BanUser(user,share)
end
end
local x = share
while x > 0 do
x = x / 1024
end
if x == 1 then BanUser(user,share) end
end
end

BanUser = function(user,share)
TempBan(user.sIP,ShareCfg.BanTime,"Banned Hostname",ShareCfg.Bot,0)
OnError("User: "..user.sName.." has been banned for "..(GetTempBannedItemTime(user.sIP)/60)..
" minutes. Reason: Fake share value: "..user.iShareSize.." or "..DoShareUnits(share))
local msg = "\r\n\r\n\t"..user.sName..", you've been banned for "..
(GetTempBannedItemTime(user.sIP)/60).." minutes.\r\n\t"..
"Reason: Fake share\r\n\r\n"
user:SendData(ShareCfg.Bot..msg)
user:Disconnect()
end

function DoShareUnits(intSize) -- Thanks to kepp and NotRambitWombat
local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then
sUnits = tUnits[index];
break;
else
intSize = intSize / 1024;
end
end
return string.format("%0.2f %s",intSize, sUnits);
end
Title: Re: Anti Fake Share Script
Post by: MrCain on 13 April, 2007, 16:44:16
Im going to test it : you will hear about it!!

Thanx C??oByt?

Respect,

MrCain
I have tested it and found some little flaws....but i found them and changed some things and now its working  ;D

Here my version of it lol

--[[

ShareCheck 1.0 LUA 5.0/5.1

By Mutor 05/21/06

Requested By Savukala

Bans users with fake share values.
-Cleans the hub on script start
-Checks any changes to shares after login.

***Notes:
This is an old list [BadShare Table] of fake share values
I cannot attest to it's completeness, Add as many as you wish. updated : Fryday 13 April

+Changes from 1.0
+Added check for share divisible by 1024
+Added check for too may consecutive zeros in share
]]

--Script Configuration
ShareCfg = {
--Admin's Nick
--OpNick = "Mr-Cain",
-- Botname pulled from the hub or use "CustomName"
Bot = frmHub:GetHubBotName(),
--TempBan time in minutes, 0 = default tempban time from GUI
BanTime = 0,
--TempBan nicks with these share values
BadShare = {
[1] = 10000000000,
[2] = 5368709120,
[3] = 10737418240,
[4] = 13630010000,
[5] = 16106127360,
[6] = 21474836480,
[7] = 26843545600,
[8] = 27000000000,
[9] = 32212254720,
[10] = 7970010000,
[11] = 37580963840,
[12] = 37970010000,
[13] = 6599201000000,
[14] = 65992010000000,
[15] = 36772010000000,
[16] = 3677201000000,
[17] = 42949672960,
[18] = 48318382080,
[19] = 214266156265,
[20] = 53687091200,
[21] = 59055800320,
[22] = 1747201000000,
[23] = 16772010000000,
[24] = 147720100000000,
[25] = 10240000000000,
[26] = 64424509440,
[27] = 65719010000,
[28] = 69793218560,
[29] = 75161927680,
[30] = 80530636800,
[31] = 85899345920,
[32] = 91268055040,
[33] = 96636764160,
[34] = 102005473280,
[35] = 102400000000,
[36] = 107374182400,
[37] = 118648471552,
[38] = 128849018880,
[39] = 140301549174,
[40] = 161061273600,
[41] = 174720100000,
[42] = 183287729356,
[43] = 214748364800,
[44] = 268435456000,
[45] = 322122547200,
[46] = 375809638400,
[47] = 397760100000,
[48] = 429496729600,
[49] = 536870912000,
[50] = 657190100000,
[51] = 1024000000000,
[52] = 183287729357,
[53] = 102392020337,
[54] = 13625783747,
[55] = 174719269601,
[56] = 65712999629,
[57] = 26993869455,
[58] = 140295106724,
[59] = 21171699199,
      [60] = 38492561408,
      [61] = 39051993934,
      [62] = 42949672960,
      [63] = 438086654400,
      [64] = 44171435392,
      [65] = 55104430407,
      [66] = 63337526819,
      [67] = 66947802726,
      [68] = 86949673012,
      [69] = 166430355311,
      [70] = 715112427375,
      [71] = 111669147200,
      [72] = 158913786400,
      [73] = 171798688000,
      [74] = 18552221398,
      [75] = 203000004669,
      [76] = 23195309186,
      [77] = 270582933600,
      [78] = 32577036319,
      [79] = 36600541184,
      [80] = 98965856458,
      [81] = 111111111111,
      [82] = 1357822319300,
      [83] = 20000000000,
      [84] = 21000000000,
      [85] = 23000000000,
      [86] = 24000000000,
      [87] = 25000000000,
      [88] = 26000000000,
      [89] = 27000000000,
      [90] = 28000000000,
      [91] = 29000000000,
      [92] = 30000000000,
      [93] = 31000000000,
      [94] = 32000000000,
      [95] = 33000000000,
      [96] = 34000000000,
      [97] = 35000000000,
      [98] = 36000000000,
      [99] = 37000000000,
      [100] = 97500000000,
      [101] = 96000000000,
      [102] = 36457547474,
      [103] = 175446786545,
      [104] = 98000000000,
      [105] = 99000000000,
      [106] = 231274144532,
      [107] = 97000000000,
      [108] = 10100000000,
      [109] = 10200000000,
      [110] = 10300000000,
      [111] = 10400000000,
      [112] = 10500000000,
      [113] = 10600000000,
      [114] = 10700000000,
      [115] = 10800000000,
      [116] = 10900000000,
      [117] = 11000000000,
      [118] = 11100000000,
      [119] = 11200000000,
      [120] = 11300000000,
      [121] = 11400000000,
      [122] = 11500000000,
      [123] = 11600000000,
      [124] = 11700000000,
      [125] = 11800000000,
      [126] = 11900000000,
      [127] = 12000000000,
      [128] = 12100000000,
      [129] = 12200000000,
      [130] = 12300000000,
      [131] = 12400000000,
      [132] = 12500000000,
      [133] = 12600000000,
      [134] = 12700000000,
      [135] = 12800000000,
      [136] = 12900000000,
      [137] = 13000000000,
      [138] = 13100000000,
      [139] = 13200000000,
      [140] = 13300000000,
      [141] = 13400000000,
      [142] = 13500000000,
      [143] = 13600000000,
      [144] = 13700000000,
      [145] = 13800000000,
      [146] = 13900000000,
      [147] = 14000000000,
      [148] = 14100000000,
      [149] = 14200000000,
      [150] = 14300000000,
      [151] = 14400000000,
      [152] = 14500000000,
      [153] = 14600000000,
      [154] = 14700000000,
      [155] = 14800000000,
      [156] = 14900000000,
      [157] = 15000000000,
      [158] = 58456382732,
      [159] = 500000000000,
      [160] = 600000000000,
      [161] = 150000000000,
      [162] = 241658435135,
      [163] = 99998798978,
      [164] = 80000000000,
      [165] = 124512321454,
      [166] = 89889977882,
      [167] = 67954123542,
      [168] = 185462541585,
      [169] = 65564546848,
      [170] = 104108657128,
      [171] = 241658435135,
      [172] = 111221111111,
      [173] = 125999999999,
      [174] = 980980980999,
      [175] = 60000000000,
      [176] = 119991004860,
      [177] = 39443158311455,
      [178] = 123456789235,
      [179] = 80245791301,
      [180] = 144174134841,
      [181] = 856258542542,
      [182] = 122222222222,
      [183] = 223475090568,
      [184] = 102456456464,
      [185] = 1234567888,
[186] = 68000000000,
[187] = 108000000000,
[188] = 87000000000,
[189] = 124000000000,
[190] = 93000000000,
[191] = 176000000000,
[192] = 186000000000,
      [193] = 164000000000,
[194] = 77000000000,
[195] = 107000000000,
[196] = 128000000000,
[197] = 196000000000,
[198] = 194000000000,
[199] = 174000000000,
[200] = 142000000000,
[201] = 109000000000,
      [202] = 157000000000,
      [203] = 64000000000,
[204] = 192000000000,
[205] = 179000000000,
[206] = 66000000000,
[207] = 114000000000,
[208] = 168000000000,
[209] = 138000000000,
[210] = 70000000000,
[211] = 62000000000,
[212] = 144000000000,
[213] = 144000000000,
[214] = 193000000000,
[215] = 180000000000,
[216] = 169000000000,
[217] = 121000000000,
[218] = 135000000000,
[219] = 192000000000,
[220] = 73000000000,
[221] = 165000000000,
[222] = 147000000000,
[223] = 124000000000,
[224] = 131000000000,
[225] = 122000000000,
[226] = 158000000000,
[227] = 117000000000,
[228] = 199000000000,
[229] = 61000000000,
[230] = 148000000000,
[231] = 177000000000,
[232] = 101000000000,
[233] = 166000000000,
[234] = 141000000000,
[235] = 130000000000,
[236] = 112000000000,
[237] = 126000000000,
[238] = 188000000000,
[239] = 175000000000,
[240] = 136000000000,
[241] = 90000000000,
[242] = 94000000000,
},


}

ExtraCfg = {
Same_nr = {
[1] = "000000",
[2] = "111111",
[3] = "222222",
[3] = "333333",
[4] = "444444",
[5] = "555555",
[6] = "666666",
[7] = "777777",
[8] = "888888",
[9] = "999999",
},
}

Main = function()
ShareCfg.GC,ShareCfg.Ver,ShareCfg.Auth,ShareCfg.No = false,"ShareCheck 1.0 L5.1","Mutor",table.getn
if _VERSION:sub(1,7) == "Lua 5.1" then
ShareCfg.GC,ShareCfg.No = "collect",table.maxn
end
for i,v in ipairs(frmHub:GetOnlineUsers()) do
local usr,share = GetItemByName(v.sName),v.iShareSize
share = tonumber(share) or 0
CheckShare(usr,share)
end
collectgarbage(Gc)
OnError("Starting "..ShareCfg.Ver.." by "..ShareCfg.Auth..", Memory Used: "..gcinfo()..
" Kb., Fake Share Entries:"..ShareCfg.No(ShareCfg.BadShare))
end

OnExit = function()
OnError("Shutting down "..ShareCfg.Ver.." by "..ShareCfg.Auth.."...")
end

OnError = function(msg)
SendToNick(ShareCfg.OpNick,"<"..ShareCfg.Bot.."> "..msg)
end

MyINFOArrival = function(user,data)
local share = tonumber(user.iShareSize) or 0
CheckShare(user,share)
collectgarbage(Gc)
end

CheckShare = function(user,share)
if share > 0 then
for _,what in ipairs(ExtraCfg.Same_nr) do
if string.find(share,what) then BanUser(user,share) end
end
for _,x in ipairs(ShareCfg.BadShare) do
if share == x then
BanUser(user,share)
end
end
local x = share
while x > 0 do
x = x / 1024
end
if x == 1 then BanUser(user,share) end
end
end

BanUser = function(user,share)
TempBan(user.sIP,ShareCfg.BanTime,"Banned Hostname",ShareCfg.Bot,0)
OnError("User: "..user.sName.." has been banned for "..(GetTempBannedItemTime(user.sIP)/60)..
" minutes. Reason: Fake share value: "..user.iShareSize.." or "..DoShareUnits(share))
local msg = "\r\n\r\n\t"..user.sName..", you've been banned for "..
(GetTempBannedItemTime(user.sIP)/720).." minutes.\r\n\t"..
"Reason: Fake share\r\n\r\n"..
      "\t     what are you doing ?          faking  !??                                not anymore!!  \r\n"..
      "\t     //               //                       //                  //                                 //  \r\n"..
      "\t    (,'')             (''o)                     (o'')                 (''.)                ; ' '-,,____(''o)     \r\n"..
      "\t  <(   )>         <(   )>                <(   )/              <(   )>        (..*)  /(   )\        (   )>     \r\n"..
      "\t,,_)^(_,,,,,,,,,,,_)^(_,,             ,,_)^(_,,,,,,,,,,,,,,_)^(_,,       //  ,,_)^(_,,,,,_)^(_,,,             \r\n\r\n"
      SendPmToOps(frmHub:GetHubBotName(), "*** User "..user.sName.." with IP: "..user.sIP.." is now timebanned for "..(GetTempBannedItemTime(user.sIP)/60).." minutes reason: Sharesize "..user.iShareSize.." => fakeshare....sucker :P ")
user:SendData(ShareCfg.Bot..msg)
user:Disconnect()
end

function DoShareUnits(intSize) -- Thanks to kepp and NotRambitWombat
local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then
sUnits = tUnits[index];
break;
else
intSize = intSize / 1024;
end
end
return string.format("%0.2f %s",intSize, sUnits);
end



Respect,

MrCain
Title: Re: Anti Fake Share Script
Post by: MrCain on 14 April, 2007, 10:54:49
hmmm...but wich one to choose...im getting a little confused here  ???

see the difference but not in the working of the script..

anyway al 2 works fine and stops more fakers, after a little time i dont have to do anything in the hub  ;D
evrything will go automatic  :P

tanx to all you guys who have worked/helped, im now stop changing the script lol its working perfect now !!
now its time to enjoy the weather en drink some beer  ;)

Respect,

Mr-Cain
Title: Re: Anti Fake Share Script
Post by: Naithif on 14 April, 2007, 13:09:23
Quote from: bastya_elvtars on 13 April, 2007, 12:11:04
1) iShareSize does not need to be tonumber()'d.
2) <a href="http://www.lua.org/manual/5.1/manual.html#pdf-math.fmod">math.fmod(x,1024) > 0</a> should be enough

Thanks for notifying about this method B?stya, I was using another method for this

if tonumber(string.format("%0.0f", User.iShareSize /1024 /1024 /1024)) == (User.iShareSize /1024 /1024 /1024) then

So that rounds share/GB to an integer (would be easier with VB  ::)) and compares with the normal share/GB.
If the two is the same, then ban

If user has 5.00000001 GB that rounds 5, they're not equal, no ban
If user has 5GB precisely then it's equal with the rounded, banning him

@Mutor - I'm still not sure about that method, you used, as I wrote in my previous post, isn't it ban only 1024's powers?
Title: Re: Anti Fake Share Script
Post by: achiever on 14 April, 2007, 14:28:45
hi,

well doesnt power means 2^2=4
and multiples 2*3=6

so i think
Quote from: Mutor on 14 April, 2007, 03:03:51

This should trigger on any number 'evenly' divisible by 1024


local x = share
while x > 1024 do
x = x / 1024
end
if x == 1024 then BanUser(user,share) end


well this part as i c should find users having only share exactly 1mb. 1gb, 1tb....
but shouldnt it also detect exact share of 50 gb or 90 gb??

m i wrong?
Title: Re: Anti Fake Share Script
Post by: Naithif on 14 April, 2007, 14:37:26
Quote from: achiever on 14 April, 2007, 14:28:45
hi,

well doesnt power means 2^2=4
and multiples 2*3=6

so i think
well this part as i c should find users having only share exactly 1mb. 1gb, 1tb....
but shouldnt it also detect exact share of 50 gb or 90 gb??

m i wrong?

Example:

1024*1024*1024*50 (50GB fake share)
when > 1024 it becames divided, so final value is <= than 1024 in this case after 3 divisions it's 50 and it's not equal to 1024

The cases when dividing with 1024 multiple times until it gives 1024 without leftovers are the cases of 1024's powers.

Edit: I've posted in my first message in this thread what you've posted here (the second part got corrected since then)

Edit2: I've also posted a solution for the dividable with GB fakes. Commonly the dividable with GB (Or is it MB? Oops gotta correct it in my script too  ::) Just remove one /1024 from every division if you want to use it, is should be better in detecting :) ) and six same numbers are used (for example in OP clients)
Title: Re: Anti Fake Share Script
Post by: MrCain on 14 April, 2007, 19:48:18
....i have started something with my request.......  ;)


i have tested this with DC++ Stealth and if i log in with axact 50 or an other amount i still get in to the hub....so if i can get in to the hub the users also can... problem solved  ;D to test this sort of script you really have to come in a hub with fake share i noticed, seems to be the only way

You still have to check shares manually for the die hard fackers, but the rest of the crap the script interceps

im happy  :D

Respect,

MrCain
Title: Re: Anti Fake Share Script
Post by: Naithif on 15 April, 2007, 12:08:39
Quote from: Mutor on 14 April, 2007, 14:41:33
Yes thats better, but it should trigger on == 0 not > 0


local x = share
while x > 1024 do
x = math.fmod(x,1024)
end
if x == 0 then BanUser(user,share) end


Or at least as far as my testing shows.
Script above updated with this method.

(Sorry about my previous post (since I've deleted it) I thought that the '/1024'  is still the same, just the final line changed)

BTW there's still something :)
x when divided with 1024 gives remainder of 0-1023 immediately with fmod, so the while statement has no meaning
I mean:
1: Line 1: x becomes share
2: Line 2: x is greater than 1024 -> line 3
3: Line 3: x becomes the remainder of dividing x with 1024 -> x becomes 0-1023
4: Line 4: returning to while -> line 2
5: Line 2: x is less than 1024 -> line 5
6: Line 5: if x equals to zero, ban

So


local x = share
x = math.fmod(x,1024)
if x == 0 then BanUser(user,share) end


Should give the same result isn't it?
Title: Re: Anti Fake Share Script
Post by: MrCain on 25 April, 2007, 18:02:33
Hello Mutor,

Sorry for the bit late reply but had some other things to do in life.
I have tested the script and so far its working perfect  :D
All fakes of multyple 1024 and with 6 same numbers are blocked from the hub even if the activate it in the hub!

I also tryed to create a share thats exact X gig and its almost not possible....so real users can almost not be blocked from the hub.

Here is sitting a very happy dude who is worshipping the maker of this script  ;D ;D

Thank you very much and till next time!!

Great respect,

Mr Cain
Title: Re: Anti Fake Share Script
Post by: fanem008 on 17 July, 2007, 13:17:14
You can add this [245] = "142204874157"  i foud this fake share, from Strong dc++ Stealth version by Smasher v1.2.
Title: Re: Anti Fake Share Script
Post by: MrCain on 28 July, 2007, 11:55:08
Quote from: fanem008 on 17 July, 2007, 13:17:14
You can add this [245] = "142204874157"  i foud this fake share, from Strong dc++ Stealth version by Smasher v1.2.

Thanx fanem008, but DC++Stealth is a client witch you can setup with the share you want and Client type you want.
I've also that problem in my hub. The only way to check this way of faking is to check share manually......it's a time consuming job but the only way for now.

You also can set youre , if you using it , RoboCop miversion : take a high "minversion" of DC++Stealth and set "Enable minversion check" in the user profile. Somethimes it works, if the users isnt fake his Client version.

I know its a problem in DC this days..

Hope its usefull for you.

Respect,

Mr-Cain
Title: Re: Anti Fake Share Script
Post by: Toast on 25 January, 2008, 17:27:23
Question could this script made to support regexp ?

so instead of value 1 2 3 etc

Instead

.*(0{7,15}|1{7,15}|2{7,15}|3{7,15}|4{7,15}|5{7,15}|6{7,15}|7{7,15}|8{7,15}|9{7,15}).*

Regards Toast
Title: Re: Anti Fake Share Script
Post by: Thor on 25 January, 2008, 19:01:40
LUA doesn't support {} bracket expressions (number of repetitions).
Title: Re: Anti Fake Share Script
Post by: Toast on 25 January, 2008, 20:22:05
Still it supports some kinda regexp ? or no support at all ?
Title: Re: Anti Fake Share Script
Post by: bastya_elvtars on 25 January, 2008, 21:16:20
share:match("[0123456789]+"):len()
?