Skip to content

Instantly share code, notes, and snippets.

View spy86's full-sized avatar
🎯
Focusing

Maciej Michalski spy86

🎯
Focusing
View GitHub Profile
@spy86
spy86 / GetLocalAdminGroupMembers
Created March 8, 2019 10:12
GetLocalAdminGroupMembers
invoke-command {
$members = net localgroup administrators |
where {$_ -AND $_ -notmatch "command completed successfully"} |
select -skip 4
New-Object PSObject -Property @{
Computername = $env:COMPUTERNAME
Group = "Administrators"
Members=$members
}
} -computer chi-fp01,chi-win8-01,chi-ex01 -HideComputerName |
@spy86
spy86 / GetLocalAdminGroupMembers
Created March 8, 2019 10:13
GetLocalAdminGroupMembers
PS C:\> Get-NetLocalGroup -Group "remote desktop users" -Computername $sessions
Group : remote desktop users
Computername : CHI-FP01
Members :
Group : remote desktop users
Computername : CHI-WIN8-01
Members :
Computername : CHI-EX01
Members :
Group : remote desktop users
@spy86
spy86 / FunctionGetNetLocalGroup .ps1
Created March 8, 2019 10:14
Function Get-NetLocalGroup
Function Get-NetLocalGroup {
[cmdletbinding()]
Param(
[Parameter(Position=0)]
[ValidateNotNullorEmpty()]
[object[]]$Computername=$env:computername,
[ValidateNotNullorEmpty()]
[string]$Group = "Administrators",
[switch]$Asjob
)
param(
$domain
) #end param
# Begin Functions
Function funWhoIs()
{
β€œObtaining WhoIs $domain …”
$strQuery=”http://reports.internic.net/cgi/whois?whois_nic=$domain&type=domain”
@spy86
spy86 / config.yml
Created May 26, 2019 08:35
Sample config for Sonarqube scan in CircleCI
version: 2
jobs:
code_analyze:
docker:
- image: circleci/openjdk:8
steps:
- run:
name: Clone repository
command: git clone https://bitbucket.org/some_repo/perl.git
- run:
@spy86
spy86 / Dockerfile
Created October 19, 2019 17:58
alpine:3.9 and azure cli
FROM alpine:3.9
RUN \
apk update && \
apk add bash py-pip && \
apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python-dev make && \
pip --no-cache-dir install -U pip && \
pip install azure-cli && \
apk del --purge build
@spy86
spy86 / docker_run_azure_cli
Created October 19, 2019 17:59
Run docker container with azure cli
$ docker run --rm -e AZURE_APPLICATION_ID=[Your Application ID] \
-e AZURE_SECRET=[Your Secret] \
-e AZURE_TENANT_ID=[Your Tenant ID] \
-e CMD="/usr/bin/az vm start -g [ResourceGroup] -n [VM Name]" azure-cli-centos:v1.0
@spy86
spy86 / Dockerfile
Created October 19, 2019 18:02
centos image with azure cli
FROM centos:7.6.1810
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc && \
echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" \
> /etc/yum.repos.d/azure-cli.repo
RUN yum install -y azure-cli
CMD /usr/bin/az login --service-principal \
-u $AZURE_APPLICATION_ID \
-p $AZURE_SECRET \
[root@dlp ~]# yum -y install ntp
[root@dlp ~]# vi /etc/ntp.conf
# line 19: add the network range you allow to receive requestsrestrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# change servers for synchronization
#
server 0.rhel.pool.ntp.org
#
server 1.rhel.pool.ntp.org
#
server 2.rhel.pool.ntp.org
@spy86
spy86 / Whois.ps1
Created October 25, 2019 17:43
Simple script in powershell (WHOIS)
param(
$domain
) #end param
# Begin Functions
Function funWhoIs()
{
"Obtaining WhoIs $domain ..."
$strQuery="http://reports.internic.net/cgi/whois?whois_nic=$domain&type=domain"