adjust package code structure
parent
51d38acbe1
commit
38ab6883de
|
@ -1,11 +1,10 @@
|
|||
package Nipe::Engine::Restart;
|
||||
package Nipe::Engine::Restart {
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Engine::Stop;
|
||||
use Nipe::Engine::Start;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Engine::Stop;
|
||||
use Nipe::Engine::Start;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my $stop = Nipe::Engine::Stop -> new();
|
||||
|
||||
if ($stop) {
|
||||
|
@ -17,6 +16,7 @@ sub new {
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,10 +1,9 @@
|
|||
package Nipe::Engine::Start;
|
||||
package Nipe::Engine::Start {
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my %device = Nipe::Utils::Device -> new();
|
||||
my $dnsPort = "9061";
|
||||
my $transferPort = "9051";
|
||||
|
@ -70,6 +69,7 @@ sub new {
|
|||
system ("iptables -t filter -A OUTPUT -p icmp -j REJECT");
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,10 +1,9 @@
|
|||
package Nipe::Engine::Stop;
|
||||
package Nipe::Engine::Stop {
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my %device = Nipe::Utils::Device -> new();
|
||||
my @table = ("nat", "filter");
|
||||
my $stopTor = "systemctl stop tor";
|
||||
|
@ -25,6 +24,7 @@ sub new {
|
|||
system ($stopTor);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package Nipe::Utils::Device;
|
||||
package Nipe::Utils::Device {
|
||||
use strict;
|
||||
use warnings;
|
||||
use Config::Simple;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Config::Simple;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my $config = Config::Simple -> new("/etc/os-release");
|
||||
my $id_like = $config -> param("ID_LIKE") || "";
|
||||
my $id_distro = $config -> param("ID");
|
||||
|
@ -35,6 +34,7 @@ sub new {
|
|||
}
|
||||
|
||||
return %device;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package Nipe::Utils::Helper;
|
||||
package Nipe::Utils::Helper {
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
return "
|
||||
\rCore Commands
|
||||
\r==============
|
||||
|
@ -14,6 +13,7 @@ sub new {
|
|||
\r\tstop Stop routing
|
||||
\r\trestart Restart the Nipe circuit
|
||||
\r\tstatus See status\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,10 +1,9 @@
|
|||
package Nipe::Utils::Install;
|
||||
package Nipe::Utils::Install {
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Nipe::Utils::Device;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my %device = Nipe::Utils::Device -> new();
|
||||
my $stopTor = "systemctl stop tor";
|
||||
|
||||
|
@ -36,6 +35,7 @@ sub new {
|
|||
system ($stopTor);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package Nipe::Utils::Status;
|
||||
package Nipe::Utils::Status {
|
||||
use JSON;
|
||||
use strict;
|
||||
use warnings;
|
||||
use HTTP::Tiny;
|
||||
|
||||
use JSON;
|
||||
use strict;
|
||||
use warnings;
|
||||
use HTTP::Tiny;
|
||||
|
||||
sub new {
|
||||
sub new {
|
||||
my $apiCheck = "https://check.torproject.org/api/ip";
|
||||
my $request = HTTP::Tiny -> new -> get($apiCheck);
|
||||
|
||||
|
@ -19,6 +18,7 @@ sub new {
|
|||
}
|
||||
|
||||
return "\n[!] ERROR: sorry, it was not possible to establish a connection to the server.\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue