SIMPLE HTTP PROXY SERVER CHECKER (Completed)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SIMPLE HTTP PROXY SERVER CHECKER (Completed)
# 1  
Old 05-30-2012
SIMPLE HTTP PROXY SERVER CHECKER (Completed)

Simple Http Proxy Server Checker Script with curl
mirror proxies-scripts/proxc at master * Anoncheg1/proxies-scripts * GitHub
output in terminal
HTTP, HTTP Connect (HTTPS not supported)
Code:
command line:
proxc filename

where filename is file like
119.110.69.185:8080
119.235.16.41:8080
154.182.broadband15.iol.cz:8080
119.252.165.170:8080

requirements:
  1. curl
  2. your own site with php support
  3. you must change "sitedns" and "siteip" variable in script.
Code:
#! /bin/bash
trap bashtrap INT
bashtrap()
{
    echo
    echo "CTRL+C Detected"
    kill 0
    exit
}

sitedns="yoursite.dns"
siteip="1.1.1.1" #not required for browser check

varagent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1"
TIMEOUT=4

cookie_header="Cookie: __atuvc=19%7C23; NIXSESSID=3f5d178f0ce66213c512e512b65269008c365038;" #random cookie

phpsiteprase="any fucking text"

function ping_http {
# <p>$phpsiteprase</p>/nArray
#    [Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
#    [Accept-Charset] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
#    [Accept-Encoding] => gzip,deflate
#    [Accept-Language] => en-us,en;q=0.5
#    [Connection] => close
#    [Host] => yoursitedns.com
#    [User-Agent] => Mozilla/5.0 (Android; Tablet; rv:12.0) Gecko/12.0 Firefox/12.0
#    [Via] => 1.1 89.28.122.140 (Mikrotik HttpProxy)
#    [X-Forwarded-For] => 1.1.1.1
#    [X-Proxy-Id] => 1773250874
#    [X-Real-Ip] => 89.28.122.140
    local proxyip=$1

    local http_check_var=`curl -s -A "$varagent" -x "$proxyip" --connect-timeout $TIMEOUT \
    --url "http://""$sitedns""/tmp/" -m 5`                   #Proxies for browser
#    --header "Host: "$sitedns"" --url "http://"$siteip"/tmp/" -L -m 5`
    local check1_phrase=`echo "$http_check_var" | grep -o "$phpsiteprase"`
    local check2_forwarded=`echo "$http_check_var" | grep -o "Forwarded"`
    local check3_clientip=`echo "$http_check_var" | grep -o "Client-Ip"`
    local check4_proxy=`echo "$http_check_var" | grep -o "Proxy"`
    local check5_via=`echo "$http_check_var" | grep -o "Via"`
    if [[ -n "$check1_phrase" ]]; then    #-n not zero # working
#        local http_check_var_connect=`curl -s -A "$varagent" -p -x "$proxyip" --connect-timeout $TIMEOUT \
#        --header "Host: "$sitedns"" --url "http://"$siteip"/tmp/" -m 5 | grep -o "$phpsiteprase"`  #Http Connect check
        if [[ -z "$check2_forwarded" && -z "$check3_clientip" ]]; then  #  -z - if null #Elite without cookie
            local http_check_var=`curl -s -A "$varagent" -x "$proxyip" --connect-timeout $TIMEOUT --header "$cookie_header" --header "Cache-Control: no-cache"\
            --url "http://""$sitedns""/tmp/" -m 5` #second check with cookie now
            local check1_phrase=`echo "$http_check_var" | grep -o "$phpsiteprase"`
            local check2_forwarded=`echo "$http_check_var" | grep -o "Forwarded"`
            local check3_clientip=`echo "$http_check_var" | grep -o "Client-Ip"`
            local check44_proxy_2=`echo "$http_check_var" | grep -o "Proxy"`
            local check55_via_2=`echo "$http_check_var" | grep -o "Via"`
            if [[ -n "$check1_phrase" && -z "$check2_forwarded" && -z "$check3_clientip" ]]; then #Elite with cookie
                local check6_vk=`curl -s -A "$varagent" -x "$proxyip" --url vk.com -m 1 | grep -o "vklogin"` #check for speed

                # I check country for elite. Move it where u want.
                local prip=$(echo "$line" | sed 's/:.*//')
                local whoisvar=$(whois "$prip" )
                local countryvar=$(echo "$whoisvar" | grep "country:" | sed 's/country: \{1,\}//' | head -n 1)
                [[ -z "$countryvar" ]] && local countryvar=$(echo "$whoisvar" | grep "Country-Code" | sed 's/.*:\{1,\}//' | head -n 1)
                [[ -z "$countryvar" ]] && local countryvar=$(echo "$whoisvar" | grep "Nameserver" | sed 's/.*\.\{1,\}//' | head -n 1)
                    #case $countryvar in
                    #"RU" | "UA" | "BY" | "KZ" | "KG")
                        #echo...
                        #;;
                    #esac
                #if [[ "$countryvar" != "CN" && "$countryvar" != "cn" ]]; then
                    echo -ne "\t\t\t\tElite\r"
                    echo -ne "\t\t\t\t\t\t"${countryvar:0:13}"\r"
                    if [[ -z "$check4_proxy" && -z "$check5_via" && -z "$check44_proxy_2" && -z "$check55_via_2" ]]; then
                        echo -ne "\t\t\t\t\tSuperEl\r"
                    fi
                    [[ -n "$check6_vk" ]] && echo -ne "\t\t\t\t\t\t\t\t\tSpeedVK \r"

                    echo "$proxyip""      "
                #fi
            fi
        fi
        #if [[ -n "$http_check_var_connect" ]]; then    #-n not zero  #HTTP Connect
            #echo -ne "\t\t\t\t\t\t\t\tConn \r"
        #fi
    fi
    echo -ne "process $count finished    \r"
}

function check_alive_http {
    ##### check loop #####
    local count=1
    for line in $( cat $1 )
    do    
        ping_http "$line" &
        sleep 0.2

    let count++
    done
    wait
    echo 
}

### MAIN ####
TOTAL_HTTP=`cat $1 | wc -l`
[ "$TOTAL_HTTP" == 0 ] && { echo "Found 0 proxies"; exit; }
echo "Checking "$TOTAL_HTTP" HTTP proxies"
check_alive_http $1

#            # DNS to IP
#            local ipold=$(echo "$proxyip" | sed 's/:.*//')
#            local ip=$(dig +short "$ipold")
#            if [[ "$ip" != "" ]]; then
#                local proxyip=$ip:$(echo "$proxyip" | sed 's/.*://')
#            fi
#            #

your PHP site with adderess http://"your.site.com"/tmp/index.php:
PHP Code:

<html>
 <head>
  <title>proxc</title>
 </head>
 <body>

 <?php echo '<p>any fucking text</p>/n';
if(!
function_exists('apache_request_headers')) {
    function 
apache_request_headers() {
        
$headers = array();
        foreach(
$_SERVER as $key => $value) {
            if(
substr($key05) == 'HTTP_') {
                
$headers[str_replace(' ''-'ucwords(str_replace('_'' 'strtolower(substr($key5)))))] = $value;
            }
        }
        return 
$headers;
    }
}


print_rapache_request_headers() );

?>
</body>
</html>
All proxies still may be unsafe. To redice risk use My HTTP headers with double loading.


If you wanna use proxies not for browser only, replace:
Code:
--url "http://""$sitedns""/"

with
Code:
--header "Host: "$sitedns"" --url "http://"$siteip"/"

If you wanna add your check in script you should do all curl request before echo commands

Socks and grabber scripts: https://github.com/Anoncheg1/proxies-scripts/

Last edited by 654321; 05-23-2014 at 08:14 AM.. Reason: script upgrades
This User Gave Thanks to 654321 For This Post:
# 2  
Old 05-31-2012
I dont wanna include this for keeping it simple
Code:
            # DNS to IP
            local ipold=$(echo $proxyip | sed 's/:.*//')
            local ip=$(dig +short $ipold)
            if [[ $ip != "" ]]; then
                local proxyip=$ip:$(echo $proxyip | sed 's/.*://')
            fi
            #

can be used inside function ping_http

Last edited by 654321; 06-05-2012 at 05:08 AM..
# 3  
Old 06-05-2012
MySQL

I found that some proxies work different with cookies
That is why I added second check for Elite proxy servers.

... Now I found that some proxies work different with header "Cache-Control: no-cache" . That is why I added such header in second check.

Last edited by 654321; 11-15-2012 at 03:56 AM..
These 2 Users Gave Thanks to 654321 For This Post:
# 4  
Old 09-23-2012
Thank you very much for your script, this is exactly what I was looking for!

However, I have a few problems with it:

To get it to run, I first had to save the PHP file in your post as index.php in the /tmp directory of my webserver. I had to read the source code to know that, it would be nice to have it in the documentation.

I tested it with several proxylists from today, combined about 4500 unique proxySmilieort combinations. In my access logfiles of the webserver I saw that more than 1200 of them successfully retrieved the /tmp/index.php testscript. But the proxyc script just terminates after the last process finished, without printing any results on the screen. Where do I get the results?
# 5  
Old 09-23-2012
Ever wondered where those huge lists of mostly-broken public proxies come from? I don't, anymore. I saw a server become compromised by a rootkit, and appear in one of those lists. A badly thought-out apache configuration also made a different server of mine appear in one of those lists, and even after I fixed it, I was getting 403's for months from people trying to use it as a proxy.

Those lists are full of computers that are, or were, compromised. My advice? Get your own.

Last edited by Corona688; 09-23-2012 at 03:40 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

Configure HTTP proxy in SUMA

Hi, I am trying to configure an HTTP_PROXY so that suma can reach out beyond our intranet and pull updates from the IBM website. Currently, our suma config is the default as it's not been used before. When I attempt to issue the following command sudo suma... (7 Replies)
Discussion started by: JAR1
7 Replies

2. Web Development

Http connect to proxy to websockets

I am having a hard time with this one. We have a websocket server listening on port 80 at myserver.com/wsDemo?ID=12. We need to test a client program by connecting it to this server through a proxy. I am trying nginx 1.2.7 as the proxy on port 8080, running on proxy-server. We want the client to... (1 Reply)
Discussion started by: glev2005
1 Replies

3. Shell Programming and Scripting

Completed: Domain name tools. Generator & Checker

I'm fairly new to bash scripts, and all things unix in general. But I was in desperate need of this script, so I took matters into my own hands and built it! The first script uses a password generator that creates 4 letter domain names and outputs only the ones that are available. Currently its... (0 Replies)
Discussion started by: Files
0 Replies

4. Programming

Sending and Receiving data between Client, HTTP Proxy, and Remote Server

I am having problems receiving data from a remote server. It seems that I can send an HTTP request to any host such as http://www.google.com, but I can't get a reply. I'm sending the host a HTTP 1.0 request that is formatted as such: GET / HTTP/1.0 Host: http://www.google.com Connection:... (0 Replies)
Discussion started by: shubham92
0 Replies

5. Shell Programming and Scripting

Simple HTTP server in GAWK

Hi, Not sure if this post belongs to this forum but I have been trying every so often to setup a simple http server in awk. After a couple of try and errors I finally came across this: REMCONF - TCP/IP Internetworking With `gawk' This tutorial is not to cut and paste without change, so here... (0 Replies)
Discussion started by: ripat
0 Replies

6. IP Networking

Software/tool to route an IP packet to proxy server and capture the Proxy reply as an

Hi, I am involved in a project on Debian. One of my requirement is to route an IP packet in my application to a proxy server and receive the reply from the proxy server as an IP packet. My application handles data at the IP frame level. My application creates an IP packet(with all the necessary... (0 Replies)
Discussion started by: Rajesh_BK
0 Replies

7. Programming

Tools for writing a simple syntax checker?

I'm trying to write a small utility for syntax checking. I've tried using Flex/Bison, but these seem too advanced for my task. A simpler tool would be appreciated. (1 Reply)
Discussion started by: Ilja
1 Replies

8. Programming

Proxy Checker in C

Hello Everyone Im planning to make a C program to check a proxy server if it is working or bot, test the proxy speed ,response time , as well as a proxy type. i'm learning using libcurl right now to fetch http headers. do you guys have some links about how to check proxy headers?. Thank you. ... (0 Replies)
Discussion started by: magictalong
0 Replies
Login or Register to Ask a Question