Skip to content

Instantly share code, notes, and snippets.

View allenmichael's full-sized avatar

Allen-Michael Grobelny allenmichael

  • Amazon Web Services
  • Austin, TX
  • X @amsxbg
View GitHub Profile
@allenmichael
allenmichael / main.ts
Created August 30, 2023 23:24
Upload in memory data direct to S3
import { randomUUID } from "crypto";
import { S3Client } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
import { PassThrough } from "stream";
const s3Client = new S3Client({});
(async () => {
const passThrough = new PassThrough();
for (const person of ["person-1", "person-2", "person-3"]) {
@allenmichael
allenmichael / HttpClient.ts
Created April 14, 2023 16:21
Generic HTTP Client in Node/Browser
export interface ClientResponse {
statusCode: number,
headers: Headers,
body: any
}
export const Methods = {
GET: "GET",
POST: "POST",
PUT: "PUT",
@allenmichael
allenmichael / DaemonWorker.csproj
Created March 22, 2023 21:31
All the resources needed to create a .NET worker app to run on Amazon Linux through systemd
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
# citing sources: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
# citing sources: https://gist.github.com/felipecsl/cecfece3075312174e92592d4231e971
sudo yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel -y
mkdir ~/ffmpeg_sources
# nasm
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar xjvf nasm-2.14.02.tar.bz2
#!/bin/sh
random_string() {
STR_LENGTH=${1:-20}
INCLUDE_SYMBOLS=${2:-0}
FILTER='A-Za-z0-9'
SYMBOLS=${3:-'!@#%^&*'}
if [ $INCLUDE_SYMBOLS -eq 0 ]; then
FILTER="$FILTER$SYMBOLS"
fi
Write-Host "Install command has been executed. Nessus Agent will be installed"
$serviceName = 'Tenable Nessus Agent'
$nameE = "Enable Nessus Agent"
$operationE = "Starting Nessus Agent"
$messageE = "Enable Nessus agent"
function DownloadFile {
Param(
[Parameter(Mandatory = $True)]
[hashtable]$Params,
import boto3
from botocore.exceptions import ClientError
import json
from pprint import pprint
from tenable.dl import Downloads
from zipfile import ZipFile
import re
import hashlib
import logging
FROM amazonlinux:2.0.20210721.2
RUN touch $HOME/.bashrc
RUN yum -y update
RUN yum -y install tar gzip unzip
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
#!/bin/bash
UBUNTU_64='13147'
UBUNTU_64_NAME='NessusAgent-8.3.0-ubuntu1110_amd64.deb'
WHICH_OS=$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)
WHICH_CHIP=$(uname -m)
if [ "$WHICH_OS" = "ubuntu" ]; then
echo 'using ubuntu'
curl -v https://www.tenable.com/downloads/api/v1/public/pages/nessus-agents/downloads/$UBUNTU_64/download?i_agree_to_tenable_license_agreement=true --output $UBUNTU_64_NAME
dpkg -i $UBUNTU_64_NAME
def orchestrator_function(context: df.DurableOrchestrationContext):
logging.info('starting orchestrator')
# Persistent state stored with a Durable Entity
entityId = df.EntityId("TenableExportJob", "currentJobInfo")
state = yield context.call_entity(entityId, "get")
state = json.loads(state)
logging.info('got current state')
logging.info(state)