Skip to content

Commit

Permalink
Adding Perl:Critic to unit tests and fixing it's critique
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSeccubus committed Jun 23, 2017
1 parent 1d731fe commit f83e853
Show file tree
Hide file tree
Showing 41 changed files with 329 additions and 577 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ WriteMakefile (
'Carp' => 1.04,
'ExtUtils::MakeMaker' => 6.30,
'Mojolicious' => '7.26',
'Perl::Critic' => 1.0,
},
NO_MYMETA => 1
);
Expand Down
2 changes: 1 addition & 1 deletion bin/attach_file
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ my $run_id = update_run($workspace_id, $scan_id, $timestamp, $file, $description

exit;

sub help(;$) {
sub help() {
my $msg = shift;
print "$msg\n
Usage: attach_file --workspace <workspace name> --scan <scan name>
Expand Down
20 changes: 10 additions & 10 deletions bin/burp2ivil
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ unless ( $outfile ) {
$outfile .= ".ivil.xml";
}
print "Opening file $outfile for output\n" if $verbose;
open(OUT, ">$outfile") or die "Unable to open output file $outfile";
print OUT xml_header();
print OUT ivil_open();
open(my $OUT, ">", $outfile) or die "Unable to open output file $outfile";
print $OUT xml_header();
print $OUT ivil_open();

if ($workspace) {
print "Creating addressee block\n" if $verbose;
print OUT ivil_addressee("Seccubus", {
print $OUT ivil_addressee("Seccubus", {
"workspace" => $workspace,
"scan" => $scanname,
});
}

print "Creating findings\n" if $verbose;
print OUT "<findings>\n";
print $OUT "<findings>\n";

#lets go through all issues

Expand Down Expand Up @@ -164,18 +164,18 @@ foreach my $issue ( @{$burp->{issue}}) {
#print Dumper($finding);

#write to ivil
print OUT ivil_finding($finding);
print $OUT ivil_finding($finding);
}

print OUT "</findings>\n";
print $OUT "</findings>\n";

#print "Creating sender block\n" if $verbose;
#print OUT ivil_sender($scanner, $scannerversion, $timestamp);
#print $OUT ivil_sender($scanner, $scannerversion, $timestamp);


print OUT ivil_close();
print $OUT ivil_close();

close OUT;
close $OUT;

exit();

Expand Down
212 changes: 0 additions & 212 deletions bin/convert_v1_v2

This file was deleted.

50 changes: 25 additions & 25 deletions bin/export
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ print "Exporting workspace details\n" if $verbose;
my $workspace = {
name => $workspace
};
open WS, ">$out/workspace.json" or die("Unable to open '$out/workspace.json'");
print WS to_json($workspace, { pretty => 1 });
close WS;
open(my $WS, ">", "$out/workspace.json") or die("Unable to open '$out/workspace.json'");
print $WS to_json($workspace, { pretty => 1 });
close $WS;
print to_json($workspace, { pretty => 1 }) if $verbose > 2;

print "Exporting hostnames\n" if $verbose;
Expand All @@ -113,9 +113,9 @@ foreach my $h ( @$hostnames_in ) {
push @$hostnames, { ip => $$h[0], name => $$h[1] };
}
$hostnames_in = [];
open JS, ">$out/hostnames.json" or die("Unable to open '$out/hostnames.json'");
print JS to_json($hostnames, { pretty => 1 });
close JS;
open(my $JS, ">", "$out/hostnames.json") or die("Unable to open '$out/hostnames.json'");
print $JS to_json($hostnames, { pretty => 1 });
close $JS;
print to_json($hostnames, { pretty => 1 }) if $verbose > 2;

print "Exporting scan configurations\n" if $verbose;
Expand All @@ -133,9 +133,9 @@ foreach my $s ( @{ get_scans($workspace_id) } ) {
push @$scans, $scan;
}
}
open JS, ">$out/scans.json" or die("Unable to open '$out/scans.json'");
print JS to_json($scans, { pretty => 1 });
close JS;
open(my $JS, ">", "$out/scans.json") or die("Unable to open '$out/scans.json'");
print $JS to_json($scans, { pretty => 1 });
close $JS;
print to_json($scans, { pretty => 1 }) if $verbose > 2;

foreach my $scan ( @$scans ) {
Expand All @@ -153,9 +153,9 @@ foreach my $scan ( @$scans ) {
trigger => $$n[4]
};
}
open JS, ">$scandir/notifications.json" or die("Unable to open '$scandir/notifications.json'");
print JS to_json($notifications, { pretty => 1 });
close JS;
open(my $JS, ">", "$scandir/notifications.json") or die("Unable to open '$scandir/notifications.json'");
print $JS to_json($notifications, { pretty => 1 });
close $JS;
print to_json($notifications, { pretty => 1 }) if $verbose > 2;

print "Exporting runs and attachments\n" if $verbose;
Expand All @@ -170,9 +170,9 @@ foreach my $scan ( @$scans ) {
mkdir "$scandir/att_$$r[2]", 0700;
my $att = get_attachment($workspace_id,$scan->{id},$$r[0],$$r[2]);
#die Dumper $att;
open ATT, ">$scandir/att_$$r[2]/$$r[3]" or die "Unable to write attachments $$r[2] in scan '$scan->{name}'";
print ATT $$att[0][1];
close ATT;
open(my $ATT, ">", "$scandir/att_$$r[2]/$$r[3]") or die "Unable to write attachments $$r[2] in scan '$scan->{name}'";
print $ATT $$att[0][1];
close $ATT;
print "Wrote " if $verbose > 1;
print length $$att[0][1] if $verbose > 1;
print " bytes to $scandir/att_$$r[2]/$$r[3]\n" if $verbose > 1;
Expand Down Expand Up @@ -211,9 +211,9 @@ foreach my $scan ( @$scans ) {
print "Skipping data from run '$ts' because it is before '$after'\n" if $verbose > 1;
}
}
open JS, ">$scandir/runs.json" or die("Unable to open '$scandir/runs.json'");
print JS to_json($runs, { pretty => 1 });
close JS;
open(my $JS, ">", "$scandir/runs.json") or die("Unable to open '$scandir/runs.json'");
print $JS to_json($runs, { pretty => 1 });
close $JS;
print to_json($runs, { pretty => 1 }) if $verbose > 2;

print "Exporting findings and history\n" if $verbose;
Expand Down Expand Up @@ -258,9 +258,9 @@ foreach my $scan ( @$scans ) {
} # After
}
#print Dumper $finding;die;
open JS, ">$scandir/finding_$finding->{id}.json" or die("Unable to open '$scandir/finding_$finding->{id}.json'");
print JS to_json($finding, { pretty => 1 });
close JS;
open(my $JS, ">", "$scandir/finding_$finding->{id}.json") or die("Unable to open '$scandir/finding_$finding->{id}.json'");
print $JS to_json($finding, { pretty => 1 });
close $JS;
print to_json($finding, { pretty => 1 }) if $verbose > 3;
print "." if ! $quiet && $verbose <= 3;
$count++;
Expand Down Expand Up @@ -315,16 +315,16 @@ foreach my $i ( @{ get_issues($workspace_id,undef,1) } ) {
}
push @{$issue->{findings}}, $$i[8];
}
open JS, ">$out/issues.json" or die("Unable to open '$out/issues.json'");
print JS to_json($issues, { pretty => 1 });
close JS;
open(my $JS, ">", "$out/issues.json") or die("Unable to open '$out/issues.json'");
print $JS to_json($issues, { pretty => 1 });
close $JS;
print to_json($issues, { pretty => 1 }) if $verbose > 2;

print "\n*** Done ***\n" unless $quiet;

exit;

sub help(;$) {
sub help() {
my $message = shift;

print "
Expand Down
Loading

0 comments on commit f83e853

Please sign in to comment.