{"id":1778,"date":"2014-06-22T20:58:11","date_gmt":"2014-06-23T03:58:11","guid":{"rendered":"http:\/\/vcomputadoras.com\/?p=1778"},"modified":"2014-06-22T20:58:11","modified_gmt":"2014-06-23T03:58:11","slug":"detect-tor-network","status":"publish","type":"post","link":"https:\/\/www.techuserspace.com\/detect-tor-network\/","title":{"rendered":"Detect Tor Network"},"content":{"rendered":"\n<p>Well, I can only say that I have had lots of trouble with <a title=\"https:\/\/torproject.org\" href=\"https:\/\/torproject.org\" target=\"_blank\" rel=\"noopener\"><strong>Tor<\/strong><\/a> I understand the need of keeping your Ip address secured and the need to user this kind of Network..<\/p>\n\n\n\n<p>But for the most part and in my experience I have only had problems with it.. Of course not all the people that uses it, does bad thing with it but I had this individual trying to hack my application, registering and posting obscene comment posting unappropriated material and so on..<\/p>\n\n\n\n<p>I kept banning Ips and he would just switch on the fly to another, I had blocked by Ip range and only end up blocking legit users, not a feasible fix.<\/p>\n\n\n\n<p>Goggling I found <a title=\"Will give you a list of possible Ips that could connect to your website or service.\" href=\"https:\/\/check.torproject.org\/cgi-bin\/TorBulkExitList.py\" target=\"_blank\" rel=\"noopener\">https:\/\/check.torproject.org\/cgi-bin\/TorBulkExitList.py<\/a><\/p>\n\n\n\n<p>You enter the Ip of your server or Website and will print a list of possible Ips that could connect.. after that it was easy for me to create a short function and use it in the page I wanted to detain the individual.<\/p>\n\n\n\n<p>At the precise moment I was being attacked by the hacker spammer, captured the ip he was currently using and tested against the list I was given. success it worked it was already included I saw the light again&#8230;<\/p>\n\n\n\n<p>Ok so the code..<\/p>\n\n\n\n<p>First go to the page <a title=\"https:\/\/check.torproject.org\/cgi-bin\/TorBulkExitList.py\" href=\"https:\/\/check.torproject.org\/cgi-bin\/TorBulkExitList.py\" target=\"_blank\" rel=\"noopener\">Bulk Tor Exit Exporter<\/a><br>You will get a web list with Tor Ips that could connect to your service, save it to txt format and name it <strong>TorList.txt<\/strong> then create a PHP document name as you like, I called it <strong>torchecker.php<\/strong>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function checkTORconnection(){\n$ips = file('.\/TorList.txt');\n$iptocheck = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : false;\n$isfound = false;\nif( $ips &amp;&amp; $iptocheck ){\nfor ( $i=0; $i &lt;count( $ips ) $i++ ){\nif( trim( $ips[$i] ) == $iptocheck ){\n$isfound = true;\n}\n}\nif( $isfound )\n{\nreturn true;\n}\nreturn false;\n}\nreturn true;\n}<\/pre>\n\n\n\n<p>I check <strong>$_SERVER[&#8216;REMOTE_ADDR&#8217;]<\/strong> if not found for me that&#8217;s it, I don&#8217;t want that user but your taste could be different.. anyways you use the function as follow:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">require_once('.\/torchecker.php');\/\/ require our function\n\/\/ now use it as normal conditional\nif( checkTORconnection() ){\n\/\/ allow or do anything you want.\n}<\/pre>\n\n\n\n<p>Well that&#8217;s it, I needed to post this because it was really important for me and people should know how to defend against this anonymizers..<\/p>\n\n\n\n<p>regards all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, I can only say that I have had lots of trouble with Tor I understand the need of keeping your Ip address secured and the need to user this kind of Network.. But for&hellip;<\/p>\n<p><a href=\"https:\/\/www.techuserspace.com\/detect-tor-network\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> of Detect Tor Network<\/span><span aria-hidden=\"true\"> &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,25],"tags":[],"class_list":["post-1778","post","type-post","status-publish","format-standard","hentry","category-guias-para-la-web","category-php-y-algo-mas"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/posts\/1778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/comments?post=1778"}],"version-history":[{"count":0,"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/posts\/1778\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/media?parent=1778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/categories?post=1778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techuserspace.com\/wp-json\/wp\/v2\/tags?post=1778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}