proxy detection script

Discussion in 'PHP' started by mark103, Sep 9, 2010.

  1. #1
    Hi guys,

    I am creating a script as I am using this to detection the proxy server levels.

    <?php
    //proxy levels
    //Level 3 Elite Proxy, connection looks like a regular client
    //Level 2 Anonymous Proxy, no ip is forworded but target site could still tell it's a proxy
    //Level 1 Transparent Proxy, ip is forworded and target site would be able to tell it's a proxy
     
    if(!$_SERVER['HTTP_X_FORWARDED_FOR'] && !$_SERVER['HTTP_VIA'] && !$_SERVER['HTTP_PROXY_CONNECTION']){
    echo '3';
    } elseif(!$_SERVER['HTTP_X_FORWARDED_FOR']){
    echo '2';
    } else echo '1';
    ?>
    PHP:

    I want the script to check the ip that if the proxy server is a Codeen/PlanetLab and BotNet proxy servers, then place on level one and if they are safe/unsafe to use. I cannot find the code to do the methods.


    Please help me!

    Thanks in advance.
     
    mark103, Sep 9, 2010 IP
  2. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #2
    bump...

    Too short
     
    mark103, Sep 10, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    Well you can use preg_match() to to detect an ip range.
     
    danx10, Sep 10, 2010 IP
  4. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Thanks for this danx10, so I am bit not sure what you mean by detect an ip range?

    I'd hope that preg_match() can find out the levels of the ip and how safe they are...

    Thanks!
     
    mark103, Sep 11, 2010 IP
  5. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #5
    I think you should probably know that any client can send a "HTTP_X_FORWARDED_FOR" header, even if it's not a proxy, so the only reliable info is "REMOTE_ADDR"
     
    Gray Fox, Sep 11, 2010 IP
  6. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Thanks for this, so which one of these methods would tell me whether if the proxy is safe to use while it does not belong to the FBI, government or Ria? There are three methods that I am unsure which one I should use, preg_match(), "HTTP_X_FORWARDED_FOR and REMOTE_ADDR.


    For e.g: Level 3 of proxy is safe which are not belong to the FBI/Government, but level 1 are transparent and some proxy are unsafe and could be belong to FBI/Government.


    Hope you understand what I am trying work on.


    Thanks,
    Mark
     
    Last edited: Sep 11, 2010
    mark103, Sep 11, 2010 IP
  7. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #7
    preg_match() is a reguluar expression function. You can use it to do pattern matching, you can find more about it on google. Either use that or obtain a black/white list somewhere.
     
    Kaizoku, Sep 13, 2010 IP
  8. bcdef1358

    bcdef1358 Guest

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    This will detect any suspicious anonymous proxy and any suspicious open socket that the user is running
     
    bcdef1358, Sep 13, 2010 IP
  9. mark103

    mark103 Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #9
    Which one of php are you referring to?
     
    mark103, Sep 27, 2010 IP