[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-06-2005, 04:08 PM   #1 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


Anonymous Proxy with PHP

i was wondering if any of you know how to make a browser-type script in php using frames, iframes, or includes that uses an anonymous proxy

something like BypassIt.com, i saw they use PHP

if not php, possibly cgi or something else?

i just want to know the script that can be put in, i can make the rest
r22pl is offline  
Old 03-06-2005, 07:14 PM   #2 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


Read the remote URL in from the query string. Get the remote URL into a variable If your using PHP you probably wget in the toolbox. That's what I usually use. (I've used the MS xmlhtml thing as well, and plain old sockets). This is where you set your agent, referrer, etc.

Then create a list of substitutions that need to be done. Regexs make this particularly painless. For example, you might want to replace “http://” with “http://yoursite/proxy.php?”, insert “/proxy.php?” into relative links, etc.

Now write out the variable. There's not much more to it than that.
primacomputer is offline  
Old 03-07-2005, 03:58 AM   #3 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


PHP Code:
<?php
$user
= "xxxxxx";
$pass = "xxxxxxx";


// Tango with the user input
$luser = $_COOKIE['user'];
$lpass = $_COOKIE['pass'];

if(!
$luser|!$lpass) {
    
$luser = $_POST['user'];
    
$lpass = $_POST['pass'];
    
setcookie('user', $luser);
    
setcookie('pass', $lpass);
    if(!
$luser|!$pass) {
        echo
"<form method='post'><input type='text' name='user'><br><input type='password' name='pass'><br><input type='submit' value='auth!'></form>";
        exit;
        }
    }

// Authenticate
if(($user != $luser)|($pass != $lpass)) {
    
setcookie('user');
    
setcookie('pass');
    die(
'wrong pass and shit');
    }

// Do we have an url?
if(!$_GET['url']) {
    echo
"<form><input type='text' name='url' value='http://'><input type='submit' value='Gogo!'></form>";
    exit;
    }

// Do some initialization, fetching
$url = urldecode($_GET['url']);
$url_bits = parse_url($url);
// For rewriting
$host = $url_bits['host'];
$path = $url_bits['path'];
// Since some web browsers actually support spaces in urls, there are some
// websites that have them as well (edge forums :). Let's be graceful about
// those. no reason to comply with the rfcs, is there?
$url = str_replace(' ', '%20', $url);

// only http requests
if($url_bits['scheme'] != 'http')
    die(
"HTTP only. For now at least.");

// Get the web resource
if(($connection = @fopen($url, 'r')) === FALSE) {
    die(
"404 or similar. page can't be opened");
    }
$content = '';
while (!
feof($connection))
    
$content .= fread($connection, 8192);

// Get content-type from headers
foreach($http_response_header as $header)
    
ereg('content-type: ([^;]*)', strtolower($header), $regs);
$ctype = $regs[1];

// If it should prove to be neccessary, do some content-type guessing with mime
// magic shit or file name.. doesnt look to important since most servers always
// specify content-type.

fclose($connection);

// Rewrite 'href=', 'src=', 'action='
if($ctype == 'text/html') {
    
// This obviously isn't very elegant.. will be cutting the conent
    // and doing rewriting piece by piece
    
$pose = 0;
    
$pos = 0;
    
$content_rewritten = '';
    
// Find a new tag
    
while(($pos = strpos($content, '<', $pose)) !== FALSE) {
        
// Add everything between this and the last tag
        
$content_rewritten .= substr($content, $pose, $pos - $pose);
        
// Get content of this tag
        
$pose = strpos($content, '>', $pos);
        
$cont = substr($content, $pos, $pose - $pos);
        
        
// Find possible urls and rewrite them
        
$link = '';
        
eregi('(((href)|(src)|(action)) ?= ?[\'"]?)([^\'" >]*)', $cont, $link);
        if(
$link[1])
            
$cont = ereg_replace($link[1] . slashreg($link[6]), $link[1] . rewrite($link[6]), $cont);
            
        
// Write the tag to the content
        
$content_rewritten .= $cont;
        
$pos = $pose;
        }
    
// Write the end of content and make it actual
    
$content_rewritten .= substr($content, $pose);
    
$content = $content_rewritten;
    }

// Cough it out
echo $content;

// This rewrites the different urls
function rewrite($url) {
    global
$host, $path;
    if(
strtolower(substr($url, 0, 7)) == 'http://') {
        
$url = urlencode($url);
        }
    else if(
strtolower(substr($url, 0, 11)) == 'javascript:') {
        return
$url;
        }
    else if(
substr($url, 0, 1) == '/') {
        
$url = urlencode('http://' . $host . $url);
        }
    else {
        
$url = urlencode('http://' . $host . '/' . ereg_replace('/?(.*)/.*', '\\1/', $path) . $url);
        }
    
    return
'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?url=' . $url;
    }

// Slashes some things that **** with ereg_replace
function slashreg($str) {
    return
str_replace(array("\\","(",")","?"),array("\\\\","\\(","\\)","\\?"), $str);
    }

?>
uses the ip of the server, check the fopen function on how to connect to a proxy and get a website. This also rewrites urls.
axilant is offline  
Old 03-07-2005, 12:43 PM   #4 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


do you need to have the username and password in there in order for it to work?

and some websites ive tried came up as errors

Last edited by r22pl; 03-07-2005 at 01:00 PM.
r22pl is offline  
Old 03-07-2005, 01:13 PM   #5 (permalink)
Senior Member
 
Ferman's Avatar
 
Join Date: Aug 2004
Location: Criticize BUSH at CRITICIZE.TV
Posts: 1,155
49.00 NP$ (Donate)

Ferman has a spectacular aura aboutFerman has a spectacular aura about


is it possible to modify this script to work for ftp:// https:// urls ? jmarshall s cgiproxy does it but i need a php one
Ferman is offline  
Old 03-07-2005, 01:43 PM   #6 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


im looking for one with like frames or something
r22pl is offline  
Old 03-07-2005, 05:49 PM   #7 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


Quote:
Originally Posted by r22pl
im looking for one with like frames or something
i dont think that would work without a downloaded program?
axilant is offline  
Old 03-07-2005, 06:08 PM   #8 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


oh ok, well i'll try the one you posted earlier tomorrow in school
r22pl is offline  
Old 03-07-2005, 09:29 PM   #9 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


If you have to frame it why not frame the original page that posts to the script? After the form is posted the results of the script will display inside the frame.
primacomputer is offline  
Old 03-08-2005, 03:49 AM   #10 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


ok thanks
r22pl is offline  
Old 03-08-2005, 11:53 AM   #11 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


why do you need something like this? If you can explain the use, i can help you a little bit more.
axilant is offline  
Old 03-08-2005, 12:04 PM   #12 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
 
Join Date: Aug 2004
Posts: 3,794
47.60 NP$ (Donate)

stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of


i think there is a php application called snoopy, try sf.net and look for it, i know i saw it
stscac is offline  
Old 03-08-2005, 12:07 PM   #13 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


Quote:
Originally Posted by stscac
i think there is a php application called snoopy, try sf.net and look for it, i know i saw it
Well snoopy is mainly for connecting to a proxy and then pulling information :P such as whois

Quote:
Originally Posted by axilant
Well snoopy is mainly for connecting to a proxy and then pulling information :P such as whois
nope i was wrong forgive me,

http://sourceforge.net/projects/snoopy/
axilant is offline  
Old 03-08-2005, 12:46 PM   #14 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


in my internet class at school, i need to make something that you can browse with anonymous proxy. something similar to www.bypassit.com or www.proxify.com, but i dont need all those options. just an input box
r22pl is offline  
Old 03-08-2005, 12:54 PM   #15 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


so basicly your asking someone to do your homework? :-/
axilant is offline  
Old 03-08-2005, 01:16 PM   #16 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


no its not homework, its for the teacher, she needs to use it and asked our class to see if we could get one, because all the other ones were blocked by our internet filter
r22pl is offline  
Old 03-08-2005, 06:58 PM   #17 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


Teach wants to surf porn on the job eh?
primacomputer is offline  
Old 03-08-2005, 07:18 PM   #18 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


haha i hope not
r22pl is offline  
Old 03-11-2005, 09:30 AM   #19 (permalink)
NamePros Member
 
Join Date: Oct 2004
Location: New York
Posts: 76
177.20 NP$ (Donate)

redking is an unknown quantity at this point


Quote:
Originally Posted by r22pl
no its not homework, its for the teacher, she needs to use it and asked our class to see if we could get one, because all the other ones were blocked by our internet filter
I think you're asking someone to do your homework. I'm sure a teacher for an "internet class" could find such a program herself.
redking is offline  
Old 03-11-2005, 02:03 PM   #20 (permalink)
NamePros Member
 
Join Date: Mar 2005
Location: York, PA
Posts: 39
75.00 NP$ (Donate)

r22pl is an unknown quantity at this point


no, im not. and besides, i figured it out myself
r22pl is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
Free Anonymous Proxy Browser Spondoo Free Resources 4 03-16-2005 12:18 PM
Proxy Detection in php axilant CODE 1 06-25-2004 05:24 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:26 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85