This commit is contained in:
wh1te909 2020-08-10 04:47:46 +00:00
parent fe946483c8
commit 745fd71225
4 changed files with 91 additions and 55 deletions

View File

@ -295,7 +295,9 @@ def install_agent(request):
client = get_object_or_404(Client, client=request.data["client"])
site = get_object_or_404(Site, client=client, site=request.data["site"])
_, token = AuthToken.objects.create(user=request.user, expiry=dt.timedelta(hours=1))
_, token = AuthToken.objects.create(
user=request.user, expiry=dt.timedelta(hours=request.data["expires"])
)
resp = {"token": token, "client": client.pk, "site": site.pk}
return Response(resp)

View File

@ -11,7 +11,7 @@ AUTH_USER_MODEL = "accounts.User"
# bump this version everytime vue code is changed
# to alert user they need to manually refresh their browser
APP_VER = "0.0.18"
APP_VER = "0.0.19"
# https://github.com/wh1te909/salt
LATEST_SALT_VER = "1.0.3"

View File

@ -1,5 +1,5 @@
<template>
<q-card style="min-width: 60vw">
<q-card style="min-width: 70vw">
<q-card-section class="row">
<q-card-actions align="left">
<div class="text-h6">Installation Instructions</div>
@ -18,11 +18,11 @@
&& timeout /t 20 /nobreak > NUL
&& "C:\Program Files\TacticalAgent\tacticalrmm.exe" -m install --api "{{ info.api }}"
--client-id {{ info.data.client }} --site-id {{ info.data.site }}
--agent-type "{{ info.agenttype }}" --auth "{{ info.data.token }}"
--agent-type "{{ info.agenttype }}" --power {{ info.power }} --rdp {{ info.rdp }} --ping {{ info.ping }} --auth "{{ info.data.token }}"
</code>
</p>
<br />
<p class="text-italic">Note: the auth token above will be valid for 1 hour.</p>
<p class="text-italic">Note: the auth token above will be valid for {{ info.expires }} hours.</p>
<q-btn type="a" :href="info.download" color="primary" label="Download Agent" />
</q-card-section>
</q-card>

View File

@ -1,53 +1,73 @@
<template>
<div>
<q-card style="min-width: 25vw" v-if="loaded">
<q-card-section class="row">
<q-card-actions align="left">
<div class="text-h6">Add an agent</div>
</q-card-actions>
<q-space />
<q-card-actions align="right">
<q-btn v-close-popup flat round dense icon="close" />
</q-card-actions>
</q-card-section>
<q-card-section>
<q-form @submit.prevent="addAgent">
<q-card-section v-if="tree !== null">
<q-select
outlined
label="Client"
v-model="client"
:options="Object.keys(tree)"
@input="site = sites[0]"
<q-card style="min-width: 35vw" v-if="loaded">
<q-card-section class="row">
<q-card-actions align="left">
<div class="text-h6">Add an agent</div>
</q-card-actions>
<q-space />
<q-card-actions align="right">
<q-btn v-close-popup flat round dense icon="close" />
</q-card-actions>
</q-card-section>
<q-card-section>
<q-form @submit.prevent="addAgent">
<q-card-section v-if="tree !== null" class="q-gutter-sm">
<q-select
outlined
dense
label="Client"
v-model="client"
:options="Object.keys(tree)"
@input="site = sites[0]"
/>
</q-card-section>
<q-card-section class="q-gutter-sm">
<q-select dense outlined label="Site" v-model="site" :options="sites" />
</q-card-section>
<q-card-section>
<div class="q-gutter-sm">
<q-radio v-model="agenttype" val="server" label="Server" @input="power = false" />
<q-radio v-model="agenttype" val="workstation" label="Workstation" />
</div>
</q-card-section>
<q-card-section>
<div class="q-gutter-sm">
<q-input
v-model.number="expires"
dense
type="number"
filled
label="Token expiration (hours)"
style="max-width: 200px;"
stack-label
/>
</q-card-section>
<q-card-section>
<q-select outlined label="Site" v-model="site" :options="sites" />
</q-card-section>
<q-card-section>
<div>
Agent type:
<br />
<q-radio v-model="agenttype" val="server" label="Server" />
<q-radio v-model="agenttype" val="workstation" label="Workstation" />
</div>
</q-card-section>
<q-card-section>
Select Version
<q-select outlined v-model="version" :options="Object.values(versions)" />
</q-card-section>
<q-card-actions align="left">
<q-btn label="Generate Agent" color="primary" type="submit" />
</q-card-actions>
</q-form>
</q-card-section>
</q-card>
<div>
<q-dialog v-model="showAgentDownload">
<AgentDownload :info="info" @close="showAgentDownload = false" />
</q-dialog>
</div>
</div>
</div>
</q-card-section>
<q-card-section>
<div class="q-gutter-sm">
<q-checkbox v-model="rdp" dense label="Enable RDP" />
<q-checkbox v-model="ping" dense label="Enable Ping" />
<q-checkbox
v-model="power"
dense
v-show="agenttype === 'workstation'"
label="Disable sleep/hibernate"
/>
</div>
</q-card-section>
<q-card-section>
Select Version
<q-select dense outlined v-model="version" :options="Object.values(versions)" />
</q-card-section>
<q-card-actions align="left">
<q-btn label="Show Install Command" color="primary" type="submit" />
</q-card-actions>
</q-form>
</q-card-section>
<q-dialog v-model="showAgentDownload">
<AgentDownload :info="info" @close="showAgentDownload = false" />
</q-dialog>
</q-card>
</template>
<script>
@ -68,6 +88,10 @@ export default {
site: null,
version: null,
agenttype: "server",
expires: 1,
power: false,
rdp: false,
ping: false,
github: [],
showAgentDownload: false,
info: {},
@ -106,9 +130,19 @@ export default {
const download = release.assets[0].browser_download_url;
const exe = `${release.name}.exe`;
const data = { client: this.client, site: this.site };
const data = { client: this.client, site: this.site, expires: this.expires };
axios.post("/agents/installagent/", data).then((r) => {
this.info = { exe, download, api, agenttype: this.agenttype, data: r.data };
this.info = {
exe,
download,
api,
agenttype: this.agenttype,
expires: this.expires,
power: this.power ? 1 : 0,
rdp: this.rdp ? 1 : 0,
ping: this.ping ? 1 : 0,
data: r.data,
};
this.showAgentDownload = true;
});
},