Skip to Content
Python for Offensive PenTest
book

Python for Offensive PenTest

by Hussam Khrais
April 2018
Intermediate to advanced content levelIntermediate to advanced
176 pages
4h 16m
English
Packt Publishing
Content preview from Python for Offensive PenTest

Privilege escalation – creating a new admin account and covering the tracks

In our previous section, we created a malicious Python service and replaced the legitimate one with it. Once the system has started, we verified that we get a system or admin privilege. Now, in this section, we'll see how we can create a new admin account and then jump from the standard user to the admin account. So, what I have changed on the coding part is adding the following section to the previous code, which in summary will create a new admin account once the service gets started:

...        USER = "Hacked"        GROUP = "Administrators"        user_info = dict ( # create a user info profile in a dictionary format               name = USER, password = "python_is_my_life", # Define the password ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Penetration Testing Cookbook

Python Penetration Testing Cookbook

Rejah Rehim

Publisher Resources

ISBN: 9781788838979Supplemental Content