Results 1 to 9 of 9

Thread: Proxy Lister

  1. #1
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Proxy Lister

    This is a script I wrote up, hopefully to be later used with some sort of Google AdSense-abusing mischief

    It retrieves a list of proxies from my favourite proxy site, samair.ru; please note that this script was designed with that site and that one only in mind, and will *not* work 'out of the box' with any proxy list site.

    The logic is pretty simple, it trims off the heading chunk of useless text, then substr's and regex's the rest of the junk off, then it puts all the proxies into a nice neat array and prints them in the debug for you

    Oh, and BTW, this was written in 3.13, so I'm not sure if it is backwards-compatible.

    Enjoy!

    SCAR Code:
    program New;
    var
      Page, Info : string;
      Proxies : TStringArray;

    function ProxyArray(Delimiter : string; Str : string) : array of string;
    var
      DelimPos, i : integer;
      Arr1 : array of string;
      Potential : string;
    begin
      SetArrayLength(Arr1, 500);
      i := 0;
      repeat
        if (pos(Delimiter, Str) = 0) then Break;
        DelimPos := pos(Delimiter, Str);
        Potential := Replace((copy(Str,0,DelimPos)),Delimiter,'');
        if pos(FindRegex(Potential,'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'),Potential) <> 0 then
          begin
            Delete(Potential, (pos(':',Potential)+1),1);
            Arr1[i] := Potential;
            i := i + 1;
          end;
        Delete(Str,1,DelimPos);
      until(pos(Delimiter, Str) = 0);
      SetArrayLength(Arr1, i);
      Result := Arr1;
    end;

    procedure PrintArray(r : TStringArray);
    var
      i : integer;
    begin
      i := 0;
      repeat
        Writeln('Array['+IntToStr(i)+'] = '+r[i]);
        i := i + 1;
      until(i = GetArrayLength(r));
    end;

    procedure TrimShit;
    var
      i : integer;
    begin
      i := pos('Country',Page);
      Delete(Page,1,i);
      Delete(Page,1,6);
    end;

    procedure TrimHTML;
    var
      StartEncaps, EndEncaps, Length : integer;
    begin
      repeat
        StartEncaps := pos('<',page);
        EndEncaps := pos('>',page);
        Length := (EndEncaps - StartEncaps) + 1;
        Delete(Page,StartEncaps,Length);
      until(StartEncaps = 0);
      Delete(Page,1,6);
    end;

    procedure TrimRemnants;
    var
      StartEncaps, EndEncaps, Length : integer;
    begin
      repeat
        StartEncaps := pos('-',page);
        EndEncaps := pos(',',page);
        Length := (EndEncaps - StartEncaps) + 1;
        Delete(Page,StartEncaps,Length);
      until(StartEncaps = 0);
    end;

    procedure TrimTimes;
    begin
      Info := ReplaceRegex(Info,'[0-9][0-9]:[0-9][0-9]','');
    end;

    procedure Clean;
    begin
      TrimShit;
      TrimHTML;
      TrimRemnants;
      Info := TrimLetters(Page);
      TrimTimes;
    end;

    procedure LoadPage;
    begin
      Page := GetPage('http://www.samair.ru/proxy');
      Clean;
    end;

    begin
      LoadPage;
      Proxies := ProxyArray(' ',Info);
      PrintArray(Proxies);
    end.



    EDIT: Some weird stuff going on, it doesn't work 2 hours later. If it doesn't for you, try this one:

    SCAR Code:
    program New;
    var
      Page, Info : string;
      Proxies : TStringArray;

    function ProxyArray(Delimiter : string; Str : string) : array of string;
    var
      DelimPos, i : integer;
      Arr1 : array of string;
      Potential : string;
    begin
      SetArrayLength(Arr1, 500);
      i := 0;
      repeat
        if (pos(Delimiter, Str) = 0) then Break;
        DelimPos := pos(Delimiter, Str);
        Potential := Replace((copy(Str,0,DelimPos)),Delimiter,'');
        if pos(FindRegex(Potential,'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'),Potential) <> 0 then
          begin
            Delete(Potential, (pos(':',Potential)+1),1);
            Potential := replace(Potential,'-','');
            Arr1[i] := Potential;
            i := i + 1;
          end;
        Delete(Str,1,DelimPos);
      until(pos(Delimiter, Str) = 0);
      SetArrayLength(Arr1, i);
      Result := Arr1;
    end;

    procedure PrintArray(r : TStringArray);
    var
      i : integer;
    begin
      i := 0;
      repeat
        Writeln('Array['+IntToStr(i)+'] = '+r[i]);
        i := i + 1;
      until(i = GetArrayLength(r));
    end;

    procedure TrimShit;
    var
      i : integer;
    begin
      i := pos('Country',Page);
      Delete(Page,1,i);
      Delete(Page,1,6);
    end;

    procedure TrimHTML;
    var
      StartEncaps, EndEncaps, Length : integer;
    begin
      repeat
        StartEncaps := pos('<',page);
        EndEncaps := pos('>',page);
        Length := (EndEncaps - StartEncaps) + 1;
        Delete(Page,StartEncaps,Length);
      until(StartEncaps = 0);
      Delete(Page,1,6);
    end;

    procedure TrimRemnants;
    var
      StartEncaps, EndEncaps, Length : integer;
    begin
      repeat
        StartEncaps := pos('-',Info);
        EndEncaps := pos(',',Info);
        Length := (EndEncaps - StartEncaps) + 1;
        Delete(Info, StartEncaps, Length);
      until(StartEncaps = 0);
    end;

    procedure TrimTimes;
    begin
      Info := ReplaceRegex(Info,'[0-9][0-9]:[0-9][0-9]','');
    end;

    procedure Clean;
    begin
      TrimShit;
      TrimHTML;
      TrimRemnants;
      Info := TrimLetters(Page);
      TrimTimes;
    end;

    procedure LoadPage;
    begin
      Page := GetPage('http://www.samair.ru/proxy');
      Clean;
    end;

    begin
      LoadPage;
      Proxies := ProxyArray(' ', Info);
      PrintArray(Proxies);
    end.

  2. #2
    Join Date
    Feb 2007
    Location
    SparklesProd.com
    Posts
    2,406
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, great job, looks very sexy and original. First post, Grats =P

  3. #3
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice work, but couldnt u just go to the website and find them manually?? :P

    lol but its nice

    ~Spaz

  4. #4
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    But this way you can cycle through a lot of proxies, then rape AdSense overnight :P

  5. #5
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Proxies never work for me on firefox...It takes 10x longer to load the sites...I just use http://www.kproxy.com/

  6. #6
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Could you make it work with http://proxy.org? As that is a very good source list for proxies.

    Plus, i do not understand this code ><
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  7. #7
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by IP-Drowner View Post
    Could you make it work with http://proxy.org? As that is a very good source list for proxies.

    Plus, i do not understand this code ><
    Proxy.org provides just web proxies, right? If that's the case, it ought to be a pretty simple matter of mouse-clicking your way around.

    I can comment the script if you want

  8. #8
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Agent, you should apply to SRL memebrs if you made it yourslef, but you need a runescaoe script...


    Hmmm...mhhh I have to admit I can't understand not a single thing there
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  9. #9
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks I just need a good idea for a script.

    A runthrough of the logic for anyone who is confused:

    1) TrimShit --> Site-specific, it trims off useless text starting at the beginning of the page and ending at the last word before the list starts. ("Country").

    2) TrimHTML --> Deletes any HTML tags, (<>) and anything encapsulated in them; works by repeatedly searching with pos() and deleting with delete(). The delete(Page,1,6) at the end is also site-specific; it trims off whitespace and a table character at the beginning.

    3)TrimRemnants --> Rather specific, gets rid of some date text.

    4)TrimTimes --> Uses a 'regex' or regular expression to find any dates, regexes are a bit tricky but this particular one ("[0-9][0-9]:[0-9][0-9]") finds any 2 digits (from 1 to 9) followed by a colon, then another 2 digits. Essentially, it deletes the 24h clock time stamps.

    5) ProxyArray --> The real heart of the script...
    By this point, all that's left of the page is the proxies with spaces and sometimes whitespace in between them, and a table character between the colon and the port number.

    This sets up a big, empty array, then starts a loop. It then finds the first instance of the delimiter, the space between the proxies, then uses this position as reference to pick out just one proxy, by using
    SCAR Code:
    Potential :=Replace((copy(Str,0,DelimPos)),Delimiter,'');

    This creates a new string called "Potential" by copying the text up to the delimiter, then deleting said delimiter. Next, it uses this:

    SCAR Code:
    if pos(FindRegex(Potential,'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'),Potential) <> 0 then
          begin
            Delete(Potential, (pos(':',Potential)+1),1);
            Potential := replace(Potential,'-','');
            Arr1[i] := Potential;
            i := i + 1;
          end;
        Delete(Str,1,DelimPos);

    The first line uses pos() to search, using another regex to check whether the string we have selected is in proxy format (number.number.number.number). Next, it deletes the table character between the colon and the port. Lastly, it strips any hyphens from the proxy, adds it to the array, then deletes it from the string to avoid repeats.

    Hope I was clear enough, enjoy!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need programming project help - sudoku combinations lister?
    By JAD in forum C/C++ Help and Tutorials
    Replies: 12
    Last Post: 02-21-2009, 12:18 AM
  2. Proxy?
    By Danteliciouz in forum Misc. Links and Programs
    Replies: 2
    Last Post: 12-14-2007, 06:39 AM
  3. Proxy?
    By THG in forum Bot Information and Spottings
    Replies: 6
    Last Post: 08-21-2007, 02:28 PM
  4. What do you use for your Proxy?
    By kissdemon in forum News and General
    Replies: 12
    Last Post: 08-15-2007, 06:36 AM
  5. PHP proxy / http protocol proxy
    By botmaster in forum Web Development
    Replies: 4
    Last Post: 05-04-2007, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •