Skip to content

Instantly share code, notes, and snippets.

View infamousjoeg's full-sized avatar
🙊
I'm really good at keeping secrets.

Joe Garcia infamousjoeg

🙊
I'm really good at keeping secrets.
View GitHub Profile
@infamousjoeg
infamousjoeg / LDAPQuery_CompObj
Created May 23, 2017 15:02
LDAP Query returns Computer Object via prefix matching
(&(objectClass=computer)(sAMAccountName=USRC*))
@infamousjoeg
infamousjoeg / SOAPAIMDualAccount.xml
Created July 17, 2017 19:00
SOAP Example - AIM Dual Account XML
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPassword xmlns="https://tempuri.org/">
<passwordWSRequest>
<AppID>App_ApplicationID</AppID>
<Safe>AIM_ApplicationSafe</Safe>
<Folder>Root</Folder>
<Query>VirtualUsername=AppVirName</Query>
</passwordWSRequest>
@infamousjoeg
infamousjoeg / keybase.md
Created July 24, 2017 14:04
Identity Proof for Keybase.io

Keybase proof

I hereby claim:

  • I am infamousjoeg on github.
  • I am infamousjoeg (https://keybase.io/infamousjoeg) on keybase.
  • I have a public key ASBR9KhHoyuxeEK_EAnJJbycJy5qRPes0qnJbGcAk4peMgo

To claim this, I am signing this object:

@infamousjoeg
infamousjoeg / SOAPAIMDualAccount.ps1
Last active August 9, 2017 02:34
SOAP Example - AIM Dual Accounts
$proxy = New-WebServiceProxy -Uri https://windev.cyberark.local/aimwebservice/v1.1/aim.asmx?WSDL
$cert= New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\cert\GoodCert.cer")
$t = $proxy.getType().namespace
$proxy.ClientCertificates.Add($cert)
$request = New-Object ($t + ".passwordRequest")
$request.AppID = "DistributedApp";
$request.Query = "VirtualUsername=aimtest";
$response = $proxy.GetPassword($request)
write-host "Username:"
$response.username
@infamousjoeg
infamousjoeg / ccp-kornshell.sh
Created June 9, 2017 21:17
AIM CCP REST - Korn Shell Example
#!/bin/ksh
BASEURL="https://pvwa.cyberark.local"
APPID="RESTExamples"
SAFE="T-APP-CYBR-RESTAPI"
FOLDER="Root"
OBJECTNAME="Database-MicrosoftSQLServer-sql01.cyberark.local-Svc_BambooHR"
PASSWORD = wget --quiet \
--method GET \
@infamousjoeg
infamousjoeg / ccp-perl.pl
Last active August 9, 2017 02:36
AIM CCP REST - Perl Example
#!/usr/bin/perl
use REST::Client;
my $client = REST::Client->new();
$client->addHeader('Content-Type', 'application/json');
$client->addHeader('cache-control', 'no-cache');
$baseURL = "https://pvwa.cyberark.local"
@infamousjoeg
infamousjoeg / machineID.sh
Last active August 28, 2017 17:41
Example of how to create a host using host factory token via curl
## Machine identity Example (-k due to self-signed cert on Conjur Master)
token=hostfactorytokenvalue
hostid="jenkins/masters/master01"
baseurl="https://devops"
curl --request POST -k --data-urlencode id=$hostid --header "Authorization: Token token=\"$token\"" $baseurl/api/host_factories/hosts
@infamousjoeg
infamousjoeg / aim_example.bat
Last active September 21, 2017 15:54
AIM Example
@echo off
REM Declare and set variables
set Admin_ID=Svc_CyberArkREST
set AIM_AppID=AIM-CP-Test
set AIM_Safe=T-APP-CYBR-RESTAPI
REM Make sure the Object Name is the "Name" value of the account stored in EPV
set AIM_Object=Operating System-WinDomain-joe-garcia.local-Svc_CyberArkREST
REM Set AIM CP CLI command to run
function Get-AIMPassword ([string]$PVWA_URL, [string]$AppID, [string]$Safe, [string]$ObjectName) {
# Declaration
$fetchAIMPassword = "${PVWA_URL}/AIMWebService/api/Accounts?AppID=${AppID}&Safe=${Safe}&Folder=Root&Object=${ObjectName}"
# Execution
try {
$response = Invoke-RestMethod -Uri $fetchAIMPassword -Method GET -ContentType "application/json" -ErrorVariable aimResultErr
Return $response.content
}
@infamousjoeg
infamousjoeg / CreateTestUsers.ps1
Created March 31, 2017 19:28
Create 1,000 Test Users for Home Lab
Import-Module ActiveDirectory
$total = 1000
for ($userIndex=0; $userIndex -lt $total; $userIndex++)
{
$userID = "{0:0000}" -f ($userIndex + 1)
$userName = "test.user$userID"
Write-Host "Creating user" ($userIndex + 1) "of" $total ":" $userName