Skip to content

Instantly share code, notes, and snippets.

@giper45
giper45 / utm-snapshot.sh
Created June 23, 2023 13:14
UTM snapshot feature
#!/bin/bash
CMD=$1
VMNAME=$2
SNAP_NAME=$3
UTM_FOLDER=/Users/$USER/Library/Containers/com.utmapp.UTM/Data/Documents
UTM_VM_FOLDER=${UTM_FOLDER}/$VMNAME.utm/Data
mkdir -p ~/.utm-snapshots
1. install openjdk
`sudo apt-get install openjdk-7-jdk`
2. install `android sdk`
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
@giper45
giper45 / tasks.yml
Created November 18, 2021 13:14
Ansible Docker-Compose install
---
- name: "Install Docker Compose"
gather_facts: true
become: true
hosts: all
tasks:
- name: "Download dockker-compose"
get_url:
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-{{ ansible_system }}-{{ ansible_machine }}
dest: /usr/local/bin/docker-compose
@giper45
giper45 / gist:707bb9c047a10d75e89705e63415b431
Last active April 27, 2021 11:08
Fix wazuh unsecure key permissions
docker-compose -f production-cluster.yml exec elasticsearch "chmod 700 /usr/share/elasticsearch/config && chmod 600 /usr/share/elasticsearch/config/elasticsearch.yml && chmod 600 /usr/share/elasticsearch/config/node1.key && chmod 600 /usr/share/elasticsearch/config/root-ca.pem && chmod 600 /usr/share/elasticsearch/config/node1.pem"
docker-compose -f production-cluster.yml exec elasticsearch-2 "chmod 700 /usr/share/elasticsearch/config && chmod 600 /usr/share/elasticsearch/config/elasticsearch.yml && chmod 600 /usr/share/elasticsearch/config/node2.key && chmod 600 /usr/share/elasticsearch/config/root-ca.pem && chmod 600 /usr/share/elasticsearch/config/node2.pem"
docker-compose -f production-cluster.yml exec elasticsearch-3 "chmod 700 /usr/share/elasticsearch/config && chmod 600 /usr/share/elasticsearch/config/elasticsearch.yml && chmod 600 /usr/share/elasticsearch/config/node2.key && chmod 600 /usr/share/elasticsearch/config/root-ca.pem && chmod 600 /usr/share/elasticsearch/config/node2.pem"
@giper45
giper45 / gist:b27c7a23a56132e5b06cac81bb35daed
Created January 26, 2021 09:05
openssl-nginx-generation.sh
MYDOMAIN=secsi.com
docker run -it --rm -d --name openssl alpine/openssl
docker exec -it openssl openssl req -x509 -nodes -days 365 -subj "/C=CA/ST=QC/O=Company, Inc./CN=$MYDOMAIN" -addext "subjectAltName=DNS:$MYDOMAIN" -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt;
docker cp openssl:/etc/ssl ssl-output
docker rm -f openssl
@giper45
giper45 / IKeystoreService.cpp
Created January 16, 2021 12:05
Android Keystore binder service client interface x86
#include <android/security/keystore/IKeystoreService.h>
#include <android/security/keystore/BpKeystoreService.h>
namespace android {
namespace security {
namespace keystore {
IMPLEMENT_META_INTERFACE(KeystoreService, "android.security.keystore.IKeystoreService")
@giper45
giper45 / phpdangerousfuncs.md
Created December 17, 2020 19:22 — forked from mccabe615/phpdangerousfuncs.md
Dangerous PHP Functions

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
#!/bin/bash
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
# SYNOPSIS
# manopt command opt
#
# DESCRIPTION
# Returns the portion of COMMAND's man page describing option OPT.
# Note: Result is plain text - formatting is lost.
#
# OPT may be a short option (e.g., -F) or long option (e.g., --fixed-strings);
# specifying the preceding '-' or '--' is OPTIONAL - UNLESS with long option
# names preceded only by *1* '-', such as the actions for the `find` command.
@giper45
giper45 / create-swarm.sh
Created September 17, 2020 13:17
swarm env with docker-machine
docker-machine create manager
docker-machine create agent-1
docker-machine create agent-2
MANAGER_IP=`docker-machine ip manager`
JOIN_CMD=`docker-machine ssh manager docker swarm init --advertise-addr ${MANAGER_IP} | grep "\-\-token"`
docker-machine ssh agent-1 ${JOIN_CMD}
docker-machine ssh agent-2 ${JOIN_CMD}