Leser: 44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
#EierlegendeWollMilchSau.pl
use Net::Ping;
if ($ARGV[0] eq '-p' ){
our $input = $ARGV[1];
our @namesplit = split(/\./, $input);
our $r1 = $namesplit[0];
our $r2 = $namesplit[1];
our $r3 = $namesplit[2];
our $r4 = $namesplit[3];
if (!defined $ARGV[2]){
our $till = $r4;}
else { $till = $ARGV[2]; }
our $until = $till +1;
while ($r4 != $until ) {
my $ip = $r1.'.'.$r2.'.'.$r3.'.'.$r4;
my $ping = Net::Ping->new( "icmp", 1, 64 );
if ( $ping->ping($ip) ) {
print "$ip online\n";
} else {
print "$ip offline \n";
}
$r4++;
}
}
elsif{ YOUR PART }
else{ exit 0;}
2010-02-19T19:31:13 conrayDas hier würde vllt eher in ein Perl Forum passen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/usr/bin/perl use strict; #EierlegendeWollMilchSau.pl use Net::Ping; if ($ARGV[0] eq '-p' ){ my $input = $ARGV[1]; my @namesplit = split(/\./, $input); my $r1 = $namesplit[0]; my $r2 = $namesplit[1]; my $r3 = $namesplit[2]; my $r4 = $namesplit[3]; my $till; if (!defined $ARGV[2]){ $till = $r4;} else { $till = $ARGV[2]; } my $until = $till +1; while ($r4 != $until ) { my $ip = $r1.'.'.$r2.'.'.$r3.'.'.$r4; my $ping = Net::Ping->new( "icmp", 1, 64 ); if ( $ping->ping($ip) ) { print "$ip online\n"; } else { print "$ip offline \n"; } $r4++; } } elsif{ YOUR PART } else{ exit 0;}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#!/usr/bin/perl use strict; use warnings; # History: # conray - 19.02.2010 : 19:31 UTC - initial version with ping (-p) # betterworld - 19.02.2010 : 19:44 UTC - minor changes # esskar - 19.02.2010 : 20:27 UTC - changes on ping, and dump myself command (-dump) use FindBin; use Net::Ping; #EierlegendeWollMilchSau.pl my $cmd = lc shift @ARGV; if ($cmd eq '-p' ) #ping { my $ip = shift @ARGV or die "No ip."; my @r = split(/\./, $ip); my $till = shift(@ARGV) || $r[3]; my $until = $till + 1; while ($r[3] < $until ) { $ip = join '.', @r; my $ping = Net::Ping->new('icmp', 1, 64 ); print "$ip " . ($ping->ping($ip) ? 'online' : 'offline') . "\n"; $r[3]++; } } elsif($cmd eq '-dump') { my $path = "$FindBin::Bin/$FindBin::Script"; open(my $myself, "< $path") or die "Unable to open myself ($path): $!"; while(<$myself>) { print $_; } close $myself; } # elsif(MORE) { } else { print "usage: EierlegendeWollMilchSau.pl <parameters>\n\n"; print "parameters:\n"; print "\t-p <ip> [range]\t\ttrys to ping an ip or an range of ip addresses.\n"; print "\t-dump\t\t\tdumps itself to STDOUT\n"; print "\n"; exit 0; } __END__
2010-02-19T21:06:34 conraywas genau mach lc
2010-02-19T20:30:14 esskarCode (perl): (dl )1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57#!/usr/bin/perl use strict; use warnings; # History: # conray - 19.02.2010 : 19:31 UTC - initial version with ping (-p) # betterworld - 19.02.2010 : 19:44 UTC - minor changes # esskar - 19.02.2010 : 20:27 UTC - changes on ping, and dump myself command (-dump) use FindBin; use Net::Ping; #EierlegendeWollMilchSau.pl my $cmd = lc shift @ARGV; if ($cmd eq '-p' ) #ping { my $ip = shift @ARGV or die "No ip."; my @r = split(/\./, $ip); my $till = shift(@ARGV) || $r[3]; my $until = $till + 1; while ($r[3] < $until ) { $ip = join '.', @r; my $ping = Net::Ping->new('icmp', 1, 64 ); print "$ip " . ($ping->ping($ip) ? 'online' : 'offline') . "\n"; $r[3]++; } } elsif($cmd eq '-dump') { my $path = "$FindBin::Bin/$FindBin::Script"; open(my $myself, "< $path") or die "Unable to open myself ($path): $!"; while(<$myself>) { print $_; } close $myself; } elsif( $cmd eq '-devil' ) { print "So long, and thanks for all the fish.\n"; unlink $0 or die "Will not stop :'-(\n"; } # elsif(MORE) { } else { print "usage: EierlegendeWollMilchSau.pl <parameters>\n\n"; print "parameters:\n"; print "\t-p <ip> [range]\t\ttrys to ping an ip or an range of ip addresses.\n"; print "\t-dump\t\t\tdumps itself to STDOUT\n"; print "\t-devil\t\t\tDon't try that\n"; print "\n"; exit 0; } __END__
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
#!/usr/bin/perl use strict; use warnings; # History: # conray - 19.02.2010 : 19:31 UTC - initial version with ping (-p) # betterworld - 19.02.2010 : 19:44 UTC - minor changes # esskar - 19.02.2010 : 20:27 UTC - changes on ping, and dump myself command (-dump) # topeg - 19.02.2010 : 00:02 UTC - addded mirror use FindBin; use Net::Ping; #EierlegendeWollMilchSau.pl my $cmd = lc shift @ARGV; if ($cmd eq '-p' ) #ping { my $ip = shift @ARGV or die "No ip."; my @r = split(/\./, $ip); my $till = shift(@ARGV) || $r[3]; my $until = $till + 1; while ($r[3] < $until ) { $ip = join '.', @r; my $ping = Net::Ping->new('icmp', 1, 64 ); print "$ip " . ($ping->ping($ip) ? 'online' : 'offline') . "\n"; $r[3]++; } } elsif($cmd eq '-dump') { my $path = "$FindBin::Bin/$FindBin::Script"; open(my $myself, "< $path") or die "Unable to open myself ($path): $!"; while(<$myself>) { print $_; } close $myself; } elsif( $cmd eq '-devil' ) { print "So long, and thanks for all the fish.\n"; unlink $0 or die "Will not stop :'-(\n"; } elsif($cmd eq '-mirror') { my $fh=\*STDIN; my $file=shift; open($fh,'<',$file) || die("ERROR open $file ($!)") if($file); chomp($_) && print reverse($_)."\n" while(<$fh>); close($fh); } # elsif(MORE) { } else { print "usage: EierlegendeWollMilchSau.pl <parameters>\n\n"; print "parameters:\n"; print "\t-p <ip> [range]\t\ttrys to ping an ip or an range of ip addresses.\n"; print "\t-dump\t\t\tdumps itself to STDOUT\n"; print "\t-devil\t\t\tDon't try that\n"; print "\t-mirror [file]\t\t mirror file or STDIN\n"; print "\n"; exit 0; } __END__
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
#!/usr/bin/perl use strict; use warnings; # History: # conray - 19.02.2010 : 19:31 UTC - initial version with ping (-p) # betterworld - 19.02.2010 : 19:44 UTC - minor changes # esskar - 19.02.2010 : 20:27 UTC - changes on ping, and dump myself command (-dump) # topeg - 19.02.2010 : 00:02 UTC - addded mirror # Kalle - 01.03.2010 - added technology assimilation automation use FindBin; use Net::Ping; #EierlegendeWollMilchSau.pl my $cmd = lc shift @ARGV; if ($cmd eq '-p' ) #ping { my $ip = shift @ARGV or die "No ip."; my @r = split(/\./, $ip); my $till = shift(@ARGV) || $r[3]; my $until = $till + 1; while ($r[3] < $until ) { $ip = join '.', @r; my $ping = Net::Ping->new('icmp', 1, 64 ); print "$ip " . ($ping->ping($ip) ? 'online' : 'offline') . "\n"; $r[3]++; } } elsif($cmd eq '-dump') { my $path = "$FindBin::Bin/$FindBin::Script"; open(my $myself, "< $path") or die "Unable to open myself ($path): $!"; while(<$myself>) { print $_; } close $myself; } elsif( $cmd eq '-devil' ) { print "So long, and thanks for all the fish.\n"; unlink $0 or die "Will not stop :'-(\n"; } elsif($cmd eq '-mirror') { my $fh=\*STDIN; my $file=shift; open($fh,'<',$file) || die("ERROR open $file ($!)") if($file); chomp($_) && print reverse($_)."\n" while(<$fh>); close($fh); } elsif($cmd eq '-assimilate') { my $newtechsource=shift @ARGV; my $borgtechnology; my $assimilationspace; my $newtechnology; my $biomemorycube; my ($newcmdname)=split(/\./,$newtechsource,0); use File::Basename; my ($borgbase,$borgpath)=fileparse($0); my $newborgtechnology="${borgpath}Neue$borgbase"; if (open($borgtechnology,'<',$0)) { if (open($assimilationspace,'>',$newborgtechnology)) { if (open($newtechnology,'<',$newtechsource)) { while(<$borgtechnology>) { if (/\\t-assimilate newparameter.pl\\t\\t/) { print $assimilationspace $_; print $assimilationspace " print \"\\t-$newcmdname\\t\\t assimilated weird stuff\\n\";\n"; } elsif (/^# elsif\(MORE\) \{ \}/) { my $thisline=$_; print "Assimiliere neue Technologie...\n"; print $assimilationspace "elsif(\$cmd eq \'-$newcmdname\')\n\{\n"; while(<$newtechnology>) { next if (/^#!|^use strict;|^use warnings;/); print $assimilationspace $_; } close($newtechnology); print $assimilationspace "\}\n$thisline"; } else { print $assimilationspace $_; } } close($borgtechnology); if (close($assimilationspace)) { print "Widerstand war zwecklos!\nNeue Technologie einsetzbar: Neue$borgbase -$newcmdname\n"; } else { print "Aktivierungssequenz ungültig. Assimilation abgebrochen.\n"; } } else { print "Neue Technologie kann nicht assimiliert werden. Abbruch der Assimilation\n"; } } else { print "Fluktuation im temporären Raum-/Zeitgefüge. Abbruch der Assimilation.\n"; } } else { print "Wo sind wir ? Es ist so....leise. Bring uns nach Hause!\n"; } } # elsif(MORE) { } <-- don't touch this else { print "usage: EierlegendeWollMilchSau.pl <parameters>\n\n"; print "parameters:\n"; print "\t-p <ip> [range]\t\ttrys to ping an ip or an range of ip addresses.\n"; print "\t-dump\t\t\tdumps itself to STDOUT\n"; print "\t-devil\t\t\tDon't try that\n"; print "\t-mirror [file]\t\t mirror file or STDIN\n"; print "\t-assimilate newparam.pl\t assimilate more perl code into this script\n"; print "\n"; exit 0; } __END__
Quotenum ist darum ein recht schlechter Optionsname da man nicht weiß wohin er gehören soll pwnum wäre schon besser.