1. #1

    Need help to identify if a code from a weak auras string has anything malicious.

    The two lines are

    return function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
    local player_energy = UnitPower("player", 1)
    local red, green, blue = 1,1,0
    if player_energy > 70 then
    red, green, blue = 0,1,0
    elseif player_energy > 40 then
    red, green, blue = 1,1,0
    elseif player_energy < 35 then
    red, green, blue = 1,0,0
    end
    return red, green, blue, 1
    end

    and

    return function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
    local player_energy = UnitPower("player", 11)
    local red, green, blue = 1,1,0
    if player_energy > 75 then
    red, green, blue = 0,1,0
    elseif player_energy > 40 then
    red, green, blue = 1,1,0
    elseif player_energy < 40 then
    red, green, blue = 1,0,0
    end
    return red, green, blue, 1
    end


    I just want to make sure as I've heard some bad things about people getting weakauras strings with malicious code built in.

    Thanks for any and all help

  2. #2
    It looks fine to me. It's just returning different sets of numbers based on your mana/rage/energy/etc. It's probably used to color some bars based on how full your mana/etc. is.

  3. #3
    Deleted
    the code is messy but okay.

    its for recolloring the energy bar.

    i just ask myself 3 questions:
    1. why are there so many unnedet lines of code
    2. why the hell is a return infront of function
    3. why is he not using r1,g1,b1,a1,r2,g2,b2,a2 (maybe he dont want to)

  4. #4
    1. There really aren't any unnecessary lines of code
    2. WeakAuras has been including the 'return' in its default when you select custom for a color function of late. But you can use closures in Lua that return functions, so it's not like it's completely against the rules.
    3. He doesn't need those values because the deterministic aspect of the function is based solely around UnitPower(). He probably just forgot to delete r1,g1,etc from the WeakAuras template.

  5. #5
    thanks alot for the replies.

  6. #6
    Deleted
    Quote Originally Posted by SilenceDK View Post
    1. There really aren't any unnecessary lines of code
    2. WeakAuras has been including the 'return' in its default when you select custom for a color function of late. But you can use closures in Lua that return functions, so it's not like it's completely against the rules.
    3. He doesn't need those values because the deterministic aspect of the function is based solely around UnitPower(). He probably just forgot to delete r1,g1,etc from the WeakAuras template.
    1. if you consider double checking as usefull you are right.
    2.its not agains the rules but you will never use it like this
    Code:
    return function()
    --code 
    end
    if you do smth like this it looks like that:
    Code:
    function abc(a)
    return function()
    end
    end
    3. its fine to use hard coded colors. i just dont like it to define things and dont use them.

  7. #7
    Quote Originally Posted by venomhunter View Post
    1. if you consider double checking as usefull you are right.
    2.its not agains the rules but you will never use it like this
    Code:
    return function()
    --code 
    end
    if you do smth like this it looks like that:
    Code:
    function abc(a)
    return function()
    end
    end
    3. its fine to use hard coded colors. i just dont like it to define things and dont use them.
    Yes, whoever made the LUA seems to be quite new. There is a million ways to optimize this. But this isn't the point of the thread. He asked if it was malicious or not, and the answer is no, it is not.

  8. #8
    I made a weak aura that looks similar, that to me is a colour changing energy bar. Nothing malicious, perfectly safe. It's usually fairly easy to tell, that's just calling to see what your "unitpower" is, which is energy, rage e.t.c

    It's when a string is referencing a mailbox you gotta worry or initiating trades e.t.c - It's hard to miss that stuff.
    Last edited by thunterman; 2016-08-29 at 06:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •