This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Add frontend host | |
hosts: localhost | |
tasks: | |
- name: Create master control socket | |
shell: | |
cmd: "sshpass -p '{{ backend_password }}' ssh -fN -M -S /tmp/{{ backend_ip }} {{ backend_username }}@{{ backend_ip }}" | |
executable: /bin/bash | |
- name: Add frontend | |
add_host: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## .env | |
IMAGE=debian:buster | |
## docker-compose.yml | |
services: | |
container1: | |
image: $IMAGE | |
command: /bin/bash -c "while true; do echo 'alive' && sleep 60; done" | |
networks: | |
network1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get admin token | |
SERVER_IP=X.X.X.X | |
PASS=root_password | |
TARGET_NUMBER=number_without_country_code | |
WIREGUARD_SERVER=Home | |
TOKEN=$(curl -s -k -X POST --data-binary pwd=${PASS} "https://${SERVER_IP}/cgi-bin/api/router/login" | jq -r .token) | |
echo $TOKEN | |
# List messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stable-slim | |
MAINTAINER castironclay | |
ARG TERRAFORM=1.0.0 | |
ARG CLOUDFLARED=2021.5.10 | |
# Backports | |
RUN echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' > /etc/apt/sources.list.d/buster-backports.list | |
# Install deps and Wireguard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pi Setup | |
apt update -y | |
apt upgrade -y | |
## Install Dependencies | |
apt install gpsd gpsd-clients wget curl screen vim wireguard | |
## Modify /etc/default/gpsd | |
DEVICES="/dev/ttyUSB0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resource https://www.bitarray.io/dictionaries-in-bash/ | |
declare -A associative | |
# Special characters | |
associative[0021]="!" | |
associative[0000]="@" | |
associative[0023]="#" | |
associative[0002]="$" | |
associative[0025]="%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APPROVED_SOURCES=(+18008675309) | |
SOURCE=$(curl -X $'GET' -H $'Host: 192.168.0.1' -H $'Referer: http://192.168.0.1/index.html' -H $'Connection: close' $'http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=sms_data_total&page=0&data_per_page=500&mem_store=1&tags=10&order_by=order+by+id+desc&_=1620342672308' | jq -r .messages[0].number) | |
COMMAND=$(curl -X $'GET' -H $'Host: 192.168.0.1' -H $'Referer: http://192.168.0.1/index.html' -H $'Connection: close' $'http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=sms_data_total&page=0&data_per_page=500&mem_store=1&tags=10&order_by=order+by+id+desc&_=1620342672308' | jq -r .messages[0].content | awk -F "" '{print $4}') | |
#SOURCE CHECK | |
if [[ "${APPROVED_SOURCES[@]}" =~ "${SOURCE}" ]]; then | |
if [[ "${COMMAND}" =~ "1" ]]; then | |
systemctl start wg-quick@wg0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
until ping -I usb0 -c 1 192.168.0.1 >/dev/null 2>&1; do sleep 1; done | |
generate_pub_ip () | |
{ | |
current_ip=$(curl ifconfig.io) | |
first_octet=$(echo $current_ip | awk -F "." '{print $1}') | |
second_octet=$(echo $current_ip | awk -F "." '{print $2}') | |
third_octet=$(echo $current_ip | awk -F "." '{print $3}') | |
fourth_octet=$(echo $current_ip | awk -F "." '{print $4}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set viewport cookie with js | |
<script type="text/javascript"> | |
document.cookie = 'viewport=' + screen.width; | |
</script> | |
# Nginx location | |
location / { | |
# Proxy only Iphone X | |
if ($cookie_viewport ~ "375") { | |
proxy_pass 127.0.0.1:8443; |
NewerOlder