The definitive VirusTotal’s admin guide
|
Check out our Walkthrough guide for VirusTotal group administrators! |
Introducing the walkthrough guide for VirusTotal group admins
General notions
- Group ID: on the VT Enterprise group portal, the GROUP PREFERENCES section shows your Group ID.
- User ID: on the VT Enterprise group portal, the Group members section lists the group’s users. By clicking on any of them, you automatically pivot to USER PROFILE where the user’s ID is shown near the user’s avatar.
- Service account ID: on the VT Enterprise group portal, the Service accounts section lists the group’s service accounts by their IDs.
- VirusTotal user API key: there are 2 ways of getting your API key from the landing page as in the below image.
Use cases
- Group members management
In this section you will find how to manage users and service accounts by adding or removing them to/from the group, how to download a list of members and how to manage users privileges.
- Group management
This section focuses on group-level configurations that may also affect users, such as active session timings and Single Sign On (SSO) security features.
- Consumption
At this section you will find information about one of the most requested topics, which is quota and consumption.
Enforcing security – 2FA
In the VT Enterprise group web interface you will find the USERS tab, and under the Group members section there is a Filter by dropdown with the View only users without 2FA option:
**DISCLAIMER:**
Please note that this code is for educational purposes only.
It is not intended to be run directly in production.
This is provided on a best effort basis.
Please make sure the code you run does what you expect it to do.
“””
import requests
def get_users_without_2fa(apikey, group_id):
“””
Getting users objects related to a group by group ID, filtering by 2fa_enabled = false.
Requested users attributes: first_name,last_name,email.
VT API endpoint reference: https://developers.virustotal.com/reference/groups-relationships
“””
users = []
url = f”https://www.virustotal.com/api/v3/groups/{group_id}/users?attributes=first_name,last_name,email&filter=2fa_enabled:false”
headers = {“accept”: “application/json”, “x-apikey”: apikey}
while url:
res = requests.get(url, headers=headers)
res.raise_for_status()
res = res.json()
for el in res[“data”]:
users.append(
f”username:{el[‘id’]},”
f”first_name:{el[‘attributes’].get(‘first_name’,”)},”
f”last_name:{el[‘attributes’].get(‘last_name’,”)},”
f”email:{el[‘attributes’].get(’email’,”)}”
)
url = res.get(“links”, {}).get(“next”, None)
return users
Check it out on our GitHub repository!
Enforcing security – privileges are granted where required
**DISCLAIMER:**
Please note that this code is for educational purposes only.
It is not intended to be run directly in production.
This is provided on a best effort basis.
Please make sure the code you run does what you expect it to do.
“””
import requests
def get_possible_unauthorized_admins(apikey, group_id, authorized_admins):
“””
Getting users objects (administrators) related to a group by group ID.
Requested users attributes: first_name,last_name,email.
VT API endpoint reference: https://docs.virustotal.com/reference/get-group-administrators
“””
unauthorized_admins = []
url = f”https://www.virustotal.com/api/v3/groups/{group_id}/administrators?attributes=first_name,last_name,email”
headers = {“accept”: “application/json”, “x-apikey”: apikey}
while url:
res = requests.get(url, headers=headers)
res.raise_for_status()
res = res.json()
for el in res[“data”]:
if el[“id”] not in authorized_admins:
unauthorized_admins.append(
f”username: {el[‘id’]}, “
f”first_name: {el[‘attributes’].get(‘first_name’, ”)}, “
f”last_name: {el[‘attributes’].get(‘last_name’, ”)}, “
f”email: {el[‘attributes’].get(’email’, ”)}”
)
url = res.get(“links”, {}).get(“next”, None)
return unauthorized_admins
Check it out on our GitHub repository!
Wrapping up
Read more: The definitive VirusTotal’s admin guide