Skip to content

Commit

Permalink
Release 0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Apr 23, 2021
2 parents d1c3fc8 + 6b5bda8 commit 8dd636b
Show file tree
Hide file tree
Showing 45 changed files with 420 additions and 112 deletions.
2 changes: 1 addition & 1 deletion api/tacticalrmm/agents/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from packaging import version as pyver

from agents.models import Agent
from core.models import CoreSettings, CodeSignToken
from core.models import CodeSignToken, CoreSettings
from logs.models import PendingAction
from scripts.models import Script
from tacticalrmm.celery import app
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/agents/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
import requests
import urllib.parse

import requests
from django.conf import settings


Expand Down
3 changes: 2 additions & 1 deletion api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ def patch(self, request):

@api_view(["POST"])
def install_agent(request):
from agents.utils import get_winagent_url
from knox.models import AuthToken

from agents.utils import get_winagent_url

client_id = request.data["client"]
site_id = request.data["site"]
version = settings.LATEST_AGENT_VER
Expand Down
8 changes: 8 additions & 0 deletions api/tacticalrmm/clients/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class Meta:
def __str__(self):
return self.name

@property
def agent_count(self) -> int:
return Agent.objects.filter(site__client=self).count()

@property
def has_maintenanace_mode_agents(self):
return (
Expand Down Expand Up @@ -173,6 +177,10 @@ class Meta:
def __str__(self):
return self.name

@property
def agent_count(self) -> int:
return Agent.objects.filter(site=self).count()

@property
def has_maintenanace_mode_agents(self):
return Agent.objects.filter(site=self, maintenance_mode=True).count() > 0
Expand Down
4 changes: 4 additions & 0 deletions api/tacticalrmm/clients/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Meta:
class SiteSerializer(ModelSerializer):
client_name = ReadOnlyField(source="client.name")
custom_fields = SiteCustomFieldSerializer(many=True, read_only=True)
agent_count = ReadOnlyField()

class Meta:
model = Site
Expand All @@ -37,6 +38,7 @@ class Meta:
"client_name",
"client",
"custom_fields",
"agent_count",
)

def validate(self, val):
Expand Down Expand Up @@ -68,6 +70,7 @@ class Meta:
class ClientSerializer(ModelSerializer):
sites = SiteSerializer(many=True, read_only=True)
custom_fields = ClientCustomFieldSerializer(many=True, read_only=True)
agent_count = ReadOnlyField()

class Meta:
model = Client
Expand All @@ -79,6 +82,7 @@ class Meta:
"alert_template",
"sites",
"custom_fields",
"agent_count",
)

def validate(self, val):
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from .models import CoreSettings, CustomField, CodeSignToken
from .models import CodeSignToken, CoreSettings, CustomField

admin.site.register(CoreSettings)
admin.site.register(CustomField)
Expand Down
50 changes: 31 additions & 19 deletions api/tacticalrmm/core/installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $rdp = rdpchange
$ping = pingchange
$auth = '"tokenchange"'
$downloadlink = 'downloadchange'
$apilink = $downloadlink.split('/')

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Expand Down Expand Up @@ -47,24 +48,35 @@ If (Get-Service $serviceName -ErrorAction SilentlyContinue) {
# pass
}

Try
{
Invoke-WebRequest -Uri $downloadlink -OutFile $OutPath\$output
Start-Process -FilePath $OutPath\$output -ArgumentList ('/VERYSILENT /SUPPRESSMSGBOXES') -Wait
write-host ('Extracting...')
Start-Sleep -s 5
Start-Process -FilePath "C:\Program Files\TacticalAgent\tacticalrmm.exe" -ArgumentList $installArgs -Wait
exit 0
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Error -Message "$ErrorMessage $FailedItem"
exit 1
}
Finally
{
Remove-Item -Path $OutPath\$output
$X = 0
do {
Write-Output "Waiting for network"
Start-Sleep -s 5
$X += 1
} until(($connectreult = Test-NetConnection $apilink[2] -Port 443 | ? { $_.TcpTestSucceeded }) -or $X -eq 3)

if ($connectreult.TcpTestSucceeded -eq $true){
Try
{
Invoke-WebRequest -Uri $downloadlink -OutFile $OutPath\$output
Start-Process -FilePath $OutPath\$output -ArgumentList ('/VERYSILENT /SUPPRESSMSGBOXES') -Wait
write-host ('Extracting...')
Start-Sleep -s 5
Start-Process -FilePath "C:\Program Files\TacticalAgent\tacticalrmm.exe" -ArgumentList $installArgs -Wait
exit 0
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Error -Message "$ErrorMessage $FailedItem"
exit 1
}
Finally
{
Remove-Item -Path $OutPath\$output
}
} else {
Write-Output "Unable to connect to server"
}
}
2 changes: 1 addition & 1 deletion api/tacticalrmm/core/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytz
from rest_framework import serializers

from .models import CoreSettings, CustomField, CodeSignToken
from .models import CodeSignToken, CoreSettings, CustomField


class CoreSettingsSerializer(serializers.ModelSerializer):
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/core/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests
from unittest.mock import patch

import requests
from channels.db import database_sync_to_async
from channels.testing import WebsocketCommunicator
from model_bakery import baker
Expand Down
5 changes: 3 additions & 2 deletions api/tacticalrmm/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

from tacticalrmm.utils import notify_error

from .models import CoreSettings, CustomField, CodeSignToken
from .models import CodeSignToken, CoreSettings, CustomField
from .serializers import (
CodeSignTokenSerializer,
CoreSettingsSerializer,
CustomFieldSerializer,
CodeSignTokenSerializer,
)


Expand Down Expand Up @@ -71,6 +71,7 @@ def dashboard_info(request):
"client_tree_sort": request.user.client_tree_sort,
"client_tree_splitter": request.user.client_tree_splitter,
"loading_bar_color": request.user.loading_bar_color,
"no_code_sign": hasattr(settings, "NOCODESIGN") and settings.NOCODESIGN,
}
)

Expand Down
77 changes: 49 additions & 28 deletions api/tacticalrmm/scripts/community_scripts.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"guid": "6820cb5e-5a7f-4d9b-8c22-d54677e3cc04",
"filename": "Win_Clear_Firefox_Cache.ps1",
"filename": "Win_Firefox_Clear_Cache.ps1",
"submittedBy": "https://github.com/Omnicef",
"name": "Firefox - Clean Cache",
"description": "This script will clean up Mozilla Firefox for all users.",
Expand All @@ -10,7 +10,7 @@
},
{
"guid": "3ff6a386-11d1-4f9d-8cca-1b0563bb6443",
"filename": "Win_Clear_Google_Chrome_Cache.ps1",
"filename": "Win_Google_Chrome_Clear_Cache.ps1",
"submittedBy": "https://github.com/Omnicef",
"name": "Chrome - Clear Cache for All Users",
"description": "This script will clean up Google Chrome for all users.",
Expand Down Expand Up @@ -82,7 +82,7 @@
},
{
"guid": "9d34f482-1f0c-4b2f-b65f-a9cf3c13ef5f",
"filename": "Win_Rename_Installed_App.ps1",
"filename": "Win_TRMM_Rename_Installed_App.ps1",
"submittedBy": "https://github.com/bradhawkins85",
"name": "TacticalRMM Agent Rename",
"description": "Updates the DisplayName registry entry for the Tactical RMM windows agent to your desired name. This script takes 1 required argument: the name you wish to set.",
Expand Down Expand Up @@ -154,7 +154,7 @@
},
{
"guid": "95a2ee6f-b89b-4551-856e-3081b041caa7",
"filename": "Win_Reset_High_Performance_Power_Profile_to_Defaults.ps1",
"filename": "Win_Power_Profile_Reset_High_Performance_to_Defaults.ps1",
"submittedBy": "https://github.com/azulskyknight",
"name": "Power Profile - Reset High Perf Power Profile to defaults",
"description": "Resets monitor, disk, standby, and hibernate timers in the default High Performance power profile to their default values. It also re-indexes the AC and DC power profiles into their default order.",
Expand All @@ -163,7 +163,7 @@
},
{
"guid": "2cbd30b0-84dd-4388-a36d-2e2e980f1a3e",
"filename": "Win_Set_High_Performance_Power_Profile.ps1",
"filename": "Win_Power_Profile_Set_High_Performance.ps1",
"submittedBy": "https://github.com/azulskyknight",
"name": "Power Profile - Set High Performance",
"description": "Sets the High Performance Power profile to the active power profile. Use this to keep machines from falling asleep.",
Expand Down Expand Up @@ -192,7 +192,7 @@
"guid": "7c14beb4-d1c3-41aa-8e70-92a267d6e080",
"filename": "Win_Duplicati_Status.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Duplicati - Check",
"name": "Duplicati - Check Status",
"description": "Checks Duplicati Backup is running properly over the last 24 hours",
"shell": "powershell",
"category": "TRMM (Win):3rd Party Software"
Expand Down Expand Up @@ -262,13 +262,23 @@
},
{
"guid": "d980fda3-a068-47eb-8495-1aab07a24e64",
"filename": "Win_Defender_Status.ps1",
"filename": "Win_Defender_Status_Report_Last24hrs.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Defender - Status",
"description": "This will check for Malware, Antispyware, that Windows Defender is Healthy, last scan etc within the last 24 hours",
"name": "Defender - Status Report Last 24hr",
"description": "Using Event Viewer, this will check for Malware and Antispyware within the last 24 hours and display, otherwise will report as Healthy",
"shell": "powershell",
"category": "TRMM (Win):Security>Antivirus"
},
{
"guid": "6a0202fc-1b27-4905-95c0-0a03bb881893",
"filename": "Win_Defender_Status_Report_LastYear.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Defender - Status Report Last Year",
"description": "Using Event Viewer, this will check for Malware and Antispyware and display, otherwise will report as Healthy",
"shell": "powershell",
"category": "TRMM (Win):Security>Antivirus",
"default_timeout": "300"
},
{
"guid": "9956e936-6fdb-4488-a9d8-8b274658037f",
"filename": "Win_Disable_Fast_Startup.bat",
Expand All @@ -289,7 +299,7 @@
},
{
"guid": "2472bbaf-1941-4722-8a58-d1dd0f528801",
"filename": "Win_Update_Tactical_Exclusion.ps1",
"filename": "Win_TRMM_AV_Update_Exclusion.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "TRMM Defender Exclusions",
"description": "Windows Defender Exclusions for Tactical RMM",
Expand Down Expand Up @@ -389,19 +399,10 @@
},
{
"guid": "f396dae2-c768-45c5-bd6c-176e56ed3614",
"filename": "Win_Finish_updates_and_restart.ps1",
"filename": "Win_Power_RestartorShutdown.ps1",
"submittedBy": "https://github.com/tremor021",
"name": "Updates - Finish and restart",
"description": "Finish installing Windows updates and restart PC",
"shell": "powershell",
"category": "TRMM (Win):Updates"
},
{
"guid": "63f89be0-a9c9-4c61-9b55-bce0b28b90b2",
"filename": "Win_Finish_updates_and_shutdown.ps1",
"submittedBy": "https://github.com/tremor021",
"name": "Updates - Finish and Shutdown",
"description": "Finish installing Windows updates and shutdown PC",
"name": "Power - Restart or Shutdown PC",
"description": "Restart PC. Add parameter: shutdown if you want to shutdown computer",
"shell": "powershell",
"category": "TRMM (Win):Updates"
},
Expand All @@ -422,7 +423,7 @@
},
{
"guid": "3abbb62a-3757-492c-8979-b4fc6174845d",
"filename": "Win_Disable_AutoRun.bat",
"filename": "Win_AutoRun_Disable.bat",
"submittedBy": "https://github.com/silversword411",
"name": "Autorun - Disable",
"description": "Disable Autorun System Wide",
Expand All @@ -432,7 +433,7 @@
},
{
"guid": "4a11877a-7555-494c-ac74-29d6df3c1989",
"filename": "Win_Disable_Cortana.bat",
"filename": "Win_Cortana_Disable.bat",
"submittedBy": "https://github.com/silversword411",
"name": "Cortana - Disable",
"description": "Disable Cortana System Wide",
Expand All @@ -444,7 +445,7 @@
"guid": "28ef1387-dd4f-4bab-b042-26250914e370",
"filename": "Win_WOL_Enable_Status.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Network WoL - Enable function",
"name": "BROKEN Network WoL - Enable function",
"description": "Wake on Lan enable on Dell, HP, Lenovo",
"shell": "powershell",
"category": "TRMM (Win):Network",
Expand All @@ -454,7 +455,7 @@
"guid": "685d5432-0b84-46d5-98e8-3ec2054150fe",
"filename": "Win_WOL_Test_State.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Network WoL - Test State",
"name": "BROKEN Network WoL - Test State",
"description": "Wake on Lan test status",
"shell": "powershell",
"category": "TRMM (Win):Network",
Expand All @@ -470,6 +471,26 @@
"category": "TRMM (Win):Network",
"default_timeout": "90"
},
{
"guid": "745bb7cd-b71a-4f2e-b6f2-c579b1828162",
"filename": "Win_Network_DHCP_Set.bat",
"submittedBy": "https://github.com/silversword411",
"name": "Network - Set Primary NIC to DHCP",
"description": "Enable DHCP on primary adapter",
"shell": "cmd",
"category": "TRMM (Win):Network",
"default_timeout": "90"
},
{
"guid": "83aa4d51-63ce-41e7-829f-3c16e6115bbf",
"filename": "Win_Network_DNS_Set_to_1.1.1.2.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Network - Set all NICs to use DNS of 1.1.1.2",
"description": "Domain computers skipped. Sets all NICs to have primary DNS server of 1.1.1.2, backup of 1.0.0.2 (Cloudflare malware blocking)",
"shell": "powershell",
"category": "TRMM (Win):Network",
"default_timeout": "90"
},
{
"guid": "6ce5682a-49db-4c0b-9417-609cf905ac43",
"filename": "Win_Win10_Change_Key_and_Activate.ps1",
Expand All @@ -484,8 +505,8 @@
"guid": "83f6c6ea-6120-4fd3-bec8-d3abc505dcdf",
"filename": "Win_TRMM_Start_Menu_Delete_Shortcut.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "TRMM Delete Start Menu Shortcut for App",
"description": "Tactical RMM delete its application shortcut that's installed in the start menu",
"name": "TacticalRMM Delete Start Menu Shortcut for App",
"description": "Delete its application shortcut that's installed in the start menu by default",
"shell": "powershell",
"category": "TRMM (Win):TacticalRMM Related",
"default_timeout": "10"
Expand Down
3 changes: 2 additions & 1 deletion api/tacticalrmm/scripts/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import base64
import re
from loguru import logger
from typing import Any, List, Union

from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.db import models
from loguru import logger

from logs.models import BaseAuditModel

Expand Down
Loading

0 comments on commit 8dd636b

Please sign in to comment.