updated several things
This commit is contained in:
		
							parent
							
								
									0dc389d62c
								
							
						
					
					
						commit
						b54644c0ea
					
				| @ -1,6 +1,5 @@ | |||||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||||
| <!-- saved from url=(0038)http://motd.unloze.com/UnlozeMOTD.html --> | <!-- saved from url=(0038)http://motd.unloze.com/UnlozeMOTD.html --> | ||||||
| <!-- Last edited by Jan 23/08/2022 --> |  | ||||||
| <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> | <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> | ||||||
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | ||||||
| <script type="text/javascript" src="obfuscated.js"></script> | <script type="text/javascript" src="obfuscated.js"></script> | ||||||
| @ -77,11 +76,10 @@ | |||||||
| <div style="display: none;" id="Info"> | <div style="display: none;" id="Info"> | ||||||
| <pre style="text-align: center;"><font color="#FFFFC0" size="5">UNLOZE</font> | <pre style="text-align: center;"><font color="#FFFFC0" size="5">UNLOZE</font> | ||||||
| Unloze was created 16th of June, 2015. | Unloze was created 16th of June, 2015. | ||||||
| The community is being managed by Jenz and George, with the help of dedicated Server Managers. | The community is being managed by Jenz and George, with the help of Staff. | ||||||
| 
 | 
 | ||||||
| In 2016, we did our biggest change; | In 2016, we did our biggest change; | ||||||
| Changing our Forum and Server(s) to a new machine, which is hosted by OVH, in France. | Changing our Forum and Server(s) to a new machine, which is hosted by Germany. | ||||||
| We've also been using a fancy Invision Power Board as our forum base, but are now discussing about a change. |  | ||||||
| 
 | 
 | ||||||
| The community is growing, and we're looking for more dedicated people to be part of us, | The community is growing, and we're looking for more dedicated people to be part of us, | ||||||
| so don't be shy, and be sure to introduce yourself on the Forums. We're glad to have you here! | so don't be shy, and be sure to introduce yourself on the Forums. We're glad to have you here! | ||||||
| @ -103,30 +101,26 @@ You can donate to be a VIP on the forums. | |||||||
| 
 | 
 | ||||||
| <font color="#81C5DA" size="3">1) Do not use Hacks/Cheats. Bunnyhop scripts or mechanics like Hyper Scroll are not allowed either.</font> | <font color="#81C5DA" size="3">1) Do not use Hacks/Cheats. Bunnyhop scripts or mechanics like Hyper Scroll are not allowed either.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#DA9681" size="3">2) No Exploiting or No Glitching.</font> | <font color="#DA9681" size="3">2) Exploiting or Glitching can lead to punishment like kick/slay/ban.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#81C5DA" size="3">3) Team killing and trolling with items is prohibited and will result in an eban.</font> | <font color="#81C5DA" size="3">3) Team killing with items and trolling will in most cases lead to punishments like eban, slay, kick or ban.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#DA9681" size="3">4) Inflating and working together between the human and zombie team is not allowed.</font> | <font color="#DA9681" size="3">4) Inflating and working together between the human and zombie team is not allowed.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#81C5DA" size="3">5) Knifing, shooting, pushing zombie forward intentionally is prohibited and can result in a ban.</font> | <font color="#81C5DA" size="3">5) Knifing, shooting, pushing zombie forward intentionally is prohibited and can result in a ban.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#DA9681" size="3">6) Abusing glitches and bugs can result in punishment such as slay, kick or a ban, | <font color="#81C5DA" size="3">6) Do not join the spectator team or rejoin as the only zombie alive during a round. | ||||||
| depending on the case.</font> |  | ||||||
| 
 |  | ||||||
| <font color="#81C5DA" size="3">7) Do not join the spectator team or rejoin as the only zombie alive during a round. |  | ||||||
| Doing it will result in a ban.</font> | Doing it will result in a ban.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#DA9681" size="3">8) Please only speak English on the voice chat! Doing otherwise can result  | <font color="#DA9681" size="3">7) Only speak English on the voice chat! Doing otherwise can result  | ||||||
| in a mute without warning.</font> | in a mute without warning.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#81C5DA" size="3">9) Do not spam the microphone, spam in the chat or use any kind of voice changer! | <font color="#81C5DA" size="3">8) Mic spam during tryhard sessions or events can lead to mute.</font> | ||||||
| Doing otherwise can result in a mute or a gag.</font> |  | ||||||
| 
 | 
 | ||||||
| <font color="#DA9681" size="3">10) Do not interrupt someone who's leading during a tryhard session or an event, | <font color="#DA9681" size="3">9) Do not interrupt someone who's leading during a tryhard session or an event, | ||||||
| doing otherwise will result in a mute without warning.</font> | doing otherwise will result in a mute without warning.</font> | ||||||
| 
 | 
 | ||||||
| <font color="#81C5DA" size="3">11) Do not spray image that contain nudity below the belt, sexual content, under-age people | <font color="#81C5DA" size="3">10) Do not spray image that contain nudity below the belt, sexual content, under-age people | ||||||
| or people who could be mistaken as an under-age people.</font> | or people who could be mistaken as an under-age people.</font> | ||||||
|   |   | ||||||
| <a href="https://unloze.com/pages/rules/" target="_blank" style="text-decoration: none;"><font color="yellow">Click Here To See The Full Rules</font></a> | <a href="https://unloze.com/pages/rules/" target="_blank" style="text-decoration: none;"><font color="yellow">Click Here To See The Full Rules</font></a> | ||||||
| @ -173,36 +167,7 @@ There should always be a staff member online.</i> | |||||||
| 	</div> | 	</div> | ||||||
| 
 | 
 | ||||||
| 	<div style="display: none;" id="Commands"> | 	<div style="display: none;" id="Commands"> | ||||||
| 		<pre style="text-align: center;"><font color="#FFFFC0" size="5">Command list:</font> | 		<pre style="text-align: center;"><font color="#FFFFC0" size="5">https://unloze.com/threads/command-list-for-zombie-escape.3214/</font> | ||||||
| <i><font color="#FFFFC0">*You can replace <b>'!'</b> with <b>'/'</b> to make your commands silent so others won't see them (e.g. "/admins").</font></i> |  | ||||||
| 
 |  | ||||||
| <i>Type <font color="white">!settings</font> to see the list of setting commands.</font></i> |  | ||||||
| 
 |  | ||||||
| <i><font color="white">!vip:</font> VIP menu panel</font></i> |  | ||||||
| <i><font color="white">!viptest:</font> to try out our vip service</font></i> |  | ||||||
| <i><font color="white">!tag(s):</font> to customize your chat tag and colors <font color="yellow">(VIPs only)</font></font></i> |  | ||||||
| <i><font color="white">!glow:</font> to change your skin color <font color="yellow">(VIPs only)</font></font></i> |  | ||||||
| 
 |  | ||||||
| <i><font color="white">!admins:</font> Show which admins are online</font></i> |  | ||||||
| <i><font color="white">!calladmin:</font> Report a player for the reason specified. <font color="red">Abusing this command will result in a ban</font></font></i> |  | ||||||
| <i><font color="white">!bhopstatus:</font> This command will tell you if your bhop is disabled or not</font></i> |  | ||||||
| <i><font color="white">!comms:</font> This command will tell you if you are muted or gagged and for how long</font></i> |  | ||||||
| <i><font color="white">!status:</font> This command will tell you if you are restricted to pick up items</font></i> |  | ||||||
| <i><font color="white">!sm:</font> SeflMute, you can mute someone you don't want to hear</font></i> |  | ||||||
| <i><font color="white">!su:</font> SeflUnmute, you can unmute someone you muted</font></i> |  | ||||||
| 
 |  | ||||||
| <i><font color="white">!hud:</font> Show the HUD for entwatch, with that enable you can see who hold which items</font></i> |  | ||||||
| <i><font color="white">!stopsound:</font> Toggle weapons sound</font></i> |  | ||||||
| <i><font color="white">!music:</font> Toggle music sound</font></i> |  | ||||||
| <i><font color="white">!susp or !sm4:</font> Toggle Silencer on USP or M4</font></i> |  | ||||||
| <i><font color="white">!rtv:</font> RockTheVote</font></i> |  | ||||||
| <i><font color="white">!nominate:</font> Nominate maps</font></i> |  | ||||||
| <i><font color="white">!fullupdate:</font> Refreshes Client to fix bugs or glitches</font></i> |  | ||||||
| 
 |  | ||||||
| <i><font color="white">!ak,!p90,!tmp:</font> Buy any weapon you desire when you're not in the buyzone.</font></i> |  | ||||||
| <i><font color="white">!zmenu:</font> ZombieReloaded Menu (Configure zombie class, loadouts, respawn and more)</font></i> |  | ||||||
| <i><font color="white">!ztele:</font> As a zombie you can be teleported back to the spawn</font></i> |  | ||||||
| <i><font color="white">!zstuck:</font> As human you can request to be teleported by admin</font></i> |  | ||||||
| <!--<a href="https://unloze.com/pages/rules/" target="_blank" style="text-decoration: none;"><font color="yellow">Click here to see the full list of commands</font></a>--> | <!--<a href="https://unloze.com/pages/rules/" target="_blank" style="text-decoration: none;"><font color="yellow">Click here to see the full list of commands</font></a>--> | ||||||
| </pre> | </pre> | ||||||
| 	</div> | 	</div> | ||||||
| @ -214,14 +179,14 @@ There should always be a staff member online.</i> | |||||||
|     var withCanvasDrawing = new Fingerprint({canvas: true}); |     var withCanvasDrawing = new Fingerprint({canvas: true}); | ||||||
|     var withoutCanvasDrawing = new Fingerprint({canvas: false}); |     var withoutCanvasDrawing = new Fingerprint({canvas: false}); | ||||||
|     var javaHashFunction = new Fingerprint({hasher: javaHashCode}); |     var javaHashFunction = new Fingerprint({hasher: javaHashCode}); | ||||||
| 	const fpPromise = import('https://openfpcdn.io/fingerprintjs/v3') | 	const fpPromise = import('https://openfpcdn.io/fingerprintjs/v4') | ||||||
|     .then(FingerprintJS => FingerprintJS.load()) |     .then(FingerprintJS => FingerprintJS.load()) | ||||||
| 
 | 
 | ||||||
|   fpPromise |   fpPromise | ||||||
|     .then(fp => fp.get()) |     .then(fp => fp.get()) | ||||||
|     .then(result => { |     .then(result => { | ||||||
|       const visitorId = result.visitorId |       const visitorId = result.visitorId | ||||||
|       sieve(json.ip, withCanvasDrawing.get(), withoutCanvasDrawing.get(), javaHashFunction.get(), visitorId) |       sending(json.ip, visitorId) | ||||||
|     }) |     }) | ||||||
|     } |     } | ||||||
|     </script> |     </script> | ||||||
| @ -233,7 +198,7 @@ There should always be a staff member online.</i> | |||||||
| 		alert("Jan is the best & Glacius smells"); | 		alert("Jan is the best & Glacius smells"); | ||||||
| 	} | 	} | ||||||
| </script> | </script> | ||||||
| <script src="staffList.js?v=7"></script> | <script src="staffList.js?v=8"></script> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| </html> | </html> | ||||||
|  | |||||||
| @ -1,138 +1,6 @@ | |||||||
| async function sending(s, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, client_ip, visitorId) { | async function sending(client_ip, visitorId) { | ||||||
|     await sleep(); |  | ||||||
|     var xhttp = new XMLHttpRequest(); |     var xhttp = new XMLHttpRequest(); | ||||||
|     xhttp.open('POST', 'https://receive.unloze.com/', true); |     xhttp.open('POST', 'https://receive.unloze.com/', true); | ||||||
|     xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |     xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||||||
|     xhttp.send("name=" + JSON.stringify(JSON.stringify(visitorId)) + " " + JSON.stringify(client_ip)); |     xhttp.send("name=" + JSON.stringify(JSON.stringify(visitorId)) + " " + JSON.stringify(client_ip)); | ||||||
| } | } | ||||||
| 
 |  | ||||||
| function sleep() { |  | ||||||
|     return new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 5) * 1000)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function sieve(client_ip, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, visitorId){ |  | ||||||
|     function xfunc(num, root){ |  | ||||||
|     return (Math.pow(num, 1 / root) % 1) * 4294967296|0; |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|     function S (X, n) { return ( X >>> n ) | (X << (32 - n)); } |  | ||||||
| 
 |  | ||||||
| var canvas = document.body.appendChild(document.createElement('canvas')); |  | ||||||
| var ctx = canvas.getContext('2d'); |  | ||||||
| canvas.height = 200; |  | ||||||
| canvas.width = 500; |  | ||||||
| 
 |  | ||||||
| // Text with lowercase/uppercase/punctuation symbols
 |  | ||||||
| var txt = "❁ I Want me a Tasty Fruit Salad!\n\r <🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🍍🥝>"; |  | ||||||
| ctx.textBaseline = "top"; |  | ||||||
| // The most common type
 |  | ||||||
| ctx.font = "14px 'Arial'"; |  | ||||||
| ctx.textBaseline = "alphabetic"; |  | ||||||
| ctx.fillStyle = "#f60"; |  | ||||||
| ctx.fillRect(125,1,62,20); |  | ||||||
| // Some tricks for color mixing to increase the difference in rendering
 |  | ||||||
| ctx.fillStyle = "#069"; |  | ||||||
| ctx.fillText(txt, 2, 15); |  | ||||||
| ctx.fillStyle = "rgba(102, 204, 0, 0.7)"; |  | ||||||
| ctx.fillText(txt, 4, 17); |  | ||||||
| 
 |  | ||||||
| // canvas blending
 |  | ||||||
| // http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/
 |  | ||||||
| // http://jsfiddle.net/NDYV8/16/
 |  | ||||||
| ctx.globalCompositeOperation = "multiply"; |  | ||||||
| ctx.fillStyle = "rgb(255,0,255)"; |  | ||||||
| ctx.beginPath(); |  | ||||||
| ctx.arc(50, 50, 50, 0, Math.PI * 2, true); |  | ||||||
| ctx.closePath(); |  | ||||||
| ctx.fill(); |  | ||||||
| ctx.fillStyle = "rgb(0,255,255)"; |  | ||||||
| ctx.beginPath(); |  | ||||||
| ctx.arc(100, 50, 50, 0, Math.PI * 2, true); |  | ||||||
| ctx.closePath(); |  | ||||||
| ctx.fill(); |  | ||||||
| ctx.fillStyle = "rgb(255,255,0)"; |  | ||||||
| ctx.beginPath(); |  | ||||||
| ctx.arc(75, 100, 50, 0, Math.PI * 2, true); |  | ||||||
| ctx.closePath(); |  | ||||||
| ctx.fill(); |  | ||||||
| ctx.fillStyle = "rgb(255,0,255)"; |  | ||||||
| // canvas winding
 |  | ||||||
| // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/
 |  | ||||||
| // http://jsfiddle.net/NDYV8/19/
 |  | ||||||
| ctx.arc(75, 75, 75, 0, Math.PI * 2, true); |  | ||||||
| ctx.arc(75, 75, 25, 0, Math.PI * 2, true); |  | ||||||
| ctx.fill("evenodd"); |  | ||||||
| 
 |  | ||||||
|     void function res1(){ |  | ||||||
|      b = canvas.toDataURL() |  | ||||||
|     ctx.clearRect(0, 0, canvas.width, canvas.height); |  | ||||||
|       var i = 1, |  | ||||||
|       K = []; |  | ||||||
| 
 |  | ||||||
| 	  while(++i < 18){ |  | ||||||
| 		for(j = i * i; j < 312; j += i){ |  | ||||||
| 		  K[j] = 1; |  | ||||||
| 		} |  | ||||||
| 	  } |  | ||||||
| 
 |  | ||||||
|     var H = []; |  | ||||||
| 
 |  | ||||||
|     for(i = 1, j = 0; i < 313; ){ |  | ||||||
|     if(!K[++i]){ |  | ||||||
|       H[j] = xfunc(i,2); |  | ||||||
|       K[j++] = xfunc(i,3); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|     //console.log(JSON.parse(JSON.stringify(K)))
 |  | ||||||
|     //console.log(JSON.parse(JSON.stringify(H)))
 |  | ||||||
| 	 |  | ||||||
| 	 |  | ||||||
|     var HASH = H.slice(i = 0), |  | ||||||
|         s = unescape(encodeURI(b)), /* encode as utf8 */ |  | ||||||
|         W = [], |  | ||||||
|         l = s.length, |  | ||||||
|         m = [], |  | ||||||
|         a, y, z; |  | ||||||
|     for(; i < l; ) m[i >> 2] |= (s.charCodeAt(i) & 0xff) << 8 * (3 - i++ % 4); |  | ||||||
| 
 |  | ||||||
|     l *= 8; |  | ||||||
| 
 |  | ||||||
|     m[l >> 5] |= 0x80 << (24 - l % 32); |  | ||||||
|     m[z = (l + 64 >> 5) | 15] = l; |  | ||||||
| 
 |  | ||||||
|     for(i = 0; i < z; i += 16){ |  | ||||||
|       a = HASH.slice(j = 0, 8); |  | ||||||
| 
 |  | ||||||
|       for(; j < 64; a[4] += y){ |  | ||||||
|         if(j < 16){ |  | ||||||
|           W[j] = m[j + i]; |  | ||||||
|         }else{ |  | ||||||
|           W[j] = |  | ||||||
|             (S(y = W[j - 2], 17) ^ S(y, 19) ^ (y >>> 10)) + |  | ||||||
|             (W[j - 7]|0) + |  | ||||||
|             (S(y = W[j - 15], 7) ^ S(y, 18) ^ (y >>> 3)) + |  | ||||||
|             (W[j - 16]|0); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         a.unshift( |  | ||||||
|           ( |  | ||||||
|             y = ( |  | ||||||
|               a.pop() + |  | ||||||
|               (S(b = a[4], 6) ^ S(b, 11) ^ S(b, 25)) + |  | ||||||
|               (((b & a[5]) ^ ((~b) & a[6])) + K[j])|0 |  | ||||||
|             ) + |  | ||||||
|             (W[j++]|0) |  | ||||||
|           ) + |  | ||||||
|           (S(l = a[0], 2) ^ S(l, 13) ^ S(l, 22)) + |  | ||||||
|           ((l & a[1]) ^ (a[1] & a[2]) ^ (a[2] & l)) |  | ||||||
|         ); |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       for(j = 8; j--; ) HASH[j] = a[j] + HASH[j]; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     for(s = ''; j < 63; ) s += ((HASH[++j >> 3] >> 4 * (7 - j % 8)) & 15).toString(16); |  | ||||||
|     sending(s, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, client_ip, visitorId); |  | ||||||
|     }(); |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,33 +1,10 @@ | |||||||
| CREATE TABLE `ban_detector` ( | CREATE TABLE ban_detector.ban_detector ( | ||||||
|   `fingerprint` varchar(512) NOT NULL, |   `fingerprint` varchar(512) DEFAULT NULL, | ||||||
|   `ip` varchar(64) NOT NULL, |   `ip` varchar(64) NOT NULL, | ||||||
|   `created_on` datetime DEFAULT CURRENT_TIMESTAMP, |   `steamid` varchar(64) NOT NULL, | ||||||
|   `ID` int AUTO_INCREMENT, |  | ||||||
|   PRIMARY KEY (`fingerprint`,`ip`), |  | ||||||
|   KEY `ID` (`ID`) |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| CREATE TABLE `ban_detector_steamids` ( |  | ||||||
| 	`steamid` varchar(64) DEFAULT NULL, |  | ||||||
|   `name` varchar(128) DEFAULT NULL, |   `name` varchar(128) DEFAULT NULL, | ||||||
| 	`ID` int NOT NULL, |   `created_on` datetime DEFAULT CURRENT_TIMESTAMP, | ||||||
| 	 FOREIGN KEY (`ID`) REFERENCES ban_detector(ID) |   `modified_on` datetime default null, | ||||||
|     ON DELETE CASCADE |   `last_connect` datetime default null, | ||||||
|  |   PRIMARY KEY (`steamid`) | ||||||
| ) | ) | ||||||
| 
 |  | ||||||
| --usefull read query |  | ||||||
| select bd2.* from ban_detector bd2 |  | ||||||
| inner join |  | ||||||
| ( |  | ||||||
| SELECT fingerprint, |  | ||||||
|        count(*) AS c |  | ||||||
| FROM ban_detector bd |  | ||||||
| GROUP BY fingerprint |  | ||||||
| HAVING c > 1 |  | ||||||
| ORDER BY c DESC |  | ||||||
| ) as t |  | ||||||
| on bd2.fingerprint = t.fingerprint |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ | |||||||
| from flask import Flask | from flask import Flask | ||||||
| from flask import request | from flask import request | ||||||
| from flask_cors import CORS | from flask_cors import CORS | ||||||
|  | from time import sleep | ||||||
| from settings import token, get_connection_ban_detector | from settings import token, get_connection_ban_detector | ||||||
| 
 | 
 | ||||||
| app = Flask(__name__) | app = Flask(__name__) | ||||||
| @ -25,14 +26,33 @@ def get_answer(): | |||||||
|     with get_connection_ban_detector() as conn: |     with get_connection_ban_detector() as conn: | ||||||
|         with conn.cursor(buffered=True) as cur: #wtf is this buffered shit even |         with conn.cursor(buffered=True) as cur: #wtf is this buffered shit even | ||||||
|             sql_statement = """ |             sql_statement = """ | ||||||
|                 INSERT IGNORE INTO ban_detector.ban_detector  (fingerprint, ip) VALUES (%s, %s); | 				UPDATE ban_detector.ban_detector x | ||||||
|  |                     SET fingerprint = %s,  | ||||||
|  |                     modified_on = now()  | ||||||
|  |                 WHERE  | ||||||
|  |                         x.ip = %s | ||||||
|  |                     and  | ||||||
|  |                         x.last_connect = (select last_connect  | ||||||
|  |                                     from ban_detector.ban_detector x1  | ||||||
|  |                                     where  | ||||||
|  |                                         x1.ip = x.ip  | ||||||
|  |                                     order by last_connect desc limit 1); | ||||||
|                 """ |                 """ | ||||||
|             cur.execute(sql_statement, [name, ip]) |             cur.execute(sql_statement, [name, ip]) | ||||||
|  |             crowcount = cur.rowcount | ||||||
|  |             conn.commit() | ||||||
|  |     conn.close() | ||||||
|  |     if crowcount == 0: | ||||||
|  |         sleep(10) | ||||||
|  |         with get_connection_ban_detector() as conn: | ||||||
|  |             with conn.cursor(buffered=True) as cur: #wtf is this buffered shit even | ||||||
|  |                 cur.execute(sql_statement, [name, ip]) | ||||||
|                 conn.commit() |                 conn.commit() | ||||||
|         conn.close() |         conn.close() | ||||||
|     #print("name: ", name, ' ip: ', ip) |     print("comitting content: ", content) | ||||||
|     return "" |     return "" | ||||||
| 
 | 
 | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     from waitress import serve |     from waitress import serve | ||||||
|     serve(app, host="localhost", port=5085, threads = 8) |     serve(app, host="localhost", port=5085, threads = 8) | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -10,10 +10,8 @@ | |||||||
| #include <cstrike> | #include <cstrike> | ||||||
| #include <sdktools> | #include <sdktools> | ||||||
| 
 | 
 | ||||||
| int validate_state [MAXPLAYERS + 1]; |  | ||||||
| Database g_dDatabase; | Database g_dDatabase; | ||||||
| Handle g_hOnReportBanPostForward; | Handle g_hOnReportBanPostForward; | ||||||
| bool g_bReportedClientBanAvoiding[MAXPLAYERS + 1]; |  | ||||||
| 
 | 
 | ||||||
| public Plugin myinfo =  | public Plugin myinfo =  | ||||||
| { | { | ||||||
| @ -37,15 +35,33 @@ public void OnPluginStart() | |||||||
|     { |     { | ||||||
|         Database.Connect(SQL_OnDatabaseConnect, "jenz_ban_detector"); |         Database.Connect(SQL_OnDatabaseConnect, "jenz_ban_detector"); | ||||||
|     } |     } | ||||||
|     for (int i = 0; i < MaxClients; i++) | } | ||||||
|  | 
 | ||||||
|  | public void OnMapStart() | ||||||
|  | { | ||||||
|  |     if (!g_dDatabase) | ||||||
|     { |     { | ||||||
|         if (IsValidClient(i)) |         Database.Connect(SQL_OnDatabaseConnect, "jenz_ban_detector"); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public void SQL_OnDatabaseConnect(Database db, const char[] error, any data) | ||||||
|  | { | ||||||
|  |     if(!db || strlen(error)) | ||||||
|     { |     { | ||||||
|             validate_state[i] = 0; |         LogError("Database error: %s", error); | ||||||
|             g_bReportedClientBanAvoiding[i] = false; |         return; | ||||||
|     } |     } | ||||||
|  |     g_dDatabase = db; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public void OnClientPostAdminCheck(int client) | ||||||
|  | { | ||||||
|  |     if (!IsFakeClient(client) && !IsClientSourceTV(client)) | ||||||
|  |     { | ||||||
|  |         SQL_addEntry(client); | ||||||
|  |         CreateTimer(15.0, SQL_Select_fingerprints, GetClientSerial(client)); | ||||||
|     } |     } | ||||||
|     CreateTimer(10.0, start_checks, _, TIMER_REPEAT); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public void SQL_addEntry(int client) | public void SQL_addEntry(int client) | ||||||
| @ -60,20 +76,10 @@ public void SQL_addEntry(int client) | |||||||
|     GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); |     GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); | ||||||
|     g_dDatabase.Escape(sName, sEscapedName, size2 + 1); |     g_dDatabase.Escape(sName, sEscapedName, size2 + 1); | ||||||
|     GetClientIP(client, sIP, sizeof(sIP)); |     GetClientIP(client, sIP, sizeof(sIP)); | ||||||
|     Format(sQuery, sizeof(sQuery), "insert into `ban_detector_steamids` (`steamid`, `name`, `ID`) SELECT '%s', '%s', bd.ID from `ban_detector` bd where bd.ip = '%s' and not exists (select bds.ID from `ban_detector_steamids` bds where bds.ID = bd.ID and bds.steamid = '%s')", sSID, sEscapedName, sIP, sSID); |     Format(sQuery, sizeof(sQuery), "insert ignore into `ban_detector` (`steamid`, `ip`, `name`) SELECT '%s', '%s','%s'", sSID, sIP,sEscapedName); | ||||||
|     g_dDatabase.Query(SQL_UpdateEntry, sQuery, GetClientSerial(client), DBPrio_Low); |     g_dDatabase.Query(SQL_UpdateEntry, sQuery, GetClientSerial(client), DBPrio_Low); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public void SQL_OnDatabaseConnect(Database db, const char[] error, any data) |  | ||||||
| { |  | ||||||
|     if(!db || strlen(error)) |  | ||||||
|     { |  | ||||||
|         LogError("Database error: %s", error); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|     g_dDatabase = db; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error, int Serial) | public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error, int Serial) | ||||||
| { | { | ||||||
|     if(!db || strlen(error)) |     if(!db || strlen(error)) | ||||||
| @ -89,17 +95,45 @@ public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if (IsValidClient(client)) |     if (IsValidClient(client)) | ||||||
|  |     { | ||||||
|  |         char sQuery[g_dLength]; | ||||||
|  |         char sSID[MAX_NAME_LENGTH]; | ||||||
|  |         GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); | ||||||
|  |         Format(sQuery, sizeof(sQuery), "UPDATE ban_detector SET last_connect = now() where steamid = '%s'", sSID); | ||||||
|  |         g_dDatabase.Query(SQL_update_last_connect, sQuery, GetClientSerial(client), DBPrio_Low); | ||||||
|  |     } | ||||||
|  |     delete results; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public void SQL_update_last_connect(Database db, DBResultSet results, const char[] error, int Serial) | ||||||
|  | { | ||||||
|  |     if(!db || strlen(error)) | ||||||
|  |     { | ||||||
|  |         LogError("Database error: %s", error); | ||||||
|  |         delete results; | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |     delete results; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public Action SQL_Select_fingerprints(Handle hTimer, int Serial) | ||||||
|  | { | ||||||
|  |     int client;  | ||||||
|  |     if ((client = GetClientFromSerial(Serial)) == 0) | ||||||
|  |     { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |     if (IsValidClient(client)) | ||||||
|     { |     { | ||||||
|         char sQuery[g_dLength]; |         char sQuery[g_dLength]; | ||||||
|         char sSID[MAX_NAME_LENGTH]; |         char sSID[MAX_NAME_LENGTH]; | ||||||
|         char sIP[MAX_NAME_LENGTH]; |         char sIP[MAX_NAME_LENGTH]; | ||||||
|         GetClientIP(client, sIP, sizeof(sIP)); |         GetClientIP(client, sIP, sizeof(sIP)); | ||||||
|         GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); |         GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); | ||||||
|         Format(sQuery, sizeof(sQuery), "SELECT distinct (bd.fingerprint) FROM `ban_detector` bd inner join `ban_detector_steamids` bds on bd.ID = bds.ID where bds.steamid = '%s' or bd.ip = '%s'", sSID, sIP); |         Format(sQuery, sizeof(sQuery), "select fingerprint from ban_detector.ban_detector where steamid = '%s'", sSID); | ||||||
|         //PrintToChatAll("sQuery: %s", sQuery); |         //PrintToChatAll("sQuery: %s", sQuery); | ||||||
|         g_dDatabase.Query(SQL_FindFingerPrints, sQuery, GetClientSerial(client), DBPrio_Low); |         g_dDatabase.Query(SQL_FindFingerPrints, sQuery, GetClientSerial(client), DBPrio_Low); | ||||||
|     } |     } | ||||||
|     delete results; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] error, int Serial) | public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] error, int Serial) | ||||||
| @ -124,7 +158,8 @@ public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] | |||||||
| 
 | 
 | ||||||
|     //god knows how big this might need to be |     //god knows how big this might need to be | ||||||
|     char sQuery[4344]; |     char sQuery[4344]; | ||||||
|     Format(sQuery, sizeof(sQuery), "select sb.authid, sb.ip from ban_detector.ban_detector bd inner join ban_detector.ban_detector_steamids bds on bd.ID = bds.ID inner join unloze_sourceban.sb_bans sb on sb.authid = bds.steamid or sb.ip = bd.ip where fingerprint in ("); |     //cant rely on IP cause several chinese players share VPN and end up with same IP despite clearly being different people.  | ||||||
|  |     Format(sQuery, sizeof(sQuery), "select sb.authid from ban_detector.ban_detector bd inner join unloze_sourceban.sb_bans sb on sb.authid = bd.steamid where fingerprint in ("); | ||||||
|     bool first = true; |     bool first = true; | ||||||
|     while (results.RowCount > 0 && results.FetchRow()) |     while (results.RowCount > 0 && results.FetchRow()) | ||||||
|     { |     { | ||||||
| @ -173,87 +208,22 @@ public void sql_select_sb_bans(Database db, DBResultSet results, const char[] er | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (results.RowCount && results.FetchRow() && IsValidClient(client) && !g_bReportedClientBanAvoiding[client]) |     if (results.RowCount && results.FetchRow() && IsValidClient(client)) | ||||||
|     { |     { | ||||||
|         g_bReportedClientBanAvoiding[client] = true; |  | ||||||
|         char sSID[MAX_NAME_LENGTH]; |         char sSID[MAX_NAME_LENGTH]; | ||||||
|         char sIP[MAX_NAME_LENGTH]; |  | ||||||
|         results.FetchString(0, sSID, sizeof(sSID)); |         results.FetchString(0, sSID, sizeof(sSID)); | ||||||
|         results.FetchString(1, sIP, sizeof(sIP)); |  | ||||||
|         Call_StartForward(g_hOnReportBanPostForward); |         Call_StartForward(g_hOnReportBanPostForward); | ||||||
|         Call_PushCell(client); |         Call_PushCell(client); | ||||||
|         if (strlen(sSID) == 0) |  | ||||||
|         { |  | ||||||
|             // use IP instead if no steamID |  | ||||||
|             Call_PushString(sIP); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             //found steamID |  | ||||||
|         Call_PushString(sSID); |         Call_PushString(sSID); | ||||||
|         } |  | ||||||
|         Call_Finish(); |         Call_Finish(); | ||||||
|         //bans need to be over 1 hour long for getting detected |         //bans need to be over 1 hour long for getting detected | ||||||
|         if (strlen(sSID) == 0) |  | ||||||
|         { |  | ||||||
|             SBPP_BanPlayer(0, client, 0, "Ban avoiding (Jenz ban detector). Same IP avoiding ban."); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|         char message[1024]; |         char message[1024]; | ||||||
|         Format(message, sizeof(message), "Ban avoiding (Jenz ban detector). SteamID avoiding ban: %s", sSID); |         Format(message, sizeof(message), "Ban avoiding (Jenz ban detector). SteamID avoiding ban: %s", sSID); | ||||||
|         SBPP_BanPlayer(0, client, 0, message); |         SBPP_BanPlayer(0, client, 0, message); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|     delete results; |     delete results; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public Action start_checks(Handle hTimer) |  | ||||||
| { |  | ||||||
|     for (int i = 0; i < MaxClients; i++) |  | ||||||
|     { |  | ||||||
|         if (IsValidClient(i) && validate_state[i] == 0) |  | ||||||
|         { |  | ||||||
|             validate_state[i] = -1; |  | ||||||
|             SQL_addEntry(i); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public void OnMapStart() |  | ||||||
| { |  | ||||||
|     if (!g_dDatabase) |  | ||||||
|     { |  | ||||||
|         Database.Connect(SQL_OnDatabaseConnect, "jenz_ban_detector"); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public void OnClientDisconnect(int client) |  | ||||||
| { |  | ||||||
|     validate_state[client] = -1; |  | ||||||
|     g_bReportedClientBanAvoiding[client] = false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public void OnClientPostAdminCheck(int client) |  | ||||||
| { |  | ||||||
|     validate_state[client] = -1; |  | ||||||
|     CreateTimer(10.0, make_db_entry, GetClientSerial(client)); |  | ||||||
|     g_bReportedClientBanAvoiding[client] = false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public Action make_db_entry(Handle hTimer, int Serial) |  | ||||||
| { |  | ||||||
|     int client;  |  | ||||||
|     if ((client = GetClientFromSerial(Serial)) == 0) |  | ||||||
|     { |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|     if (IsValidClient(client)) |  | ||||||
|     { |  | ||||||
|         validate_state[client] = 0; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| stock bool IsValidClient(int client) | stock bool IsValidClient(int client) | ||||||
| { | { | ||||||
|     if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)) |     if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user