devicer.py 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devicer_py-0.1.1.dist-info → devicer_py-0.1.2.dist-info}/METADATA +2 -2
- {devicer_py-0.1.1.dist-info → devicer_py-0.1.2.dist-info}/RECORD +5 -6
- devicer/confidence_test.py +0 -112
- {devicer_py-0.1.1.dist-info → devicer_py-0.1.2.dist-info}/WHEEL +0 -0
- {devicer_py-0.1.1.dist-info → devicer_py-0.1.2.dist-info}/licenses/license.txt +0 -0
- {devicer_py-0.1.1.dist-info → devicer_py-0.1.2.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: devicer.py
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.2
|
4
4
|
Summary: Open-Source Python Middleware for Digital Fingerprinting
|
5
5
|
Author: One anonymous contributor
|
6
6
|
Author-email: Samuel Roux <sam.roux.com@gmail.com>, Stephen Perso <stephenrperso@gmail.com>
|
@@ -29,7 +29,7 @@ FP-Devicer is a digital fingerprinting middleware library designed for ease of u
|
|
29
29
|
|
30
30
|
Importing and using the library to compare fingerprints between users is as simple as collecting some user data and running the calculateConfidence function.
|
31
31
|
```python
|
32
|
-
from devicer.confidence import
|
32
|
+
from devicer.confidence import calculate_confidence
|
33
33
|
|
34
34
|
user1, user2 = {
|
35
35
|
"""Collected data goes here"""
|
@@ -1,11 +1,10 @@
|
|
1
1
|
devicer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
devicer/confidence.py,sha256=VoClMMJebzvT3ewGvJkuVEsyMGtsvAjg8A58dgWrCNU,2039
|
3
|
-
devicer/confidence_test.py,sha256=EsKeCMrmu8UiNzc5Ytcpb3ycNpIfYW3DhWa4Zst-4G4,4591
|
4
3
|
devicer/data_test.py,sha256=MSVbsIgkOUWxQLlJLZeLmohlwgS4MGXSrcoh8YFKmGk,3783
|
5
4
|
devicer/hashing.py,sha256=drqu_9YA7UbcaxgSiD3lWP5qkce6-0c-HHWmqyJi4Tg,645
|
6
5
|
devicer/hashing_test.py,sha256=mCbJAep6aUf0lcMbcQY1g0qmRB9u3WBJpSvSkGxi-q4,2854
|
7
|
-
devicer_py-0.1.
|
8
|
-
devicer_py-0.1.
|
9
|
-
devicer_py-0.1.
|
10
|
-
devicer_py-0.1.
|
11
|
-
devicer_py-0.1.
|
6
|
+
devicer_py-0.1.2.dist-info/licenses/license.txt,sha256=z84l2WzrGJ9egXM0Gcgl2_G1GK_L6OtqP3SBi5aKOxg,1171
|
7
|
+
devicer_py-0.1.2.dist-info/METADATA,sha256=B8kLLdvyEIJ47WKc_CiYQoOW_91AJQwGWlXkg6I2LdE,1752
|
8
|
+
devicer_py-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
devicer_py-0.1.2.dist-info/top_level.txt,sha256=U7avJlzadMpnTLycX86eYZWIZxZAffgTkOj0MmZ6VvY,8
|
10
|
+
devicer_py-0.1.2.dist-info/RECORD,,
|
devicer/confidence_test.py
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
import unittest
|
2
|
-
from confidence import calculate_confidence
|
3
|
-
from hashing_test import random_string
|
4
|
-
|
5
|
-
sampleData1 = {
|
6
|
-
"fonts": ['Arial', 'Verdana'],
|
7
|
-
"hardware": {
|
8
|
-
"cpu": 'Intel Core i7',
|
9
|
-
"gpu": 'NVIDIA GTX 1080',
|
10
|
-
"ram": 16384
|
11
|
-
},
|
12
|
-
"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
13
|
-
"screen": {
|
14
|
-
"width": 1920,
|
15
|
-
"height": 1080,
|
16
|
-
"colorDepth": 24
|
17
|
-
},
|
18
|
-
"timezone": 'America/New_York',
|
19
|
-
"ip": '157.185.170.244',
|
20
|
-
"languages": ['en-US', 'en'],
|
21
|
-
"plugins": ['Chrome PDF Viewer', 'Shockwave Flash'],
|
22
|
-
"canvasHash": random_string().encode('utf-8'),
|
23
|
-
"audioHash": random_string().encode('utf-8'),
|
24
|
-
"webglHash": random_string().encode('utf-8'),
|
25
|
-
}
|
26
|
-
|
27
|
-
sampleData2 = {
|
28
|
-
"fonts": ['Arial', 'Verdana'],
|
29
|
-
"hardware": {
|
30
|
-
"cpu": 'Pentium 4',
|
31
|
-
"gpu": 'Intel HD Graphics',
|
32
|
-
"ram": 4096
|
33
|
-
},
|
34
|
-
"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
35
|
-
"screen": {
|
36
|
-
"width": 1280,
|
37
|
-
"height": 720,
|
38
|
-
"colorDepth": 24
|
39
|
-
},
|
40
|
-
"timezone": 'Europe/London',
|
41
|
-
"ip": '178.238.11.6',
|
42
|
-
"languages": ['en-GB', 'en'],
|
43
|
-
"plugins": ['Chrome PDF Viewer', 'Shockwave Flash'],
|
44
|
-
"canvasHash": random_string().encode('utf-8'),
|
45
|
-
"audioHash": random_string().encode('utf-8'),
|
46
|
-
"webglHash": random_string().encode('utf-8'),
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
class TestConfidenceCalculation(unittest.TestCase):
|
51
|
-
def test_confidence_range(self):
|
52
|
-
"""
|
53
|
-
Test that the confidence score is between 0 and 100.
|
54
|
-
"""
|
55
|
-
confidence = calculate_confidence(sampleData1, sampleData2)
|
56
|
-
self.assertGreaterEqual(confidence, 0, "Confidence score should be at least 0.")
|
57
|
-
self.assertLessEqual(confidence, 100, "Confidence score should not exceed 100.")
|
58
|
-
|
59
|
-
def test_confidence_identical_data(self):
|
60
|
-
"""
|
61
|
-
Test that the confidence score is 100 when both data dictionaries are identical.
|
62
|
-
"""
|
63
|
-
confidence = calculate_confidence(sampleData1, sampleData1)
|
64
|
-
self.assertEqual(confidence, 100, "Confidence score should be 100 for identical data.")
|
65
|
-
|
66
|
-
def test_confidence_different_data(self):
|
67
|
-
"""
|
68
|
-
Test that the confidence score is less than 10 when data dictionaries are different.
|
69
|
-
"""
|
70
|
-
confidence = calculate_confidence(sampleData1, sampleData2)
|
71
|
-
self.assertLess(confidence, 10, "Confidence score should be less than 10 for different data.")
|
72
|
-
|
73
|
-
def test_confidence_similar_data(self):
|
74
|
-
"""
|
75
|
-
Test that the confidence score is greater than 80 when data dictionaries are similar.
|
76
|
-
"""
|
77
|
-
similar_data = sampleData2.copy()
|
78
|
-
similar_data['hardware']['ram'] = 8192
|
79
|
-
confidence = calculate_confidence(sampleData2, similar_data)
|
80
|
-
self.assertGreater(confidence, 80, "Confidence score should be greater than 80 for similar data.")
|
81
|
-
|
82
|
-
def test_confidence_partial_data(self):
|
83
|
-
"""
|
84
|
-
Test that the confidence score is calculated correctly when some fields match.
|
85
|
-
"""
|
86
|
-
partial_data = sampleData1.copy()
|
87
|
-
partial_data['hardware']['cpu'] = 'Pentium 4'
|
88
|
-
partial_data['hardware']['gpu'] = 'Intel HD Graphics'
|
89
|
-
partial_data['hardware']['ram'] = 4096
|
90
|
-
partial_data['timezone'] = 'Europe/London'
|
91
|
-
partial_data['ip'] = '178.238.11.6'
|
92
|
-
partial_data['languages'] = ['en-GB', 'en']
|
93
|
-
partial_data['userAgent'] = 'Mozilla/5.0 (compatible; Konqueror/2.2.2-3; Linux)'
|
94
|
-
confidence = calculate_confidence(sampleData1, partial_data)
|
95
|
-
self.assertGreater(confidence, 10, "Confidence score should be greater than 10 for partially matching data.")
|
96
|
-
self.assertLess(confidence, 95, "Confidence score should be less than 95 for partially matching data.")
|
97
|
-
|
98
|
-
def test_confidence_empty_data(self):
|
99
|
-
"""
|
100
|
-
Test that the confidence score is 0 when one of the data dictionaries is empty.
|
101
|
-
"""
|
102
|
-
confidence = calculate_confidence({}, sampleData2)
|
103
|
-
self.assertEqual(confidence, 0, "Confidence score should be 0 for empty data.")
|
104
|
-
|
105
|
-
confidence = calculate_confidence(sampleData1, {})
|
106
|
-
self.assertEqual(confidence, 0, "Confidence score should be 0 for empty data.")
|
107
|
-
|
108
|
-
confidence = calculate_confidence({}, {})
|
109
|
-
self.assertEqual(confidence, 0, "Confidence score should be 0 for both data dictionaries being empty.")
|
110
|
-
|
111
|
-
if __name__ == '__main__':
|
112
|
-
unittest.main()
|
File without changes
|
File without changes
|
File without changes
|