Newer
Older
CHaS / CHaS.pl
root on 7 May 2019 2 KB Initial commit
  1. #!/usr/bin/perl
  2. # By NaN
  3. #
  4. # Requirements:
  5. # aha https://github.com/masukomi/aha
  6. # sslscan https://github.com/rbsec/sslscan
  7. # testssl https://github.com/drwetter/testssl.sh
  8. # securityheaders https://github.com/juerkkil/securityheaders
  9.  
  10. use strict;
  11. use warnings;
  12.  
  13.  
  14. my $sslscan = "sslscan"; # command or path to sslscan
  15. my $testssl = "/opt/testssl.sh/testssl.sh"; # command or path to testssl.sh
  16. my $headers = "/opt/securityheaders/securityheaders.py"; # securityheaders
  17. my $aha = "aha"; # command or path to aha
  18. my $browser = "thunar"; # your file browser - remove to disable
  19.  
  20. if($#ARGV < 1){
  21. print "Check Headers and SSL v0.1\n";
  22. print "Usage: ./CHaS.pl </full/directory/path> <https://www.url.com>\n";
  23. exit(-1);
  24. }else{
  25. my $dir = $ARGV[0];
  26. my $url = $ARGV[1];
  27. my @children_pids;
  28.  
  29. if($url =~ /^(?:(?:https?|s))/i){}else{
  30. die "[!] Not a valid URL!\n";
  31. }
  32.  
  33. print "[i] Directory: $dir \n";
  34. print "[i] URL: $url \n";
  35.  
  36. print "[+] Creating Directory\n";
  37. unless(mkdir($dir, 0755)) {
  38. die "[!] Unable to create!\n";
  39. }
  40.  
  41. my $pid = fork();
  42. if( $pid == 0 ){
  43. push @children_pids, $pid;
  44. print "[+] Launching SSLScan\n";
  45. system("$sslscan $url | aha >$dir/sslscan.html");
  46. print "[+] Finished SSLScan\n";
  47. exit 0;
  48. }
  49.  
  50. my $pid2 = fork();
  51. if( $pid2 == 0 ){
  52. push @children_pids, $pid2;
  53. print "[+] Launching testssl.sh\n";
  54. system("$testssl $url | aha >$dir/testssl.html");
  55. print "[+] Finished testssl.sh\n";
  56. exit 0;
  57. }
  58.  
  59. my $pid3 = fork();
  60. if( $pid3 == 0 ){
  61. push @children_pids, $pid3;
  62. print "[+] Checking Headers\n";
  63. system(" echo \"curl -Is --insecure $url\n\" > $dir/headers.txt");
  64. system("curl -Is --insecure $url >> $dir/headers.txt");
  65. system("python $headers $url | aha >$dir/headers.html");
  66. print "[+] Finished Headers\n";
  67. exit 0;
  68. }
  69.  
  70. my $loop = 1;
  71. $SIG{CHLD} = 'DEFAULT'; # turn off auto reaper
  72. $SIG{INT} = $SIG{TERM} = sub {$loop = 0; kill -15 => @children_pids};
  73. while ($loop && getppid() != 1) {
  74. my $child = waitpid(-1, 0);
  75. last if $child == -1;
  76. }
  77.  
  78. if( length $browser ){
  79. print "[!] Launching file browser\n";
  80. system("$browser $dir &");
  81. }else{
  82. print "[!] Complete\n";
  83. }
  84. exit();
  85. }
  86.  
Buy Me A Coffee