@@ -265,13 +265,13 @@ $framework ||= Msf::Simple::Framework.create(
265
265
if opts [ :list ]
266
266
opts [ :list ] . each do |mod |
267
267
case mod
268
- when /payloads/i
268
+ when /^ payloads$ /i
269
269
$stderr. puts dump_payloads
270
- when /encoders/i
270
+ when /^ encoders$ /i
271
271
$stderr. puts dump_encoders ( opts [ :arch ] )
272
- when /nops/i
272
+ when /^ nops$ /i
273
273
$stderr. puts dump_nops
274
- when /all/i
274
+ when /^ all$ /i
275
275
$stderr. puts dump_payloads
276
276
$stderr. puts dump_encoders
277
277
$stderr. puts dump_nops
@@ -422,26 +422,26 @@ end
422
422
423
423
$stdout. binmode
424
424
425
- if opts [ :format ] !~/ruby|rb|perl|pl|bash|sh|c|csharp|js|dll|elf/i
425
+ if opts [ :format ] !~/^( ruby|rb|perl|pl|bash|sh|c|csharp|js|dll|elf)$ /i
426
426
exe = Msf ::Util ::EXE . to_executable_fmt ( $framework, opts [ :arch ] , opts [ :platform ] , payload_raw , opts [ :format ] , exeopts )
427
427
end
428
428
429
429
case opts [ :format ]
430
- when /ruby|rb|perl|pl|bash|^sh$|^c$|^ csharp$ |js_le|raw|^py /i
430
+ when /^( ruby|rb|perl|pl|bash|sh|c| csharp|js_le|raw|py)$ /i
431
431
$stdout. write Msf ::Simple ::Buffer . transform ( payload_raw , opts [ :format ] )
432
- when /asp$/
432
+ when /^ asp$/
433
433
asp = Msf ::Util ::EXE . to_win32pe_asp ( $framework, payload_raw , exeopts )
434
434
$stdout. puts asp
435
- when /aspx/
435
+ when /^ aspx$ /
436
436
aspx = Msf ::Util ::EXE . to_win32pe_aspx ( $framework, payload_raw , exeopts )
437
437
$stdout. puts aspx
438
- when /js_be/i
438
+ when /^ js_be$ /i
439
439
if Rex ::Arch . endian ( payload . arch ) != ENDIAN_BIG
440
440
print_error ( "Big endian format selected for a non big endian payload" )
441
441
exit
442
442
end
443
443
$stdout. puts Msf ::Simple ::Buffer . transform ( payload_raw , opts [ :format ] )
444
- when /java/i
444
+ when /^ java$ /i
445
445
if ( !exe and payload . platform . platforms . index ( Msf ::Module ::Platform ::Java ) )
446
446
exe = payload . generate_jar . pack
447
447
end
@@ -451,75 +451,75 @@ when /java/i
451
451
else
452
452
print_error ( "Could not generate payload format" )
453
453
end
454
- when /elf/i
454
+ when /^ elf$ /i
455
455
if ( opts [ :platform ] . index ( Msf ::Module ::Platform ::Linux ) )
456
456
elf = case opts [ :arch ]
457
- when /x64/ ; Msf ::Util ::EXE . to_linux_x64_elf ( $framework, payload_raw , exeopts )
458
- when /x86/ ; Msf ::Util ::EXE . to_linux_x86_elf ( $framework, payload_raw , exeopts )
459
- when /arm/ ; Msf ::Util ::EXE . to_linux_armle_elf ( $framework, payload_raw , exeopts )
457
+ when /^ x64$ / ; Msf ::Util ::EXE . to_linux_x64_elf ( $framework, payload_raw , exeopts )
458
+ when /^ x86$ / ; Msf ::Util ::EXE . to_linux_x86_elf ( $framework, payload_raw , exeopts )
459
+ when /^ arm$ / ; Msf ::Util ::EXE . to_linux_armle_elf ( $framework, payload_raw , exeopts )
460
460
end
461
461
elsif ( opts [ :platform ] . index ( Msf ::Module ::Platform ::BSD ) )
462
462
elf = case opts [ :arch ]
463
- when /x86/ ; Msf ::Util ::EXE . to_bsd_x86_elf ( $framework, payload_raw , exeopts )
463
+ when /^ x86$ / ; Msf ::Util ::EXE . to_bsd_x86_elf ( $framework, payload_raw , exeopts )
464
464
end
465
465
elsif ( opts [ :platform ] . index ( Msf ::Module ::Platform ::Solaris ) )
466
466
elf = case opts [ :arch ]
467
- when /x86/ ; Msf ::Util ::EXE . to_solaris_x86_elf ( $framework, payload_raw , exeopts )
467
+ when /^ x86$ / ; Msf ::Util ::EXE . to_solaris_x86_elf ( $framework, payload_raw , exeopts )
468
468
end
469
469
end
470
470
if elf . nil?
471
471
print_error ( "This format does not support that architecture" )
472
472
exit
473
473
end
474
474
$stdout. write elf
475
- when /macho/i
475
+ when /^ macho$ /i
476
476
bin = case opts [ :arch ]
477
- when /x64/ ; Msf ::Util ::EXE . to_osx_x64_macho ( $framework, payload_raw , exeopts )
478
- when /x86/ ; Msf ::Util ::EXE . to_osx_x86_macho ( $framework, payload_raw , exeopts )
479
- when /arm/ ; Msf ::Util ::EXE . to_osx_arm_macho ( $framework, payload_raw , exeopts )
480
- when /ppc/ ; Msf ::Util ::EXE . to_osx_ppc_macho ( $framework, payload_raw , exeopts )
477
+ when /^ x64$ / ; Msf ::Util ::EXE . to_osx_x64_macho ( $framework, payload_raw , exeopts )
478
+ when /^ x86$ / ; Msf ::Util ::EXE . to_osx_x86_macho ( $framework, payload_raw , exeopts )
479
+ when /^ arm$ / ; Msf ::Util ::EXE . to_osx_arm_macho ( $framework, payload_raw , exeopts )
480
+ when /^ ppc$ / ; Msf ::Util ::EXE . to_osx_ppc_macho ( $framework, payload_raw , exeopts )
481
481
end
482
482
if bin . nil?
483
483
print_error ( "This format does not support that architecture" )
484
484
exit
485
485
end
486
486
$stdout. write bin
487
- when /dll/i
487
+ when /^ dll$ /i
488
488
dll = case opts [ :arch ]
489
- when /x86/ ; Msf ::Util ::EXE . to_win32pe_dll ( $framework, payload_raw )
490
- when /x64|x86_64/ ; Msf ::Util ::EXE . to_win64pe_dll ( $framework, payload_raw )
489
+ when /^ x86$ / ; Msf ::Util ::EXE . to_win32pe_dll ( $framework, payload_raw )
490
+ when /^( x64|x86_64)$ / ; Msf ::Util ::EXE . to_win64pe_dll ( $framework, payload_raw )
491
491
end
492
492
if dll . nil?
493
493
print_error ( "This format does not support that architecture" )
494
494
exit
495
495
end
496
496
497
497
$stdout. write dll
498
- when /exe/i
498
+ when /^ exe$ /i
499
499
$stdout. write exe
500
- when /exe-small/i
501
- when /vba/i
500
+ when /^ exe-small$ /i
501
+ when /^ vba$ /i
502
502
vba = Msf ::Util ::EXE . to_vba ( $framework, payload_raw )
503
503
$stdout. puts vba
504
- when /vba-exe/i
504
+ when /^ vba-exe$ /i
505
505
exe = Msf ::Util ::EXE . to_win32pe ( $framework, payload_raw )
506
506
vba = Msf ::Util ::EXE . to_exe_vba ( exe )
507
507
$stdout. puts vba
508
- when /vbs/i
508
+ when /^ vbs$ /i
509
509
exe = Msf ::Util ::EXE . to_win32pe ( $framework, payload_raw )
510
510
vbs = Msf ::Util ::EXE . to_exe_vbs ( exe )
511
511
$stdout. puts vbs
512
- when /war/i
512
+ when /^ war$ /i
513
513
if ( !exe and payload . platform . platforms . index ( Msf ::Module ::Platform ::Java ) )
514
514
exe = payload . generate_war . pack
515
515
else
516
516
exe = Msf ::Util ::EXE . to_jsp_war ( exe )
517
517
end
518
518
$stdout. write exe
519
- when /psh/i
519
+ when /^ psh$ /i
520
520
psh = Msf ::Util ::EXE . to_win32pe_psh ( $framework, payload_raw , exeopts )
521
521
$stdout. write psh
522
- when /psh-net/i
522
+ when /^ psh-net$ /i
523
523
psh = Msf ::Util ::EXE . to_win32pe_psh_net ( $framework, payload_raw , exeopts )
524
524
$stdout. write psh
525
525
else
0 commit comments