ubuntu resolute
This commit is contained in:
39
PS1/Setperm.ps1
Normal file
39
PS1/Setperm.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/setpermrepo"
|
||||
|
||||
# Définir les données de permission
|
||||
$repoName = "REPONAME" # Remplacez par le nom du dépôt
|
||||
$userOrGroup = "USERNAME_OR_GROUPNAME" # Remplacez par le nom d'utilisateur ou de groupe auquel vous souhaitez accorder les permissions
|
||||
$permission = "rw"
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
repoName = $repoName
|
||||
userOrGroup = $userOrGroup
|
||||
permission = $permission
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificatePAroblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
37
PS1/addingroup.ps1
Normal file
37
PS1/addingroup.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/addingroup"
|
||||
|
||||
# Définir les données pour ajouter un utilisateur au groupe
|
||||
$groupName = "admin" # Remplacez par le nom du groupe
|
||||
$username = "USERNAME" # Remplacez par le nom d'utilisateur à ajouter
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
groupName = $groupName
|
||||
username = $username
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
36
PS1/changepassword.ps1
Normal file
36
PS1/changepassword.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https:///action/changepassword"
|
||||
|
||||
# Définir les données pour le changement de mot de passe
|
||||
$username = "USERNAME" # Remplacez par le nom d'utilisateur
|
||||
$newPassword = "NEWPASSWORD" # Remplacez par le nouveau mot de passe
|
||||
$apiKey = "TOKEN"
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
username = $username
|
||||
newPassword = $newPassword
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
35
PS1/deletegroup.ps1
Normal file
35
PS1/deletegroup.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/deletegroup"
|
||||
|
||||
# Définir les données du groupe à supprimer
|
||||
$groupName = "NAMEGROUP" # Remplacez par le nom du groupe à supprimer
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
groupName = $groupName
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
35
PS1/deleterepo.ps1
Normal file
35
PS1/deleterepo.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/deleterepo"
|
||||
|
||||
# Définir les données du repository à supprimer
|
||||
$repoName = "REPONAME" # Remplacez par le nom du repository à supprimer
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
repoName = $repoName
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
35
PS1/deleteuser.ps1
Normal file
35
PS1/deleteuser.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/deleteuser"
|
||||
|
||||
# Définir les données de l'utilisateur à supprimer
|
||||
$username = "USERNAME" # Remplacez par le nom d'utilisateur à supprimer
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
username = $username
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
37
PS1/deleteuseringroup.ps1
Normal file
37
PS1/deleteuseringroup.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/deleteuseringroup"
|
||||
|
||||
# Définir les données pour supprimer un utilisateur du groupe
|
||||
$groupName = "groupename" # Remplacez par le nom du groupe
|
||||
$username = "USERNAME" # Remplacez par le nom d'utilisateur à supprimer
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
groupName = $groupName
|
||||
username = $username
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
45
PS1/depperm.ps1
Normal file
45
PS1/depperm.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/delperm"
|
||||
|
||||
# Définir les données du dépôt à obtenir
|
||||
$repoName = "REPONAME" # Remplace par le nom du dépôt que tu souhaites obtenir
|
||||
$user = "USERNAME" # Remplace par le nom de l'utilisateur à supprimer
|
||||
$apiKey = "TOKEN" # Remplace par ta clé API si nécessaire
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
repoName = $repoName
|
||||
user = $user
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide si nécessaire
|
||||
# Ajout d'un type uniquement si nécessaire
|
||||
if (-not [System.Type]::GetType("TrustAllCertsPolicy")) {
|
||||
$typeDefinition = @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
Add-Type -TypeDefinition $typeDefinition
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
}
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
} catch {
|
||||
Write-Host "Erreur lors de l'appel à l'API : $_"
|
||||
}
|
||||
24
PS1/getgroups.ps1
Normal file
24
PS1/getgroups.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/getgroups"
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête GET à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
40
PS1/getperm.ps1
Normal file
40
PS1/getperm.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
# --- Paramètres personnalisables ---
|
||||
$repoName = "REPONAME" # Remplace par le nom du dépôt SVN
|
||||
$apiKey = "TOKEN" # Clé API
|
||||
$hostUrl = "https://localhost:8445" # URL de base de l'API
|
||||
|
||||
# --- Construction de l'URL complète avec paramètre GET ---
|
||||
$apiUrl = "$hostUrl/action/getperm?repo=$([uri]::EscapeDataString($repoName))"
|
||||
|
||||
# --- Ignorer les erreurs SSL (certificat auto-signé) ---
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# --- Appel de l'API ---
|
||||
try {
|
||||
$headers = @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Envoi de la requête GET
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers $headers
|
||||
|
||||
# Affichage formaté de la réponse
|
||||
Write-Host "`n--- Utilisateurs et Permissions pour '$repoName' ---"
|
||||
for ($i = 0; $i -lt $response.users.Count; $i++) {
|
||||
Write-Host "$($response.users[$i]) => $($response.permissions[$i])"
|
||||
}
|
||||
|
||||
Write-Host "`nTotal: $($response.count) utilisateur(s)"
|
||||
}
|
||||
catch {
|
||||
Write-Error "Erreur lors de l'appel à l'API : $($_.Exception.Message)"
|
||||
}
|
||||
24
PS1/getrepos.ps1
Normal file
24
PS1/getrepos.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/getrepos"
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête GET à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
26
PS1/getuseringroup.ps1
Normal file
26
PS1/getuseringroup.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Définir l'URL de l'API avec le paramètre 'group'
|
||||
$groupName = "admin" # Remplacez par le nom du groupe que vous souhaitez interroger
|
||||
$apiUrl = "https://localhost/action/getuseringroup?group=$groupName"
|
||||
|
||||
# Définir la clé API si nécessaire
|
||||
$apiKey = "TOKEN" # Remplacez par votre clé API
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête GET à l'API avec la clé API dans les headers
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
24
PS1/getusers.ps1
Normal file
24
PS1/getusers.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/getusers"
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête GET à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
39
PS1/login.ps1
Normal file
39
PS1/login.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
# API Configuration
|
||||
$apiUrl = "https://localhost/action/login"
|
||||
|
||||
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# Headers
|
||||
$headers = @{
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
|
||||
# Get credentials
|
||||
$username = Read-Host "Enter username"
|
||||
$password = Read-Host "Enter password" -AsSecureString
|
||||
$plainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
|
||||
|
||||
# Prepare body
|
||||
$body = @{
|
||||
username = $username
|
||||
password = $plainPassword
|
||||
} | ConvertTo-Json
|
||||
|
||||
# Send request
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $body
|
||||
Write-Host "`nAuthentication successful!"
|
||||
if ($response.isAdmin) {
|
||||
Write-Host "Admin access granted"
|
||||
Write-Host "API Token: $($response.token)"
|
||||
} else {
|
||||
Write-Host "Regular user access granted"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "`nAuthentication failed. Details:"
|
||||
Write-Host $_.Exception.Message
|
||||
if ($_.Exception.Response) {
|
||||
Write-Host "Status Code:" $_.Exception.Response.StatusCode.value__
|
||||
}
|
||||
}
|
||||
36
PS1/newgroup.ps1
Normal file
36
PS1/newgroup.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://LOCALHOST/action/newgroup"
|
||||
# Définir les données du groupe à créer
|
||||
$groupName = "GROUPENAME" # Remplacez par le nom du groupe souhaité
|
||||
$users = @("USERNAME") # Remplacez par la liste des utilisateurs souhaités
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
groupName = $groupName
|
||||
users = $users
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
34
PS1/newrepo.ps1
Normal file
34
PS1/newrepo.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/newrepo"
|
||||
|
||||
# Définir les données du dépôt à créer
|
||||
$repoName = "REPONAME" # Remplacez par le nom du dépôt que vous souhaitez créer
|
||||
$apiKey = "TOKEN" # Remplacez par votre clé API si nécessaire
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
repoName = $repoName
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
37
PS1/newuser.ps1
Normal file
37
PS1/newuser.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "http://loczlhost/action/newuser"
|
||||
|
||||
# Définir les données de l'utilisateur à créer
|
||||
$username = "USERNAME" # Remplacez par le nom d'utilisateur souhaité
|
||||
$password = "PASSWORD" # Remplacez par le mot de passe souhaité
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
username = $username
|
||||
password = $password
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
37
PS1/removeperm.ps1
Normal file
37
PS1/removeperm.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
# Définir l'URL de l'API
|
||||
$apiUrl = "https://localhost/action/removepermrepo"
|
||||
|
||||
# Définir les données pour la suppression des permissions
|
||||
$repoName = "REPONAME" # Remplacez par le nom du dépôt
|
||||
$userOrGroup = "USERNAME_OR_GROUPNAME" # Remplacez par le nom d'utilisateur ou de groupe dont vous souhaitez supprimer les permissions
|
||||
$apiKey = "TOKEN"
|
||||
|
||||
# Créer les données à envoyer dans le corps de la requête
|
||||
$body = @{
|
||||
repoName = $repoName
|
||||
userOrGroup = $userOrGroup
|
||||
}
|
||||
|
||||
# Convertir les données en JSON
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
# Ignorer les erreurs de certificat SSL non valide
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificatePAroblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# Envoyer la requête POST à l'API
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonBody -ContentType "application/json" -Headers @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Afficher la réponse de l'API
|
||||
$response | Format-List
|
||||
Reference in New Issue
Block a user