基于深度学习的DGA恶意域名检测 commited on
Commit
0cbb927
·
1 Parent(s): 0470a03

test env variable & secret -v4

Browse files
Files changed (4) hide show
  1. main.py +1 -1
  2. static/index.html +34 -137
  3. static/index_bk.html +0 -36
  4. static/index_bk2.html +139 -0
main.py CHANGED
@@ -26,4 +26,4 @@ app.mount("/", StaticFiles(directory="static", html=True), name="static")
26
 
27
  @app.get("/")
28
  def index() -> FileResponse:
29
- return FileResponse(path="/app/static/index_bk.html", media_type="text/html")
 
26
 
27
  @app.get("/")
28
  def index() -> FileResponse:
29
+ return FileResponse(path="/app/static/index.html", media_type="text/html")
static/index.html CHANGED
@@ -1,139 +1,36 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Model Usage Information Collection</title>
7
- <style>
8
- .hidden-link {
9
- visibility: hidden;
10
- }
11
- </style>
12
- </head>
13
- <body>
14
- <h1>Collected User Information</h1>
15
- <div id="user-info"></div>
16
-
17
- <script>
18
- // Function to display collected information
19
- function displayInfo(label, value) {
20
- document.getElementById('user-info').innerHTML += `<p><strong>${label}:</strong> ${value}</p>`;
21
- }
22
-
23
- // Display basic browser and device information
24
- displayInfo('Browser', navigator.userAgent);
25
- displayInfo('Platform', navigator.platform);
26
- displayInfo('Screen Resolution', `${screen.width}x${screen.height}`);
27
- displayInfo('Language', navigator.language);
28
- displayInfo('Time Zone', Intl.DateTimeFormat().resolvedOptions().timeZone);
29
-
30
- // Capture IP address and geolocation
31
- fetch('https://api.ipify.org?format=json')
32
- .then(response => response.json())
33
- .then(data => {
34
- displayInfo('IP Address', data.ip);
35
- return fetch(`https://ipapi.co/${data.ip}/json/`);
36
- })
37
- .then(response => response.json())
38
- .then(data => {
39
- displayInfo('City', data.city);
40
- displayInfo('Region', data.region);
41
- displayInfo('Country', data.country_name);
42
- displayInfo('Postal Code', data.postal);
43
- displayInfo('Latitude', data.latitude);
44
- displayInfo('Longitude', data.longitude);
45
- })
46
- .catch(error => console.error('Error fetching IP data:', error));
47
-
48
- // Capture user's precise geolocation (requires permission)
49
- if (navigator.geolocation) {
50
- navigator.geolocation.getCurrentPosition(
51
- position => {
52
- displayInfo('Geolocation Latitude', position.coords.latitude);
53
- displayInfo('Geolocation Longitude', position.coords.longitude);
54
- },
55
- error => displayInfo('Geolocation', 'Permission denied or unavailable.')
56
- );
57
- } else {
58
- displayInfo('Geolocation', 'Not supported by this browser.');
59
- }
60
-
61
- // Capture referrer URL
62
- displayInfo('Referrer', document.referrer || 'None');
63
-
64
- // Capture user's interaction with the model (assumed input)
65
- function captureSearchQuery(query) {
66
- displayInfo('Search Query', query);
67
- // You would log or process this data further as needed
68
- }
69
-
70
- // Example function to simulate a search or interaction with the model
71
- function simulateUserInteraction() {
72
- const userQuery = "Example user search input"; // This would be the actual user input in practice
73
- captureSearchQuery(userQuery);
74
- }
75
-
76
- // Simulate the user interaction (for example purposes)
77
- simulateUserInteraction();
78
-
79
- // Capture page views, mouse clicks, and other interactions
80
- document.addEventListener('click', function(event) {
81
- displayInfo('Click Coordinates', `X: ${event.clientX}, Y: ${event.clientY}`);
82
- displayInfo('Clicked Element', event.target.tagName);
83
- });
84
-
85
- // Capture clipboard access (if granted by the user)
86
- document.addEventListener('copy', function() {
87
- navigator.clipboard.readText().then(text => {
88
- displayInfo('Clipboard Content', text);
89
- }).catch(err => {
90
- displayInfo('Clipboard Access', 'Failed to access clipboard content.');
91
- });
92
- });
93
-
94
- // Attempt to capture user media access (Microphone/Camera) (requires permission)
95
- navigator.mediaDevices.getUserMedia({ audio: true, video: true })
96
- .then(stream => {
97
- displayInfo('Media Access', 'Microphone and Camera access granted.');
98
- stream.getTracks().forEach(track => track.stop());
99
- })
100
- .catch(err => {
101
- displayInfo('Media Access', 'Microphone and Camera access denied.');
102
- });
103
-
104
- // Detect browsing history for specific sites
105
- function detectBrowsingHistory() {
106
- const urlsToCheck = [
107
- 'https://www.google.com',
108
- 'https://www.facebook.com',
109
- 'https://www.youtube.com',
110
- 'https://www.amazon.com',
111
- 'https://www.wikipedia.org',
112
- 'https://www.baidu.com'
113
- ];
114
-
115
- urlsToCheck.forEach(url => {
116
- const link = document.createElement('a');
117
- link.href = url;
118
- link.className = 'hidden-link';
119
- document.body.appendChild(link);
120
-
121
- const colorBefore = getComputedStyle(link).color;
122
- link.style.color = 'blue';
123
- const colorAfter = getComputedStyle(link).color;
124
-
125
- if (colorBefore !== colorAfter) {
126
- displayInfo('Visited', url);
127
- } else {
128
- displayInfo('Not Visited', url);
129
- }
130
-
131
- document.body.removeChild(link);
132
- });
133
- }
134
-
135
- // Execute the browsing history detection
136
- detectBrowsingHistory();
137
- </script>
138
- </body>
139
- </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Fast API 🤗 Space served with Uvicorn</title>
7
+ <link rel="stylesheet" href="style.css" />
8
+ <script type="module" src="script.js"></script>
9
+ </head>
10
+ <body>
11
+ <main>
12
+ <section id="text-gen">
13
+ <h1>Text generation using Flan T5</h1>
14
+ <p>
15
+ Model:
16
+ <a
17
+ href="https://huggingface.co/google/flan-t5-small"
18
+ rel="noreferrer"
19
+ target="_blank"
20
+ >google/flan-t5-small</a
21
+ >
22
+ </p>
23
+ <form class="text-gen-form">
24
+ <label for="text-gen-input">Text prompt</label>
25
+ <input
26
+ id="text-gen-input"
27
+ type="text"
28
+ value="English: Translate There are many ducks. German:"
29
+ />
30
+ <button id="text-gen-submit">Submit</button>
31
+ <p class="text-gen-output"></p>
32
+ </form>
33
+ </section>
34
+ </main>
35
+ </body>
36
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/index_bk.html DELETED
@@ -1,36 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Fast API 🤗 Space served with Uvicorn</title>
7
- <link rel="stylesheet" href="style.css" />
8
- <script type="module" src="script.js"></script>
9
- </head>
10
- <body>
11
- <main>
12
- <section id="text-gen">
13
- <h1>Text generation using Flan T5</h1>
14
- <p>
15
- Model:
16
- <a
17
- href="https://huggingface.co/google/flan-t5-small"
18
- rel="noreferrer"
19
- target="_blank"
20
- >google/flan-t5-small</a
21
- >
22
- </p>
23
- <form class="text-gen-form">
24
- <label for="text-gen-input">Text prompt</label>
25
- <input
26
- id="text-gen-input"
27
- type="text"
28
- value="English: Translate There are many ducks. German:"
29
- />
30
- <button id="text-gen-submit">Submit</button>
31
- <p class="text-gen-output"></p>
32
- </form>
33
- </section>
34
- </main>
35
- </body>
36
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/index_bk2.html ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Model Usage Information Collection</title>
7
+ <style>
8
+ .hidden-link {
9
+ visibility: hidden;
10
+ }
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <h1>Collected User Information</h1>
15
+ <div id="user-info"></div>
16
+
17
+ <script>
18
+ // Function to display collected information
19
+ function displayInfo(label, value) {
20
+ document.getElementById('user-info').innerHTML += `<p><strong>${label}:</strong> ${value}</p>`;
21
+ }
22
+
23
+ // Display basic browser and device information
24
+ displayInfo('Browser', navigator.userAgent);
25
+ displayInfo('Platform', navigator.platform);
26
+ displayInfo('Screen Resolution', `${screen.width}x${screen.height}`);
27
+ displayInfo('Language', navigator.language);
28
+ displayInfo('Time Zone', Intl.DateTimeFormat().resolvedOptions().timeZone);
29
+
30
+ // Capture IP address and geolocation
31
+ fetch('https://api.ipify.org?format=json')
32
+ .then(response => response.json())
33
+ .then(data => {
34
+ displayInfo('IP Address', data.ip);
35
+ return fetch(`https://ipapi.co/${data.ip}/json/`);
36
+ })
37
+ .then(response => response.json())
38
+ .then(data => {
39
+ displayInfo('City', data.city);
40
+ displayInfo('Region', data.region);
41
+ displayInfo('Country', data.country_name);
42
+ displayInfo('Postal Code', data.postal);
43
+ displayInfo('Latitude', data.latitude);
44
+ displayInfo('Longitude', data.longitude);
45
+ })
46
+ .catch(error => console.error('Error fetching IP data:', error));
47
+
48
+ // Capture user's precise geolocation (requires permission)
49
+ if (navigator.geolocation) {
50
+ navigator.geolocation.getCurrentPosition(
51
+ position => {
52
+ displayInfo('Geolocation Latitude', position.coords.latitude);
53
+ displayInfo('Geolocation Longitude', position.coords.longitude);
54
+ },
55
+ error => displayInfo('Geolocation', 'Permission denied or unavailable.')
56
+ );
57
+ } else {
58
+ displayInfo('Geolocation', 'Not supported by this browser.');
59
+ }
60
+
61
+ // Capture referrer URL
62
+ displayInfo('Referrer', document.referrer || 'None');
63
+
64
+ // Capture user's interaction with the model (assumed input)
65
+ function captureSearchQuery(query) {
66
+ displayInfo('Search Query', query);
67
+ // You would log or process this data further as needed
68
+ }
69
+
70
+ // Example function to simulate a search or interaction with the model
71
+ function simulateUserInteraction() {
72
+ const userQuery = "Example user search input"; // This would be the actual user input in practice
73
+ captureSearchQuery(userQuery);
74
+ }
75
+
76
+ // Simulate the user interaction (for example purposes)
77
+ simulateUserInteraction();
78
+
79
+ // Capture page views, mouse clicks, and other interactions
80
+ document.addEventListener('click', function(event) {
81
+ displayInfo('Click Coordinates', `X: ${event.clientX}, Y: ${event.clientY}`);
82
+ displayInfo('Clicked Element', event.target.tagName);
83
+ });
84
+
85
+ // Capture clipboard access (if granted by the user)
86
+ document.addEventListener('copy', function() {
87
+ navigator.clipboard.readText().then(text => {
88
+ displayInfo('Clipboard Content', text);
89
+ }).catch(err => {
90
+ displayInfo('Clipboard Access', 'Failed to access clipboard content.');
91
+ });
92
+ });
93
+
94
+ // Attempt to capture user media access (Microphone/Camera) (requires permission)
95
+ navigator.mediaDevices.getUserMedia({ audio: true, video: true })
96
+ .then(stream => {
97
+ displayInfo('Media Access', 'Microphone and Camera access granted.');
98
+ stream.getTracks().forEach(track => track.stop());
99
+ })
100
+ .catch(err => {
101
+ displayInfo('Media Access', 'Microphone and Camera access denied.');
102
+ });
103
+
104
+ // Detect browsing history for specific sites
105
+ function detectBrowsingHistory() {
106
+ const urlsToCheck = [
107
+ 'https://www.google.com',
108
+ 'https://www.facebook.com',
109
+ 'https://www.youtube.com',
110
+ 'https://www.amazon.com',
111
+ 'https://www.wikipedia.org',
112
+ 'https://www.baidu.com'
113
+ ];
114
+
115
+ urlsToCheck.forEach(url => {
116
+ const link = document.createElement('a');
117
+ link.href = url;
118
+ link.className = 'hidden-link';
119
+ document.body.appendChild(link);
120
+
121
+ const colorBefore = getComputedStyle(link).color;
122
+ link.style.color = 'blue';
123
+ const colorAfter = getComputedStyle(link).color;
124
+
125
+ if (colorBefore !== colorAfter) {
126
+ displayInfo('Visited', url);
127
+ } else {
128
+ displayInfo('Not Visited', url);
129
+ }
130
+
131
+ document.body.removeChild(link);
132
+ });
133
+ }
134
+
135
+ // Execute the browsing history detection
136
+ detectBrowsingHistory();
137
+ </script>
138
+ </body>
139
+ </html>