mightyroot

Maltego airodump WPS

Jun 22nd, 2012
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.71 KB | None | 0 0
  1. Create Entities:
  2. WPA2-AP
  3. WPA-AP
  4. WEP-AP
  5. OPEN-AP
  6. Unknown-AP
  7. WPA2-AP-WPS
  8. WPA-AP-WPS
  9. Path-to-svs-file
  10.  
  11. Create transform:
  12. <TransformSettings enabled="true" disclaimerAccepted="false" showHelp="true">
  13.    <Properties>
  14.       <Property name="transform.local.command" type="string" popup="false">/usr/bin/perl</Property>
  15.       <Property name="transform.local.parameters" type="string" popup="false">listAPs_WPS.pl</Property>
  16.       <Property name="transform.local.working-directory" type="string" popup="false">/usr/share/MaltegoCE/Airgraph-NG/</Property>
  17.       <Property name="transform.local.debug" type="boolean" popup="false">true</Property>
  18.    </Properties>
  19. </TransformSettings>
  20.  
  21.  
  22. --------------{ listAPs_WPS.pl }------------------------------------
  23. #!/usr/bin/perl
  24. ############################################
  25. #    search all APs in airodump CSV file   #
  26. #    and search WPS enable among of them   #
  27. #    use path without extentions e.g.:     #
  28. #        /root/capture-01  to got files:   #
  29. #    capture-01.csv and capture-01.cap     #
  30. #                                          #
  31. #                              (c) r3dh4t  #
  32. ############################################
  33.  
  34. use Text::CSV;
  35. $path = $ARGV[0];
  36. $file = "$ARGV[0].csv";
  37. $file_wps = "$path-wps.csv";
  38. $csv = Text::CSV->new();
  39.  
  40. #use WASH utility from REAVER package. If not find try remove -C key
  41. system('/usr/local/bin/wash -C -f "'.$path.'.cap" -o "'.$file_wps.'"');
  42.  
  43.  
  44. open (WPS, "<", $file_wps) or die $!;
  45. @wps_list = <WPS>;
  46. close WPS;
  47.  
  48. open (CSV, "<", $file) or die $!;
  49.  
  50. print "<MaltegoMessage>\n<MaltegoTransformResponseMessage>\n<Entities>\n";
  51.  
  52. while (<CSV>) {
  53.  
  54.    if ($csv->parse($_)) {
  55.         my @columns = $csv->fields();
  56.         $bssid = $columns[0];
  57.         $channel = $columns[3];
  58.         $proto = $columns[5];
  59.         $proto =~s/\s//g;
  60.         $auth = $columns[6];
  61.         $chifer = $columns[7];
  62.         $power = $columns[8];
  63.         $essid = $columns[13];
  64.     if ($essid){
  65.       if ($proto ne "Privacy") {
  66. #print "\n+++$proto+++";
  67.         if (($proto eq "WPA2") or ($proto eq "WPA2WPA")){    
  68.         $entity_type="WPA2-AP";
  69.         } else {
  70.             if ($proto eq "WPA") {
  71.                 $entity_type="WPA-AP";
  72.              } else {
  73.                 if ($proto eq "WEP") {
  74.                 $entity_type="WEP-AP";
  75.                  } else {
  76.                     if ($proto eq "OPN") {
  77.                         $entity_type="OPEN-AP";
  78.                     } else {
  79.                         $entity_type="Unknown-AP";
  80.                             }
  81.                         }
  82.                      }
  83.                 }
  84. #Search active WPS APs from WASH output file
  85.         $wps_search=grep(/^$bssid/,@wps_list);
  86.         if ($wps_search){
  87.             $entity_type="$entity_type-WPS";
  88.         }
  89.  
  90.         $weight = ($power*-1);
  91.         &print_maltego($entity_type,$bssid,$channel,$proto,$auth,$chifer,$power,$essid,$weight,$file);
  92.       }
  93.     }
  94.    } else {
  95.         my $err = $csv->error_input;
  96.         print "Failed to parse line: $err";
  97.  }
  98.  
  99. }
  100. print "</Entities>\n<UIMessages>\n</UIMessages>\n</MaltegoTransformResponseMessage>\n</MaltegoMessage>\n";
  101.  
  102. close CSV;
  103.  
  104.  
  105. sub print_maltego()
  106. {
  107. print '<Entity Type="'.$entity_type.'"><Value>'.$essid.'</Value><Weight>'.$weight.'</Weight><AdditionalFields>';
  108. print "\n";
  109. print '<Field Name="bssid" DisplayName="BSSID">'.$bssid.'</Field>';
  110. print "\n";
  111. print '<Field Name="channel" DisplayName="Channel">'.$channel.'</Field>';
  112. print "\n";
  113. print '<Field Name="proto" DisplayName="Encription">'.$proto.'</Field>';
  114. print "\n";
  115. print '<Field Name="chifer" DisplayName="Chifer">'.$chifer.'</Field>';
  116. print "\n";
  117. print '<Field Name="power" DisplayName="Power">'.$power.'</Field>';
  118. print "\n";
  119. print '<Field Name="file" DisplayName="file CSV">'.$file.'</Field>';
  120. print "\n";
  121. print "</AdditionalFields></Entity>\n";
  122. }
Add Comment
Please, Sign In to add comment