1. #!/usr/bin/perl
2. $| = 1;
3. use Getopt::Long;
4. use Lwp::UserAgent;
5. use Time::Local;
6.
7. $time = localtime;
8.
9. my $ua = LWP::UserAgent->new;
10.
11. $version = "0.3A";
12.
13. print "Version $version made by Saustin (c).\nIf you use this, please thank me for creating this free tool!\n\n\n";
14. @website_array = ();
15. @completed_array = ();
16. @proxies = ();
17. GetOptions( "list=s" => \$list,
18. "help" => \$help,
19. "website=s" => \$website,
20. "bandwith" => \$bandwith_switch,
21. "timeout=i" => \$timeout,
22. "bell" => \$is_bell_true,
23. "proxy-list=s" => \$proxy_list,
24. "no-longer-than=i" => \$no_longer_than,
25. "debug" => \$debug);
26. if(!defined($timeout))
27. {
28. $timeout = 10;
29. }
30. if($help == 1)
31. {
32. print "$0 [OPTIONS]\n";
33. print "Options:\n";
34. print "--list = Specify a list to use.\n";
35. print "--website = Website for you to use.\n";
36. print "--bandwith = Tells you how much bandwith in kilobytes has been used so far.\n";
37. print "--timeout = Cancel dead connections, default is 10 secs.\n";
38. print "--bell = Ring a bell on the computer when finished. (Doesnt always work)\n";
39. print "--proxy-list = Use a proxy list (domain/ip:port OR http://proxy:[port]/ format)\n";
40. print "--no-longer-than = Specify an integer that is a timeout for proxies.\n";
41. print "--help = Displays this menu and exits.\n\n\n\n\n";
42. print "Please note:\nBacklinks should be in this format:\nhttp://www.examples.com/web_dir/\{0\}\n\n\n";
43. exit;
44. }
45. if(!defined($website))
46. {
47. print "You must define a website. I suggest you look at help?\n";
48. exit;
49. }
50. if(defined($proxy_list))
51. {
52. open PROXY_LIST, "$proxy_list" or die "Error opening proxy list: $!\n";
53. while(<PROXY_LIST>)
54. {
55. chop($_);
56. if($_ =~ /http/)
57. {
58. push(@proxies, $_);
59. }
60. else
61. {
62. $new_proxy = "http://" . $_ . "/";
63. push(@proxies, $new_proxy);
64. }
65. }
66. foreach(@proxies)
67. {
68. $proxy = $_;
69. $time = time;
70. $ua->proxy('http', $proxy);
71. $ua->timeout($timeout);
72. $request = new HTTP::Request('GET', 'http://www.google.com/');
73. $response = $ua->request($request);
74. $content = $response->content;
75.
76. if(defined($content))
77. {
78. if($content =~ /google/)
79. {
80. if(defined($no_longer_than))
81. {
82. $time_new = time;
83. $time_taken = $time_new - $time;
84. if($time_taken > $no_longer_than)
85. {
86. print "Proxy took $time_taken seconds, not using...\n";
87. }
88. if($time_taken < $no_longer_than)
89. {
90. print "Proxy works! Visted google!: $proxy\n";
91. push(@working_proxies, $_);
92. }
93. }
94. else
95. {
96. print "Proxy works! Visited google!: $proxy\n";
97. push(@working_proxies, $_);
98. }
99. }
100. else
101. {
102. print "Proxy is broken: $proxy\n";
103. }
104.
105. }
106. $size_of_proxy_array = @working_proxies;
107. }
108. }
109.
110. if(defined($list))
111. {
112. open FILE, "$list" or die "ERROR: Error loading $list: $!\n";
113. print "List opened.\n";
114. while(<FILE>)
115. {
116. chomp($cur_row = $_);
117. push(@website_array, $cur_row);
118. }
119. $count = 0;
120. foreach(@website_array)
121. {
122. $cur = $_;
123. if($cur =~ /\{0\}/)
124. {
125. $cur =~ s/\{0\}/$website/g;
126. push(@completed_array, $cur);
127. $count++;
128. }
129. if($cur =~ /\[URL\]/)
130. {
131. $cur =~ s/\[URL\]/$website/g;
132. push(@completed_array, $cur);
133. $count++;
134. }
135. }
136. print "Done replacing URLs. Starting to visit them..\n";
137. $start_time = time;
138. $completed_count = 0;
139. if($bandwith_switch == 1) { $bandwith_used = 0; }
140.
141. foreach(@completed_array)
142. {
143. $cur_website = $_;
144. $ua->timeout($timeout);
145. if(defined($proxy_list))
146. {
147. $random_proxy = int(rand($size_of_proxy_array));
148. $proxy_to_use = $working_proxies[$random_proxy];
149. $ua->proxy('http', $proxy_to_use);
150. }
151. $req = HTTP::Request->new('GET', $cur_website);
152. $response = $ua->request($req);
153. $content = $response->content;
154. if(defined($content))
155. {
156. $completed_count++;
157. $time_ran = time - $start_time;
158. if($bandwith_switch == 1)
159. {
160. $percent_done = ($completed_count / $count) * 100;
161. $bandwith_used = $bandwith_used + length($content);
162. if($bandwith_used > 1048576)
163. {
164. $cb = int($bandwith_used / 1048576);
165. print "[+] Amount worked so far: $completed_count | $percent_done\% | Time: $time_ran sec | BW used: $cb\MB";
166. print "\r";
167. }
168. else
169. {
170. $cb = int($bandwith_used / 1024);
171. print "[+] Amount worked so far: $completed_count | $percent_done\% | Time: $time_ran sec | BW used: $cb\KB";
172. print "\r";
173. }
174.
175. }
176. else
177. {
178. $percent_done = ($completed_count / $count) * 100;
179.
180. if($debug == 1)
181. {
182. print "[+] Amount worked so far: $completed_count | $percent_done\% | Time: $time_ran sec\n";
183. print "URL: $cur_website\nPROXY: $proxy_to_use\n";
184. }
185. else
186. {
187. print "[+] Amount worked so far: $completed_count | $percent_done\% | Time: $time_ran sec";
188. print "\r";
189. }
190. }
191. }
192. }
193. print "\nDone with list!\n";
194. if($is_bell_true == 1)
195. {
196. print "\a\a\a\a\a\a";
197. }
198. exit;
199. }
200.
201. else
202. {
203. print "You must specify a list... --help...\n";
204. exit;
205. }