File tree Expand file tree Collapse file tree 2 files changed +31
-31
lines changed Expand file tree Collapse file tree 2 files changed +31
-31
lines changed Original file line number Diff line number Diff line change @@ -436,37 +436,6 @@ def service_name_map(proto)
436
436
end
437
437
end
438
438
439
- def unserialize_object ( xml_elem , allow_yaml = false )
440
- return nil unless xml_elem
441
- string = xml_elem . text . to_s . strip
442
- return string unless string . is_a? ( String )
443
- return nil if ( string . empty? || string . nil? )
444
-
445
- begin
446
- # Validate that it is properly formed base64 first
447
- if string . gsub ( /\s +/ , '' ) =~ /^([a-z0-9A-Z\+ \/ =]+)$/
448
- Marshal . load ( $1. unpack ( "m" ) [ 0 ] )
449
- else
450
- if allow_yaml
451
- begin
452
- YAML . load ( string )
453
- rescue
454
- dlog ( "Badly formatted YAML: '#{ string } '" )
455
- string
456
- end
457
- else
458
- string
459
- end
460
- end
461
- rescue ::Exception => e
462
- if allow_yaml
463
- YAML . load ( string ) rescue string
464
- else
465
- string
466
- end
467
- end
468
- end
469
-
470
439
# Boils down the validate_import_file to a boolean
471
440
def validate_import_file ( data )
472
441
begin
Original file line number Diff line number Diff line change @@ -11,4 +11,35 @@ module Msf::DBManager::Import::MetasploitFramework
11
11
def nils_for_nulls ( str )
12
12
str == "NULL" ? nil : str
13
13
end
14
+
15
+ def unserialize_object ( xml_elem , allow_yaml = false )
16
+ return nil unless xml_elem
17
+ string = xml_elem . text . to_s . strip
18
+ return string unless string . is_a? ( String )
19
+ return nil if ( string . empty? || string . nil? )
20
+
21
+ begin
22
+ # Validate that it is properly formed base64 first
23
+ if string . gsub ( /\s +/ , '' ) =~ /^([a-z0-9A-Z\+ \/ =]+)$/
24
+ Marshal . load ( $1. unpack ( "m" ) [ 0 ] )
25
+ else
26
+ if allow_yaml
27
+ begin
28
+ YAML . load ( string )
29
+ rescue
30
+ dlog ( "Badly formatted YAML: '#{ string } '" )
31
+ string
32
+ end
33
+ else
34
+ string
35
+ end
36
+ end
37
+ rescue ::Exception => e
38
+ if allow_yaml
39
+ YAML . load ( string ) rescue string
40
+ else
41
+ string
42
+ end
43
+ end
44
+ end
14
45
end
You can’t perform that action at this time.
0 commit comments