@@ -38,58 +38,60 @@ def run
38
38
wordlist . close
39
39
end
40
40
41
- hashlist = Rex ::Quickfile . new ( "jtrtmp" )
42
-
43
41
myloots = myworkspace . loots . find ( :all , :conditions => [ 'ltype=?' , 'aix.hashes' ] )
44
- unless myloots . nil? or myloots . empty?
45
- myloots . each do |myloot |
46
- usf = ''
47
- begin
48
- File . open ( myloot . path , "rb" ) do |f |
49
- usf = f . read
50
- end
51
- rescue Exception => e
52
- print_error ( "Unable to read #{ myloot . path } \n #{ e } " )
53
- next
54
- end
55
- usf . each_line do |row |
56
- row . gsub! ( /\n / , ":#{ myloot . host . address } \n " )
57
- hashlist . write ( row )
42
+ return if myloots . nil? or myloots . empty?
43
+
44
+ loot_data = ''
45
+
46
+ myloots . each do |myloot |
47
+ usf = ''
48
+ begin
49
+ File . open ( myloot . path , "rb" ) do |f |
50
+ usf = f . read
58
51
end
52
+ rescue Exception => e
53
+ print_error ( "Unable to read #{ myloot . path } \n #{ e } " )
54
+ next
55
+ end
56
+ usf . each_line do |row |
57
+ row . gsub! ( /\n / , ":#{ myloot . host . address } \n " )
58
+ loot_data << row
59
59
end
60
- hashlist . close
60
+ end
61
61
62
- print_status ( "HashList: #{ hashlist . path } " )
62
+ hashlist = Rex ::Quickfile . new ( "jtrtmp" )
63
+ hashlist . write ( row )
64
+ hashlist . close
63
65
64
- print_status ( "Trying Format:des Wordlist: #{ wordlist . path } " )
65
- john_crack ( hashlist . path , :wordlist => wordlist . path , :rules => 'single' , :format => 'des' )
66
- print_status ( "Trying Format:des Rule: All4..." )
67
- john_crack ( hashlist . path , :incremental => "All4" , :format => 'des' )
68
- print_status ( "Trying Format:des Rule: Digits5..." )
69
- john_crack ( hashlist . path , :incremental => "Digits5" , :format => 'des' )
66
+ print_status ( "HashList: #{ hashlist . path } " )
70
67
71
- cracked = john_show_passwords ( hashlist . path )
68
+ print_status ( "Trying Format:des Wordlist: #{ wordlist . path } " )
69
+ john_crack ( hashlist . path , :wordlist => wordlist . path , :rules => 'single' , :format => 'des' )
70
+ print_status ( "Trying Format:des Rule: All4..." )
71
+ john_crack ( hashlist . path , :incremental => "All4" , :format => 'des' )
72
+ print_status ( "Trying Format:des Rule: Digits5..." )
73
+ john_crack ( hashlist . path , :incremental => "Digits5" , :format => 'des' )
72
74
75
+ cracked = john_show_passwords ( hashlist . path )
73
76
74
- print_status ( "#{ cracked [ :cracked ] } hashes were cracked!" )
75
77
76
- cracked [ :users ] . each_pair do |k , v |
77
- if v [ 0 ] == "NO PASSWORD"
78
- passwd = ""
79
- else
80
- passwd = v [ 0 ]
81
- end
82
- print_good ( "Host: #{ v . last } User: #{ k } Pass: #{ passwd } " )
83
- report_auth_info (
84
- :host => v . last ,
85
- :port => 22 ,
86
- :sname => 'ssh' ,
87
- :user => k ,
88
- :pass => passwd
89
- )
78
+ print_status ( "#{ cracked [ :cracked ] } hashes were cracked!" )
79
+
80
+ cracked [ :users ] . each_pair do |k , v |
81
+ if v [ 0 ] == "NO PASSWORD"
82
+ passwd = ""
83
+ else
84
+ passwd = v [ 0 ]
90
85
end
86
+ print_good ( "Host: #{ v . last } User: #{ k } Pass: #{ passwd } " )
87
+ report_auth_info (
88
+ :host => v . last ,
89
+ :port => 22 ,
90
+ :sname => 'ssh' ,
91
+ :user => k ,
92
+ :pass => passwd
93
+ )
91
94
end
92
-
93
95
end
94
96
95
97
end
0 commit comments