@@ -61,25 +61,6 @@ def smb_read_file(smbshare, host, file)
61
61
end
62
62
end
63
63
64
- def change_service_description ( svc_handle , service_description )
65
- svc_status = nil
66
- stubdata =
67
- svc_handle +
68
- NDR . long ( 1 ) + # dwInfoLevel = SERVICE_CONFIG_DESCRIPTION
69
- NDR . long ( 1 ) + # lpInfo -> *SERVICE_DESCRIPTION
70
- NDR . long ( 0x0200 ) + # SERVICE_DESCRIPTION struct
71
- NDR . long ( 0x04000200 ) +
72
- NDR . wstring ( service_description )
73
- begin
74
- response = dcerpc . call ( 0x25 , stubdata ) # ChangeServiceConfig2
75
- svc_status = response . unpack ( 'V' ) . first
76
- rescue Rex ::Proto ::DCERPC ::Exceptions ::Fault => e
77
- print_error ( "#{ peer } - Error changing service description : #{ e } " )
78
- end
79
-
80
- svc_status
81
- end
82
-
83
64
# Executes a single windows command.
84
65
#
85
66
# If you want to retrieve the output of your command you'll have to
@@ -105,13 +86,12 @@ def psexec(command, disconnect=true)
105
86
if scm_status == ERROR_ACCESS_DENIED
106
87
print_error ( "#{ peer } - ERROR_ACCESS_DENIED opening the Service Manager" )
107
88
end
89
+
108
90
return false unless scm_handle
109
91
110
92
vprint_status ( "#{ peer } - Creating the service..." )
111
93
svc_handle , svc_status = dce_createservicew ( dcerpc , scm_handle , service_name , display_name , command , { } )
112
94
113
- return false unless svc_handle && svc_status
114
-
115
95
case svc_status
116
96
when ERROR_SUCCESS
117
97
vprint_good ( "#{ peer } - Successfully created the service" )
@@ -131,7 +111,7 @@ def psexec(command, disconnect=true)
131
111
132
112
if service_description
133
113
vprint_status ( "#{ peer } - Changing service description..." )
134
- change_service_description ( svc_handle , service_description )
114
+ dce_changeservicedescription ( dcerpc , svc_handle , service_description )
135
115
end
136
116
137
117
vprint_status ( "#{ peer } - Starting the service..." )
0 commit comments