potatoqualitee / tentools

💙 tenable.sc / nessus / acas powershell module
BSD 3-Clause "New" or "Revised" License
39 stars 7 forks source link

upload custom plugin to sc #14

Closed potatoqualitee closed 3 years ago

potatoqualitee commented 3 years ago
Invoke-WebRequest -Uri "https://securitycenter/rest/file/upload" `
-Method "POST" `
-Headers @{
"Accept"="application/json, text/javascript, */*; q=0.01"
  "X-Requested-With"="XMLHttpRequest"
} `
-ContentType "multipart/form-data; boundary=----WebKitFormBoundaryEn5zqqXVxLNArW5n" `
-Body ([System.Text.Encoding]::UTF8.GetBytes("------WebKitFormBoundaryEn5zqqXVxLNArW5n$([char]13)$([char]10)Content-Disposition: form-data; name=`"Filedata`"; filename=`"plugin.tar.gz`"$([char]13)$([char]10)Content-Type: application/x-gzip$([char]13)$([char]10)$([char]13)$([char]10)$([char]13)$([char]10)------WebKitFormBoundaryEn5zqqXVxLNArW5n--$([char]13)$([char]10)"))

Invoke-WebRequest -Uri "https://securitycenter/rest/customPlugins/active/process" `
-Method "POST" `
-ContentType "application/x-www-form-urlencoded; charset=UTF-8" `
-Body "{`"filename`":`"SnPasX`"}"

filename is randomly generated and different each time

potatoqualitee commented 3 years ago

While you're at it

import dashboard import asset lists import nessus scan policy and xml scan

potatoqualitee commented 3 years ago

done done done