-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsod.thinpack.pl
More file actions
executable file
·70 lines (62 loc) · 1.99 KB
/
Copy pathsod.thinpack.pl
File metadata and controls
executable file
·70 lines (62 loc) · 1.99 KB
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
#!/usr/bin/perl -Ilib
BEGIN {
package main;
`mkdir -p deps/lib/perl5` if ! -e 'deps/lib/perl5';
use lib "$ENV{PWD}/deps/lib/perl5";
my @deps = qw(POE::Component::Client::TCP POE::Component::Server::TCP POE::Component::Client::DNS Net::IP XML::DOM2 Moo);
my @inst;
for my $dep (@deps) {
eval "require $dep";
push @inst, $dep if $@;
}
if (@inst) {
unless (-e './cpanm') {
print "Installing cpanm\n";
`curl -LO http://xrl.us/cpanm && chmod 777 cpanm`;
#die "Failed to install App::cpanminus" if $@;
}
`./cpanm --notest -l "$ENV{PWD}/deps/" ${\join(' ',@inst)}`;
#die "Failed to install deps: $! $@" if $@;
}
# Check binary deps
system(qw/sh -c/, 'type nmap') and die "You need nmap!";
die "You need perl >= 5.10.0!" if !$^V or $^V < v5.10.0;
system(qw/sh -c/, 'type xml2-config') and die "You need libxml2(-dev)!";
}
use warnings; use strict;
use 5.010;
use POE;
use SOD::DNS;
use lib "$ENV{PWD}/deps/lib/perl5";
# NOTE: This requires changes to PoCo::Client::DNS which have not been merged and released yet,
# so this includes my fork as a git submodule for now
#my $sod = SOD::DNS->new(
# #servers => [qw(127.0.0.1 74.82.42.42 8.8.8.8 8.8.4.4)]
#);
#
#$sod->run;
#$sod->servers([qw(127.0.0.1 74.82.42.42 8.8.8.8 8.8.4.4)]);
#print "scan\n";
#$sod->scan;
if (!defined $ARGV[0] or $ARGV[0] eq '--help') {
print <<EOF;
sod.pl <--server|se.rve.r.ip [delay]>
delay is an option delay (in seconds) to add between scans
EOF
exit 0;
}
if ($ARGV[0] eq '--server') {
require "SOD/Master.pm";
SOD::Master->new;
}
else {
require "SOD/Slave.pm";
my $client = SOD::Slave->new(
server_addr => $ARGV[0],
connection_callback => sub { "You can do something in here too..." },
line_callback => sub { "Or like this!" },
);
print "Connecting to $ARGV[0]:1027...\n";
$client->connection; # poke the connection so it starts working
}
POE::Kernel->run;