Skip to content

Commit

Permalink
Merge pull request 0bbedCode#15 from LuigiVampa92/drm_unique_id
Browse files Browse the repository at this point in the history
Added a hook that prevents requesting of the unique DRM id
  • Loading branch information
M66B authored Jun 5, 2021
2 parents 0e1475b + 6a5db55 commit 210ba47
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/src/main/assets/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2749,5 +2749,21 @@
"enabled": false,
"usage": false,
"luaScript": "@webview_constructor"
},
{
"collection": "Privacy",
"group": "Use.Tracking",
"name": "MediaDrm.getPropertyByteArray",
"author": "LuigiVampa92",
"description": "DRM manager will return fake unique device ID",
"className": "android.media.MediaDrm",
"methodName": "getPropertyByteArray",
"parameterTypes": [
"java.lang.String"
],
"returnType": "byte[]",
"minSdk": 18,
"enabled": true,
"luaScript": "@mediadrm_unique_id"
}
]
35 changes: 35 additions & 0 deletions app/src/main/assets/mediadrm_unique_id.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- This file is part of XPrivacyLua.

-- XPrivacyLua is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.

-- XPrivacyLua is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.

-- You should have received a copy of the GNU General Public License
-- along with XPrivacyLua. If not, see <http://www.gnu.org/licenses/>.

-- Copyright 2017-2019 Marcel Bokhorst (M66B)

function after(hook, param)
local result = param:getResult()
if result == nil or result.length == 0 then
return false
end

local propertyString = param:getArgument(0)
if propertyString == nil or propertyString ~= 'deviceUniqueId' then
return false
end

local arrayClass = luajava.bindClass('java.lang.reflect.Array')
local byteClass = luajava.bindClass('java.lang.Byte')
local rawByteType = byteClass.TYPE
local fake = arrayClass:newInstance(rawByteType, result.length)
param:setResult(fake)
return true
end

0 comments on commit 210ba47

Please sign in to comment.