rapid7/metasploit-framework — pull request #2763 by bmerinofe (2013-12-13 23:33:39+00:00)
Title: added driver_loaded post meterpreter module

Module to loads a KMD using the Windows Service API

Note:
If I try to load an already-loaded driver instead of getting a "error_service_already_running" error I get a GetLastError = 2 (file not found). Any explanation about this would be welcome. Ej:

msf post(driver_loader) > set driver_name MS1_service
driver_name => MS1_service
msf post(driver_loader) > set driver_path system32\\drivers\\msf32.sys
driver_path => system32\drivers\msf32.sys
msf post(driver_loader) > exploit

[*] Service Control Manager opened successfully.
[*] Service object added to the Service Control Manager database.
[+] Driver loaded successfully.
[*] Post module execution completed
msf post(driver_loader) > set driver_name MS2_service
driver_name => MS2_service
msf post(driver_loader) > exploit

[*] Service Control Manager opened successfully.
[*] Service object added to the Service Control Manager database.
[-] There was an error loading the driver. GetLastError=2.
[*] Post module execution completed

Some useful commands:

driverquery /v | findstr MSF
sc query type= service state= all
sc query MSF