1- #!/usr/bin/perl
2- use Win32::API::Prototype;
3- use Win32::GUI::Loft::Design;
4- use Thread qw(async);
5- use Thread::Queue;
6- $SIG{'PIPE'} = 'IGNORE';
7- $SIG{'CHLD'} = 'IGNORE';
8- my $parent = 0;
9- my @children = ();
10- use LWP 5.64;
11- use LWP::ConnCache;
12- use IO::Handle; $SIG{'INT'} = 'INT_handler'; STDERR->autoflush(0); $| = 1;
13- %PRIORITIES = (
14- low => 0x00000040,
15- normal => 0x00000020,
16- high => 0x00000080,
17- idle => 0x00000040,
18- realtime => 0x00000100,
19- );
20- $maxL = 100;
21- $tout = 3;
22- $startzeit = time();
23- @browsers = (
24- “Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6“,
25- “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)“,
26- “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)“,
27- “Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522.11 (KHTML, like Gecko) Safari/3.0.2“,
28- “Opera/9.00 (Windows NT 5.1; U; de)“,
29- “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6“,
30- “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)“,
31- “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)“,
32- “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)“,
33- “Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; .NET CLR 1.1.4322)“,
34- “Opera/9.20 (Windows NT 6.0; U; de) Opera 9.2“,
35- “Opera/9.00 (Windows NT 5.1; U; de) Opera 9.0“,
36- “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; de) Opera 8.50“,
37- “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; de) Opera 8.0“,
38- “Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.02 [de]“,
39- “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1“
40- );
41- $browser = $browsers[rand @browsers];
42- @urls = (“http://www.linkdirectory.com/top-hits.html“,“http://www.mister-wong.de/charts/“,“http://www.bildblog.de/“,“http://www.heise.de/tp/“,“http://www.folkd.com/“,“http://www.yigg.de/neueste-nachrichten“,“http://delicious.com/“,“http://digg.com/“,“http://www.oneview.de/home/cloud.jsf“,“http:/mozilla.org“,“http://de.wikipedia.org“);
43- $url = $urls[rand @urls]; $ApL = 0; @pL = ();
44-
45- open (CON, “<config.ini“);
46- $con = <CON>;
47- close (CON);
48- ($sleeep1,$sleeep2,$priority) = split('!',$con);
49- $sleeep1 = $sleeep1 ? $sleeep1 : 3;
50- $sleeep1 = $sleeep1 ? $sleeep1 : 9;
51- $priority = $priority ? $priority : “low“;
52- $sleeper = random_range($sleeep1,$sleeep2);
53- $response = httpget(“http://anti-vorratsdatenspeicherung.mahakala.de/?checkupdate“,5);
54- if (($response !~ /2.0.3|500 Can/)) { Win32::GUI::MessageBox(0, “Es ist ein Update [ $response ] verfügbar!\nBitte besuchen Sie\nhttp://anti-vorratsdatenspeicherung.mahakala.de/“, “Anti Vorratsdatenspeicherung: Update verfügbar!“); }
55-
56- my $winTransformer = undef;
57- my $mnuTray = Win32::GUI::MakeMenu(
58- “tray“ => “tray“,
59- “ > &Wiederherstellen“ => “mnuTrayRestore“,
60- “ > -“ => 0,
61- “ > &Beenden“ => “mnuTrayExit“,
62- );
63- eval { main();};
64- Win32::GUI::MessageBox(0, “Error: $@“, “Anti-Vorratsdatenspeicherung“) if($@);
65-
66- sub main {
67-
68- {
69- my $fileWindow = “ansi.gld“;
70- my $objDesign = Win32::GUI::Loft::Design->newLoad($fileWindow) or die(“Could not open window file ($fileWindow)“);
71- $objDesign->buildWindow() or die(“Could not build window ($fileWindow)“);
72- }
73- my $hwnd = GUI::GetPerlWindow(); GUI::Hide($hwnd);
74- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Initialisierung.“);
75- $Win32::GUI::Loft::window{AnSi}->sleep1->Text($sleeep1);
76- $Win32::GUI::Loft::window{AnSi}->sleep2->Text($sleeep2);
77- $Icon{'0'} = new Win32::GUI::Icon('ansi.ni0');
78- $Icon{'1'} = new Win32::GUI::Icon('ansi.ni1');
79- $Icon{'2'} = new Win32::GUI::Icon('ansi.ni2');
80- my $icon = new Win32::GUI::Icon('ansi.ni0');
81-
82- $winTransformer = new Win32::GUI::Window(
83- -left => 0,
84- -top => 0,
85- -width => 0,
86- -height => 0,
87- -name => “winTransformer“,
88- -text => “Anti Vorratsdatenspeicherung“
89- );
90-
91- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Initialisierung..“);
92-
93- my $niTray = Win32::GUI::NotifyIcon->new($winTransformer,
94- -name => “niTray“,
95- -id => $$,
96- -icon => $Icon{'2'},
97- -tip => “Anti Vorratsdatenspeicherung - Starte...“,
98- );
99-
100- $value{'Priority'} = $priority;
101- if( defined $PRIORITIES{lc $value{'Priority'}} )
102- {
103- ApiLink( 'kernel32.dll', “BOOL SetPriorityClass( HANDLE hThread, DWORD dwPriorityClass )“ ) || die “Unable to load SetPriorityClass()“;
104- ApiLink( 'kernel32.dll', “HANDLE OpenProcess()“ ) || die “Unable to load GetCurrentProcess()“;
105- ApiLink( 'kernel32.dll', “HANDLE GetCurrentProcess()“ ) || die “Unable to load GetCurrentProcess()“;
106- ApiLink( 'kernel32.dll', “BOOL CloseHandle( HANDLE )“ ) || die “Unable to load CloseHandle()“;
107-
108- my $hProcess = GetCurrentProcess();
109- if( 0 == SetPriorityClass( $hProcess, $PRIORITIES{lc $value{'Priority'}} ) )
110- {
111- $Win32::GUI::Loft::window{MIP}->StatusBar->Text(“Unable to set the process scheduling priority to $value{'Priority'}.Error: “ . Win32::FormatMessage( Win32::GetLastError() ) . “.“);
112- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Konnte Prozesspriorität nicht auf $value{'Priority'} ändern. Fehler: “.Win32::FormatMessage(Win32::GetLastError()));
113- }
114- else
115- {
116- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Prozesspriorität auf $value{'Priority'} gesetzt.“);
117- }
118-
119- CloseHandle( $hProcess );
120- }
121- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Initialisierung...“);
122- Win32::GUI::Dialog();
123- return(1);
124- }
125-
126- sub ::Scripttimer2_Timer {
127- $Win32::GUI::Loft::window{AnSi}->Scripttimer2->Kill();
128- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Starting...“);
129- changeIcon(1,“Anti Vorratsdatenspeicherung - Lade Webseite...“);
130- #doit();
131- $thr = Thread::Queue->new();
132- $thr->enqueue(&doit());
133- $thr->enqueue(undef);
134- changeIcon(0,“Anti Vorratsdatenspeicherung“);
135- $sleeper = random_range($sleeep1,$sleeep2);
136- $Win32::GUI::Loft::window{AnSi}->Scripttimer2->Interval($sleeper*1000);
137- return(1);
138- }
139-
140- sub ::Scripttimer3_Timer { httpget(“http://anti-vorratsdatenspeicherung.mahakala.de/?online“,1); }
141-
142- sub doit{
143- $ApL = @pL -1 ;
144- if ($ApL <= ($maxL/4)) { geturl($urls[rand @urls]); return; }
145- $curl = @pL[0];
146- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text($curl);
147-
148- if ($ApL > ($maxL/2)) {
149- $rndcrypt = crypt(“SOKjWBwl69DBs“x61,rand(99999));
150- $rndcrypt =~ s/([^A-Za-z0-9])/sprintf(“%%%02X“, ord($1))/seg;
151- if ($curl !~ /\/$/) { $curl = “$curl/“; }
152- if ($curl =~ /\?/) { $rndcrypt = “&$rndcrypt“; } else { $rndcrypt = “?$rndcrypt“; }
153- $curl = substr($curl.“$rndcrypt“,0,999);
154- httpget($curl,1);
155- }
156- else { geturl($curl);}
157-
158- $ApL = @pL -1 ;
159- shift(@pL);
160- }
161-
162- sub geturl {
163- $url = shift;
164- changeIcon(2,“Bitte warten - Lade neue Links...“);
165- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Lade neue Links...“);
166-
167- $response = httpget($url);
168- while ($response =~ /<a[^>]+href=“(http:[^“]+)“[^>]*>/igs) { #“
169- push @pL, $1;
170- }
171-
172- @pL_ = del_double(@pL);
173- @pL = undef;
174- @pL = @pL_;
175- @pL_ = undef;
176-
177- $ApL = @pL -1 ;
178- if ($ApL <= ($maxL/2)) { geturl($urls[rand @urls]); }
179- elsif ($ApL <= $maxL) { geturl($pL[rand @pL]); }
180- }
181- ######
182- sub httpget{
183- ($url,$tout_) = @_;
184- if (!$tout) { $tout_ = $tout; }
185- my $ua = LWP::UserAgent->new;
186- $ua->timeout($tout_);
187- $ua->protocols_allowed( [ 'http', 'https'] );
188- $ua->conn_cache(LWP::ConnCache->new());
189- $ua->agent( $browsers[rand @browsers] );
190- my $response = $ua->get( $url);
191- if ($response->is_success) { $response = $response->decoded_content; }
192- else { $response = $response->status_line; }
193- }
194- ######
195- sub INT_handler {$Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Initializing Exit...“); exit;}
196-
197- sub del_double{
198- my %all=();
199- @all{@_}=1;
200- return (keys %all);
201- }
202- ######
203- sub random_range {
204- my $low = shift;
205- my $hi = shift;
206- return int( rand( $hi - $low+1)) + $low;
207- }
208- ######
209- sub ::AnSi_Terminate { &hideWin; }
210- sub hideWin{
211- $Win32::GUI::Loft::window{AnSi}->Disable();
212- $Win32::GUI::Loft::window{AnSi}->Hide();
213- 1;}
214- ######
215- sub ::niTray_Click {
216- return(::niTray_RightClick(@_));
217- }
218- ######
219- sub ::niTray_RightClick {
220- defined($winTransformer) or return(1);
221-
222- my ($x, $y) = Win32::GUI::GetCursorPos();
223- $winTransformer->TrackPopupMenu($mnuTray->{tray}, $x, $y);
224-
225- return(1);
226- }
227- ######
228- sub ::mnuTrayExit_Click {
229- return(-1);
230- }
231- ######
232- sub ::mnuTrayRestore_Click {
233- $Win32::GUI::Loft::window{AnSi}->Enable();
234- $Win32::GUI::Loft::window{AnSi}->Show();
235- return(1);
236- }
237- ######
238-
239- sub changeIcon{
240- ($iconNR,$tip) = @_;
241- Win32::GUI::NotifyIcon::Modify($winTransformer,
242- -id => $$,
243- -icon => $Icon{$iconNR},
244- -tip => $tip);
245- }
246- ######
247- sub ::savebutton_Click {
248- if ($sleeep1 !~ /\D/) { $sleeep1 = $Win32::GUI::Loft::window{AnSi}->sleep1->Text(); }
249- else { $Win32::GUI::Loft::window{AnSi}->sleep1->Text($sleeep1); }
250- if ($sleeep1 <= 1) { $sleeep1 = 1; }
251-
252- if ($sleeep2 !~ /\D/) { $sleeep2 = $Win32::GUI::Loft::window{AnSi}->sleep2->Text(); }
253- else { $Win32::GUI::Loft::window{AnSi}->sleep2->Text($sleeep2); }
254- if ($sleeep2 <= 1) { $sleeep2 = 1; }
255-
256- if ($sleeep2 < $sleeep1) { $sleeep1_ = $sleeep1; $sleeep1 = $sleeep2; $sleeep2 = $sleeep1_; }
257- $Win32::GUI::Loft::window{AnSi}->sleep1->Text($sleeep1);
258- $Win32::GUI::Loft::window{AnSi}->sleep2->Text($sleeep2);
259- open (CON, “>config.ini“);
260- print CON “$sleeep1!$sleeep2!$priority“;
261- close (CON);
262- $Win32::GUI::Loft::window{AnSi}->CurrentUrl->Text(“Gespeichert!“);
263- }
264- ######