| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # | 
| 2 |  |  |  |  |  |  | # $Id$ | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # password::mirai Brik | 
| 5 |  |  |  |  |  |  | # | 
| 6 |  |  |  |  |  |  | package Metabrik::Password::Mirai; | 
| 7 | 1 |  |  | 1 |  | 510 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 8 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 5 | use base qw(Metabrik); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 897 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub brik_properties { | 
| 13 |  |  |  |  |  |  | return { | 
| 14 | 0 |  |  | 0 | 1 |  | revision => '$Revision$', | 
| 15 |  |  |  |  |  |  | tags => [ qw(unstable dictionary bruteforce iot) ], | 
| 16 |  |  |  |  |  |  | author => 'GomoR ', | 
| 17 |  |  |  |  |  |  | license => 'http://opensource.org/licenses/BSD-3-Clause', | 
| 18 |  |  |  |  |  |  | commands => { | 
| 19 |  |  |  |  |  |  | telnet => [ ], | 
| 20 |  |  |  |  |  |  | save_as_csv => [ qw(output_file) ], | 
| 21 |  |  |  |  |  |  | save_as_couple => [ qw(output_file) ], | 
| 22 |  |  |  |  |  |  | }, | 
| 23 |  |  |  |  |  |  | require_modules => { | 
| 24 |  |  |  |  |  |  | 'Metabrik::File::Csv' => [ ], | 
| 25 |  |  |  |  |  |  | 'Metabrik::File::Text' => [ ], | 
| 26 |  |  |  |  |  |  | 'Metabrik::System::File' => [ ], | 
| 27 |  |  |  |  |  |  | }, | 
| 28 |  |  |  |  |  |  | }; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | # | 
| 32 |  |  |  |  |  |  | # https://github.com/jgamblin/Mirai-Source-Code/blob/6a5941be681b839eeff8ece1de8b245bcd5ffb02/mirai/bot/scanner.c | 
| 33 |  |  |  |  |  |  | # | 
| 34 |  |  |  |  |  |  | sub telnet { | 
| 35 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | return [ | 
| 38 | 0 |  |  |  |  |  | { login => '666666', passwords => [ qw( 666666 ) ] }, | 
| 39 |  |  |  |  |  |  | { login => '888888', passwords => [ qw( 888888 ) ] }, | 
| 40 |  |  |  |  |  |  | { login => 'admin', passwords => [ "", qw( 1111 1111111 1234 12345 123456 54321 7ujMko0admin admin admin1234 meinsm pass password smcadmin ) ] }, | 
| 41 |  |  |  |  |  |  | { login => 'admin1', passwords => [ qw( password ) ] }, | 
| 42 |  |  |  |  |  |  | { login => 'administrator', passwords => [ qw( 1234 ) ] }, | 
| 43 |  |  |  |  |  |  | { login => 'Administrator', passwords => [ qw( admin ) ] }, | 
| 44 |  |  |  |  |  |  | { login => 'guest', passwords => [ qw( 12345 guest ) ] }, | 
| 45 |  |  |  |  |  |  | { login => 'mother', passwords => [ qw( fucker ) ] }, | 
| 46 |  |  |  |  |  |  | { login => 'root', passwords => [ "", qw( 00000000 1111 1234 12345 123456 54321 666666 7ujMko0admin 7ujMko0vizxv 888888 admin anko default dreambox hi3518 ikwb juantech jvbzd klv123 klv1234 pass password realtek root system user vizxv xc3511 xmhdipc zlxx.  Zte521 ) ] }, | 
| 47 |  |  |  |  |  |  | { login => 'service', passwords => [ qw( service ) ] }, | 
| 48 |  |  |  |  |  |  | { login => 'supervisor', passwords => [ qw( supervisor ) ] }, | 
| 49 |  |  |  |  |  |  | { login => 'support', passwords => [ qw( support ) ] }, | 
| 50 |  |  |  |  |  |  | { login => 'tech', passwords => [ qw( tech ) ] }, | 
| 51 |  |  |  |  |  |  | { login => 'ubnt', passwords => [ qw( ubnt ) ] }, | 
| 52 |  |  |  |  |  |  | { login => 'user', passwords => [ qw( user ) ] }, | 
| 53 |  |  |  |  |  |  | ]; | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | sub save_as_csv { | 
| 57 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 58 | 0 |  |  |  |  |  | my ($output_file) = @_; | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 | 0 |  |  |  |  | $self->brik_help_run_undef_arg('save_as_csv', $output_file) or return; | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 | 0 |  |  |  |  | my $fc = Metabrik::File::Csv->new_from_brik_init($self) or return; | 
| 63 | 0 |  |  |  |  |  | $fc->header([ qw( login password ) ]); | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 0 | 0 |  |  |  |  | if (-f $output_file) { | 
| 66 | 0 | 0 |  |  |  |  | my $fs = Metabrik::System::File->new_from_brik_init($self) or return; | 
| 67 | 0 | 0 |  |  |  |  | $fs->remove($output_file) or return; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 0 |  |  |  |  |  | my @lines = (); | 
| 71 | 0 | 0 |  |  |  |  | my $list = $self->telnet or return; | 
| 72 | 0 |  |  |  |  |  | for my $this (@$list) { | 
| 73 | 0 |  |  |  |  |  | my $login = $this->{login}; | 
| 74 | 0 |  |  |  |  |  | for my $pass (@{$this->{passwords}}) { | 
|  | 0 |  |  |  |  |  |  | 
| 75 | 0 |  |  |  |  |  | push @lines, { | 
| 76 |  |  |  |  |  |  | login => $login, | 
| 77 |  |  |  |  |  |  | password => $pass, | 
| 78 |  |  |  |  |  |  | }; | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 | 0 |  |  |  |  | $fc->write(\@lines, $output_file) or return; | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 0 |  |  |  |  |  | return $output_file; | 
| 85 |  |  |  |  |  |  | } | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | sub save_as_couple { | 
| 88 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 89 | 0 |  |  |  |  |  | my ($output_file) = @_; | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 0 | 0 |  |  |  |  | $self->brik_help_run_undef_arg('save_as_couple', $output_file) or return; | 
| 92 |  |  |  |  |  |  |  | 
| 93 | 0 | 0 |  |  |  |  | my $ft = Metabrik::File::Text->new_from_brik_init($self) or return; | 
| 94 |  |  |  |  |  |  |  | 
| 95 | 0 | 0 |  |  |  |  | if (-f $output_file) { | 
| 96 | 0 | 0 |  |  |  |  | my $fs = Metabrik::System::File->new_from_brik_init($self) or return; | 
| 97 | 0 | 0 |  |  |  |  | $fs->remove($output_file) or return; | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  |  | 
| 100 | 0 |  |  |  |  |  | my @lines = (); | 
| 101 | 0 | 0 |  |  |  |  | my $list = $self->telnet or return; | 
| 102 | 0 |  |  |  |  |  | for my $this (@$list) { | 
| 103 | 0 |  |  |  |  |  | my $login = $this->{login}; | 
| 104 | 0 |  |  |  |  |  | for my $pass (@{$this->{passwords}}) { | 
|  | 0 |  |  |  |  |  |  | 
| 105 | 0 |  |  |  |  |  | push @lines, "$login:$pass"; | 
| 106 |  |  |  |  |  |  | } | 
| 107 |  |  |  |  |  |  | } | 
| 108 |  |  |  |  |  |  |  | 
| 109 | 0 | 0 |  |  |  |  | $ft->write(\@lines, $output_file) or return; | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 0 |  |  |  |  |  | return $output_file; | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | 1; | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | __END__ |