Jump to content

saversites

Member
  • Posts

    65
  • Joined

  • Last visited

Everything posted by saversites

  1. Php Pros, I want to run a public web proxy. But first, I need to add some security measures to prevent anyone from the public abusing my proxy server. I need to add some php functions in the proxy script to prevent a few types of behaviour by the users. If you check the proxy then you will see it hardly has any admin panel nor any features to block uploads or downloads or streamings. That is why I must add my own after learning the required functions. I need the name of the functions I need to look into and learn. Hence, asking the pros here to provide me with the list of required functions. And so, it is still a php question. github.com/joshdick/miniProxy/blob/master/miniProxy.php QUESTIONS Q1. What is that php function that blocks downloads like file downloads ? (That should prevent anyone downloading malware/viruses, etc. using my proxy). Q2. What is that php function that blocks uploads, like file uploads ? (That should prevent anyone uploading malware/viruses, etc. using my proxy). Q3. What is that php function that blocks audio/video streaming (downloading) ? (That should prevent anyone viewing video streams using my proxy and clogging the server down). Q4. What is that php function that blocks audio/video streaming (uploading) ? (That should prevent anyone uploading viruses infected video files, etc. using my proxy). Q5. And, what is that php function that prevents the user's browser from playing any audio/video files on a website ? Eg. Prevent playing youtube vids, vimeo vids, metacafe vids, clickbank vids, etc. ? Q6. And, what is that php function that records bandwidth usage (uploads & downloads and audio & video streaming) ? (I might aswell give each account just enough data limit for them to browse text pages only. Not give enough limit to them to view or listen to audio/video pages (like youtube vid pages)). Q7. Any other features to add to prevent anyone abusing my public proxy service ? If so, which php functions should I use to add them ? Thank you for your precious time & energy answering my questions.
  2. Any chance I can point you to a link (through PM) that will reveal to you my trade secret a little so that you can better come to a conclusion whether I'd be a target or not by hackers & online thieves ? I don't want to publicly mention the link here as I don't want other programmers copying my idea. I tried PMing you but this forum is not showing the PM page.

    1. administrator

      administrator

      I wouldn't want to be responsible for anything, so if you send me your link you have to first to agree to clear me of any and all responsibility forever. 

      That said, I don't need to see it. If you have an idea, you will have to get it out at some point and if it is good, you will have to deal with copycats. The key is to release it when it is ready and have a good marketing plan in place.

      Stef

    2. saversites

      saversites

      Mr Stef,

      How can I mssg you in private ?

      Thanks!

    3. administrator

      administrator

      No simple functions to handle all this network traffic sniffing and filtering. 

      Look into PHP IO functions. I haven't used PHP do you this sort of thing.

      Stef

  3. Stef, The url is loading on my end here. It's just cURL is not posting. I see no activity in the commenting section.
  4. Hi, I was searching for a tutorial that teaches how cURL can auto post and came across the following code. It is supposed to fill-in WP comment form. But for some reason I see no response on the commenting section on the blog. Why is that ? If I run the script on my site then I see cURL fetches the page (the above link) but I see no response on the comment form. If I run the script on my Xampp (localhost) then I see a complete white blank page. Why ? <?php $postfields = array(); $postfields["action"] = "submit"; $postfields["author"] = "programmer"; $postfields["email"] = "email@email.com"; $postfields["url"] = "http://www.example.com/"; $postfields["comment"] = "Testing comment 1,2,3."; $postfields["comment_post_ID"] = "123"; $postfields["_wp_unfiltered_html_comment"] = "0d870b294b"; //Url of the form submission $url = "https://www.atilus.com/top10internetmarketingblogs/"; $useragent = "Mozilla/5.0"; $referer = $url; //Initialize CURL session $ch = curl_init($url); //CURL options curl_setopt($ch, CURLOPT_POST, 1); //We post $postfields data curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); //We define an useragent (Mozilla/5.0) curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //We define a refferer ($url) curl_setopt($ch, CURLOPT_REFERER, $referer); //We get the result page in a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //We exits CURL $result = curl_exec($ch); curl_close($ch); //Finally, we display the result echo $result; ?>
  5. Thanks. But, which of their plan do you think would be suitable to run a web proxy service like anonymouse.org and the like ? I don't want to signup to something either below the required level or even above it.
  6. Stef, That is great. But, how do we provide a similar feature onto our sites such as onto our membership site or forum so others can signup likewise using facebook/twitter/gmail ? Did you build that php script or did you get it from somewhere else ? How-about freely providing the code here so we php students can learn from it ? Thanks
  7. Folks,I am looking for a free or a paid webhost that will allow me to run my own web proxy for the public to use. I am not looking to use a third party service. No! I want to provide the proxy service to the public (like to you) like anonymouse.org does. I'm going to use Mini Proxy php script to run the service. And, I've searched google twice before few wks ago on 2 different days but no luck. The webhosts I usually find, will not allow me to run my own public proxy service. Some will not allow me to run it on a shared server and expect me to hire a dedicated server and charge me an arm & leg every month. That's the big problem. I've used many keywords in the google search to find the right host. But, no luck. Can you think of a few key-phrases that will yield positive results on the google search ? The host must allow me to use port 3306 so that my .exe bots can dump data to my website's mysql database.
  8. I manage to fix my on code: if (!$urlIsValid) { die("Error: The requested URL was disallowed by the server administrator."); } $response = makeRequest($url); $rawResponseHeaders = $response["headers"]; $responseBody = $response["body"]; $responseInfo = $response["responseInfo"]; //SET THE BANNED WORDS. $banned_words = array("Prick","****","bull****","****","asshole"); //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). if($responseInfo['http_code'] == '200' ) { $regex = '/\b'; // The beginning of the regex string syntax $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive $substitute = '****'; $responseBody = preg_replace($regex, $substitute, $responseBody); } I changed this: $url = preg_replace($regex, $substitute, $response); to this: $responseBody = preg_replace($regex, $substitute, $responseBody);
  9. 300 - //SET THE BANNED WORDS. 301 - $banned_words = array("Prick","Dick","bullshit"); 303 - //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). 304 - if($responseInfo['http_code'] == '200' ) 305 - { 307 - $regex = '/\b'; // The beginning of the regex string syntax 308 - $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax 309 - $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive 310 - $substitute = '****'; 311 - $url = preg_replace($regex, $substitute, $response); 312 - echo $url; 313 - }
  10. UPDATE: Now. I get this error only. The rest mentioned earlier are gone: Notice: Array to string conversion in C:\xampp\htdocs\proxy\browser_experimenting.php on line 311 Notice: Array to string conversion in C:\xampp\htdocs\proxy\browser_experimenting.php on line 312 Line 311 & 312 looks like this: //SET THE BANNED WORDS. $banned_words = array("Prick","Dick","bullshit"); //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). if($responseInfo['http_code'] == '200' ) { $regex = '/\b'; // The beginning of the regex string syntax $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive $substitute = '****'; $url = preg_replace($regex, $substitute, $response); echo $url; }
  11. Attached is my full modified code of the original Mini Proxy script. My own comments are in CAPITALS. The codes immediately following the UPPER CASED comments are mine. Added a $url logger so the proxied page's url gets logged onto my db. Now need to add the content filter. browser_experimenting.php
  12. Thanks. But, at a loss here. I added this filter code: //SET THE BANNED WORDS. $banned_words = array("Prick","dick","bullshit"); //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). if($responseInfo['http_code'] == '200' ) { $regex = '/\b'; // The beginning of the regex string syntax $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive $substitute = '****'; $cleanresponse = preg_replace($regex, $substitute, $response); echo $cleanresponse; } After this as someone suggested: $response = makeRequest($url); $rawResponseHeaders = $response["headers"]; $responseBody = $response["body"]; But, I get error: Notice: Undefined variable: responseInfo in C:\xampp\htdocs\proxy\browser_experimenting.php on line 304 I never should have got that error, as the variable is defined in line 169. (Maybe, it's within a condition. Hard to see as the original programmer made it messy). And so, I lowered my filter code another line. Below these: $response = makeRequest($url); $rawResponseHeaders = $response["headers"]; $responseBody = $response["body"]; $responseInfo = $response["responseInfo"]; That way, my filter code is underneath the $responseInfo. However, this time more errors: Warning: preg_replace(): Compilation failed: nothing to repeat at offset 21 in C:\xampp\htdocs\proxy\\browser_experimenting.php on line 311 Warning: preg_replace(): Compilation failed: nothing to repeat at offset 21 in C:\xampp\htdocs\proxy\\browser_experimenting.php on line 311 Notice: Array to string conversion in C:\xampp\htdocs\proxy\\browser_experimenting.php on line 311 Warning: preg_replace(): Compilation failed: nothing to repeat at offset 21 in C:\xampp\htdocs\proxy\\browser_experimenting.php on line 311 Notice: Array to string conversion in C:\xampp\htdocs\proxy\browser_experimenting.php on line 312 Array I do not understand why the preg_replace is failing this time when it did not before. Anyway, earlier on, I placed my filter code on line 170 but no luck: //Set the request URL. curl_setopt($ch, CURLOPT_URL, $url); //Make the request. $response = curl_exec($ch); $responseInfo = curl_getinfo($ch); On many of my 3hrs experiments, I have been shifting the filter code on many lines and even changing the variable name but no luck. Changing this: //SET THE BANNED WORDS. $banned_words = array("prick","dick","bullshit"); //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). if($responseInfo['http_code'] == '200' ) { $regex = '/\b'; // The beginning of the regex string syntax $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive $substitute = '****'; [B]$cleanresponse [/B]= preg_replace($regex, $substitute, $response); [B]echo $cleanresponse;[/B] } to this: //SET THE BANNED WORDS. $banned_words = array("prick","dick","bullshit"); //SUBSTITUTE THE BANNED WORDS ON PROXIED PAGE (CONTENT FILTERING). if($responseInfo['http_code'] == '200' ) { $regex = '/\b'; // The beginning of the regex string syntax $regex .= implode('\b|\b', $banned_words); // joins all the banned words to the string with correct regex syntax $regex .= '\b/i'; // Adds ending to regex syntax. Final i makes it case insensitive $substitute = '****'; [B]$url[/B] = preg_replace($regex, $substitute, $response); [B]echo $url;[/B] } Sometimes, I even removed the echoes when I saw the proxy showing a duplicate of the page where when the top version was proxied with no content filtering and the bottom version unproxied with content filtering. And vice versa. [B]echo $cleanresponse;[/B] [B]echo $url;[/B] I reckon the answer lies in the filter code. I'm not doing it right. Any example I can see from you on how the filter should be coded and put under which particular line ? The original Mini Proxy code is here: https://github.com/joshdick/miniProxy/blob/master/miniProxy.php
  13. Thanks. But on which line should I call the function ? That's the answer I've been experimenting and seeking for the past 2.5hrs fruitlessly. On which line here ? https://github.com/joshdick/miniProxy/blob/master/miniProxy.php
  14. Hi, I need to know on which line in the Mini Proxy I should add the "banned words" filter code so that when banned words are found on the proxied pages, then the banned words are substituted ? https://github.com/joshdick/miniProxy/blob/master/miniProxy.php Here is the code that I need to add: Filter Code: <?php /* ERROR HANDLING */ //declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); // 1). Set banned words. $banned_words = array("blow", "nut", "bull****"); // 2). $curl is going to be data type curl resource. $curl = curl_init(); // 3). Set cURL options. curl_setopt($curl, CURLOPT_URL, 'https://www.buzzfeed.com/mjs538/the-68-words-you-cant-say-on-tv?utm_term=.xlN0R1Go89#.pbdl8dYm3X'); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true ); // 4). Run cURL (execute http request). $result = curl_exec($curl); if (curl_errno($curl)) { echo 'Error:' . curl_error($curl); } $response = curl_getinfo( $curl ); if($response['http_code'] == '200' ) { $regex = '/\b'; $regex .= implode('\b|\b', $banned_words); $regex .= '\b/i'; $substitute = '****'; $cleanresult = preg_replace($regex, $substitute, $result); echo $cleanresult; } curl_close($curl); ?> If you reckon the code is not sound then you are welcome to show a suitable example.
×
×
  • Create New...